APPEUI handling changed (issue #5)

This commit is contained in:
Klaus K Wilting 2018-03-21 22:50:49 +01:00
parent 86c2bfd98e
commit 701e8192f8
2 changed files with 6 additions and 6 deletions

View File

@ -10,13 +10,10 @@
/* /*
// Only define DEVEUI here if you don't want it to be derived from device's MAC address // Only define DEVEUI here if you don't want it to be derived from device's MAC address
// Use same format as in TTN console (cut & paste, for your convenience) // Note: Use same format as in TTN console (cut & paste, for your convenience)
// static const u1_t DEVEUI[8]={ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; // static const u1_t DEVEUI[8]={ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
// This EUI must be in little-endian format, so least-significant-byte // Note: Use msb format for APPEUI as in TTN console (cut & paste, for your convenience)
// first. When copying an EUI from ttnctl output, this means to reverse
// the bytes. For TTN issued EUIs the last bytes should be 0xD5, 0xB3,
// 0x70.
static const u1_t APPEUI[8]={ 0x00, 0x00, 0x00, 0x00, 0x00, 0xD5, 0xB3, 0x70 }; static const u1_t APPEUI[8]={ 0x00, 0x00, 0x00, 0x00, 0x00, 0xD5, 0xB3, 0x70 };
// This key should be in big endian format (or, since it is not really a // This key should be in big endian format (or, since it is not really a

View File

@ -82,8 +82,11 @@ void RevBytes(unsigned char* b, size_t c);
#endif // VERBOSE #endif // VERBOSE
// LMIC callback functions // LMIC callback functions
void os_getArtEui (u1_t *buf) { memcpy(buf, APPEUI, 8);}
void os_getDevKey (u1_t *buf) { memcpy(buf, APPKEY, 16);} void os_getDevKey (u1_t *buf) { memcpy(buf, APPKEY, 16);}
void os_getArtEui (u1_t *buf) {
memcpy(buf, APPEUI, 8);
RevBytes(buf, 8); // TTN requires it in LSB First order, so we swap bytes
}
void os_getDevEui (u1_t* buf) { void os_getDevEui (u1_t* buf) {
#ifdef DEVEUI #ifdef DEVEUI
memcpy(buf, DEVEUI, 8); memcpy(buf, DEVEUI, 8);