MCPcopy Create free account
hub / github.com/OpenEPaperLink/OpenEPaperLink / wsSendUploadProgress

Function wsSendUploadProgress

ESP32_AP-Flasher/src/web.cpp:61–73  ·  view source on GitHub ↗

Live upload progress of data being sent to a display. Protocol: {"upload":{"src":"<16 hex MAC>","current":N,"total":M}} The frontend shows "P% (N/M)" on the tag card; current >= total means done.

Source from the content-addressed store, hash-verified

59// Protocol: {"upload":{"src":"<16 hex MAC>","current":N,"total":M}}
60// The frontend shows "P% (N/M)" on the tag card; current >= total means done.
61void wsSendUploadProgress(const uint8_t *mac, uint16_t current, uint16_t total) {
62 if (wsClientCount() == 0) return; // nobody is listening, skip the work
63 char hexmac[17];
64 mac2hex(mac, hexmac);
65 JsonDocument doc;
66 JsonObject up = doc["upload"].to<JsonObject>();
67 up["src"] = hexmac;
68 up["current"] = current;
69 up["total"] = total;
70 if (wsMutex) xSemaphoreTake(wsMutex, portMAX_DELAY);
71 ws.textAll(doc.as<String>());
72 if (wsMutex) xSemaphoreGive(wsMutex);
73}
74
75// Sends the real touch positions to all connected websocket clients.
76// Protocol: {"touch":{"count":N,"points":[{"id":..,"x":..,"y":..,"size":..}, ...]}}

Callers 2

BLETaskFunction · 0.85
processBlockRequestFunction · 0.85

Calls 2

wsClientCountFunction · 0.85
mac2hexFunction · 0.85

Tested by

no test coverage detected