Connecting to gateway and sending packets with a MultiTech mDot.

Dependencies:   libmDot mbed-rtos mbed

Fork of libmDot_sample by MultiTech

Revision:
5:e9d78a9bafc5
Parent:
4:36e214ebfa56
Child:
6:f0b6fea36e28
--- a/main.cpp	Wed Sep 30 19:49:02 2015 +0000
+++ b/main.cpp	Mon Apr 04 18:44:38 2016 +0000
@@ -7,9 +7,9 @@
 
 // these options must match the settings on your Conduit
 // uncomment the following lines and edit their values to match your configuration
-//static std::string config_network_name = "<lora network id>";
-//static std::string config_network_pass = "<lora network key>";
-//static uint8_t config_frequency_sub_band = 1;
+static std::string config_network_name = "<lora network id>";
+static std::string config_network_pass = "<lora network key>";
+static uint8_t config_frequency_sub_band = 1;
 
 int main() {
     int32_t ret;
@@ -37,7 +37,12 @@
     // frequency sub band is only applicable in the 915 (US) frequency band
     // if using a MultiTech Conduit gateway, use the same sub band as your Conduit (1-8) - the mDot will use the 8 channels in that sub band
     // if using a gateway that supports all 64 channels, use sub band 0 - the mDot will use all 64 channels
-    logInfo("setting frequency sub band");
+    
+    if ((ret = dot->setPublicNetwork(true)) != mDot::MDOT_OK) {
+        logError("failed to set public network %d:%s", ret, mDot::getReturnCodeString(ret).c_str());
+    }
+
+    logInfo("setting frequency sub band");    
     if ((ret = dot->setFrequencySubBand(config_frequency_sub_band)) != mDot::MDOT_OK) {
         logError("failed to set frequency sub band %d:%s", ret, mDot::getReturnCodeString(ret).c_str());
     }