Stable version of the xDot library for mbed 5. This version of the library is suitable for deployment scenarios.

Dependents:   Dot-Examples XDOT-Devicewise Dot-Examples-delujoc Dot-Examples_receive ... more

Fork of libxDot-dev-mbed5-deprecated by MultiTech

The Dot library provides a LoRaWan certified stack for LoRa communication using MultiTech mDot and xDot devices. The stack is compatible with mbed 5.

The name of the repository can be used to determine which device the stack was compiled for and if it's a development or production-ready build:

A changelog for the Dot library can be found here.

The Dot library version and the version of mbed-os it was compiled against can both be found in the commit message for that revision of the Dot library. Building your application with the same version of mbed-os as what was used to build the Dot library is highly recommended!

The Dot-Examples repository demonstrates how to use the Dot library in a custom application.

The mDot and xDot platform pages have lots of platform specific information and document potential issues, gotchas, etc, and provide instructions for getting started with development. Please take a look at the platform page before starting development as they should answer many questions you will have.

FOTA

Full FOTA support is only available with mDot, xDot does not have the required external flash. xDot can use the FOTA example to dynamically join a multicast session only. After joining the multicast session the received Fragmentation packets could be handed to a host MCU for processing and at completion the firmware can be loaded into the xDot using the bootloader and y-modem. See xDot Developer Guide.

  • Add the following code to allow Fota to use the Dot instance

examples/src/fota_example.cpp

    // Initialize FOTA singleton
    Fota::getInstance(dot);
  • Add fragmentation handling the the PacketRx event

examples/inc/RadioEvent.h

    virtual void PacketRx(uint8_t port, uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr, lora::DownlinkControl ctrl, uint8_t slot, uint8_t retries, uint32_t address, bool dupRx) {
        mDotEvent::PacketRx(port, payload, size, rssi, snr, ctrl, slot, retries, address, dupRx);

#if ACTIVE_EXAMPLE == FOTA_EXAMPLE
        if(port == 200 || port == 201 || port == 202) {
            Fota::getInstance()->processCmd(payload, port, size);
        }
#endif
    }

The FOTA implementation has a few differences from the LoRaWAN Protocol

  • Fragmentation Indexing starts at 0
  • McKEKey is 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
  • Start Time is a count-down in seconds to start of session
Revision:
19:aa5b1fcd05be
Parent:
18:d7332302f5f1
Child:
20:bc12c888e7dc
--- a/mDot.h	Thu Aug 29 08:40:49 2019 -0500
+++ b/mDot.h	Thu Aug 29 12:21:40 2019 -0500
@@ -61,6 +61,21 @@
         void waitForPacket();
         void waitForLinkCheck();
 
+
+        MBED_DEPRECATED("Will be removed in dotlib 3.3.0")
+        void setActivityLedState(const uint8_t& state);
+
+        MBED_DEPRECATED("Will be removed in dotlib 3.3.0")
+        uint8_t getActivityLedState();
+
+        MBED_DEPRECATED("Will be removed in dotlib 3.3.0")
+        void blinkActivityLed(void) {
+            if (_activity_led) {
+                int val = _activity_led->read();
+                _activity_led->write(!val);
+            }
+        }
+
         mDot(const mDot&);
         mDot& operator=(const mDot&);
 
@@ -82,7 +97,12 @@
 
         std::string _last_error;
         static const uint32_t _baud_rates[];
-
+        uint8_t _activity_led_state; //deprecated will be removed
+        Ticker _tick;
+        DigitalOut* _activity_led; //deprecated will be removed
+        bool _activity_led_enable; //deprecated will be removed
+        PinName _activity_led_pin;  //deprecated will be removed
+        bool _activity_led_external; //deprecated will be removed
         uint8_t _linkFailCount;
         uint8_t _class;
         InterruptIn* _wakeup;
@@ -142,8 +162,7 @@
         enum RX_Output {
             HEXADECIMAL,
             BINARY,
-            EXTENDED,
-            EXTENDED_HEX
+            EXTENDED
         };
 
         enum DataRates {
@@ -349,6 +368,21 @@
 
         lora::Settings* getSettings();
 
+        MBED_DEPRECATED("Will be removed in dotlib 3.3.0")
+        void setActivityLedEnable(const bool& enable);
+
+        MBED_DEPRECATED("Will be removed in dotlib 3.3.0")
+        bool getActivityLedEnable();
+
+        MBED_DEPRECATED("Will be removed in dotlib 3.3.0")
+        void setActivityLedPin(const PinName& pin);
+
+        MBED_DEPRECATED("Will be removed in dotlib 3.3.0")
+        void setActivityLedPin(DigitalOut* pin);
+
+        MBED_DEPRECATED("Will be removed in dotlib 3.3.0")
+        PinName getActivityLedPin();
+
         /**
          * Returns boolean indicative of start-up from standby mode
          * @returns true if dot woke from standby
@@ -660,20 +694,6 @@
         int32_t setNetworkKey(const std::vector<uint8_t>& id);
 
         /**
-         * Get generic app key
-         * @returns a vector containing key (size 16)
-         */
-        std::vector<uint8_t> getGenAppKey();
-
-        /**
-         * Set generic app key
-         * for use with Multicast key exchange
-         * @param id a vector of 16 bytes
-         * @returns MDOT_OK if success
-         */
-        int32_t setGenAppKey(const std::vector<uint8_t>& id);
-
-        /**
          * Get network key
          * @returns a vector containing network key (size 16)
          */
@@ -708,48 +728,19 @@
         const uint8_t* getAppKey();
 
         /**
-         * Set join nonce counter incremented with each Join Request
-         * @returns MDOT_OK if success
-         */
-        int32_t setJoinNonce(const uint16_t& nonce);
-
-        /**
-         * Get join nonce counter incremented with each Join Request
-         * @returns join nonce
-         */
-        uint16_t getJoinNonce();
-
-        /**
          * Add a multicast session address and keys
          * Downlink counter is set to 0
-         * Up to 8 MULTICAST_SESSIONS can be set
+         * Up to 3 MULTICAST_SESSIONS can be set
          */
-        int32_t setMulticastSession(uint8_t index, uint32_t addr, const uint8_t* nsk, const uint8_t* ask);
-
-        /**
-         * Set multicast session info
-         * Up to 8 MULTICAST_SESSIONS
-         */
-        int32_t setMulticastAddress(uint8_t index, uint32_t addr);
-        int32_t setMulticastNetworkSessionKey(uint8_t index, const uint8_t* nsk);
-        int32_t setMulticastApplicationSessionKey(uint8_t index, const uint8_t* ask);
+        int32_t setMulticastSession(uint8_t index, uint32_t addr, const uint8_t* nsk, const uint8_t* dsk);
 
         /**
          * Set a multicast session counter
-         * Up to 8 MULTICAST_SESSIONS
+         * Up to 3 MULTICAST_SESSIONS can be set
          */
         int32_t setMulticastDownlinkCounter(uint8_t index, uint32_t count);
 
         /**
-         * Get multicast session info
-         * Up to 8 MULTICAST_SESSIONS
-         */
-        uint32_t getMulticastAddress(uint8_t index);
-        int32_t getMulticastNetworkSessionKey(uint8_t index, uint8_t* nsk);
-        int32_t getMulticastApplicationSessionKey(uint8_t index, uint8_t* ask);
-        uint32_t getMulticastDownlinkCounter(uint8_t index);
-
-        /**
          * Attempt to join network
          * each attempt will be made with a random datarate up to the configured datarate
          * JoinRequest backoff between tries is enforced to 1% for 1st hour, 0.1% for 1-10 hours and 0.01% after 10 hours
@@ -1089,17 +1080,18 @@
          *
          * AU915 Datarates
          * ---------------
-         * DR0 - SF12BW125
-         * DR1 - SF11BW125
-         * DR2 - SF10BW125
-         * DR3 - SF9BW125
-         * DR4 - SF8BW125
-         * DR5 - SF7BW125
-         * DR6 - SF8BW500
+         * DR0 - SF10BW125
+         * DR1 - SF9BW125
+         * DR2 - SF8BW125
+         * DR3 - SF7BW125
+         * DR4 - SF8BW500
          *
          * @returns spreading factor and bandwidth
          */
         std::string getDataRateDetails(uint8_t rate);
+        MBED_DEPRECATED("Will be removed in 3.3.0")
+        std::string getDateRateDetails(uint8_t rate);
+
 
         /**
          * Set TX power output of radio before antenna gain, default: 14 dBm
@@ -1242,28 +1234,26 @@
         /**
          * Set the ADR ACK Limit
          * @param limit - ADR ACK limit
-         * @returns MDOT_OK if success
          */
-        int32_t setAdrAckLimit(uint8_t limit);
+        void setAdrAckLimit(uint16_t limit);
 
         /**
          * Get the ADR ACK Limit
          * @returns ADR ACK limit
          */
-        uint8_t getAdrAckLimit();
+        uint16_t getAdrAckLimit();
 
         /**
          * Set the ADR ACK Delay
          * @param delay - ADR ACK delay
-         * @returns MDOT_OK if success
          */
-        int32_t setAdrAckDelay(uint8_t delay);
+        void setAdrAckDelay(uint16_t delay);
 
         /**
          * Get the ADR ACK Delay
          * @returns ADR ACK delay
          */
-        uint8_t getAdrAckDelay();
+        uint16_t getAdrAckDelay();
 
         /**
          * Enable/disable CRC checking of packets
@@ -1554,8 +1544,6 @@
         // Return total size of all files saved in FLASH
         // Does not include SPIFFS overhead
         uint32_t getUsedSpace();
-
-        bool repairFlashFileSystem();
 #else
         ///////////////////////////////////////////////////////////////
         // EEPROM (Non Volatile Memory) Operation Functions for xDot //
@@ -1713,8 +1701,6 @@
         int32_t setDeviceId(const std::vector<uint8_t>& id);
         int32_t setProtectedAppEUI(const std::vector<uint8_t>& appEUI);
         int32_t setProtectedAppKey(const std::vector<uint8_t>& appKey);
-        std::vector<uint8_t> getProtectedAppEUI();
-        std::vector<uint8_t> getProtectedAppKey();
         int32_t setDefaultFrequencyBand(const uint8_t& band);
         bool saveProtectedConfig();
         // resets the radio/mac/link
@@ -1747,7 +1733,7 @@
 
         mdot_stats _stats;
 
-        Callback<void()> _wakeup_callback;
+        FunctionPointer _wakeup_callback;
 
         bool _standbyFlag;
         bool _testMode;