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

Method call

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

Source from the content-addressed store, hash-verified

158 }
159
160 private async call(action: string, payload: any): Promise<any> {
161 return new Promise((resolve, reject) => {
162 const messageId = (++this.messageId).toString();
163 const message = [2, messageId, action, payload];
164
165 // Setup callback for response
166 this.pendingCallbacks.set(messageId, resolve);
167
168 // Send message
169 this.send(message);
170
171 // Timeout after 10 seconds
172 setTimeout(() => {
173 if (this.pendingCallbacks.has(messageId)) {
174 this.pendingCallbacks.delete(messageId);
175 reject(new Error(`Timeout waiting for response to ${action}`));
176 }
177 }, 10000);
178 });
179 }
180
181 async bootNotification(model = "Simulator", vendor = "evcc-test"): Promise<any> {
182 return this.call("BootNotification", {

Callers 3

bootNotificationMethod · 0.95
statusNotificationMethod · 0.95
meterValuesMethod · 0.95

Calls 3

sendMethod · 0.95
deleteMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected