X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Ftypes%2Focpp%2FResponses.ts;h=43250047ade5952a2d818aa7c8a0c97e5aa271b3;hb=a9ed42b2eaac1fb26700d6d86952d0d2cee4d857;hp=7e0a3c32dd621a9e4fb4307b9d127dd982805e7c;hpb=9c13b3b52e1ab803a92f090da6920310c80c12da;p=e-mobility-charging-stations-simulator.git diff --git a/src/types/ocpp/Responses.ts b/src/types/ocpp/Responses.ts index 7e0a3c32..43250047 100644 --- a/src/types/ocpp/Responses.ts +++ b/src/types/ocpp/Responses.ts @@ -1,9 +1,86 @@ -import { OCPP16BootNotificationResponse, OCPP16RegistrationStatus } from './1.6/Responses'; +import type ChargingStation from '../../charging-station/ChargingStation'; +import type { JsonType } from '../JsonType'; +import type { OCPP16MeterValuesResponse } from './1.6/MeterValues'; +import { + OCPP16AvailabilityStatus, + OCPP16BootNotificationResponse, + OCPP16ChargingProfileStatus, + OCPP16ClearChargingProfileStatus, + OCPP16ConfigurationStatus, + OCPP16HeartbeatResponse, + OCPP16RegistrationStatus, + OCPP16StatusNotificationResponse, + OCPP16TriggerMessageStatus, + OCPP16UnlockStatus, +} from './1.6/Responses'; +import type { ErrorType } from './ErrorType'; +import type { MessageType } from './MessageType'; + +export type Response = [MessageType.CALL_RESULT_MESSAGE, string, JsonType]; + +export type ErrorResponse = [MessageType.CALL_ERROR_MESSAGE, string, ErrorType, string, JsonType]; + +export type ResponseHandler = ( + chargingStation: ChargingStation, + payload: JsonType, + requestPayload?: JsonType +) => void | Promise; export type BootNotificationResponse = OCPP16BootNotificationResponse; -export type RegistrationStatus = typeof RegistrationStatus; +export type HeartbeatResponse = OCPP16HeartbeatResponse; + +export type StatusNotificationResponse = OCPP16StatusNotificationResponse; + +export type MeterValuesResponse = OCPP16MeterValuesResponse; + +export enum DefaultStatus { + ACCEPTED = 'Accepted', + REJECTED = 'Rejected', +} + +export interface DefaultResponse { + status: DefaultStatus; +} + +export type RegistrationStatus = OCPP16RegistrationStatus; export const RegistrationStatus = { - ...OCPP16RegistrationStatus + ...OCPP16RegistrationStatus, +}; + +export type AvailabilityStatus = OCPP16AvailabilityStatus; + +export const AvailabilityStatus = { + ...OCPP16AvailabilityStatus, +}; + +export type ChargingProfileStatus = OCPP16ChargingProfileStatus; + +export const ChargingProfileStatus = { + ...OCPP16ChargingProfileStatus, +}; + +export type ClearChargingProfileStatus = OCPP16ClearChargingProfileStatus; + +export const ClearChargingProfileStatus = { + ...OCPP16ClearChargingProfileStatus, +}; + +export type ConfigurationStatus = OCPP16ConfigurationStatus; + +export const ConfigurationStatus = { + ...OCPP16ConfigurationStatus, +}; + +export type UnlockStatus = OCPP16UnlockStatus; + +export const UnlockStatus = { + ...OCPP16UnlockStatus, +}; + +export type TriggerMessageStatus = OCPP16TriggerMessageStatus; + +export const TriggerMessageStatus = { + ...OCPP16TriggerMessageStatus, };