RUI3 (RAK Unified Interface 3) - RAK4631
RAKLorawan::deviceClass

Public Member Functions

uint8_t get ()
 
bool set (uint8_t value)
 

Detailed Description

Description
This api allows the user to access the LoRaWAN® class

Member Function Documentation

◆ get()

uint8_t get ( )
Description
This api allows the user to get the LoRaWAN® class
Syntax
api.lorawan.deviceClass.get()
Returns
the LoRaWan class(Type: int)
Return values
0Class A
1Class B
2Class C
Example
void setup()
{
    Serial.begin(115200);

    Serial.printf("Set device class to Class_A  %s\r\n", api.lorawan.deviceClass.set(RAK_LORA_CLASS_A) ? "Success" : "Fail");
}

void loop()
{
    switch(api.lorawan.deviceClass.get()) {
        case 0:
            Serial.println("Device is in Class A");      
            break;
        case 1:
            Serial.println("Device is in Class B");
            break;
        case 2:
            Serial.println("Device is in Class C");
            break;
    }

    delay(1000);
}

◆ set()

bool set ( uint8_t  value)
Description
This api allows the user to set the LoRaWAN® class
Syntax
api.lorawan.deviceClass.set(value)
Parameters
valuethe LoRaWan class
Returns
bool
Return values
TRUEfor setting LoRaWan class success
FALSEfor setting LoRaWan class failure
Example
  void setup()
  {
      Serial.begin(115200);

      Serial.printf("Set device class to Class_A  %s\r\n", api.lorawan.deviceClass.set(RAK_LORA_CLASS_A) ? "Success" : "Fail");
  }

  void loop()
  {
      switch(api.lorawan.deviceClass.get()) {
          case 0:
              Serial.println("Device is in Class A");
              break;
          case 1:
              Serial.println("Device is in Class B");
              break;
          case 2:
              Serial.println("Device is in Class C");
              break;
      }

      delay(1000);
  }