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

Function processXferComplete

ESP32_AP-Flasher/src/newproto.cpp:424–489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

422}
423
424void processXferComplete(struct espXferComplete* xfc, bool local) {
425 if (config.runStatus == RUNSTATUS_STOP) {
426 return;
427 }
428 char buffer[64];
429 sprintf(buffer, "%02X%02X%02X%02X%02X%02X%02X%02X reports xfer complete\r\n\0", xfc->src[7], xfc->src[6], xfc->src[5], xfc->src[4], xfc->src[3], xfc->src[2], xfc->src[1], xfc->src[0]);
430 wsLog((String)buffer);
431
432 if (local) {
433 Serial.printf("<XFC %02X%02X%02X%02X%02X%02X%02X%02X\r\n", xfc->src[7], xfc->src[6], xfc->src[5], xfc->src[4], xfc->src[3], xfc->src[2], xfc->src[1], xfc->src[0]);
434 } else {
435 Serial.printf("<REMOTE XFC %02X%02X%02X%02X%02X%02X%02X%02X\r\n", xfc->src[7], xfc->src[6], xfc->src[5], xfc->src[4], xfc->src[3], xfc->src[2], xfc->src[1], xfc->src[0]);
436 }
437
438 time_t now;
439 time(&now);
440
441 char dst_path[64];
442 sprintf(dst_path, "/current/%02X%02X%02X%02X%02X%02X%02X%02X.raw\0", xfc->src[7], xfc->src[6], xfc->src[5], xfc->src[4], xfc->src[3], xfc->src[2], xfc->src[1], xfc->src[0]);
443
444 uint8_t md5bytes[16];
445 PendingItem* queueItem = getQueueItem(xfc->src);
446 if (queueItem != nullptr) {
447 if (contentFS->exists(dst_path) && contentFS->exists(queueItem->filename)) {
448 contentFS->remove(dst_path);
449 }
450 if (contentFS->exists(queueItem->filename)) {
451 uint8_t dataType = queueItem->pendingdata.availdatainfo.dataType;
452 if (config.preview && dataType != DATATYPE_FW_UPDATE && dataType != DATATYPE_NOUPDATE) {
453 contentFS->rename(queueItem->filename, String(dst_path));
454 }
455 else {
456 if (queueItem->pendingdata.availdatainfo.dataType != DATATYPE_FW_UPDATE) contentFS->remove(queueItem->filename);
457 }
458 }
459 memcpy(md5bytes, &queueItem->pendingdata.availdatainfo.dataVer, sizeof(uint64_t));
460 memset(md5bytes + sizeof(uint64_t), 0, 16 - sizeof(uint64_t));
461 dequeueItem(xfc->src);
462 }
463
464 tagRecord* taginfo = tagRecord::findByMAC(xfc->src);
465 if (taginfo != nullptr) {
466 clearPending(taginfo);
467 memcpy(taginfo->md5, md5bytes, sizeof(md5bytes));
468 taginfo->updateCount++;
469 taginfo->updateLast = now;
470 taginfo->pendingCount = countQueueItem(xfc->src);
471 taginfo->wakeupReason = 0;
472 if (taginfo->contentMode == 12 && local == false) {
473 if (contentFS->exists(dst_path)) {
474 contentFS->remove(dst_path);
475 }
476 }
477 if (taginfo->contentMode == 5 || taginfo->contentMode == 17 || taginfo->contentMode == 18) {
478 popTagInfo(xfc->src);
479 taginfo = tagRecord::findByMAC(xfc->src);
480 taginfo->nextupdate = now;
481 }

Callers 4

rxCmdProcessorFunction · 0.70
processPacketMethod · 0.70
BLETaskFunction · 0.70
yellow_ap_display_loopFunction · 0.70

Calls 12

wsLogFunction · 0.85
getQueueItemFunction · 0.85
memcpyFunction · 0.85
memsetFunction · 0.85
dequeueItemFunction · 0.85
clearPendingFunction · 0.85
countQueueItemFunction · 0.85
popTagInfoFunction · 0.85
checkQueueFunction · 0.85
wsSendTaginfoFunction · 0.85
printfMethod · 0.80

Tested by

no test coverage detected