Add OCPP DataTransfer request support
[e-mobility-charging-stations-simulator.git] / src / types / ocpp / 1.6 / Requests.ts
1 import type { EmptyObject } from '../../EmptyObject';
2 import type { JsonObject } from '../../JsonType';
3 import type { OCPP16ChargePointErrorCode } from './ChargePointErrorCode';
4 import type { OCPP16ChargePointStatus } from './ChargePointStatus';
5 import type { ChargingProfilePurposeType, OCPP16ChargingProfile } from './ChargingProfile';
6 import type { OCPP16StandardParametersKey } from './Configuration';
7 import type { OCPP16DiagnosticsStatus } from './DiagnosticsStatus';
8
9 export enum OCPP16RequestCommand {
10 BOOT_NOTIFICATION = 'BootNotification',
11 HEARTBEAT = 'Heartbeat',
12 STATUS_NOTIFICATION = 'StatusNotification',
13 AUTHORIZE = 'Authorize',
14 START_TRANSACTION = 'StartTransaction',
15 STOP_TRANSACTION = 'StopTransaction',
16 METER_VALUES = 'MeterValues',
17 DIAGNOSTICS_STATUS_NOTIFICATION = 'DiagnosticsStatusNotification',
18 DATA_TRANSFER = 'DataTransfer',
19 }
20
21 export type OCPP16HeartbeatRequest = EmptyObject;
22
23 export interface OCPP16BootNotificationRequest extends JsonObject {
24 chargePointVendor: string;
25 chargePointModel: string;
26 chargePointSerialNumber?: string;
27 chargeBoxSerialNumber?: string;
28 firmwareVersion?: string;
29 iccid?: string;
30 imsi?: string;
31 meterType?: string;
32 meterSerialNumber?: string;
33 }
34
35 export interface OCPP16StatusNotificationRequest extends JsonObject {
36 connectorId: number;
37 errorCode: OCPP16ChargePointErrorCode;
38 status: OCPP16ChargePointStatus;
39 info?: string;
40 timestamp?: string;
41 vendorId?: string;
42 vendorErrorCode?: string;
43 }
44
45 export enum OCPP16IncomingRequestCommand {
46 RESET = 'Reset',
47 CLEAR_CACHE = 'ClearCache',
48 CHANGE_AVAILABILITY = 'ChangeAvailability',
49 UNLOCK_CONNECTOR = 'UnlockConnector',
50 GET_CONFIGURATION = 'GetConfiguration',
51 CHANGE_CONFIGURATION = 'ChangeConfiguration',
52 SET_CHARGING_PROFILE = 'SetChargingProfile',
53 CLEAR_CHARGING_PROFILE = 'ClearChargingProfile',
54 REMOTE_START_TRANSACTION = 'RemoteStartTransaction',
55 REMOTE_STOP_TRANSACTION = 'RemoteStopTransaction',
56 GET_DIAGNOSTICS = 'GetDiagnostics',
57 TRIGGER_MESSAGE = 'TriggerMessage',
58 }
59
60 export type OCPP16ClearCacheRequest = EmptyObject;
61
62 export interface ChangeConfigurationRequest extends JsonObject {
63 key: string | OCPP16StandardParametersKey;
64 value: string;
65 }
66
67 export interface RemoteStartTransactionRequest extends JsonObject {
68 connectorId: number;
69 idTag: string;
70 chargingProfile?: OCPP16ChargingProfile;
71 }
72
73 export interface RemoteStopTransactionRequest extends JsonObject {
74 transactionId: number;
75 }
76
77 export interface UnlockConnectorRequest extends JsonObject {
78 connectorId: number;
79 }
80
81 export interface GetConfigurationRequest extends JsonObject {
82 key?: string | OCPP16StandardParametersKey[];
83 }
84
85 export enum ResetType {
86 HARD = 'Hard',
87 SOFT = 'Soft',
88 }
89
90 export interface ResetRequest extends JsonObject {
91 type: ResetType;
92 }
93
94 export interface SetChargingProfileRequest extends JsonObject {
95 connectorId: number;
96 csChargingProfiles: OCPP16ChargingProfile;
97 }
98
99 export enum OCPP16AvailabilityType {
100 INOPERATIVE = 'Inoperative',
101 OPERATIVE = 'Operative',
102 }
103
104 export interface ChangeAvailabilityRequest extends JsonObject {
105 connectorId: number;
106 type: OCPP16AvailabilityType;
107 }
108
109 export interface ClearChargingProfileRequest extends JsonObject {
110 id?: number;
111 connectorId?: number;
112 chargingProfilePurpose?: ChargingProfilePurposeType;
113 stackLevel?: number;
114 }
115
116 export interface GetDiagnosticsRequest extends JsonObject {
117 location: string;
118 retries?: number;
119 retryInterval?: number;
120 startTime?: Date;
121 stopTime?: Date;
122 }
123
124 export interface DiagnosticsStatusNotificationRequest extends JsonObject {
125 status: OCPP16DiagnosticsStatus;
126 }
127
128 export enum OCPP16MessageTrigger {
129 BootNotification = 'BootNotification',
130 DiagnosticsStatusNotification = 'DiagnosticsStatusNotification',
131 FirmwareStatusNotification = 'FirmwareStatusNotification',
132 Heartbeat = 'Heartbeat',
133 MeterValues = 'MeterValues',
134 StatusNotification = 'StatusNotification',
135 }
136
137 export interface OCPP16TriggerMessageRequest extends JsonObject {
138 requestedMessage: OCPP16MessageTrigger;
139 connectorId?: number;
140 }
141
142 export interface OCPP16DataTransferRequest extends JsonObject {
143 vendorId: string;
144 messageId?: string;
145 data?: string;
146 }