|
|
@@ -12,6 +12,7 @@ namespace network { |
|
|
|
|
|
|
|
SIM808RegistrationStatus waitForRegistered(uint32_t timeout) { |
|
|
|
SIM808RegistrationStatus currentStatus; |
|
|
|
uint8_t noNetwork = 0; |
|
|
|
|
|
|
|
do { |
|
|
|
currentStatus = hardware::sim808::device.getNetworkRegistrationStatus(); |
|
|
@@ -19,6 +20,14 @@ namespace network { |
|
|
|
|
|
|
|
SIM808SignalQualityReport report = hardware::sim808::device.getSignalQuality(); |
|
|
|
VERBOSE_FORMAT("waitForRegistered", "%d, [%d %ddBm]", currentStatus.stat, report.ssri, report.attenuation); |
|
|
|
|
|
|
|
if (report.ssri == 0) noNetwork++; |
|
|
|
else noNetwork = 0; |
|
|
|
if (noNetwork > 3) { |
|
|
|
VERBOSE_MSG("waitForRegistered", "No signal"); |
|
|
|
break; //after a while, not network really means no network. Bailing out |
|
|
|
} |
|
|
|
|
|
|
|
mainunit::deepSleep(NETWORK_DEFAULT_INTERMEDIATE_TIMEOUT_MS / 1000); |
|
|
|
timeout -= NETWORK_DEFAULT_INTERMEDIATE_TIMEOUT_MS; |
|
|
|
} while (timeout > 1); |
|
|
|