Refine UI protocol documentation
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 28 Aug 2022 21:10:37 +0000 (23:10 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 28 Aug 2022 21:10:37 +0000 (23:10 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
.editorconfig
README.md
src/charging-station/ChargingStation.ts
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts
src/charging-station/ocpp/1.6/OCPP16ResponseService.ts
src/types/ChargingStationTemplate.ts
src/ui/web/.editorconfig [new file with mode: 0644]
src/ui/web/src/types/ChargingStationType.ts

index f5e7a60474a8aa71a84428148d486e5125a49bb7..be65bb51972e2110874ad41d55d8087176bea673 100644 (file)
@@ -3,7 +3,6 @@ root = true
 [*]
 indent_style = space
 indent_size = 2
-tab_width = 2
 charset = utf-8
 trim_trailing_whitespace = true
 insert_final_newline = true
index edc08c6c9c10633cd328832580b567de359f789f..c61910c98d40c4de9d7377b93784f53e8f64657d 100644 (file)
--- a/README.md
+++ b/README.md
@@ -159,8 +159,8 @@ But the modifications to test have to be done to the files in the build target d
 | amperageLimitationOcppKey          |            | undefined                                                         | string                                                                                                                             | charging stations OCPP parameter key used to set the amperage limit, per phase for each connector on AC and global for DC                                                                             |
 | amperageLimitationUnit             | A/cA/dA/mA | A                                                                 | string                                                                                                                             | charging stations amperage limit unit                                                                                                                                                                 |
 | enableStatistics                   | true/false | true                                                              | boolean                                                                                                                            | enable charging stations statistics                                                                                                                                                                   |
-| mayAuthorizeAtRemoteStart          | true/false | true                                                              | boolean                                                                                                                            | always send authorize at remote start transaction when AuthorizeRemoteTxRequests is enabled                                                                                                           |
-| payloadSchemaValidation            | true/false | true                                                              | boolean                                                                                                                            | validate OCPP commands PDU against OCA JSON schemas                                                                                                                                                   |
+| mustAuthorizeAtRemoteStart         | true/false | true                                                              | boolean                                                                                                                            | always send authorize at remote start transaction when AuthorizeRemoteTxRequests is enabled                                                                                                           |
+| payloadSchemaValidation            | true/false | true                                                              | boolean                                                                                                                            | validate OCPP commands PDU against [OCA](https://www.openchargealliance.org/) JSON schemas                                                                                                            |
 | beginEndMeterValues                | true/false | false                                                             | boolean                                                                                                                            | enable Transaction.{Begin,End} MeterValues                                                                                                                                                            |
 | outOfOrderEndMeterValues           | true/false | false                                                             | boolean                                                                                                                            | send Transaction.End MeterValues out of order. Need to relax OCPP specifications strict compliance ('ocppStrictCompliance' parameter)                                                                 |
 | meteringPerTransaction             | true/false | true                                                              | boolean                                                                                                                            | enable metering history on a per transaction basis                                                                                                                                                    |
@@ -384,147 +384,149 @@ All kind of OCPP parameters are supported in a charging station configuration or
 
 ## UI protocol
 
-Protocol to control the simulator via a Websocket
+Protocol to control the simulator via a Websocket or HTTP server.
 
-### Protocol
+### WebSocket Protocol
 
-PDU stands for Protocol Data Unit
+PDU stands for Protocol Data Unit.
 
-Request:  
-[`uuid`, `ProcedureName`, `PDU`]
+- Request:  
+  [`uuid`, `ProcedureName`, `PDU`]  
+  `uuid`: String uniquely representing this request  
+  `ProcedureName`: The procedure to run on the simulator  
+  `PDU`: The parameters for said procedure
 
-`uuid`: String uniquely representing this request  
-`ProcedureName`: The procedure to run on the simulator  
-`PDU`: The parameters for said procedure
-
-Response:  
-[`uuid`, `PDU`]
-
-`uuid`: String uniquely linking the response to the request  
-`PDU`: Response data to requested procedure
+- Response:  
+  [`uuid`, `PDU`]  
+  `uuid`: String uniquely linking the response to the request  
+  `PDU`: Response data to requested procedure
 
 ### Version 0.0.1
 
-Set the HTTP header _Sec-Websocket-Protocol_ to `ui0.0.1`
+Set the WebSocket header _Sec-Websocket-Protocol_ to `ui0.0.1`.
 
 #### Procedures
 
 ##### Start Simulator
 
-Request:  
-`ProcedureName`: 'startSimulator'  
-`PDU`: {}
+Request:  
+  `ProcedureName`: 'startSimulator'  
+  `PDU`: {}
 
-Response:  
-`PDU`: {  
-`status`  
-}
+Response:  
+  `PDU`: {  
+  `status`  
+  }
 
 ##### Stop Simulator
 
-Request:  
-`ProcedureName`: 'stopSimulator'  
-`PDU`: {}
+Request:  
+  `ProcedureName`: 'stopSimulator'  
+  `PDU`: {}
 
-Response:  
-`PDU`: {  
-`status`  
-}
+Response:  
+  `PDU`: {  
+  `status`  
+  }
 
 ##### List Charging Stations
 
-Request:  
-`ProcedureName`: 'listChargingStations'  
-`PDU`: {}
+Request:  
+  `ProcedureName`: 'listChargingStations'  
+  `PDU`: {}
 
-Response:  
-`PDU`: {  
-`status`,  
-`index`: ChargingStationData,  
-...  
-`index`: ChargingStationData  
-}
+Response:  
+  `PDU`: {  
+  `status`,  
+  `index`: ChargingStationData,  
+  ...  
+  `index`: ChargingStationData  
+  }
 
 ##### Start Transaction
 
-Request:  
-`ProcedureName`: 'startTransaction'  
-`PDU`: {  
-`hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array,  
-`connectorId`: connector id integer,  
-`idTag`: RFID tag string  
-}
+Request:  
+  `ProcedureName`: 'startTransaction'  
+  `PDU`: {  
+  `hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array,  
+  `connectorId`: connector id integer,  
+  `idTag`: RFID tag string  
+  }
 
-Response:  
-`PDU`: {  
-`status`  
-}
+Response:  
+  `PDU`: {  
+  `status`  
+  }
 
 ##### Stop Transaction
 
-Request:  
-`ProcedureName`: 'stopTransaction'  
-`PDU`: {  
-`hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array,  
-`transactionId`: transaction id integer  
-}
+Request:  
+  `ProcedureName`: 'stopTransaction'  
+  `PDU`: {  
+  `hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array,  
+  `transactionId`: transaction id integer  
+  }
 
-Response:  
-`PDU`: {  
-`status`  
-}
+Response:  
+  `PDU`: {  
+  `status`  
+  }
 
 ##### Start Charging Station
 
-Request:  
-`ProcedureName`: 'startChargingStation'  
-`PDU`: {  
-`hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array
-}
+Request:  
+  `ProcedureName`: 'startChargingStation'  
+  `PDU`: {  
+  `hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array
+  }
 
-Response:  
-`PDU`: {  
-`status`  
-}
+Response:  
+  `PDU`: {  
+  `status`  
+  }
 
 ##### Stop Charging Station
 
-Request:  
-`ProcedureName`: 'stopChargingStation'  
-`PDU`: {  
-`hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array  
-}
+Request:  
+  `ProcedureName`: 'stopChargingStation'  
+  `PDU`: {  
+  `hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array  
+  }
 
-Response:  
-`PDU`: {  
-`status`  
-}
+Response:  
+  `PDU`: {  
+  `status`  
+  }
 
 ##### Open Connection
 
-Request:  
-`ProcedureName`: 'openConnection'  
-`PDU`: {  
-`hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array  
-}
+Request:  
+  `ProcedureName`: 'openConnection'  
+  `PDU`: {  
+  `hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array  
+  }
 
-Response:  
-`PDU`: {  
-`status`  
-}
+Response:  
+  `PDU`: {  
+  `status`  
+  }
 
 ##### Close Connection
 
-Request:  
-`ProcedureName`: 'closeConnection'  
-`PDU`: {  
-`hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array  
-}
+- Request:  
+  `ProcedureName`: 'closeConnection'  
+  `PDU`: {  
+  `hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array  
+  }
+
+- Response:  
+  `PDU`: {  
+  `status`  
+  }
+
+### HTTP Protocol
 
-Response:  
-`PDU`: {  
-`status`  
-}
+A Postman or Advanced REST client collection to learn how to use the HTTP protocol to pilot the simulator is available.
 
 ## Support, Feedback, Contributing
 
index ff3b2601b8a7ba6ce9493272d06eb857a0db5109..d771ebe08ab969147e65dcc2d7efcaa726ed6c2e 100644 (file)
@@ -178,8 +178,8 @@ export default class ChargingStation {
       : true;
   }
 
-  public getMayAuthorizeAtRemoteStart(): boolean | undefined {
-    return this.stationInfo.mayAuthorizeAtRemoteStart ?? true;
+  public getMustAuthorizeAtRemoteStart(): boolean | undefined {
+    return this.stationInfo.mustAuthorizeAtRemoteStart ?? true;
   }
 
   public getPayloadSchemaValidation(): boolean | undefined {
index f069cdf662212604cd0a1aeccc1eeba05ed5ae58..c35b3e6f61e7a4e6c6e893dd78e2c9d812cb242a 100644 (file)
@@ -796,7 +796,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer
             connectorStatus.localAuthorizeIdTag = commandPayload.idTag;
             connectorStatus.idTagLocalAuthorized = true;
             authorized = true;
-          } else if (chargingStation.getMayAuthorizeAtRemoteStart()) {
+          } else if (chargingStation.getMustAuthorizeAtRemoteStart()) {
             connectorStatus.authorizeIdTag = commandPayload.idTag;
             const authorizeResponse: OCPP16AuthorizeResponse =
               await chargingStation.ocppRequestService.requestHandler<
index c7ab237a21a2bc781c99ce00454a96428fd72fdb..9e4dfd083d11d63358ce5b13a0b0d988b97db2dd 100644 (file)
@@ -349,7 +349,7 @@ export default class OCPP16ResponseService extends OCPPResponseService {
     if (
       chargingStation.getConnectorStatus(connectorId).transactionRemoteStarted &&
       chargingStation.getAuthorizeRemoteTxRequests() &&
-      chargingStation.getMayAuthorizeAtRemoteStart() &&
+      chargingStation.getMustAuthorizeAtRemoteStart() &&
       !chargingStation.getConnectorStatus(connectorId).idTagLocalAuthorized &&
       !chargingStation.getConnectorStatus(connectorId).idTagAuthorized
     ) {
index 9251909cd61256f2353a4f71a7a218cab2a41f76..1c68743d8b2903a61e84f9748cf2e020c258b2ef 100644 (file)
@@ -81,7 +81,7 @@ export default interface ChargingStationTemplate {
   reconnectExponentialDelay?: boolean;
   registrationMaxRetries?: number;
   enableStatistics?: boolean;
-  mayAuthorizeAtRemoteStart?: boolean;
+  mustAuthorizeAtRemoteStart?: boolean;
   payloadSchemaValidation?: boolean;
   amperageLimitationOcppKey?: string;
   amperageLimitationUnit?: AmpereUnits;
diff --git a/src/ui/web/.editorconfig b/src/ui/web/.editorconfig
new file mode 100644 (file)
index 0000000..be65bb5
--- /dev/null
@@ -0,0 +1,21 @@
+root = true
+
+[*]
+indent_style = space
+indent_size = 2
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+end_of_line = lf
+max_line_length = 100
+
+[*.ts{,x}]
+quote_type = single
+
+[*.md]
+max_line_length = off
+trim_trailing_whitespace = false
+
+[{Makefile,**.mk}]
+# Use tabs for indentation (Makefiles require tabs)
+indent_style = tab
index dc485451034efc2efa12a8e0d94674eaf12ea73b..4d4a7a4d3b152b0ee94029a68862952648847fe5 100644 (file)
@@ -50,7 +50,7 @@ export type ChargingStationInfo = {
   reconnectExponentialDelay?: boolean;
   registrationMaxRetries?: number;
   enableStatistics?: boolean;
-  mayAuthorizeAtRemoteStart?: boolean;
+  mustAuthorizeAtRemoteStart?: boolean;
   amperageLimitationOcppKey?: string;
   amperageLimitationUnit?: AmpereUnits;
   beginEndMeterValues?: boolean;