the node firmware of ChiaYi Xingang
Diff: Mote.h
- Revision:
- 65:acc0468b9aec
- Parent:
- 64:64982192a2af
diff -r 64982192a2af -r acc0468b9aec Mote.h --- a/Mote.h Thu Aug 23 14:18:55 2018 -0500 +++ b/Mote.h Thu Apr 18 14:55:19 2019 -0500 @@ -16,8 +16,11 @@ #ifndef __LORA_MOTE_H__ #define __LORA_MOTE_H__ -#include "rtos.h" +#include "mbed.h" +#include "mbed_events.h" + #include "MacEvents.h" + #include <vector> class SxRadio; @@ -91,6 +94,19 @@ virtual void RxDone(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr, lora::DownlinkControl ctrl, uint8_t slot); /** + * Fired when a beacon is received + * @param beacon_data parsed from the beacon payload + * @param rssi of received beacon + * @param snr of received beacon + */ + virtual void BeaconRx(const BeaconData_t& beacon_data, int16_t rssi, int8_t snr); + + /** + * Fired upon losing beacon synchronization (120 minutes elapsed from last beacon reception) + */ + virtual void BeaconLost(); + + /** * Fired if rx window times out * @param slot rx window that timed out */ @@ -121,6 +137,13 @@ virtual void NetworkLinkCheck(int16_t m_rssi, int8_t m_snr, int8_t s_snr, uint8_t s_gateways); /** + * Fired upon receiving a server time answer + * @param seconds from the GPS epoch + * @param sub_seconds from the GPS epoch + */ + virtual void ServerTime(uint32_t seconds, uint8_t sub_seconds); + + /** * Callback to for device to measure the battery level and report to server * @return battery level 0-255, 0 - external power, 1-254 level min-max, 255 device unable to measure battery */ @@ -293,6 +316,10 @@ private: ChannelPlan* _plan; MoteEvents _events; + + // Event queue objects for timing events + EventQueue _evtQueue; + Thread _dispatch_thread; }; }