build(simulator): constants, requests and responses for reservation scenario added
[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 OCPP16CancelReservationStatus,
6 OCPP16ChargingProfileStatus,
7 OCPP16ClearChargingProfileStatus,
8 OCPP16ConfigurationStatus,
9 type OCPP16DataTransferResponse,
10 OCPP16DataTransferStatus,
11 type OCPP16DiagnosticsStatusNotificationResponse,
12 type OCPP16FirmwareStatusNotificationResponse,
13 type OCPP16HeartbeatResponse,
14 OCPP16ReservationStatus,
15 type OCPP16StatusNotificationResponse,
16 OCPP16TriggerMessageStatus,
17 OCPP16UnlockStatus,
18} from './1.6/Responses';
19import type {
20 OCPP20BootNotificationResponse,
21 OCPP20ClearCacheResponse,
22 OCPP20StatusNotificationResponse,
23} from './2.0/Responses';
24import type { ErrorType } from './ErrorType';
25import type { MessageType } from './MessageType';
26import type { ChargingStation } from '../../charging-station';
27import type { JsonType } from '../JsonType';
28
29export type Response = [MessageType.CALL_RESULT_MESSAGE, string, JsonType];
30
31export type ErrorResponse = [MessageType.CALL_ERROR_MESSAGE, string, ErrorType, string, JsonType];
32
33export type ResponseHandler = (
34 chargingStation: ChargingStation,
35 payload: JsonType,
36 requestPayload?: JsonType
37) => void | Promise<void>;
38
39export type BootNotificationResponse =
40 | OCPP16BootNotificationResponse
41 | OCPP20BootNotificationResponse;
42
43export type HeartbeatResponse = OCPP16HeartbeatResponse;
44
45export type ClearCacheResponse = GenericResponse | OCPP20ClearCacheResponse;
46
47export type StatusNotificationResponse =
48 | OCPP16StatusNotificationResponse
49 | OCPP20StatusNotificationResponse;
50
51export type MeterValuesResponse = OCPP16MeterValuesResponse;
52
53export type DataTransferResponse = OCPP16DataTransferResponse;
54
55export type DiagnosticsStatusNotificationResponse = OCPP16DiagnosticsStatusNotificationResponse;
56
57export type FirmwareStatusNotificationResponse = OCPP16FirmwareStatusNotificationResponse;
58
59export enum GenericStatus {
60 Accepted = 'Accepted',
61 Rejected = 'Rejected',
62}
63
64export type GenericResponse = {
65 status: GenericStatus;
66};
67
68export enum RegistrationStatusEnumType {
69 ACCEPTED = 'Accepted',
70 PENDING = 'Pending',
71 REJECTED = 'Rejected',
72}
73
74export const AvailabilityStatus = {
75 ...OCPP16AvailabilityStatus,
76} as const;
77export type AvailabilityStatus = OCPP16AvailabilityStatus;
78
79export const ChargingProfileStatus = {
80 ...OCPP16ChargingProfileStatus,
81} as const;
82export type ChargingProfileStatus = OCPP16ChargingProfileStatus;
83
84export const ClearChargingProfileStatus = {
85 ...OCPP16ClearChargingProfileStatus,
86} as const;
87export type ClearChargingProfileStatus = OCPP16ClearChargingProfileStatus;
88
89export const ConfigurationStatus = {
90 ...OCPP16ConfigurationStatus,
91} as const;
92export type ConfigurationStatus = OCPP16ConfigurationStatus;
93
94export const UnlockStatus = {
95 ...OCPP16UnlockStatus,
96} as const;
97export type UnlockStatus = OCPP16UnlockStatus;
98
99export const TriggerMessageStatus = {
100 ...OCPP16TriggerMessageStatus,
101} as const;
102export type TriggerMessageStatus = OCPP16TriggerMessageStatus;
103
104export const DataTransferStatus = {
105 ...OCPP16DataTransferStatus,
106} as const;
107export type DataTransferStatus = OCPP16DataTransferStatus;
108
109export type ReservationStatus = OCPP16ReservationStatus;
110
111export const ReservationStatus = {
112 ...OCPP16ReservationStatus,
113};
114
115export type CancelReservationStatus = OCPP16CancelReservationStatus;
116
117export const CancelReservationStatus = {
118 ...OCPP16CancelReservationStatus,
119};