MCPcopy Create free account
hub / github.com/evcc-io/evcc / handleServerRequest

Method handleServerRequest

tests/simulator/ocppClient.ts:100–150  ·  view source on GitHub ↗
(messageId: string, action: string, payload: any)

Source from the content-addressed store, hash-verified

98 }
99
100 private handleServerRequest(messageId: string, action: string, payload: any) {
101 let response: any = {};
102
103 switch (action) {
104 case "GetConfiguration":
105 response = {
106 configurationKey: [
107 { key: "NumberOfConnectors", readonly: true, value: "1" },
108 {
109 key: "MeterValuesSampledData",
110 readonly: false,
111 value: "Energy.Active.Import.Register,Power.Active.Import",
112 },
113 ],
114 };
115 break;
116 case "ChangeConfiguration":
117 response = { status: "Accepted" };
118 break;
119 case "ChangeAvailability":
120 response = { status: "Accepted" };
121 break;
122 case "RemoteStartTransaction":
123 response = { status: "Accepted" };
124 break;
125 case "RemoteStopTransaction":
126 response = { status: "Accepted" };
127 break;
128 case "TriggerMessage":
129 // actually send the requested message so evcc's setup wait completes
130 switch (payload.requestedMessage) {
131 case "StatusNotification":
132 this.statusNotification(1, "Available");
133 break;
134 case "MeterValues":
135 this.meterValues(1, 0, 0);
136 break;
137 case "BootNotification":
138 this.bootNotification();
139 break;
140 }
141 response = { status: "Accepted" };
142 break;
143 default:
144 console.log(`[OCPP Client] Unknown action ${action}, sending empty response`);
145 }
146
147 // Send CallResult
148 const responseMessage = [3, messageId, response];
149 this.send(responseMessage);
150 }
151
152 private send(message: any): void {
153 if (this.ws && this.connected) {

Callers 1

handleMessageMethod · 0.95

Calls 4

statusNotificationMethod · 0.95
meterValuesMethod · 0.95
bootNotificationMethod · 0.95
sendMethod · 0.95

Tested by

no test coverage detected