X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2FOCPPRequestService.ts;h=c4dc0cbf396fafc986ccf921712d125c6da7582b;hb=f479a7929a02e6290ec945557136bf4ee5445107;hp=fc465b8c3e8ac784d025f44e7fa1cd146bc2995d;hpb=100680888f3b49453ddb4081988a480ee3030d07;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index fc465b8c..c4dc0cbf 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -1,20 +1,10 @@ import { - AuthorizeResponse, - StartTransactionResponse, - StopTransactionReason, - StopTransactionResponse, -} from '../../types/ocpp/Transaction'; -import { - DiagnosticsStatus, IncomingRequestCommand, RequestCommand, ResponseType, SendParams, } from '../../types/ocpp/Requests'; -import { BootNotificationResponse } from '../../types/ocpp/Responses'; -import { ChargePointErrorCode } from '../../types/ocpp/ChargePointErrorCode'; -import { ChargePointStatus } from '../../types/ocpp/ChargePointStatus'; import type ChargingStation from '../ChargingStation'; import Constants from '../../utils/Constants'; import { EmptyObject } from '../../types/EmptyObject'; @@ -22,7 +12,6 @@ import { ErrorType } from '../../types/ocpp/ErrorType'; import { HandleErrorParams } from '../../types/Error'; import { JsonType } from '../../types/JsonType'; import { MessageType } from '../../types/ocpp/MessageType'; -import { MeterValue } from '../../types/ocpp/MeterValues'; import OCPPError from '../../exception/OCPPError'; import type OCPPResponseService from './OCPPResponseService'; import PerformanceStatistics from '../../performance/PerformanceStatistics'; @@ -44,6 +33,7 @@ export default abstract class OCPPRequestService { ) { this.chargingStation = chargingStation; this.ocppResponseService = ocppResponseService; + this.sendMessageHandler.bind(this); } public static getInstance( @@ -220,7 +210,6 @@ export default abstract class OCPPRequestService { resolve(payload); } catch (error) { reject(error); - throw error; } finally { self.chargingStation.requests.delete(messageId); } @@ -326,58 +315,9 @@ export default abstract class OCPPRequestService { } } - public abstract sendHeartbeat(params?: SendParams): Promise; - public abstract sendBootNotification( - chargePointModel: string, - chargePointVendor: string, - chargeBoxSerialNumber?: string, - firmwareVersion?: string, - chargePointSerialNumber?: string, - iccid?: string, - imsi?: string, - meterSerialNumber?: string, - meterType?: string, + public abstract sendMessageHandler( + commandName: RequestCommand, + commandParams?: JsonType, params?: SendParams - ): Promise; - - public abstract sendStatusNotification( - connectorId: number, - status: ChargePointStatus, - errorCode?: ChargePointErrorCode - ): Promise; - - public abstract sendAuthorize(connectorId: number, idTag?: string): Promise; - public abstract sendStartTransaction( - connectorId: number, - idTag?: string - ): Promise; - - public abstract sendStopTransaction( - transactionId: number, - meterStop: number, - idTag?: string, - reason?: StopTransactionReason - ): Promise; - - public abstract sendMeterValues( - connectorId: number, - transactionId: number, - interval: number - ): Promise; - - public abstract sendTransactionBeginMeterValues( - connectorId: number, - transactionId: number, - beginMeterValue: MeterValue - ): Promise; - - public abstract sendTransactionEndMeterValues( - connectorId: number, - transactionId: number, - endMeterValue: MeterValue - ): Promise; - - public abstract sendDiagnosticsStatusNotification( - diagnosticsStatus: DiagnosticsStatus - ): Promise; + ): Promise; }