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)
 

Detailed Description

Description
view or change the LoRAWAN APPEUI and use it to setup the LoRAWAN connection

Member Function Documentation

◆ get()

bool get ( uint8_t *  buf,
uint32_t  len 
)
Description
This api allows the user to get the global application identifier
Syntax
api.lorawan.appeui.get(buf, len)
Parameters
bufthe buffer to get AppEUI
lenthe length of AppEUI(must be 8 bytes)
Returns
bool
Return values
TRUEfor getting AppEUI successfully
FALSEfor getting AppEUI failure
Example
  // OTAA Application EUI MSB
  uint8_t node_app_eui[8] = {0x0E, 0x0D, 0x0D, 0x01, 0x0E, 0x01, 0x02, 0x03};

  void setup()
  {
      Serial.begin(115200);

      api.lorawan.njm.set(RAK_LORA_OTAA); // Set LoRaWan join mode to OTAA

      if(api.lorawan.appeui.set(node_app_eui, 8) == true)
          Serial.println("LoRaWan AppEUI set success");
      else
          Serial.println("LoRaWan AppEUI set fail");
  }

  void loop()
  {
      uint8_t buff[8];

      if(api.lorawan.appeui.get(buff, 8) == true) {
          Serial.print("LoRaWan AppEUI = 0x");
          for(int i = 0; i < 8; i++) {
              Serial.printf("%02X", buff[i]);
          }
          Serial.println("");
      } else {
          Serial.println("LoRaWan APPEUI get fail");
      }

      delay(1000);
  }

◆ set()

bool set ( uint8_t *  buf,
uint32_t  len 
)
Description
This api allows the user to set the global application identifier
Syntax
api.lorawan.appeui.set(buf, len)
Parameters
bufthe buffer to set AppEUI
lenthe length of AppEUI(must be 8 bytes)
Returns
bool
Return values
TRUEfor setting AppEUI successfully
FALSEfor setting AppEUI failure
Example
    // OTAA Application EUI MSB
    uint8_t node_app_eui[8] = {0x0E, 0x0D, 0x0D, 0x01, 0x0E, 0x01, 0x02, 0x03}; 
     
    void setup()
    {
        Serial.begin(115200);
    
        api.lorawan.njm.set(RAK_LORA_OTAA); // Set LoRaWan join mode to OTAA
    
        if(api.lorawan.appeui.set(node_app_eui, 8) == true)
            Serial.println("LoRaWan AppEUI set success");
        else
            Serial.println("LoRaWan AppEUI set fail");
    }
    
    void loop()
    {
        uint8_t buff[8];
    
        if(api.lorawan.appeui.get(buff, 8) == true) {
            Serial.print("LoRaWan AppEUI = 0x");
            for(int i = 0; i < 8; i++) {
                Serial.printf("%02X", buff[i]);
            }
            Serial.println("");
        } else {
            Serial.println("LoRaWan AppEUI get fail");
        }
    
        delay(1000);
    }