Quick and dirty hack to get APPEUI etc. from a config file.
This commit is contained in:
parent
f7af8cd4b0
commit
19f2d650be
@ -1,3 +1,3 @@
|
||||
APPEUI = 4523000000000101
|
||||
DEVEUI = 70B3D57ED005538D
|
||||
APPEUI = 0101000000002345
|
||||
DEVEUI = 8D5305D07ED5B370
|
||||
DEVKEY = 4499B4D3DB0207E3D61A066ECB26FCA2
|
||||
|
28
main.cpp
28
main.cpp
@ -37,13 +37,13 @@ const auto TIMEOUT = std::chrono::seconds(1);
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
// application router ID (LSBF)
|
||||
static const u1_t APPEUI[8] = {0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x23, 0x45};
|
||||
static u1_t APPEUI[8];
|
||||
|
||||
// unique device ID (LSBF)
|
||||
static const u1_t DEVEUI[8] = {0x8D, 0x53, 0x05, 0xD0, 0x7E, 0xD5, 0xB3, 0x70};
|
||||
static u1_t DEVEUI[8];
|
||||
|
||||
// device-specific AES key (derived from device EUI)
|
||||
static const u1_t DEVKEY[16] = {0x44, 0x99, 0xB4, 0xD3, 0xDB, 0x02, 0x07, 0xE3, 0xD6, 0x1A, 0x06, 0x6E, 0xCB, 0x26, 0xFC, 0xA2};
|
||||
static u1_t DEVKEY[16];
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// LMIC APPLICATION CALLBACKS
|
||||
@ -358,6 +358,11 @@ int main(int argc, char *argv[])
|
||||
std::printf("%#02x", variable_map["DEVEUI"].as<deveui>().device_eui64.e8[i] );
|
||||
}
|
||||
std::cout << std::endl;
|
||||
std::memcpy(DEVEUI, variable_map["DEVEUI"].as<deveui>().device_eui64.e8, 8);
|
||||
|
||||
}else{
|
||||
std::cout << "No DEVEUI found in the config file. Add a 8 bytes long EUI to config file or specify an EUI as an option via the command line." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -368,6 +373,23 @@ int main(int argc, char *argv[])
|
||||
std::printf("%#02x", variable_map["APPEUI"].as<appeui>().application_eui64.e8[i] );
|
||||
}
|
||||
std::cout << std::endl;
|
||||
std::memcpy(APPEUI, variable_map["APPEUI"].as<appeui>().application_eui64.e8, 8);
|
||||
}else{
|
||||
std::cout << "No APPEUI found in the config file. Add a 8 bytes long EUI to config file or specify an EUI as an option via the command line." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (variable_map.count("DEVKEY"))
|
||||
{
|
||||
std::cout << "DEVKEY: " << std::endl;
|
||||
for( int i = 0; i < 16; i++ ){
|
||||
std::printf("%#02x", variable_map["DEVKEY"].as<devkey>().device_key[i] );
|
||||
}
|
||||
std::cout << std::endl;
|
||||
std::memcpy(DEVKEY, variable_map["DEVKEY"].as<devkey>().device_key, 16);
|
||||
}else{
|
||||
std::cout << "No DEVKEY found in the config file. Add a 16 bytes long key to config file or specify a key as an option via the command line." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user