71f8384f475d1e61b57880c3d061e5b5d62df135
[e-mobility-charging-stations-simulator.git] / src / types / ocpp / 1.6 / Requests.ts
1 import { ChargePointErrorCode } from './ChargePointErrorCode';
2 import { ChargePointStatus } from './ChargePointStatus';
3 import { ChargingProfile } from './ChargingProfile';
4 import { MessageType } from '../MessageType';
5 import OCPPError from '../../../charging-station/OcppError';
6
7 export default interface Requests {
8 [id: string]: Request;
9 }
10
11 export type Request = [(payload?, requestPayload?) => void, (error?: OCPPError) => void, Record<string, unknown>];
12
13 export type IncomingRequest = [MessageType, string, IncomingRequestCommand, string, string];
14
15 export enum RequestCommand {
16 BOOT_NOTIFICATION = 'BootNotification',
17 HEARTBEAT = 'Heartbeat',
18 STATUS_NOTIFICATION = 'StatusNotification',
19 CHANGE_CONFIGURATION = 'ChangeConfiguration',
20 START_TRANSACTION = 'StartTransaction',
21 STOP_TRANSACTION = 'StopTransaction',
22 METERVALUES = 'MeterValues'
23 }
24
25 export enum IncomingRequestCommand {
26 RESET = 'Reset',
27 CLEAR_CACHE = 'ClearCache',
28 UNLOCK_CONNECTOR = 'UnlockConnector',
29 GET_CONFIGURATION = 'GetConfiguration',
30 CHANGE_CONFIGURATION = 'ChangeConfiguration',
31 SET_CHARGING_PROFILE = 'SetChargingProfile',
32 REMOTE_START_TRANSACTION = 'RemoteStartTransaction',
33 REMOTE_STOP_TRANSACTION = 'RemoteStopTransaction'
34 }
35
36 // eslint-disable-next-line @typescript-eslint/no-empty-interface
37 export interface HeartbeatRequest { }
38
39 export interface BootNotificationRequest {
40 chargeBoxSerialNumber?: string;
41 chargePointModel: string;
42 chargePointSerialNumber?: string;
43 chargePointVendor: string;
44 firmwareVersion?: string;
45 iccid?: string;
46 imsi?: string;
47 meterSerialNumber?: string;
48 meterType?: string;
49 }
50
51 export interface StatusNotificationRequest {
52 connectorId: number;
53 errorCode: ChargePointErrorCode;
54 info?: string;
55 status: ChargePointStatus;
56 timestamp?: string;
57 vendorId?: string;
58 vendorErrorCode?: string;
59 }
60
61 export interface ChangeConfigurationRequest {
62 key: string;
63 value: string;
64 }
65
66 export interface RemoteStartTransactionRequest {
67 connectorId: number;
68 idTag: string;
69 chargingProfile?: ChargingProfile;
70 }
71
72 export interface RemoteStopTransactionRequest {
73 transactionId: number;
74 }
75
76 export interface UnlockConnectorRequest {
77 connectorId: number;
78 }
79
80 export interface GetConfigurationRequest {
81 key?: string[];
82 }
83
84 export enum ResetType {
85 HARD = 'Hard',
86 SOFT = 'Soft'
87 }
88
89 export interface ResetRequest {
90 type: ResetType;
91 }
92
93 export interface SetChargingProfileRequest {
94 connectorId: number;
95 csChargingProfiles: ChargingProfile;
96 }