Esta es la prueba con LoRa y el sensor de luz integrado en la placa.

Dependencies:   libxDot-mbed5 ISL29011

Files at this revision

API Documentation at this revision

Comitter:
Evan Hosseini
Date:
Fri Apr 20 14:42:46 2018 -0500
Parent:
28:558b703f621f
Child:
30:2f5ae37e6c47
Commit message:
Back out NetworkMode config so code still builds with stable 3.0 library

Changed in this revision

examples/inc/dot_util.h Show annotated file Show diff for this revision Revisions of this file
examples/src/auto_ota_example.cpp Show annotated file Show diff for this revision Revisions of this file
examples/src/class_c_example.cpp Show annotated file Show diff for this revision Revisions of this file
examples/src/dot_util.cpp Show annotated file Show diff for this revision Revisions of this file
examples/src/manual_example.cpp Show annotated file Show diff for this revision Revisions of this file
examples/src/ota_example.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/examples/inc/dot_util.h	Thu Mar 15 08:31:22 2018 -0500
+++ b/examples/inc/dot_util.h	Fri Apr 20 14:42:46 2018 -0500
@@ -12,7 +12,7 @@
 
 void display_config();
 
-void update_ota_config_name_phrase(std::string network_name, std::string network_passphrase, uint8_t frequency_sub_band, lora::NetworkType network_type, uint8_t ack);
+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_id_key(uint8_t *network_id, uint8_t *network_key, uint8_t frequency_sub_band, bool public_network, uint8_t ack);
 
--- a/examples/src/auto_ota_example.cpp	Thu Mar 15 08:31:22 2018 -0500
+++ b/examples/src/auto_ota_example.cpp	Fri Apr 20 14:42:46 2018 -0500
@@ -27,7 +27,6 @@
 static uint8_t network_id[] = { 0x6C, 0x4E, 0xEF, 0x66, 0xF4, 0x79, 0x86, 0xA6 };
 static uint8_t network_key[] = { 0x1F, 0x33, 0xA1, 0x70, 0xA5, 0xF1, 0xFD, 0xA0, 0xAB, 0x69, 0x7A, 0xAE, 0x2B, 0x95, 0x91, 0x6B };
 static uint8_t frequency_sub_band = 0;
-static lora::NetworkType public_network = lora::PUBLIC_LORAWAN;
 static uint8_t join_delay = 5;
 static uint8_t ack = 0;
 static bool adr = true;
@@ -97,7 +96,7 @@
         // only one method or the other should be used!
         // network ID = crc64(network name)
         // network KEY = cmac(network passphrase)
-        update_ota_config_name_phrase(network_name, network_passphrase, frequency_sub_band, public_network, ack);
+        update_ota_config_name_phrase(network_name, network_passphrase, frequency_sub_band, ack);
         //update_ota_config_id_key(network_id, network_key, frequency_sub_band, public_network, ack);
     
         // configure network link checks
--- a/examples/src/class_c_example.cpp	Thu Mar 15 08:31:22 2018 -0500
+++ b/examples/src/class_c_example.cpp	Fri Apr 20 14:42:46 2018 -0500
@@ -27,7 +27,6 @@
 static uint8_t network_id[] = { 0x6C, 0x4E, 0xEF, 0x66, 0xF4, 0x79, 0x86, 0xA6 };
 static uint8_t network_key[] = { 0x1F, 0x33, 0xA1, 0x70, 0xA5, 0xF1, 0xFD, 0xA0, 0xAB, 0x69, 0x7A, 0xAE, 0x2B, 0x95, 0x91, 0x6B };
 static uint8_t frequency_sub_band = 0;
-static lora::NetworkType public_network = lora::PUBLIC_LORAWAN;
 static uint8_t join_delay = 5;
 static uint8_t ack = 1;
 static bool adr = true;
@@ -89,7 +88,7 @@
     // only one method or the other should be used!
     // network ID = crc64(network name)
     // network KEY = cmac(network passphrase)
-    update_ota_config_name_phrase(network_name, network_passphrase, frequency_sub_band, public_network, ack);
+    update_ota_config_name_phrase(network_name, network_passphrase, frequency_sub_band, ack);
     //update_ota_config_id_key(network_id, network_key, frequency_sub_band, public_network, ack);
 
     // configure the Dot for class C operation
--- a/examples/src/dot_util.cpp	Thu Mar 15 08:31:22 2018 -0500
+++ b/examples/src/dot_util.cpp	Fri Apr 20 14:42:46 2018 -0500
@@ -24,17 +24,7 @@
     if (lora::ChannelPlan::IsPlanFixed(dot->getFrequencyBand())) {
         logInfo("frequency sub band ------- %u", dot->getFrequencySubBand());
     }
-
-    std::string network_mode_str("Undefined");
-    uint8_t network_mode = dot->getPublicNetwork();
-    if (network_mode == lora::PRIVATE_MTS)
-        network_mode_str = "Private MTS";
-    else if (network_mode == lora::PUBLIC_LORAWAN)
-        network_mode_str = "Public LoRaWAN";
-    else if (network_mode == lora::PRIVATE_LORAWAN)
-        network_mode_str = "Private LoRaWAN";
-    logInfo("public network ----------- %s", network_mode_str.c_str());
-    
+   
     logInfo("=========================");
     logInfo("credentials configuration");
     logInfo("=========================");
@@ -68,7 +58,7 @@
     }
 }
 
-void update_ota_config_name_phrase(std::string network_name, std::string network_passphrase, uint8_t frequency_sub_band, lora::NetworkType network_type, uint8_t ack) {
+void update_ota_config_name_phrase(std::string network_name, std::string network_passphrase, uint8_t frequency_sub_band, 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();
@@ -97,14 +87,7 @@
 	    }
 	}
     }
-    
-    if (current_network_type != network_type) {
-        logInfo("changing public network from %d to %d", current_network_type, network_type);
-        if (dot->setPublicNetwork(network_type) != mDot::MDOT_OK) {
-            logError("failed to set public network to %d", network_type);
-        }
-    }
-    
+       
     if (current_ack != ack) {
         logInfo("changing acks from %u to %u", current_ack, ack);
         if (dot->setAck(ack) != mDot::MDOT_OK) {
--- a/examples/src/manual_example.cpp	Thu Mar 15 08:31:22 2018 -0500
+++ b/examples/src/manual_example.cpp	Fri Apr 20 14:42:46 2018 -0500
@@ -24,7 +24,6 @@
 static uint8_t network_session_key[] = { 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04 };
 static uint8_t data_session_key[] = { 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04 };
 static uint8_t frequency_sub_band = 6;
-static lora::NetworkType public_network = lora::PUBLIC_LORAWAN;
 static uint8_t join_delay = 5;
 static uint8_t ack = 1;
 static bool adr = true;
@@ -100,7 +99,7 @@
         //      lora-query -a 01020304 A 0102030401020304 <your Dot's device ID> 01020304010203040102030401020304 01020304010203040102030401020304
         //   * if you change the network address, network session key, or data session key, make sure you update them on the gateway
         // to provision your Dot with a 3rd party gateway, see the gateway or network provider documentation
-        update_manual_config(network_address, network_session_key, data_session_key, frequency_sub_band, public_network, ack);
+        update_manual_config(network_address, network_session_key, data_session_key, frequency_sub_band, ack);
 
         // enable or disable Adaptive Data Rate
         dot->setAdr(adr);
--- a/examples/src/ota_example.cpp	Thu Mar 15 08:31:22 2018 -0500
+++ b/examples/src/ota_example.cpp	Fri Apr 20 14:42:46 2018 -0500
@@ -27,7 +27,6 @@
 static uint8_t network_id[] = { 0x6C, 0x4E, 0xEF, 0x66, 0xF4, 0x79, 0x86, 0xA6 };
 static uint8_t network_key[] = { 0x1F, 0x33, 0xA1, 0x70, 0xA5, 0xF1, 0xFD, 0xA0, 0xAB, 0x69, 0x7A, 0xAE, 0x2B, 0x95, 0x91, 0x6B };
 static uint8_t frequency_sub_band = 0;
-static lora::NetworkType public_network = lora::PUBLIC_LORAWAN;
 static uint8_t join_delay = 5;
 static uint8_t ack = 0;
 static bool adr = true;
@@ -96,7 +95,7 @@
         // only one method or the other should be used!
         // network ID = crc64(network name)
         // network KEY = cmac(network passphrase)
-        update_ota_config_name_phrase(network_name, network_passphrase, frequency_sub_band, public_network, ack);
+        update_ota_config_name_phrase(network_name, network_passphrase, frequency_sub_band, ack);
         //update_ota_config_id_key(network_id, network_key, frequency_sub_band, public_network, ack);
 
         // configure network link checks