From 857d8dd995425597a2bfb15d49e7ee6d69b055bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 12 Feb 2023 20:32:27 +0100 Subject: [PATCH] feat(simulator): initial work on configuration components and variables MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../ocpp/2.0/OCPP20ResponseService.ts | 11 +--- src/types/index.ts | 1 + src/types/ocpp/2.0/Variables.ts | 60 +++++++++++++++++++ src/types/ocpp/Configuration.ts | 8 +++ 4 files changed, 71 insertions(+), 9 deletions(-) create mode 100644 src/types/ocpp/2.0/Variables.ts diff --git a/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts b/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts index 5561b82b..4866b5c5 100644 --- a/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts +++ b/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts @@ -8,11 +8,11 @@ import { ErrorType, type JsonObject, type JsonType, - OCPP16StandardParametersKey, type OCPP20BootNotificationResponse, type OCPP20ClearCacheResponse, type OCPP20HeartbeatResponse, OCPP20IncomingRequestCommand, + OCPP20OptionalVariableName, OCPP20RequestCommand, type OCPP20StatusNotificationResponse, OCPPVersion, @@ -161,18 +161,11 @@ export class OCPP20ResponseService extends OCPPResponseService { if (payload.status === RegistrationStatusEnumType.ACCEPTED) { ChargingStationConfigurationUtils.addConfigurationKey( chargingStation, - OCPP16StandardParametersKey.HeartbeatInterval, + OCPP20OptionalVariableName.HeartbeatInterval, payload.interval.toString(), {}, { overwrite: true, save: true } ); - ChargingStationConfigurationUtils.addConfigurationKey( - chargingStation, - OCPP16StandardParametersKey.HeartBeatInterval, - payload.interval.toString(), - { visible: false }, - { overwrite: true, save: true } - ); chargingStation.heartbeatSetInterval ? chargingStation.restartHeartbeat() : chargingStation.startHeartbeat(); diff --git a/src/types/index.ts b/src/types/index.ts index 1ca290d2..f0a947a4 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -21,6 +21,7 @@ export * from './ocpp/1.6/Responses'; export * from './ocpp/1.6/Transaction'; export * from './ocpp/2.0/Requests'; export * from './ocpp/2.0/Responses'; +export * from './ocpp/2.0/Variables'; export * from './orm/entities/PerformanceData'; export * from './orm/entities/PerformanceRecord'; export * from './AutomaticTransactionGenerator'; diff --git a/src/types/ocpp/2.0/Variables.ts b/src/types/ocpp/2.0/Variables.ts new file mode 100644 index 00000000..3c708986 --- /dev/null +++ b/src/types/ocpp/2.0/Variables.ts @@ -0,0 +1,60 @@ +export enum OCPP20ComponentName { + AlignedDataCtrlr = 'AlignedDataCtrlr', + AuthCacheCtrlr = 'AuthCacheCtrlr', + AuthCtrlr = 'AuthCtrlr', + CHAdeMOCtrlr = 'CHAdeMOCtrlr', + ClockCtrlr = 'ClockCtrlr', + CustomizationCtrlr = 'CustomizationCtrlr', + DeviceDataCtrlr = 'DeviceDataCtrlr', + DisplayMessageCtrlr = 'DisplayMessageCtrlr', + ISO15118Ctrlr = 'ISO15118Ctrlr', + LocalAuthListCtrlr = 'LocalAuthListCtrlr', + MonitoringCtrlr = 'MonitoringCtrlr', + OCPPCommCtrlr = 'OCPPCommCtrlr', + ReservationCtrlr = 'ReservationCtrlr', + SampledDataCtrlr = 'SampledDataCtrlr', + SecurityCtrlr = 'SecurityCtrlr', + SmartChargingCtrlr = 'SmartChargingCtrlr', + TariffCostCtrlr = 'TariffCostCtrlr', + TxCtrlr = 'TxCtrlr', +} + +export enum OCPP20RequiredVariableName { + MessageTimeout = 'MessageTimeout', + FileTransferProtocols = 'FileTransferProtocols', + NetworkConfigurationPriority = 'NetworkConfigurationPriority', + NetworkProfileConnectionAttempts = 'NetworkProfileConnectionAttempts', + OfflineThreshold = 'OfflineThreshold', + MessageAttempts = 'TransactionEvent', + MessageAttemptInterval = 'MessageAttemptInterval', + UnlockOnEVSideDisconnect = 'UnlockOnEVSideDisconnect', + ResetRetries = 'ResetRetries', + ItemsPerMessage = 'ItemsPerMessage', + BytesPerMessage = 'BytesPerMessage', + DateTime = 'DateTime', + TimeSource = 'TimeSource', + OrganizationName = 'OrganizationName', + CertificateEntries = 'CertificateEntries', + SecurityProfile = 'SecurityProfile', + AuthorizeRemoteStart = 'AuthorizeRemoteStart', + LocalAuthorizeOffline = 'LocalAuthorizeOffline', + LocalPreAuthorize = 'LocalPreAuthorize', + EVConnectionTimeOut = 'EVConnectionTimeOut', + StopTxOnEVSideDisconnect = 'StopTxOnEVSideDisconnect', + TxStartPoint = 'TxStartPoint', + TxStopPoint = 'TxStopPoint', + StopTxOnInvalidId = 'StopTxOnInvalidId', + TxEndedMeasurands = 'TxEndedMeasurands', + TxStartedMeasurands = 'TxStartedMeasurands', + TxUpdatedMeasurands = 'TxUpdatedMeasurands', + TxUpdatedInterval = 'TxUpdatedInterval', +} + +export enum OCPP20OptionalVariableName { + HeartbeatInterval = 'HeartbeatInterval', + WebSocketPingInterval = 'WebSocketPingInterval', +} + +export enum OCPP20VendorVariableName { + ConnectionUrl = 'ConnectionUrl', +} diff --git a/src/types/ocpp/Configuration.ts b/src/types/ocpp/Configuration.ts index c094aab3..9aeb91dc 100644 --- a/src/types/ocpp/Configuration.ts +++ b/src/types/ocpp/Configuration.ts @@ -3,15 +3,23 @@ import { OCPP16SupportedFeatureProfiles, OCPP16VendorDefaultParametersKey, } from './1.6/Configuration'; +import { + OCPP20OptionalVariableName, + OCPP20RequiredVariableName, + OCPP20VendorVariableName, +} from './2.0/Variables'; import type { JsonObject } from '../JsonType'; export const StandardParametersKey = { ...OCPP16StandardParametersKey, + ...OCPP20RequiredVariableName, + ...OCPP20OptionalVariableName, } as const; export type StandardParametersKey = OCPP16StandardParametersKey; export const VendorDefaultParametersKey = { ...OCPP16VendorDefaultParametersKey, + ...OCPP20VendorVariableName, } as const; export type VendorDefaultParametersKey = OCPP16VendorDefaultParametersKey; -- 2.34.1