Minor maintenance updates

Files at this revision

API Documentation at this revision

Comitter:
cgoyette
Date:
Wed Sep 20 14:12:54 2017 +0000
Parent:
0:469d03d84986
Commit message:
updated library to match multitechs latest

Changed in this revision

dot_util.cpp Show annotated file Show diff for this revision Revisions of this file
dot_util.h Show annotated file Show diff for this revision Revisions of this file
--- a/dot_util.cpp	Mon Jul 24 11:30:40 2017 +0000
+++ b/dot_util.cpp	Wed Sep 20 14:12:54 2017 +0000
@@ -19,8 +19,9 @@
     logInfo("=====================");
     logInfo("version ------------------ %s", dot->getId().c_str());
     logInfo("device ID/EUI ------------ %s", mts::Text::bin2hexString(dot->getDeviceId()).c_str());
-    logInfo("frequency band ----------- %s", mDot::FrequencyBandStr(dot->getFrequencyBand()).c_str());
-    if (dot->getFrequencySubBand() != mDot::FB_EU868) {
+    logInfo("default channel plan ----- %s", mDot::FrequencyBandStr(dot->getDefaultFrequencyBand()).c_str());
+    logInfo("current channel plan ----- %s", mDot::FrequencyBandStr(dot->getFrequencyBand()).c_str());
+    if (lora::ChannelPlan::IsPlanFixed(dot->getFrequencyBand())) {
         logInfo("frequency sub band ------- %u", dot->getFrequencySubBand());
     }
     logInfo("public network ----------- %s", dot->getPublicNetwork() ? "on" : "off");
@@ -49,7 +50,12 @@
     }
     logInfo("TX datarate -------------- %s", mDot::DataRateStr(dot->getTxDataRate()).c_str());
     logInfo("TX power ----------------- %lu dBm", dot->getTxPower());
-    logInfo("antena gain ------------- %u dBm", dot->getAntennaGain());
+    logInfo("antenna gain ------------- %u dBm", dot->getAntennaGain());
+    logInfo("LBT ---------------------- %s", dot->getLbtTimeUs() ? "on" : "off");
+    if (dot->getLbtTimeUs()) {
+	logInfo("LBT time ----------------- %lu us", dot->getLbtTimeUs());
+	logInfo("LBT threshold ------------ %d dBm", dot->getLbtThreshold());
+    }
 }
 
 void update_ota_config_name_phrase(std::string network_name, std::string network_passphrase, uint8_t frequency_sub_band, bool public_network, uint8_t ack) {
@@ -73,11 +79,13 @@
         }
     }
     
-    if (current_frequency_sub_band != frequency_sub_band) {
-        logInfo("changing frequency sub band from %u to %u", current_frequency_sub_band, frequency_sub_band);
-        if (dot->setFrequencySubBand(frequency_sub_band) != mDot::MDOT_OK) {
-            logError("failed to set frequency sub band to %u", frequency_sub_band);
-        }
+    if (lora::ChannelPlan::IsPlanFixed(dot->getFrequencyBand())) {
+	if (current_frequency_sub_band != frequency_sub_band) {
+	    logInfo("changing frequency sub band from %u to %u", current_frequency_sub_band, frequency_sub_band);
+	    if (dot->setFrequencySubBand(frequency_sub_band) != mDot::MDOT_OK) {
+		logError("failed to set frequency sub band to %u", frequency_sub_band);
+	    }
+	}
     }
     
     if (current_public_network != public_network) {
@@ -119,11 +127,13 @@
         }
     }
     
-    if (current_frequency_sub_band != frequency_sub_band) {
-        logInfo("changing frequency sub band from %u to %u", current_frequency_sub_band, frequency_sub_band);
-        if (dot->setFrequencySubBand(frequency_sub_band) != mDot::MDOT_OK) {
-            logError("failed to set frequency sub band to %u", frequency_sub_band);
-        }
+    if (lora::ChannelPlan::IsPlanFixed(dot->getFrequencyBand())) {
+	if (current_frequency_sub_band != frequency_sub_band) {
+	    logInfo("changing frequency sub band from %u to %u", current_frequency_sub_band, frequency_sub_band);
+	    if (dot->setFrequencySubBand(frequency_sub_band) != mDot::MDOT_OK) {
+		logError("failed to set frequency sub band to %u", frequency_sub_band);
+	    }
+	}
     }
     
     if (current_public_network != public_network) {
@@ -692,7 +702,7 @@
 }
 
 void send_data(std::vector<uint8_t> data) {
-    uint32_t ret;
+    int32_t ret;
 
     ret = dot->send(data);
     if (ret != mDot::MDOT_OK) {
@@ -701,3 +711,4 @@
         logInfo("successfully sent data to %s", dot->getJoinMode() == mDot::PEER_TO_PEER ? "peer" : "gateway");
     }
 }
+
--- a/dot_util.h	Mon Jul 24 11:30:40 2017 +0000
+++ b/dot_util.h	Wed Sep 20 14:12:54 2017 +0000
@@ -3,6 +3,7 @@
 
 #include "mbed.h"
 #include "mDot.h"
+#include "ChannelPlans.h"
 #include "MTSLog.h"
 #include "MTSText.h"