feat(simulator): add more OCPP 2.x.x types definition
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 14 Feb 2023 17:04:57 +0000 (18:04 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 14 Feb 2023 17:04:57 +0000 (18:04 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/types/internal.ts
src/types/ocpp/2.0/Common.ts [new file with mode: 0644]
src/types/ocpp/2.0/Requests.ts
src/types/ocpp/2.0/Responses.ts
src/types/ocpp/2.0/Variables.ts

index 105c983cc3dbd0fa7f9a3100b6c978387ee2bc7e..c7a141a4972f36c6cbc552cdc89a90b428d125da 100644 (file)
@@ -7,6 +7,7 @@ export * from './ocpp/1.6/MeterValues';
 export * from './ocpp/1.6/Requests';
 export * from './ocpp/1.6/Responses';
 export * from './ocpp/1.6/Transaction';
+export * from './ocpp/2.0/Common';
 export * from './ocpp/2.0/Requests';
 export * from './ocpp/2.0/Responses';
 export * from './ocpp/2.0/Variables';
diff --git a/src/types/ocpp/2.0/Common.ts b/src/types/ocpp/2.0/Common.ts
new file mode 100644 (file)
index 0000000..5e47a25
--- /dev/null
@@ -0,0 +1,31 @@
+import type { JsonObject } from '../../internal';
+
+export enum BootReasonEnumType {
+  ApplicationReset = 'ApplicationReset',
+  FirmwareUpdate = 'FirmwareUpdate',
+  LocalReset = 'LocalReset',
+  PowerUp = 'PowerUp',
+  RemoteReset = 'RemoteReset',
+  ScheduledReset = 'ScheduledReset',
+  Triggered = 'Triggered',
+  Unknown = 'Unknown',
+  Watchdog = 'Watchdog',
+}
+
+export enum OCPP20ConnectorStatusEnumType {
+  AVAILABLE = 'Available',
+  OCCUPIED = 'Occupied',
+  RESERVED = 'Reserved',
+  UNAVAILABLE = 'Unavailable',
+  FAULTED = 'Faulted',
+}
+
+export type StatusInfoType = {
+  reasonCode: string;
+  additionalInfo?: string;
+} & JsonObject;
+
+export type EVSEType = {
+  id: number;
+  connectorId?: string;
+} & JsonObject;
index c42cd8bbbb9aa4c41912e88d1f7c14482ad1a7f6..220a39b6f617a0f020aa5b65ff04baecbc0ad3c3 100644 (file)
@@ -1,4 +1,10 @@
-import type { EmptyObject, JsonObject } from '../../internal';
+import type {
+  BootReasonEnumType,
+  EmptyObject,
+  JsonObject,
+  OCPP20ConnectorStatusEnumType,
+  OCPP20SetVariableDataType,
+} from '../../internal';
 
 export enum OCPP20RequestCommand {
   BOOT_NOTIFICATION = 'BootNotification',
@@ -12,24 +18,12 @@ export enum OCPP20IncomingRequestCommand {
   REQUEST_STOP_TRANSACTION = 'RequestStopTransaction',
 }
 
-export enum BootReasonEnumType {
-  ApplicationReset = 'ApplicationReset',
-  FirmwareUpdate = 'FirmwareUpdate',
-  LocalReset = 'LocalReset',
-  PowerUp = 'PowerUp',
-  RemoteReset = 'RemoteReset',
-  ScheduledReset = 'ScheduledReset',
-  Triggered = 'Triggered',
-  Unknown = 'Unknown',
-  Watchdog = 'Watchdog',
-}
-
-export type ModemType = {
+type ModemType = {
   iccid?: string;
   imsi?: string;
 } & JsonObject;
 
-export type ChargingStationType = {
+type ChargingStationType = {
   serialNumber?: string;
   model: string;
   vendorName: string;
@@ -46,17 +40,13 @@ export type OCPP20HeartbeatRequest = EmptyObject;
 
 export type OCPP20ClearCacheRequest = EmptyObject;
 
-export enum OCPP20ConnectorStatusEnumType {
-  AVAILABLE = 'Available',
-  OCCUPIED = 'Occupied',
-  RESERVED = 'Reserved',
-  UNAVAILABLE = 'Unavailable',
-  FAULTED = 'Faulted',
-}
-
 export type OCPP20StatusNotificationRequest = {
   timestamp: Date;
   connectorStatus: OCPP20ConnectorStatusEnumType;
   evseId: number;
   connectorId: number;
 } & JsonObject;
+
+export type OCPP20SetVariablesRequest = {
+  setVariableData: OCPP20SetVariableDataType[];
+} & JsonObject;
index 3f4d2f4274cc4c36dd73f51f303cb3ea773b5be6..fdbebf15c4eb33fd5b8fed7c4fd719fdcceb2493 100644 (file)
@@ -2,14 +2,11 @@ import type {
   EmptyObject,
   GenericStatus,
   JsonObject,
+  OCPP20SetVariableResultType,
   RegistrationStatusEnumType,
+  StatusInfoType,
 } from '../../internal';
 
-export type StatusInfoType = {
-  reasonCode: string;
-  additionalInfo?: string;
-} & JsonObject;
-
 export type OCPP20BootNotificationResponse = {
   currentTime: Date;
   status: RegistrationStatusEnumType;
@@ -27,3 +24,7 @@ export type OCPP20ClearCacheResponse = {
 } & JsonObject;
 
 export type OCPP20StatusNotificationResponse = EmptyObject;
+
+export type OCPP20SetVariablesResponse = {
+  setVariableResult: OCPP20SetVariableResultType[];
+} & JsonObject;
index 3c70898602d6c398032cc51b8d9cb67d6491432d..9de1dcc8a81bf1494061fedc4970863373229707 100644 (file)
@@ -1,4 +1,6 @@
-export enum OCPP20ComponentName {
+import type { EVSEType, JsonObject, StatusInfoType } from '../../internal';
+
+enum OCPP20ComponentName {
   AlignedDataCtrlr = 'AlignedDataCtrlr',
   AuthCacheCtrlr = 'AuthCacheCtrlr',
   AuthCtrlr = 'AuthCtrlr',
@@ -58,3 +60,50 @@ export enum OCPP20OptionalVariableName {
 export enum OCPP20VendorVariableName {
   ConnectionUrl = 'ConnectionUrl',
 }
+
+enum AttributeEnumType {
+  Actual = 'Actual',
+  Target = 'Target',
+  MinSet = 'MinSet',
+  MaxSet = 'MaxSet',
+}
+
+type ComponentType = {
+  name: string | OCPP20ComponentName;
+  instance?: string;
+  evse?: EVSEType;
+} & JsonObject;
+
+type VariableType = {
+  name: string | OCPP20RequiredVariableName | OCPP20OptionalVariableName | OCPP20VendorVariableName;
+  instance?: string;
+} & JsonObject;
+
+export type OCPP20SetVariableDataType = {
+  attributeType?: AttributeEnumType;
+  attributeValue: string;
+  component: ComponentType;
+  variable: VariableType;
+} & JsonObject;
+
+enum SetVariableStatusEnumType {
+  Accepted = 'Accepted',
+  Rejected = 'Rejected',
+  UnknownComponent = 'UnknownComponent',
+  UnknownVariable = 'UnknownVariable',
+  NotSupportedAttributeType = 'NotSupportedAttributeType',
+  RebootRequired = 'RebootRequired',
+}
+
+export type OCPP20SetVariableResultType = {
+  attributeType?: AttributeEnumType;
+  attributeStatus: SetVariableStatusEnumType;
+  component: ComponentType;
+  variable: VariableType;
+  attributeStatusInfo?: StatusInfoType;
+} & JsonObject;
+
+type OCPP20ComponentVariableType = {
+  component: ComponentType;
+  variable?: VariableType;
+} & JsonObject;