change interface for DataTransfer
MODIFY
src/authorization/AuthorizationsDefinition.ts
src/authorization/AuthorizationsDefinition.ts
@@ -196,7 +196,7 @@ const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
Action.REMOTE_STOP_TRANSACTION, Action.STOP_TRANSACTION, Action.START_TRANSACTION,
Action.UNLOCK_CONNECTOR, Action.AUTHORIZE, Action.SET_CHARGING_PROFILE, Action.GET_COMPOSITE_SCHEDULE,
Action.CLEAR_CHARGING_PROFILE, Action.GET_DIAGNOSTICS, Action.UPDATE_FIRMWARE, Action.EXPORT,
- Action.CHANGE_AVAILABILITY
+ Action.CHANGE_AVAILABILITY, Action.TRIGGER_DATA_TRANSFER
]
},
{ resource: Entity.TRANSACTIONS, action: [Action.LIST, Action.EXPORT, Action.IN_ERROR] },

MODIFY
src/client/ocpi/OCPIChargingStationClient.ts
src/client/ocpi/OCPIChargingStationClient.ts
import { OCPPAvailabilityStatus, OCPPChangeAvailabilityCommandParam, OCPPChangeAvailabilityCommandResult, OCPPChangeConfigurationCommandParam, OCPPChangeConfigurationCommandResult, OCPPChargingProfileStatus, OCPPClearCacheCommandResult, OCPPClearCacheStatus, OCPPClearChargingProfileCommandParam, OCPPClearChargingProfileCommandResult, OCPPClearChargingProfileStatus, OCPPConfigurationStatus, OCPPGetCompositeScheduleCommandParam, OCPPGetCompositeScheduleCommandResult, OCPPGetCompositeScheduleStatus, OCPPGetConfigurationCommandParam, OCPPGetConfigurationCommandResult, OCPPGetDiagnosticsCommandParam, OCPPGetDiagnosticsCommandResult, OCPPRemoteStartStopStatus, OCPPRemoteStartTransactionCommandParam, OCPPRemoteStartTransactionCommandResult, OCPPRemoteStopTransactionCommandParam, OCPPRemoteStopTransactionCommandResult, OCPPResetCommandParam, OCPPResetCommandResult, OCPPResetStatus, OCPPSetChargingProfileCommandParam, OCPPSetChargingProfileCommandResult, OCPPUnlockConnectorCommandParam, OCPPUnlockConnectorCommandResult, OCPPUnlockStatus, OCPPUpdateFirmwareCommandParam } from '../../types/ocpp/OCPPClient';
+import { OCPPDataTransferRequest, OCPPDataTransferResponse } from '../../types/ocpp/OCPPServer';
import ChargingStation from '../../types/ChargingStation';
import ChargingStationClient from '../ocpp/ChargingStationClient';
@@ -96,4 +97,9 @@ export default class OCPIChargingStationClient extends ChargingStationClient {
}
async updateFirmware(params: OCPPUpdateFirmwareCommandParam): Promise<void> { }
+
+ // eslint-disable-next-line @typescript-eslint/require-await
+ public async triggerDataTransfer(params: OCPPDataTransferRequest): Promise<OCPPDataTransferResponse> {
+ throw new Error('Method not implemented.');
+ }
}

MODIFY
src/client/ocpp/ChargingStationClient.ts
src/client/ocpp/ChargingStationClient.ts
import { OCPPChangeAvailabilityCommandParam, OCPPChangeAvailabilityCommandResult, OCPPChangeConfigurationCommandParam, OCPPChangeConfigurationCommandResult, OCPPClearCacheCommandResult, OCPPClearChargingProfileCommandParam, OCPPClearChargingProfileCommandResult, OCPPGetCompositeScheduleCommandParam, OCPPGetCompositeScheduleCommandResult, OCPPGetConfigurationCommandParam, OCPPGetConfigurationCommandResult, OCPPGetDiagnosticsCommandParam, OCPPGetDiagnosticsCommandResult, OCPPRemoteStartTransactionCommandParam, OCPPRemoteStartTransactionCommandResult, OCPPRemoteStopTransactionCommandParam, OCPPRemoteStopTransactionCommandResult, OCPPResetCommandParam, OCPPResetCommandResult, OCPPSetChargingProfileCommandParam, OCPPSetChargingProfileCommandResult, OCPPUnlockConnectorCommandParam, OCPPUnlockConnectorCommandResult, OCPPUpdateFirmwareCommandParam } from '../../types/ocpp/OCPPClient';
+import { OCPPDataTransferRequest, OCPPDataTransferResponse } from '../../types/ocpp/OCPPServer';
export default abstract class ChargingStationClient {
public abstract reset(params: OCPPResetCommandParam): Promise<OCPPResetCommandResult>;
public abstract clearCache(): Promise<OCPPClearCacheCommandResult>;
+ public abstract triggerDataTransfer(params: OCPPDataTransferRequest): Promise<OCPPDataTransferResponse>;
+
public abstract getConfiguration(params: OCPPGetConfigurationCommandParam): Promise<OCPPGetConfigurationCommandResult>;
public abstract changeConfiguration(params: OCPPChangeConfigurationCommandParam): Promise<OCPPChangeConfigurationCommandResult>;

MODIFY
src/client/ocpp/json/JsonChargingStationClient.ts
src/client/ocpp/json/JsonChargingStationClient.ts
import { OCPPChangeAvailabilityCommandParam, OCPPChangeAvailabilityCommandResult, OCPPChangeConfigurationCommandParam, OCPPChangeConfigurationCommandResult, OCPPClearCacheCommandResult, OCPPClearChargingProfileCommandParam, OCPPClearChargingProfileCommandResult, OCPPGetCompositeScheduleCommandParam, OCPPGetCompositeScheduleCommandResult, OCPPGetConfigurationCommandParam, OCPPGetConfigurationCommandResult, OCPPGetDiagnosticsCommandParam, OCPPGetDiagnosticsCommandResult, OCPPRemoteStartTransactionCommandParam, OCPPRemoteStartTransactionCommandResult, OCPPRemoteStopTransactionCommandParam, OCPPRemoteStopTransactionCommandResult, OCPPResetCommandParam, OCPPResetCommandResult, OCPPSetChargingProfileCommandParam, OCPPSetChargingProfileCommandResult, OCPPUnlockConnectorCommandParam, OCPPUnlockConnectorCommandResult, OCPPUpdateFirmwareCommandParam } from '../../../types/ocpp/OCPPClient';
+import { OCPPDataTransferRequest, OCPPDataTransferResponse } from '../../../types/ocpp/OCPPServer';
import ChargingStationClient from '../../ocpp/ChargingStationClient';
import { Command } from '../../../types/ChargingStation';
@@ -78,6 +79,10 @@ export default class JsonChargingStationClient extends ChargingStationClient {
return this.sendMessage(params, Command.UPDATE_FIRMWARE);
}
+ public async triggerDataTransfer(params: OCPPDataTransferRequest): Promise<OCPPDataTransferResponse> {
+ return this.sendMessage(params, Command.TRIGGER_DATA_TRANSFER);
+ }
+
private async sendMessage(params: any, commandName: Command): Promise<any> {
// Log
await Logging.logChargingStationClientSendAction(MODULE_NAME, this.tenantID, this.chargingStationID, `ChargingStation${commandName}` as ServerAction, params);

MODIFY
src/client/ocpp/json/JsonRestChargingStationClient.ts
src/client/ocpp/json/JsonRestChargingStationClient.ts
import ChargingStation, { Command } from '../../../types/ChargingStation';
import { OCPPChangeAvailabilityCommandParam, OCPPChangeAvailabilityCommandResult, OCPPChangeConfigurationCommandParam, OCPPChangeConfigurationCommandResult, OCPPClearCacheCommandResult, OCPPClearChargingProfileCommandParam, OCPPClearChargingProfileCommandResult, OCPPGetCompositeScheduleCommandParam, OCPPGetCompositeScheduleCommandResult, OCPPGetConfigurationCommandParam, OCPPGetConfigurationCommandResult, OCPPGetDiagnosticsCommandParam, OCPPGetDiagnosticsCommandResult, OCPPRemoteStartTransactionCommandParam, OCPPRemoteStartTransactionCommandResult, OCPPRemoteStopTransactionCommandParam, OCPPRemoteStopTransactionCommandResult, OCPPResetCommandParam, OCPPResetCommandResult, OCPPSetChargingProfileCommandParam, OCPPSetChargingProfileCommandResult, OCPPStatus, OCPPUnlockConnectorCommandParam, OCPPUnlockConnectorCommandResult, OCPPUpdateFirmwareCommandParam } from '../../../types/ocpp/OCPPClient';
+import { OCPPDataTransferRequest, OCPPDataTransferResponse } from '../../../types/ocpp/OCPPServer';
import { OCPPIncomingRequest, OCPPMessageType, OCPPOutgoingRequest } from '../../../types/ocpp/OCPPCommon';
import { ServerAction, WSServerProtocol } from '../../../types/Server';
@@ -97,6 +98,10 @@ export default class JsonRestChargingStationClient extends ChargingStationClient
return this.sendMessage(this.buildRequest(Command.UPDATE_FIRMWARE, params));
}
+ public async triggerDataTransfer(params: OCPPDataTransferRequest): Promise<OCPPDataTransferResponse> {
+ return this.sendMessage(this.buildRequest(Command.TRIGGER_DATA_TRANSFER, params));
+ }
+
private async openConnection(): Promise<unknown> {
// Log
await Logging.logInfo({

MODIFY
src/client/ocpp/soap/SoapChargingStationClient.ts
src/client/ocpp/soap/SoapChargingStationClient.ts
import ChargingStation, { Command } from '../../../types/ChargingStation';
import { OCPPChangeAvailabilityCommandParam, OCPPChangeAvailabilityCommandResult, OCPPChangeConfigurationCommandParam, OCPPChangeConfigurationCommandResult, OCPPClearCacheCommandResult, OCPPClearChargingProfileCommandParam, OCPPClearChargingProfileCommandResult, OCPPGetCompositeScheduleCommandParam, OCPPGetCompositeScheduleCommandResult, OCPPGetConfigurationCommandParam, OCPPGetConfigurationCommandResult, OCPPGetDiagnosticsCommandParam, OCPPGetDiagnosticsCommandResult, OCPPRemoteStartTransactionCommandParam, OCPPRemoteStartTransactionCommandResult, OCPPRemoteStopTransactionCommandParam, OCPPRemoteStopTransactionCommandResult, OCPPResetCommandParam, OCPPResetCommandResult, OCPPSetChargingProfileCommandParam, OCPPSetChargingProfileCommandResult, OCPPUnlockConnectorCommandParam, OCPPUnlockConnectorCommandResult, OCPPUpdateFirmwareCommandParam } from '../../../types/ocpp/OCPPClient';
+import { OCPPDataTransferRequest, OCPPDataTransferResponse, OCPPVersion } from '../../../types/ocpp/OCPPServer';
import ChargingStationClient from '../ChargingStationClient';
import Configuration from '../../../utils/Configuration';
import Logging from '../../../utils/Logging';
-import { OCPPVersion } from '../../../types/ocpp/OCPPServer';
import { ServerAction } from '../../../types/Server';
import global from '../../../types/GlobalType';
import { soap } from 'strong-soap';
@@ -362,6 +362,11 @@ export default class SoapChargingStationClient extends ChargingStationClient {
throw new Error('Method not implemented.');
}
+ // eslint-disable-next-line @typescript-eslint/require-await
+ public async triggerDataTransfer(params: OCPPDataTransferRequest): Promise<OCPPDataTransferResponse> {
+ throw new Error('Method not implemented.');
+ }
+
private getWSDLEndpointBaseSecureUrl() {
return this.wsdlEndpointConfig?.baseSecureUrl;
}

MODIFY
src/server/rest/v1/router/api/ChargingStationRouter.ts
src/server/rest/v1/router/api/ChargingStationRouter.ts
@@ -29,6 +29,7 @@ export default class ChargingStationRouter {
this.buildRouteChargingStationDelete();
this.buildRouteChargingStationReset();
this.buildRouteChargingStationClearCache();
+ this.buildRouteChargingStationTriggerDataTransfer();
this.buildRouteChargingStationRetrieveConfiguration();
this.buildRouteChargingStationChangeConfiguration();
this.buildRouteChargingStationRemoteStart();
@@ -85,9 +86,9 @@ export default class ChargingStationRouter {
}
protected buildRouteChargingStationTriggerDataTransfer(): void {
- this.router.put(`/${ServerRoute.REST_CHARGING_STATIONS_DATA_TRANSFER}`, async (req: Request, res: Response, next: NextFunction) => {
+ this.router.put(`/${ServerRoute.REST_CHARGING_STATIONS_TRIGGER_DATA_TRANSFER}`, async (req: Request, res: Response, next: NextFunction) => {
req.body.chargingStationID = req.params.id;
- await RouterUtils.handleServerAction(ChargingStationService.handleAction.bind(this), ServerAction.CHARGING_STATION_DATA_TRANSFER, req, res, next);
+ await RouterUtils.handleServerAction(ChargingStationService.handleAction.bind(this), ServerAction.CHARGING_STATION_TRIGGER_DATA_TRANSFER, req, res, next);
});
}

MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -1588,6 +1588,9 @@ export default class ChargingStationService {
retryInterval: params.retryInterval
});
break;
+ case Command.TRIGGER_DATA_TRANSFER:
+ result = await chargingStationClient.triggerDataTransfer(params);
+ break;
}
if (result) {
// OCPP Command with status

MODIFY
src/types/Authorization.ts
src/types/Authorization.ts
@@ -116,6 +116,7 @@ export enum Action {
ASSIGN = 'Assign',
UNASSIGN = 'Unassign',
CLEAR_CACHE = 'ClearCache',
+ TRIGGER_DATA_TRANSFER = 'DataTransfer',
SYNCHRONIZE = 'Synchronize',
GET_CONFIGURATION = 'GetConfiguration',
CHANGE_CONFIGURATION = 'ChangeConfiguration',

MODIFY
src/types/ChargingStation.ts
src/types/ChargingStation.ts
@@ -122,6 +122,7 @@ export enum Command {
GET_COMPOSITE_SCHEDULE = 'GetCompositeSchedule',
CHANGE_AVAILABILITY = 'ChangeAvailability',
UPDATE_FIRMWARE = 'UpdateFirmware',
+ TRIGGER_DATA_TRANSFER = 'DataTransfer'
}
export enum StaticLimitAmps {

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -11,6 +11,7 @@ export enum ServerAction {
CHARGING_STATION_RESET = 'RestChargingStationReset',
CHARGING_STATION_REQUEST_OCPP_PARAMETERS = 'RestChargingStationRequestOcppParameters',
CHARGING_STATION_CLEAR_CACHE = 'RestChargingStationClearCache',
+ CHARGING_STATION_TRIGGER_DATA_TRANSFER = 'RestChargingStationDataTransfer',
CHARGING_STATION_GET_CONFIGURATION = 'RestChargingStationGetConfiguration',
CHARGING_STATION_CHANGE_CONFIGURATION = 'RestChargingStationChangeConfiguration',
CHARGING_STATION_DATA_TRANSFER = 'ChargingStationChangeDataTransfer',
@@ -455,7 +456,7 @@ export enum ServerRoute {
REST_CHARGING_STATIONS_RESET = 'charging-stations/:id/reset',
REST_CHARGING_STATIONS_CACHE_CLEAR = 'charging-stations/:id/cache/clear',
- REST_CHARGING_STATIONS_DATA_TRANSFER = 'charging-stations/:id/dataTransfer',
+ REST_CHARGING_STATIONS_TRIGGER_DATA_TRANSFER = 'charging-stations/:id/dataTransfer',
REST_CHARGING_STATIONS_RETRIEVE_CONFIGURATION = 'charging-stations/:id/configuration/retrieve',
REST_CHARGING_STATIONS_CHANGE_CONFIGURATION = 'charging-stations/:id/configuration',
REST_CHARGING_STATIONS_REMOTE_START = 'charging-stations/:id/remote/start',

change interface for DataTransfer