![]() |
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 AppSKey |
len | the length of AppSKey(must be 16 bytes) |
TRUE | for getting AppSKey successfully |
FALSE | for getting AppSKey failure |
// ABP Application Session Key uint8_t node_app_skey[16] = {0x25, 0xC4, 0xF1, 0xD1, 0x78, 0xC8, 0x8D, 0x01, 0xA8, 0x80, 0xC2, 0x79, 0xA7, 0x9F, 0x34, 0x3B}; void setup() { Serial.begin(115200); api.lorawan.njm.set(RAK_LORA_ABP); // Set LoRaWan join mode to ABP if(api.lorawan.appskey.set(node_app_skey, 16) == true) Serial.println("LoRaWan AppSKey set success"); else Serial.println("LoRaWan AppSKey set fail"); } void loop() { uint8_t buff[16]; if(api.lorawan.appskey.get(buff, 16) == true) { Serial.print("LoRaWan AppSKey = 0x"); for(int i = 0; i < 16; i++) { Serial.printf("%02X", buff[i]); } Serial.println(""); } else { Serial.println("LoRaWan AppSKey get fail"); } delay(1000); }
bool set | ( | uint8_t * | buf, |
uint32_t | len | ||
) |
buf | The buffer to get AppSKey |
len | the length of AppSkey(must be 16 bytes) |
TRUE | for getting AppSKey successfully |
FALSE | for getting AppSKey failure |
// ABP Application Session Key uint8_t node_app_skey[16] = {0x25, 0xC4, 0xF1, 0xD1, 0x78, 0xC8, 0x8D, 0x01, 0xA8, 0x80, 0xC2, 0x79, 0xA7, 0x9F, 0x34, 0x3B}; void setup() { Serial.begin(115200); api.lorawan.njm.set(RAK_LORA_ABP); // Set LoRaWan join mode to ABP if(api.lorawan.appskey.set(node_app_skey, 16) == true) Serial.println("LoRaWan AppSKey set success"); else Serial.println("LoRaWan AppSKey set fail"); } void loop() { uint8_t buff[16]; if(api.lorawan.appskey.get(buff, 16) == true) { Serial.print("LoRaWan AppSKey = 0x"); for(int i = 0; i < 16; i++) { Serial.printf("%02X", buff[i]); } Serial.println(""); } else { Serial.println("LoRaWan AppSKey get fail"); } delay(1000); }