split DataTransfer
ADD
src/assets/server/rest/v1/schemas/chargingstation/chargingstation-action-data-transfer.json
+{
+ "title": "Data Transfer",
+ "type": "object",
+ "properties": {
+ "chargingStationID": {
+ "$ref": "chargingstation.json#/definitions/id"
+ },
+ "args": {
+ "type": "object",
+ "properties": {
+ "vendorId": {
+ "type": "string",
+ "sanitize": "mongo"
+ },
+ "messageId": {
+ "type": "string",
+ "sanitize": "mongo"
+ },
+ "data": {
+ "type": "string",
+ "sanitize": "mongo"
+ }
+ },
+ "required": [
+ "vendorId"
+ ]
+ }
+ },
+ "required": [
+ "chargingStationID"
+ ]
+}

MODIFY
src/client/ocpp/json/JsonChargingStationClient.ts
src/client/ocpp/json/JsonChargingStationClient.ts
@@ -89,7 +89,7 @@ export default class JsonChargingStationClient extends ChargingStationClient {
}
public async dataTransfer(params: OCPPDataTransferCommandParam): Promise<OCPPDataTransferCommandResult> {
- return this.sendMessage(params, Command.TRIGGER_DATA_TRANSFER);
+ return this.sendMessage(params, Command.DATA_TRANSFER);
}
private async sendMessage(params: any, command: Command): Promise<any> {

MODIFY
src/client/ocpp/json/JsonRestChargingStationClient.ts
src/client/ocpp/json/JsonRestChargingStationClient.ts
@@ -98,7 +98,7 @@ export default class JsonRestChargingStationClient extends ChargingStationClient
}
public async dataTransfer(params: OCPPDataTransferCommandParam): Promise<OCPPDataTransferCommandResult> {
- return this.sendMessage(this.buildRequest(Command.TRIGGER_DATA_TRANSFER, params));
+ return this.sendMessage(this.buildRequest(Command.DATA_TRANSFER, params));
}
private async openConnection(): Promise<any> {

MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -1192,6 +1192,12 @@ export default class ChargingStationService {
result = await ChargingStationService.executeChargingStationCommand(
req.tenant, req.user, chargingStation, action, command, filteredRequest.args);
break;
+ // Data Transfer
+ case Command.DATA_TRANSFER:
+ filteredRequest = ChargingStationValidator.getInstance().validateChargingStationActionDataTransferReq(req.body);
+ result = await ChargingStationService.executeChargingStationCommand(
+ req.tenant, req.user, chargingStation, action, command, filteredRequest.args);
+ break;
// Remote Stop Transaction / Unlock Connector
case Command.REMOTE_STOP_TRANSACTION:
filteredRequest = ChargingStationValidator.getInstance().validateChargingStationActionStopTransactionReq(req.body);
@@ -1660,7 +1666,7 @@ export default class ChargingStationService {
retryInterval: params.retryInterval
});
break;
- case Command.TRIGGER_DATA_TRANSFER:
+ case Command.DATA_TRANSFER:
result = await chargingStationClient.dataTransfer(params);
break;
}

MODIFY
src/server/rest/v1/validator/ChargingStationValidator.ts
src/server/rest/v1/validator/ChargingStationValidator.ts
-import { HttpChargingProfilesRequest, HttpChargingStationChangeAvailabilityRequest, HttpChargingStationChangeConfigurationRequest, HttpChargingStationClearCacheRequest, HttpChargingStationCommandRequest, HttpChargingStationConnectorRequest, HttpChargingStationGetCompositeScheduleRequest, HttpChargingStationGetDiagnosticsRequest, HttpChargingStationGetFirmwareRequest, HttpChargingStationLimitPowerRequest, HttpChargingStationOcppParametersRequest, HttpChargingStationOcppRequest, HttpChargingStationParamsUpdateRequest, HttpChargingStationRequest, HttpChargingStationResetRequest, HttpChargingStationStartTransactionRequest, HttpChargingStationStopTransactionRequest, HttpChargingStationUpdateFirmwareRequest, HttpChargingStationsInErrorRequest, HttpChargingStationsRequest, HttpDownloadQrCodeRequest, HttpTriggerSmartChargingRequest } from '../../../../types/requests/HttpChargingStationRequest';
+import { HttpChargingProfilesRequest, HttpChargingStationChangeAvailabilityRequest, HttpChargingStationChangeConfigurationRequest, HttpChargingStationClearCacheRequest, HttpChargingStationCommandDataTransferRequest, HttpChargingStationCommandRequest, HttpChargingStationConnectorRequest, HttpChargingStationGetCompositeScheduleRequest, HttpChargingStationGetDiagnosticsRequest, HttpChargingStationGetFirmwareRequest, HttpChargingStationLimitPowerRequest, HttpChargingStationOcppParametersRequest, HttpChargingStationOcppRequest, HttpChargingStationParamsUpdateRequest, HttpChargingStationRequest, HttpChargingStationResetRequest, HttpChargingStationStartTransactionRequest, HttpChargingStationStopTransactionRequest, HttpChargingStationUpdateFirmwareRequest, HttpChargingStationsInErrorRequest, HttpChargingStationsRequest, HttpDownloadQrCodeRequest, HttpTriggerSmartChargingRequest } from '../../../../types/requests/HttpChargingStationRequest';
import { ChargingProfile } from '../../../../types/ChargingProfile';
import HttpDatabaseRequest from '../../../../types/requests/HttpDatabaseRequest';
@@ -16,6 +16,7 @@ export default class ChargingStationValidator extends SchemaValidator {
private chargingStationActionChangeAvailability: Schema;
private chargingStationActionChangeConfiguration: Schema;
private chargingStationActionClearCache: Schema;
+ private chargingStationActionDataTransfer: Schema;
private chargingStationActionStartTransaction: Schema;
private chargingStationActionStopTransaction: Schema;
private chargingStationActionGetCompositeSchedule: Schema;
@@ -46,6 +47,7 @@ export default class ChargingStationValidator extends SchemaValidator {
this.chargingStationActionChangeAvailability = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingstation-action-change-availability.json`, 'utf8'));
this.chargingStationActionChangeConfiguration = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingstation-action-change-configuration.json`, 'utf8'));
this.chargingStationActionClearCache = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingstation-action-clear-cache.json`, 'utf8'));
+ this.chargingStationActionDataTransfer = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingstation-action-data-transfer.json`, 'utf8'));
this.chargingStationActionStartTransaction = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingstation-action-start-transaction.json`, 'utf8'));
this.chargingStationActionStopTransaction = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingstation-action-stop-transaction.json`, 'utf8'));
this.chargingStationActionGetCompositeSchedule = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/chargingstation/chargingstation-action-get-composite-schedule.json`, 'utf8'));
@@ -111,6 +113,12 @@ export default class ChargingStationValidator extends SchemaValidator {
return data;
}
+ public validateChargingStationActionDataTransferReq(data: any): HttpChargingStationCommandDataTransferRequest {
+ // Validate schema for DataTransfer
+ this.validate(this.chargingStationActionDataTransfer, data);
+ return data;
+ }
+
public validateChargingStationActionClearCacheReq(data: any): HttpChargingStationClearCacheRequest {
// Validate schema for ClearCache
this.validate(this.chargingStationActionClearCache, data);

MODIFY
src/types/ChargingStation.ts
src/types/ChargingStation.ts
@@ -122,7 +122,6 @@ export enum Command {
GET_COMPOSITE_SCHEDULE = 'GetCompositeSchedule',
CHANGE_AVAILABILITY = 'ChangeAvailability',
UPDATE_FIRMWARE = 'UpdateFirmware',
- TRIGGER_DATA_TRANSFER = 'DataTransfer',
BOOT_NOTIFICATION = 'BootNotification',
AUTHORIZE = 'Authorize',
HEARTBEAT = 'Heartbeat',

MODIFY
src/types/requests/HttpChargingStationRequest.ts
src/types/requests/HttpChargingStationRequest.ts
@@ -133,6 +133,15 @@ export interface HttpChargingStationClearCacheRequest {
chargingStationID: string
}
+export interface HttpChargingStationCommandDataTransferRequest {
+ chargingStationID: string,
+ args: {
+ vendorId: string,
+ messageId?: string,
+ data?: string
+ }
+}
+
export interface HttpChargingStationStartTransactionRequest {
chargingStationID: string,
args: {

split DataTransfer