printKey() moved
This commit is contained in:
parent
c322eb5a83
commit
952ebe77f9
@ -107,18 +107,6 @@ void get_hard_deveui(uint8_t *pdeveui) {
|
||||
|
||||
#ifdef VERBOSE
|
||||
|
||||
// Display a key
|
||||
void printKey(const char *name, const uint8_t *key, uint8_t len, bool lsb) {
|
||||
const uint8_t *p;
|
||||
char keystring[len + 1] = "", keybyte[3];
|
||||
for (uint8_t i = 0; i < len; i++) {
|
||||
p = lsb ? key + len - i - 1 : key + i;
|
||||
sprintf(keybyte, "%02X", *p);
|
||||
strncat(keystring, keybyte, 2);
|
||||
}
|
||||
ESP_LOGI(TAG, "%s: %s", name, keystring);
|
||||
}
|
||||
|
||||
// Display OTAA keys
|
||||
void printKeys(void) {
|
||||
// LMIC may not have used callback to fill
|
||||
|
@ -14,7 +14,6 @@ void os_getDevKey(u1_t *buf);
|
||||
void os_getArtEui(u1_t *buf);
|
||||
void os_getDevEui(u1_t *buf);
|
||||
void printKeys(void);
|
||||
void printKey(const char *name, const uint8_t *key, uint8_t len, bool lsb);
|
||||
void lorawan_loop(void *pvParameters);
|
||||
|
||||
#endif
|
@ -24,6 +24,18 @@ int8_t isBeacon(uint64_t mac) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Display a key
|
||||
void printKey(const char *name, const uint8_t *key, uint8_t len, bool lsb) {
|
||||
const uint8_t *p;
|
||||
char keystring[len + 1] = "", keybyte[3];
|
||||
for (uint8_t i = 0; i < len; i++) {
|
||||
p = lsb ? key + len - i - 1 : key + i;
|
||||
sprintf(keybyte, "%02X", *p);
|
||||
strncat(keystring, keybyte, 2);
|
||||
}
|
||||
ESP_LOGI(TAG, "%s: %s", name, keystring);
|
||||
}
|
||||
|
||||
uint64_t macConvert(uint8_t *paddr) {
|
||||
return ((uint64_t)paddr[0]) | ((uint64_t)paddr[1] << 8) |
|
||||
((uint64_t)paddr[2] << 16) | ((uint64_t)paddr[3] << 24) |
|
||||
|
@ -15,5 +15,6 @@
|
||||
uint16_t reset_salt(void);
|
||||
uint64_t macConvert(uint8_t *paddr);
|
||||
bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type);
|
||||
void printKey(const char *name, const uint8_t *key, uint8_t len, bool lsb);
|
||||
|
||||
#endif
|
@ -183,7 +183,7 @@ void set_beacon(uint8_t val[]) {
|
||||
memmove(val, val + 1, 6); // strip off storage id
|
||||
beacons[id] = macConvert(val); // store beacon MAC in array
|
||||
ESP_LOGI(TAG, "Remote command: set beacon ID#%d", id);
|
||||
//printKey("MAC", val, 6, false); // show beacon MAC
|
||||
printKey("MAC", val, 6, false); // show beacon MAC
|
||||
};
|
||||
|
||||
void set_monitor(uint8_t val[]) {
|
||||
|
Loading…
Reference in New Issue
Block a user