Added missing Data Transfer  OCPP command in client's white list
MODIFY
src/server/ocpp/json/JsonRestWSConnection.ts
src/server/ocpp/json/JsonRestWSConnection.ts
@@ -21,7 +21,7 @@ export default class JsonRestWSConnection extends WSConnection {
public async handleRequest(command: Command, commandPayload: Record<string, unknown> | string): Promise<any> {
let result: any;
// Check Command
- if (!this.isValidOcppCommandFromRest(command)) {
+ if (!this.isValidOcppClientCommand(command)) {
throw new BackendError({
chargingStationID: this.getChargingStationID(),
siteID: this.getSiteID(),
@@ -88,24 +88,25 @@ export default class JsonRestWSConnection extends WSConnection {
public async onPong(message: string): Promise<void> {
}
- private isValidOcppCommandFromRest(command: Command): boolean {
+ private isValidOcppClientCommand(command: Command): boolean {
// Only client request is allowed
return [
- Command.RESET,
+ Command.CANCEL_RESERVATION,
+ Command.CHANGE_AVAILABILITY,
+ Command.CHANGE_CONFIGURATION,
Command.CLEAR_CACHE,
+ Command.CLEAR_CHARGING_PROFILE,
+ Command.DATA_TRANSFER,
+ Command.GET_COMPOSITE_SCHEDULE,
Command.GET_CONFIGURATION,
- Command.CHANGE_CONFIGURATION,
+ Command.GET_DIAGNOSTICS,
Command.REMOTE_START_TRANSACTION,
Command.REMOTE_STOP_TRANSACTION,
- Command.UNLOCK_CONNECTOR,
+ Command.RESERVE_NOW,
+ Command.RESET,
Command.SET_CHARGING_PROFILE,
- Command.GET_COMPOSITE_SCHEDULE,
- Command.CLEAR_CHARGING_PROFILE,
- Command.CHANGE_AVAILABILITY,
- Command.GET_DIAGNOSTICS,
+ Command.UNLOCK_CONNECTOR,
Command.UPDATE_FIRMWARE,
- Command.RESERVE_NOW,
- Command.CANCEL_RESERVATION
].includes(command);
}
}

MODIFY
src/server/ocpp/json/JsonWSConnection.ts
src/server/ocpp/json/JsonWSConnection.ts
@@ -52,7 +52,7 @@ export default class JsonWSConnection extends WSConnection {
public async handleRequest(command: Command, commandPayload: Record<string, unknown> | string): Promise<any> {
let result: any;
// Check Command
- if (!this.isValidOcppCommandFromRest(command)) {
+ if (!this.isValidOcppServerCommand(command)) {
throw new BackendError({
chargingStationID: this.getChargingStationID(),
siteID: this.getSiteID(),
@@ -141,19 +141,19 @@ export default class JsonWSConnection extends WSConnection {
}
}
- private isValidOcppCommandFromRest(command: Command): boolean {
+ private isValidOcppServerCommand(command: Command): boolean {
// Only client request is allowed
return [
- Command.BOOT_NOTIFICATION,
Command.AUTHORIZE,
- Command.HEARTBEAT,
+ Command.BOOT_NOTIFICATION,
+ Command.DATA_TRANSFER,
Command.DIAGNOSTICS_STATUS_NOTIFICATION,
Command.FIRMWARE_STATUS_NOTIFICATION,
- Command.STATUS_NOTIFICATION,
+ Command.HEARTBEAT,
+ Command.METER_VALUES,
Command.START_TRANSACTION,
+ Command.STATUS_NOTIFICATION,
Command.STOP_TRANSACTION,
- Command.METER_VALUES,
- Command.DATA_TRANSFER,
].includes(command);
}
}

Added missing Data Transfer  OCPP command in client's white list