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