![]() |
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 AppKey |
len | the length of AppKey(must be 16 bytes) |
TRUE | for getting AppKey successfully |
FALSE | for getting Appkey failure |
// OTAA Application Key MSB uint8_t node_app_key[16] = {0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3E}; void setup() { Serial.begin(115200); api.lorawan.njm.set(RAK_LORA_OTAA); // Set LoRaWan join mode to OTAA if(api.lorawan.appkey.set(node_app_key, 16) == true) Serial.println("LoRaWan AppKey set success"); else Serial.println("LoRaWan AppKey set fail"); } void loop() { uint8_t buff[16]; if(api.lorawan.appkey.get(buff, 16) == true) { Serial.print("LoRaWan AppKey = 0x"); for(int i = 0; i < 16; i++) { Serial.printf("%02X", buff[i]); } Serial.println(""); } else { Serial.println("LoRaWan AppKey get fail"); } delay(1000); }
bool set | ( | uint8_t * | buf, |
uint32_t | len | ||
) |
buf | the buffer to set AppKey |
len | the length of AppKey(must be 16 bytes) |
TRUE | for setting AppKey successfully |
FALSE | for setting Appkey failure |
// OTAA Application Key MSB uint8_t node_app_key[16] = {0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3E}; void setup() { Serial.begin(115200); api.lorawan.njm.set(RAK_LORA_OTAA); // Set LoRaWan join mode to OTAA if(api.lorawan.appkey.set(node_app_key, 16) == true) Serial.println("LoRaWan AppKey set success"); else Serial.println("LoRaWan AppKey set fail"); } void loop() { uint8_t buff[16]; if(api.lorawan.appkey.get(buff, 16) == true) { Serial.print("LoRaWan AppKey = 0x"); for(int i = 0; i < 16; i++) { Serial.printf("%02X", buff[i]); } Serial.println(""); } else { Serial.println("LoRaWan AppKey get fail"); } delay(1000); }