From 80bff1be2773cf7d97750a1518618b823bb6711c Mon Sep 17 00:00:00 2001 From: Aaron Covrig Date: Mon, 15 Jun 2020 12:36:59 -0400 Subject: [PATCH] Changed return states, modified comments 1. Returned values now track the LMIC library 2. Adjusted comments for new return values, added notes on return behavior (returns are driven by the rising/falling logic edge) --- include/TheThingsNetwork.h | 16 +++++++++++----- src/TheThingsNetwork.cpp | 10 +++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/include/TheThingsNetwork.h b/include/TheThingsNetwork.h index 0115a4a..0394076 100644 --- a/include/TheThingsNetwork.h +++ b/include/TheThingsNetwork.h @@ -229,11 +229,14 @@ public: /** * @brief Disables a channel via the underlying LMIC library. * - * This will fail to build if this component has not been configured + *.Note that it's return value is triggered via the *CHANGE* in state from + * *ENABLED->DISABLED*. A repeat call will lead to a return value of 'false' + * until the channel has been 'enabled' inbetween. + * This will fail to build if this component has not been configured * (idf.py menuconfig / make menuconfig ) * * @param channel unsigned integer indicating the channel number to disable - * @return true success + * @return true The channel was originally enabled and has now been disabled * @return false otherwise */ bool disableChannel (uint8_t channel); @@ -247,7 +250,7 @@ public: * (idf.py menuconfig / make menuconfig ) * * @param band unsigned integer indicating which block of channels to enable - * @return true success + * @return true success, at least one of the channels in the sub-band has been enabled * @return false otherwise */ bool enableSubBand(uint8_t band); @@ -255,11 +258,14 @@ public: /** * @brief Enables a channel via the underlying LMIC library. * + *.Note that it's return value is triggered via the *CHANGE* in state from + * *DISABLED->ENABLED*. A repeat call will lead to a return value of 'false' + * until the channel has been 'disabled' inbetween. * This will fail to build if this component has not been configured * (idf.py menuconfig / make menuconfig ) * * @param channel unsigned integer indicating which channel to enable - * @return true success + * @return true The channel was originally disabled and has now been enabled * @return false otherwise */ bool enableChannel(uint8_t channel); @@ -274,7 +280,7 @@ public: * * * @param band unsigned integer indicating which block of channels to disable - * @return true success + * @return true success, at least one of the channels in the sub-band was disabled * @return false otherwise */ bool disableSubBand(uint8_t band); diff --git a/src/TheThingsNetwork.cpp b/src/TheThingsNetwork.cpp index 2537ddf..11e751b 100644 --- a/src/TheThingsNetwork.cpp +++ b/src/TheThingsNetwork.cpp @@ -264,11 +264,11 @@ void TheThingsNetwork::setRSSICal(int8_t rssiCal) ttn_hal.rssiCal = rssiCal; } -bool TheThingsNetwork::disableChannel(uint8_t channel){ return !LMIC_disableChannel( channel ); } -bool TheThingsNetwork::enableSubBand(uint8_t band){ return !LMIC_enableSubBand( band ); } -bool TheThingsNetwork::enableChannel(uint8_t channel){ return !LMIC_enableChannel( channel ); } -bool TheThingsNetwork::disableSubBand(uint8_t band){ return !LMIC_disableSubBand( band ); } -bool TheThingsNetwork::selectSubBand(uint8_t band){ return !LMIC_selectSubBand( band ); } +bool TheThingsNetwork::disableChannel(uint8_t channel){ return LMIC_disableChannel( channel ); } +bool TheThingsNetwork::enableSubBand(uint8_t band){ return LMIC_enableSubBand( band ); } +bool TheThingsNetwork::enableChannel(uint8_t channel){ return LMIC_enableChannel( channel ); } +bool TheThingsNetwork::disableSubBand(uint8_t band){ return LMIC_disableSubBand( band ); } +bool TheThingsNetwork::selectSubBand(uint8_t band){ return LMIC_selectSubBand( band ); } // --- Callbacks ---