Start project of The Things Network workshop with the MultiTech mDot
Dependencies: libmDot mbed-rtos mbed
Fork of mDot_LoRa_Connect_Example_APP_EUI_KEY by
Revision 5:6b988a804fcb, committed 2016-03-29
- Comitter:
- jreiss
- Date:
- Tue Mar 29 13:41:12 2016 +0000
- Parent:
- 4:36e214ebfa56
- Child:
- 6:ac306e26e4cc
- Commit message:
- Modified mDot connect example for ABPA join
Changed in this revision
--- a/main.cpp Wed Sep 30 19:49:02 2015 +0000
+++ b/main.cpp Tue Mar 29 13:41:12 2016 +0000
@@ -7,9 +7,10 @@
// 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 uint8_t config_network_addr[] = { 0x01, 0x02, 0x03, 0x04 };
+static uint8_t config_network_nskey[] = { 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04 };
+static uint8_t config_network_dskey[] = { 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04 };
+static uint8_t config_frequency_sub_band = 1;
int main() {
int32_t ret;
@@ -42,13 +43,34 @@
logError("failed to set frequency sub band %d:%s", ret, mDot::getReturnCodeString(ret).c_str());
}
- logInfo("setting network name");
- if ((ret = dot->setNetworkName(config_network_name)) != mDot::MDOT_OK) {
+ std::vector<uint8_t> temp;
+
+ for (int i = 0; i < 4; i++) {
+ temp.push_back(config_network_addr[i]);
+ }
+
+ logInfo("setting network addr");
+ if ((ret = dot->setNetworkAddress(temp)) != mDot::MDOT_OK) {
logError("failed to set network name %d:%s", ret, mDot::getReturnCodeString(ret).c_str());
}
+ temp.clear();
+ for (int i = 0; i < 16; i++) {
+ temp.push_back(config_network_nskey[i]);
+ }
+
logInfo("setting network password");
- if ((ret = dot->setNetworkPassphrase(config_network_pass)) != mDot::MDOT_OK) {
+ if ((ret = dot->setNetworkSessionKey(temp)) != mDot::MDOT_OK) {
+ logError("failed to set network password %d:%s", ret, mDot::getReturnCodeString(ret).c_str());
+ }
+
+ temp.clear();
+ for (int i = 0; i < 16; i++) {
+ temp.push_back(config_network_dskey[i]);
+ }
+
+ logInfo("setting network password");
+ if ((ret = dot->setDataSessionKey(temp)) != mDot::MDOT_OK) {
logError("failed to set network password %d:%s", ret, mDot::getReturnCodeString(ret).c_str());
}
--- a/mbed-rtos.lib Wed Sep 30 19:49:02 2015 +0000 +++ b/mbed-rtos.lib Tue Mar 29 13:41:12 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/#d7bd06319118 +http://mbed.org/users/mbed_official/code/mbed-rtos/#bdd541595fc5
--- a/mbed.bld Wed Sep 30 19:49:02 2015 +0000 +++ b/mbed.bld Tue Mar 29 13:41:12 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/4f6c30876dfa \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/c0f6e94411f5 \ No newline at end of file
The Things Network
