The Modified Dot Library for SX1272
This version has been restoring as initial changes.
Verify the following dependencies:
Mbed-os 5.11 libmdot 3.2.0 for Mbed OS5.11
Diff: mDot.h
- Revision:
- 68:5f787643e7d7
- Parent:
- 65:acc0468b9aec
- Child:
- 69:e22889c7eaa9
--- a/mDot.h Wed May 01 09:18:46 2019 -0500 +++ b/mDot.h Thu Aug 29 08:32:27 2019 -0500 @@ -61,21 +61,6 @@ 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&); @@ -97,12 +82,7 @@ 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; @@ -162,7 +142,8 @@ enum RX_Output { HEXADECIMAL, BINARY, - EXTENDED + EXTENDED, + EXTENDED_HEX }; enum DataRates { @@ -368,21 +349,6 @@ 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 @@ -694,6 +660,20 @@ 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) */ @@ -728,19 +708,48 @@ 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 3 MULTICAST_SESSIONS can be set + * Up to 8 MULTICAST_SESSIONS can be set */ - int32_t setMulticastSession(uint8_t index, uint32_t addr, const uint8_t* nsk, const uint8_t* dsk); + 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); /** * Set a multicast session counter - * Up to 3 MULTICAST_SESSIONS can be set + * Up to 8 MULTICAST_SESSIONS */ 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 @@ -1080,18 +1089,17 @@ * * AU915 Datarates * --------------- - * DR0 - SF10BW125 - * DR1 - SF9BW125 - * DR2 - SF8BW125 - * DR3 - SF7BW125 - * DR4 - SF8BW500 + * DR0 - SF12BW125 + * DR1 - SF11BW125 + * DR2 - SF10BW125 + * DR3 - SF9BW125 + * DR4 - SF8BW125 + * DR5 - SF7BW125 + * DR6 - 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 @@ -1234,26 +1242,28 @@ /** * Set the ADR ACK Limit * @param limit - ADR ACK limit + * @returns MDOT_OK if success */ - void setAdrAckLimit(uint16_t limit); + int32_t setAdrAckLimit(uint8_t limit); /** * Get the ADR ACK Limit * @returns ADR ACK limit */ - uint16_t getAdrAckLimit(); + uint8_t getAdrAckLimit(); /** * Set the ADR ACK Delay * @param delay - ADR ACK delay + * @returns MDOT_OK if success */ - void setAdrAckDelay(uint16_t delay); + int32_t setAdrAckDelay(uint8_t delay); /** * Get the ADR ACK Delay * @returns ADR ACK delay */ - uint16_t getAdrAckDelay(); + uint8_t getAdrAckDelay(); /** * Enable/disable CRC checking of packets @@ -1544,6 +1554,8 @@ // 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 // @@ -1701,6 +1713,8 @@ 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 @@ -1733,7 +1747,7 @@ mdot_stats _stats; - FunctionPointer _wakeup_callback; + Callback<void()> _wakeup_callback; bool _standbyFlag; bool _testMode;