![]() |
RUI3 (RAK Unified Interface 3) - RAK4631
|
Public Member Functions | |
bool | get (uint8_t *buf, uint32_t len) |
bool | set (uint8_t *buf, uint32_t len) |
bool get | ( | uint8_t * | buf, |
uint32_t | len | ||
) |
buf | the buffer to get network session key |
len | the length of network session key(must be 16 bytes) |
TRUE | for getting network session key successfully |
FALSE | for getting network session key failure |
// ABP Network Session Key uint8_t node_nwk_skey[16] = {0xD6, 0x03, 0x37, 0xAC, 0x97, 0x4C, 0x43, 0x2F, 0xF3, 0x7A, 0xF9, 0xA7, 0x9B, 0xE8, 0x50, 0xF7}; void setup() { Serial.begin(115200); api.lorawan.njm.set(RAK_LORA_ABP); // Set LoRaWan join mode to ABP if(api.lorawan.nwkskey.set(node_nwk_skey, 16) == true) Serial.println("LoRaWan network session key set success"); else Serial.println("LoRaWan network session key set fail"); } void loop() { uint8_t buff[16]; if(api.lorawan.nwkskey.get(buff, 16) == true) { Serial.print("LoRaWan network session key = 0x"); for(int i = 0; i < 16; i++) { Serial.printf("%02X", buff[i]); } Serial.println(""); } else { Serial.println("LoRaWan network session key get fail"); } delay(1000); }
bool set | ( | uint8_t * | buf, |
uint32_t | len | ||
) |
buf | the buffer to set network session key |
len | the length of network session key(must be 16 bytes) |
TRUE | for setting network session key successfully |
FALSE | for setting network session key failure |
// ABP Network Session Key uint8_t node_nwk_skey[16] = {0xD6, 0x03, 0x37, 0xAC, 0x97, 0x4C, 0x43, 0x2F, 0xF3, 0x7A, 0xF9, 0xA7, 0x9B, 0xE8, 0x50, 0xF7}; void setup() { Serial.begin(115200); api.lorawan.njm.set(RAK_LORA_ABP); // Set LoRaWan join mode to ABP if(api.lorawan.nwkskey.set(node_nwk_skey, 16) == true) Serial.println("LoRaWan network session key set success"); else Serial.println("LoRaWan network session key set fail"); } void loop() { uint8_t buff[16]; if(api.lorawan.nwkskey.get(buff, 16) == true) { Serial.print("LoRaWan network session key = 0x"); for(int i = 0; i < 16; i++) { Serial.printf("%02X", buff[i]); } Serial.println(""); } else { Serial.println("LoRaWan network session key get fail"); } delay(1000); }