I was looking at the dot-examples repository in github and particularly RadioEvent.h file. In the file I see the below lines of code related to overriding the ServerTime method and its obvious the code is compiled for FOTA examples.
#if ACTIVE_EXAMPLE == FOTA_EXAMPLE
virtual void ServerTime(uint32_t seconds, uint8_t sub_seconds) {
mDotEvent::ServerTime(seconds, sub_seconds);
Fota::getInstance()->setClockOffset(seconds);
}
#endif
However my question is why do we have to override this method, if in the overridden PacketRx method we are listening to packets arriving on port 202 (APP_PORT_CLOCK_SYNC) and as shown in the PacketRx method, we seem to be passing the packets we receive on that port to to the FOTA Class and I am guessing to synchronize the time with the conduit?
virtual void PacketRx(uint8_t port, uint8_t *payload, uint16_t size, int16_t rssi, int16_t snr, lora::DownlinkControl ctrl, uint8_t slot, uint8_t retries, uint32_t address, uint32_t fcnt, bool dupRx) {
mDotEvent::PacketRx(port, payload, size, rssi, snr, ctrl, slot, retries, address, fcnt, dupRx);
#if ACTIVE_EXAMPLE == FOTA_EXAMPLE
if(port == 200 || port == 201 || port == 202) {
Fota::getInstance()->processCmd(payload, port, size);
}
#endif
}
Thanks,
Ajay