fix: move and fix statistic related helpers implementation
[e-mobility-charging-stations-simulator.git] / src / types / ocpp / Responses.ts
... / ...
CommitLineData
1import type { ChargingStation } from '../../charging-station';
2import {
3 type ErrorType,
4 type JsonType,
5 type MessageType,
6 OCPP16AvailabilityStatus,
7 type OCPP16BootNotificationResponse,
8 OCPP16ChargingProfileStatus,
9 OCPP16ClearChargingProfileStatus,
10 OCPP16ConfigurationStatus,
11 type OCPP16DataTransferResponse,
12 OCPP16DataTransferStatus,
13 type OCPP16DiagnosticsStatusNotificationResponse,
14 type OCPP16FirmwareStatusNotificationResponse,
15 type OCPP16HeartbeatResponse,
16 type OCPP16MeterValuesResponse,
17 type OCPP16StatusNotificationResponse,
18 OCPP16TriggerMessageStatus,
19 OCPP16UnlockStatus,
20 type OCPP20BootNotificationResponse,
21 type OCPP20ClearCacheResponse,
22 type OCPP20StatusNotificationResponse,
23} from '../internal';
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 =
44 | OCPP16StatusNotificationResponse
45 | OCPP20StatusNotificationResponse;
46
47export type MeterValuesResponse = OCPP16MeterValuesResponse;
48
49export type DataTransferResponse = OCPP16DataTransferResponse;
50
51export type DiagnosticsStatusNotificationResponse = OCPP16DiagnosticsStatusNotificationResponse;
52
53export type FirmwareStatusNotificationResponse = OCPP16FirmwareStatusNotificationResponse;
54
55export enum GenericStatus {
56 Accepted = 'Accepted',
57 Rejected = 'Rejected',
58}
59
60export type GenericResponse = {
61 status: GenericStatus;
62};
63
64export enum RegistrationStatusEnumType {
65 ACCEPTED = 'Accepted',
66 PENDING = 'Pending',
67 REJECTED = 'Rejected',
68}
69
70export const AvailabilityStatus = {
71 ...OCPP16AvailabilityStatus,
72} as const;
73export type AvailabilityStatus = OCPP16AvailabilityStatus;
74
75export const ChargingProfileStatus = {
76 ...OCPP16ChargingProfileStatus,
77} as const;
78export type ChargingProfileStatus = OCPP16ChargingProfileStatus;
79
80export const ClearChargingProfileStatus = {
81 ...OCPP16ClearChargingProfileStatus,
82} as const;
83export type ClearChargingProfileStatus = OCPP16ClearChargingProfileStatus;
84
85export const ConfigurationStatus = {
86 ...OCPP16ConfigurationStatus,
87} as const;
88export type ConfigurationStatus = OCPP16ConfigurationStatus;
89
90export const UnlockStatus = {
91 ...OCPP16UnlockStatus,
92} as const;
93export type UnlockStatus = OCPP16UnlockStatus;
94
95export const TriggerMessageStatus = {
96 ...OCPP16TriggerMessageStatus,
97} as const;
98export type TriggerMessageStatus = OCPP16TriggerMessageStatus;
99
100export const DataTransferStatus = {
101 ...OCPP16DataTransferStatus,
102} as const;
103export type DataTransferStatus = OCPP16DataTransferStatus;