docs: add code comment
[e-mobility-charging-stations-simulator.git] / src / types / ocpp / Responses.ts
... / ...
CommitLineData
1import type { OCPP16MeterValuesResponse } from './1.6/MeterValues';
2import {
3 OCPP16AvailabilityStatus,
4 type OCPP16BootNotificationResponse,
5 OCPP16ChargingProfileStatus,
6 OCPP16ClearChargingProfileStatus,
7 OCPP16ConfigurationStatus,
8 type OCPP16DataTransferResponse,
9 OCPP16DataTransferStatus,
10 type OCPP16DiagnosticsStatusNotificationResponse,
11 type OCPP16FirmwareStatusNotificationResponse,
12 type OCPP16HeartbeatResponse,
13 OCPP16ReservationStatus,
14 type OCPP16StatusNotificationResponse,
15 OCPP16TriggerMessageStatus,
16 OCPP16UnlockStatus,
17} from './1.6/Responses';
18import type { OCPP20BootNotificationResponse, OCPP20ClearCacheResponse } from './2.0/Responses';
19import { type GenericResponse, GenericStatus } from './Common';
20import type { ErrorType } from './ErrorType';
21import type { MessageType } from './MessageType';
22import type { ChargingStation } from '../../charging-station';
23import type { JsonType } from '../JsonType';
24
25export type Response = [MessageType.CALL_RESULT_MESSAGE, string, JsonType];
26
27export type ErrorResponse = [MessageType.CALL_ERROR_MESSAGE, string, ErrorType, string, JsonType];
28
29export type ResponseHandler = (
30 chargingStation: ChargingStation,
31 payload: JsonType,
32 requestPayload?: JsonType,
33) => void | Promise<void>;
34
35export type BootNotificationResponse =
36 | OCPP16BootNotificationResponse
37 | OCPP20BootNotificationResponse;
38
39export type HeartbeatResponse = OCPP16HeartbeatResponse;
40
41export type ClearCacheResponse = GenericResponse | OCPP20ClearCacheResponse;
42
43export type StatusNotificationResponse = OCPP16StatusNotificationResponse;
44
45export type MeterValuesResponse = OCPP16MeterValuesResponse;
46
47export type DataTransferResponse = OCPP16DataTransferResponse;
48
49export type DiagnosticsStatusNotificationResponse = OCPP16DiagnosticsStatusNotificationResponse;
50
51export type FirmwareStatusNotificationResponse = OCPP16FirmwareStatusNotificationResponse;
52
53export const AvailabilityStatus = {
54 ...OCPP16AvailabilityStatus,
55} as const;
56export type AvailabilityStatus = OCPP16AvailabilityStatus;
57
58export const ChargingProfileStatus = {
59 ...OCPP16ChargingProfileStatus,
60} as const;
61export type ChargingProfileStatus = OCPP16ChargingProfileStatus;
62
63export const ClearChargingProfileStatus = {
64 ...OCPP16ClearChargingProfileStatus,
65} as const;
66export type ClearChargingProfileStatus = OCPP16ClearChargingProfileStatus;
67
68export const ConfigurationStatus = {
69 ...OCPP16ConfigurationStatus,
70} as const;
71export type ConfigurationStatus = OCPP16ConfigurationStatus;
72
73export const UnlockStatus = {
74 ...OCPP16UnlockStatus,
75} as const;
76export type UnlockStatus = OCPP16UnlockStatus;
77
78export const TriggerMessageStatus = {
79 ...OCPP16TriggerMessageStatus,
80} as const;
81export type TriggerMessageStatus = OCPP16TriggerMessageStatus;
82
83export const DataTransferStatus = {
84 ...OCPP16DataTransferStatus,
85} as const;
86export type DataTransferStatus = OCPP16DataTransferStatus;
87
88export type ReservationStatus = OCPP16ReservationStatus;
89export const ReservationStatus = {
90 ...OCPP16ReservationStatus,
91} as const;
92
93export type CancelReservationStatus = GenericStatus;
94export const CancelReservationStatus = {
95 ...GenericStatus,
96} as const;
97
98export type CancelReservationResponse = GenericResponse;