khang_91

Revision:
172:7ec44396a51b
Parent:
109:41d16d4ab0f0
Child:
182:b642f4d0c95b
--- a/plans/ChannelPlan_AS923.h	Wed Aug 08 09:33:35 2018 -0500
+++ b/plans/ChannelPlan_AS923.h	Thu Aug 30 09:05:16 2018 -0500
@@ -23,6 +23,14 @@
 
 namespace lora {
 
+    const uint8_t  AS923_125K_NUM_CHANS = 16;        //!< Number of 125k channels in AS923 channel plan
+    const uint8_t  AS923_DEFAULT_NUM_CHANS = 2;      //!< Number of default channels in AS923 channel plan
+    const uint32_t AS923_125K_FREQ_BASE = 923200000; //!< Frequency base for 125k AS923 uplink channels
+    const uint32_t AS923_125K_FREQ_STEP = 200000;    //!< Frequency step for 125k AS923 uplink channels
+    const uint32_t AS923_RX2_FREQ = 923200000;       //!< Frequency default for second rx window in AS923
+    const uint8_t  AS923_BEACON_DR = DR_3;           //!< Default beacon datarate
+    const uint32_t AS923_BEACON_FREQ = 923400000U;   //!< Default beacon broadcast frequency
+
     class ChannelPlan_AS923: public lora::ChannelPlan {
         public:
             /**
@@ -95,9 +103,10 @@
              * Set the SxRadio rx config provided window
              * @param window to be opened
              * @param continuous keep window open
+             * @param wnd_growth factor to increase the rx window by
              * @return LORA_OK
              */
-            virtual uint8_t SetRxConfig(uint8_t window, bool continuous);
+            virtual uint8_t SetRxConfig(uint8_t window, bool continuous, uint16_t wnd_growth);
 
             /**
              * Set frequency sub band if supported by plan
@@ -230,6 +239,17 @@
              */
             virtual void DecrementDatarate();
 
+            /**
+             * Check if this packet is a beacon and if so extract parameters needed
+             * @param payload of potential beacon
+             * @param size of the packet
+             * @param [out] data extracted from the beacon if this packet was indeed a beacon
+             * @return true if this packet is beacon, false if not
+             */
+            virtual bool DecodeBeacon(const uint8_t* payload,
+                                      size_t size,
+                                      BeaconData_t& data);
+
         protected:
 
             static const uint8_t AS923_TX_POWERS[8];                    //!< List of available tx powers
@@ -238,6 +258,14 @@
             static const uint8_t AS923_MAX_PAYLOAD_SIZE_400[];              //!< List of max payload sizes for each datarate
             static const uint8_t AS923_MAX_PAYLOAD_SIZE_REPEATER[];     //!< List of repeater compatible max payload sizes for each datarate
             static const uint8_t AS923_MAX_PAYLOAD_SIZE_REPEATER_400[];     //!< List of repeater compatible max payload sizes for each datarate
+
+            typedef struct __attribute__((packed)) {
+                uint8_t RFU[2];
+                uint8_t Time[4];
+                uint8_t CRC1[2];
+                uint8_t GwSpecific[7];
+                uint8_t CRC2[2];
+            } BCNPayload;
     };
 }