refactor: cleanup method namaspace
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 12 May 2023 20:34:41 +0000 (22:34 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 12 May 2023 20:34:41 +0000 (22:34 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/AutomaticTransactionGenerator.ts
src/charging-station/ChargingStation.ts
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts
src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts
src/charging-station/ocpp/OCPPRequestService.ts

index 8b9ae7cee30e1110badce18017d87f9fa8a1ca69..948b375e13c7a377ab0ece3a57f5ff85a04e9276 100644 (file)
@@ -172,7 +172,7 @@ export class AutomaticTransactionGenerator extends AsyncResource {
         this.stopConnector(connectorId);
         break;
       }
-      if (this.chargingStation.isInAcceptedState() === false) {
+      if (this.chargingStation.inAcceptedState() === false) {
         logger.error(
           `${this.logPrefix(
             connectorId
index 9f1fa7dea8b29435e63592b2645406613d7a1526..0ae3be5f14ef9cb32e0f06ec5cfe0f3e662c7450 100644 (file)
@@ -222,26 +222,26 @@ export class ChargingStation {
     return this?.bootNotificationResponse?.status;
   }
 
-  public isInUnknownState(): boolean {
+  public inUnknownState(): boolean {
     return Utils.isNullOrUndefined(this?.bootNotificationResponse?.status);
   }
 
-  public isInPendingState(): boolean {
+  public inPendingState(): boolean {
     return this?.bootNotificationResponse?.status === RegistrationStatusEnumType.PENDING;
   }
 
-  public isInAcceptedState(): boolean {
+  public inAcceptedState(): boolean {
     return this?.bootNotificationResponse?.status === RegistrationStatusEnumType.ACCEPTED;
   }
 
-  public isInRejectedState(): boolean {
+  public inRejectedState(): boolean {
     return this?.bootNotificationResponse?.status === RegistrationStatusEnumType.REJECTED;
   }
 
   public isRegistered(): boolean {
     return (
-      this.isInUnknownState() === false &&
-      (this.isInAcceptedState() === true || this.isInPendingState() === true)
+      this.inUnknownState() === false &&
+      (this.inAcceptedState() === true || this.inPendingState() === true)
     );
   }
 
@@ -1690,7 +1690,7 @@ export class ChargingStation {
         );
       }
       if (this.isRegistered() === true) {
-        if (this.isInAcceptedState() === true) {
+        if (this.inAcceptedState() === true) {
           await this.startMessageSequence();
         }
       } else {
index b1785a13c528c0587e8676e658b7b23752f8ce3f..a7d02dcaac6d4098240ba10c2e60b06848232f03 100644 (file)
@@ -275,7 +275,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     let response: JsonType;
     if (
       chargingStation.getOcppStrictCompliance() === true &&
-      chargingStation.isInPendingState() === true &&
+      chargingStation.inPendingState() === true &&
       (commandName === OCPP16IncomingRequestCommand.REMOTE_START_TRANSACTION ||
         commandName === OCPP16IncomingRequestCommand.REMOTE_STOP_TRANSACTION)
     ) {
@@ -293,7 +293,7 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     if (
       chargingStation.isRegistered() === true ||
       (chargingStation.getOcppStrictCompliance() === false &&
-        chargingStation.isInUnknownState() === true)
+        chargingStation.inUnknownState() === true)
     ) {
       if (
         this.incomingRequestHandlers.has(commandName) === true &&
index 2d1ebd4dba73c1aa5367d4a6754b9b0e87833f9e..3ca4d3cf406e90b9c04ea18d861572ba30d5167d 100644 (file)
@@ -56,7 +56,7 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService {
     let response: JsonType;
     if (
       chargingStation.getOcppStrictCompliance() === true &&
-      chargingStation.isInPendingState() === true &&
+      chargingStation.inPendingState() === true &&
       (commandName === OCPP20IncomingRequestCommand.REQUEST_START_TRANSACTION ||
         commandName === OCPP20IncomingRequestCommand.REQUEST_STOP_TRANSACTION)
     ) {
@@ -74,7 +74,7 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService {
     if (
       chargingStation.isRegistered() === true ||
       (chargingStation.getOcppStrictCompliance() === false &&
-        chargingStation.isInUnknownState() === true)
+        chargingStation.inUnknownState() === true)
     ) {
       if (
         this.incomingRequestHandlers.has(commandName) === true &&
index a50500dc24047f7a7eb3276a03d725cedf69fb44..3eb85e3089a232f21b50b5082e644dceec573505 100644 (file)
@@ -266,12 +266,12 @@ export abstract class OCPPRequestService {
     }
   ): Promise<ResponseType> {
     if (
-      (chargingStation.isInUnknownState() === true &&
+      (chargingStation.inUnknownState() === true &&
         commandName === RequestCommand.BOOT_NOTIFICATION) ||
       (chargingStation.getOcppStrictCompliance() === false &&
-        chargingStation.isInUnknownState() === true) ||
-      chargingStation.isInAcceptedState() === true ||
-      (chargingStation.isInPendingState() === true &&
+        chargingStation.inUnknownState() === true) ||
+      chargingStation.inAcceptedState() === true ||
+      (chargingStation.inPendingState() === true &&
         (params.triggerMessage === true || messageType === MessageType.CALL_RESULT_MESSAGE))
     ) {
       // eslint-disable-next-line @typescript-eslint/no-this-alias