MCPcopy Create free account
hub / github.com/SmingHub/Sming / onSent

Function onSent

samples/Network_Ping/app/application.cpp:30–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30void onSent(void* arg, void* pdata)
31{
32 ping_resp* response = reinterpret_cast<ping_resp*>(pdata);
33
34 if(response == nullptr) {
35 debug_e("Invalid onSent call");
36 return;
37 }
38
39 Serial << _F("Ping sent. Total failed attempts: ") << failedAttempts << endl;
40 if(failedAttempts / response->total_count > MAX_FAILED_ATTEMTPS) {
41 debug_d("Scheduling system restart in %d seconds.", RESTART_DELAY_SECONDS);
42 // schedule restart
43 System.restart(RESTART_DELAY_SECONDS * 1000);
44 return;
45 }
46
47 debug_d("Scheduling another ping in %d seconds", PING_INTERVAL_SECONDS);
48 procTimer.initializeMs<PING_INTERVAL_SECONDS * 1000>(pingTask).startOnce();
49}
50
51void onReceived(void* arg, void* pdata)
52{

Callers 2

onSentMethod · 0.85
internalOnSentMethod · 0.85

Calls 2

startOnceMethod · 0.80
restartMethod · 0.45

Tested by

no test coverage detected