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 DEUI 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 end-device ID
Syntax
api.lorawan.deui.get(buf, len)
Parameters
bufthe buffer to get device EUI
lenthe length of device EUI(must be 8 bytes)
Returns
bool
Return values
TRUEfor getting device EUI successfully
FALSEfor getting device EUI failure
Example
  // OTAA Device EUI MSB
  uint8_t node_device_eui[8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};

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

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

      if(api.lorawan.deui.set(node_device_eui, 8) == true)
          Serial.println("LoRaWan device EUI set success");
      else
          Serial.println("LoRaWan device EUI set fail");
  }

  void loop()
  {
      uint8_t buff[8];

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

      delay(1000);
  }

◆ set()

bool set ( uint8_t *  buf,
uint32_t  len 
)
Description
This api allows the user to set the global end-device ID
Syntax
api.lorawan.deui.set(buf, len)
Parameters
bufthe buffer to set device EUI
lenthe length of device EUI(must be 8 bytes)
Returns
bool
Return values
TRUEfor setting device EUI successfully
FALSEfor setting device EUI failure
Example
  // OTAA Device EUI MSB
  uint8_t node_device_eui[8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};

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

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

      if(api.lorawan.deui.set(node_device_eui, 8) == true)
          Serial.println("LoRaWan device EUI set success");
      else
          Serial.println("LoRaWan device EUI set fail");
  }

  void loop()
  {
      uint8_t buff[8];

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

      delay(1000);
  }