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

Public Member Functions

uint8_t get ()
 
bool set (uint8_t value)
 

Detailed Description

Description
This api allows the user to get or set the unicast ping slot periodicity

Member Function Documentation

◆ get()

uint8_t get ( )
Description
This api allows the user to get the unicast ping slot periodicity
Syntax
api.lorawan.pgslot.get()
Returns
the ping slot periodicity
Example
// OTAA Device EUI MSB
uint8_t node_device_eui[8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
// OTAA Application EUI MSB
uint8_t node_app_eui[8] = {0x0E, 0x0D, 0x0D, 0x01, 0x0E, 0x01, 0x02, 0x03};
// 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, 0x3C};

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

    api.lorawan.appeui.set(node_app_eui, 8);
    api.lorawan.appkey.set(node_app_key, 16);
    api.lorawan.deui.set(node_device_eui, 8);

    api.lorawan.band.set(4);
    api.lorawan.njm.set(1);
    api.lorawan.deviceClass.set(1);
    Serial.printf("Set the unicast ping slot periodicity %s\r\n", api.lorawan.pgslot.set(0) ? "Success" : "Fail");
    api.lorawan.join();

    //wait for Join success
    while (api.lorawan.njs.get() == 0)
    {
      Serial.print("Waiting for Lorawan join...");
      api.lorawan.join();
      delay(10000);
    }
}

void loop()
{
    Serial.printf("The unicast ping slot peridicity is %d\r\n", api.lorawan.pgslot.get());
    delay(1000);
}

◆ set()

bool set ( uint8_t  value)
Description
This api allows the user to set the unicast ping slot periodicity
Syntax
api.lorawan.pgslot.set(value)
Parameters
valuethe unicast ping slot periodicity
Returns
bool
Return values
TRUEfor setting ping slot periodicity success
FALSEfor setting ping slot periodicity failure
Example
  // OTAA Device EUI MSB
  uint8_t node_device_eui[8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
  // OTAA Application EUI MSB
  uint8_t node_app_eui[8] = {0x0E, 0x0D, 0x0D, 0x01, 0x0E, 0x01, 0x02, 0x03};
  // 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, 0x3C};

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

      api.lorawan.appeui.set(node_app_eui, 8);
      api.lorawan.appkey.set(node_app_key, 16);
      api.lorawan.deui.set(node_device_eui, 8);

      api.lorawan.band.set(4);
      api.lorawan.njm.set(1);
      api.lorawan.deviceClass.set(1);
      Serial.printf("Set the unicast ping slot periodicity %s\r\n", api.lorawan.pgslot.set(0) ? "Success" : "Fail");
      api.lorawan.join();

      //wait for Join success
      while (api.lorawan.njs.get() == 0)
      {
        Serial.print("Waiting for Lorawan join...");
        api.lorawan.join();
        delay(10000);
      }
  }

  void loop()
  {
      Serial.printf("The unicast ping slot peridicity is %d\r\n", api.lorawan.pgslot.get());
      delay(1000);
  }