fp

Dependencies:   libmDot-mbed5 ISL29011

Revision:
30:2f5ae37e6c47
Parent:
29:9e2c0d990ace
Child:
31:b1d5811e3d5d
--- a/examples/src/dot_util.cpp	Fri Apr 20 14:42:46 2018 -0500
+++ b/examples/src/dot_util.cpp	Mon Apr 30 14:46:28 2018 -0500
@@ -24,7 +24,7 @@
     if (lora::ChannelPlan::IsPlanFixed(dot->getFrequencyBand())) {
         logInfo("frequency sub band ------- %u", dot->getFrequencySubBand());
     }
-   
+    logInfo("public network ----------- %s", dot->getPublicNetwork() ? "on" : "off");   
     logInfo("=========================");
     logInfo("credentials configuration");
     logInfo("=========================");
@@ -58,11 +58,11 @@
     }
 }
 
-void update_ota_config_name_phrase(std::string network_name, std::string network_passphrase, uint8_t frequency_sub_band, uint8_t ack) {
+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) {
     std::string current_network_name = dot->getNetworkName();
     std::string current_network_passphrase = dot->getNetworkPassphrase();
     uint8_t current_frequency_sub_band = dot->getFrequencySubBand();
-    uint8_t current_network_type = dot->getPublicNetwork();
+    bool current_public_network = dot->getPublicNetwork();
     uint8_t current_ack = dot->getAck();
     
     if (current_network_name != network_name) {
@@ -87,7 +87,14 @@
 	    }
 	}
     }
-       
+
+    if (current_public_network != public_network) {
+        logInfo("changing public network from %s to %s", current_public_network ? "on" : "off", public_network ? "on" : "off");
+        if (dot->setPublicNetwork(public_network) != mDot::MDOT_OK) {
+            logError("failed to set public network to %s", public_network ? "on" : "off");
+        }
+    }
+
     if (current_ack != ack) {
         logInfo("changing acks from %u to %u", current_ack, ack);
         if (dot->setAck(ack) != mDot::MDOT_OK) {