Thanh Nguyen / libmDot-dev-mbed5
Revision:
172:7ec44396a51b
Parent:
137:893a90334924
Child:
176:e8835022d431
--- a/mDotEvent.h	Wed Aug 08 09:33:35 2018 -0500
+++ b/mDotEvent.h	Thu Aug 30 09:05:16 2018 -0500
@@ -63,9 +63,13 @@
           PacketReceived(false),
           RxPort(0),
           RxPayloadSize(0),
+          BeaconLocked(false),
+          BeaconPayloadSize(0U),
           PongReceived(false),
           PongRssi(0),
           PongSnr(0),
+          ServerTimeReceived(false),
+          ServerTimeSeconds(0U),
           AckReceived(false),
           DuplicateRx(false),
           TxNbRetries(0),
@@ -234,6 +238,19 @@
                 _sleep_cb(mDot::AUTO_SLEEP_EVT_CLEANUP);
         }
 
+        virtual void BeaconRx(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr) {
+            logDebug("mDotEvent - BeaconRx");
+            BeaconLocked = true;
+
+            memcpy(BeaconPayload, payload, size);
+            BeaconPayloadSize = size;
+        }
+
+        virtual void BeaconLost() {
+            logDebug("mDotEvent - BeaconLost");
+            BeaconLocked = false;
+        }
+
         virtual void Pong(int16_t m_rssi, int8_t m_snr, int16_t s_rssi, int8_t s_snr) {
             logDebug("mDotEvent - Pong");
             PongReceived = true;
@@ -241,6 +258,12 @@
             PongSnr = s_snr;
         }
 
+        virtual void ServerTime(uint32_t seconds, uint8_t sub_seconds) {
+            logDebug("mDotEvent - ServerTime");
+            ServerTimeReceived = true;
+            ServerTimeSeconds = seconds;
+        }
+
         virtual void NetworkLinkCheck(int16_t m_rssi, int8_t m_snr, int8_t s_snr, uint8_t s_gateways) {
             logDebug("mDotEvent - NetworkLinkCheck");
             LinkCheckAnsReceived = true;
@@ -309,10 +332,17 @@
         uint8_t RxPayload[255];
         uint8_t RxPayloadSize;
 
+        bool BeaconLocked;
+        uint8_t BeaconPayload[25];
+        uint8_t BeaconPayloadSize;
+
         bool PongReceived;
         int16_t PongRssi;
         int16_t PongSnr;
 
+        bool ServerTimeReceived;
+        uint32_t ServerTimeSeconds;
+
         bool AckReceived;
         bool DuplicateRx;
         uint8_t TxNbRetries;