feat(simulator): add certificates related OCPP 2.x types
[e-mobility-charging-stations-simulator.git] / src / types / ocpp / Responses.ts
CommitLineData
2896e06d 1import type { ChargingStation } from '../../charging-station';
e7aeea18 2import {
2896e06d
JB
3 type ErrorType,
4 type JsonType,
5 type MessageType,
e7aeea18 6 OCPP16AvailabilityStatus,
edd13439 7 type OCPP16BootNotificationResponse,
e7aeea18
JB
8 OCPP16ChargingProfileStatus,
9 OCPP16ClearChargingProfileStatus,
10 OCPP16ConfigurationStatus,
edd13439 11 type OCPP16DataTransferResponse,
91a7d3ea 12 OCPP16DataTransferStatus,
c9a4f9ea
JB
13 type OCPP16DiagnosticsStatusNotificationResponse,
14 type OCPP16FirmwareStatusNotificationResponse,
edd13439 15 type OCPP16HeartbeatResponse,
2896e06d 16 type OCPP16MeterValuesResponse,
edd13439 17 type OCPP16StatusNotificationResponse,
e7aeea18
JB
18 OCPP16TriggerMessageStatus,
19 OCPP16UnlockStatus,
2896e06d
JB
20 type OCPP20BootNotificationResponse,
21 type OCPP20ClearCacheResponse,
22 type OCPP20StatusNotificationResponse,
23} from '../internal';
d1888640 24
5cc4b63b 25export type Response = [MessageType.CALL_RESULT_MESSAGE, string, JsonType];
b3ec7bc1 26
5cc4b63b 27export type ErrorResponse = [MessageType.CALL_ERROR_MESSAGE, string, ErrorType, string, JsonType];
b3ec7bc1 28
e7aeea18 29export type ResponseHandler = (
08f130a0 30 chargingStation: ChargingStation,
5cc4b63b
JB
31 payload: JsonType,
32 requestPayload?: JsonType
e7aeea18 33) => void | Promise<void>;
58144adb 34
d270cc87
JB
35export type BootNotificationResponse =
36 | OCPP16BootNotificationResponse
37 | OCPP20BootNotificationResponse;
c0560973 38
f22266fd
JB
39export type HeartbeatResponse = OCPP16HeartbeatResponse;
40
f03e1042 41export type ClearCacheResponse = GenericResponse | OCPP20ClearCacheResponse;
22e0d48e 42
6e939d9e
JB
43export type StatusNotificationResponse =
44 | OCPP16StatusNotificationResponse
45 | OCPP20StatusNotificationResponse;
f22266fd
JB
46
47export type MeterValuesResponse = OCPP16MeterValuesResponse;
48
91a7d3ea
JB
49export type DataTransferResponse = OCPP16DataTransferResponse;
50
c9a4f9ea
JB
51export type DiagnosticsStatusNotificationResponse = OCPP16DiagnosticsStatusNotificationResponse;
52
53export type FirmwareStatusNotificationResponse = OCPP16FirmwareStatusNotificationResponse;
54
f03e1042 55export enum GenericStatus {
6b635033
JB
56 Accepted = 'Accepted',
57 Rejected = 'Rejected',
9ccca265
JB
58}
59
f03e1042
JB
60export type GenericResponse = {
61 status: GenericStatus;
83e00df1 62};
9ccca265 63
d270cc87
JB
64export enum RegistrationStatusEnumType {
65 ACCEPTED = 'Accepted',
66 PENDING = 'Pending',
67 REJECTED = 'Rejected',
68}
9ccca265
JB
69
70export const AvailabilityStatus = {
e7aeea18 71 ...OCPP16AvailabilityStatus,
edd13439
JB
72} as const;
73export type AvailabilityStatus = OCPP16AvailabilityStatus;
9ccca265
JB
74
75export const ChargingProfileStatus = {
e7aeea18 76 ...OCPP16ChargingProfileStatus,
edd13439
JB
77} as const;
78export type ChargingProfileStatus = OCPP16ChargingProfileStatus;
9ccca265
JB
79
80export const ClearChargingProfileStatus = {
e7aeea18 81 ...OCPP16ClearChargingProfileStatus,
edd13439
JB
82} as const;
83export type ClearChargingProfileStatus = OCPP16ClearChargingProfileStatus;
9ccca265
JB
84
85export const ConfigurationStatus = {
e7aeea18 86 ...OCPP16ConfigurationStatus,
edd13439
JB
87} as const;
88export type ConfigurationStatus = OCPP16ConfigurationStatus;
9ccca265
JB
89
90export const UnlockStatus = {
e7aeea18 91 ...OCPP16UnlockStatus,
edd13439
JB
92} as const;
93export type UnlockStatus = OCPP16UnlockStatus;
802cfa13
JB
94
95export const TriggerMessageStatus = {
e7aeea18 96 ...OCPP16TriggerMessageStatus,
edd13439
JB
97} as const;
98export type TriggerMessageStatus = OCPP16TriggerMessageStatus;
91a7d3ea
JB
99
100export const DataTransferStatus = {
101 ...OCPP16DataTransferStatus,
edd13439
JB
102} as const;
103export type DataTransferStatus = OCPP16DataTransferStatus;