this is the working code for the xdot to read in serial from the pi and send it over LoRa
Diff: Mote.h
- Revision:
- 16:4a382fe8f51b
- Parent:
- 14:f0c24ce93427
- Child:
- 18:d7332302f5f1
--- a/Mote.h Fri Aug 24 10:59:18 2018 -0500 +++ b/Mote.h Tue Apr 23 08:51:44 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; }; }