# RadioLib: LoRaWANNode Class Reference

LoRaWANNode Class Reference

LoRaWAN-compatible node (class A device). More...

`#include <LoRaWAN.h>`

## Public Member Functions

| LoRaWANNode (PhysicalLayer *phy, const LoRaWANBand_t *band)
| Default constructor. More...
void | wipe ()
| Wipe internal persistent parameters. This will reset all counters and saved variables, so the device will have to rejoin the network.
int16_t | begin ()
| Join network by loading information from persistent storage. More...
int16_t | beginOTAA (uint64_t appEUI, uint64_t devEUI, uint8_t *nwkKey, uint8_t *appKey, bool force=false)
| Join network by performing over-the-air activation. By this procedure, the device will perform an exchange with the network server and set all necessary configuration. More...
int16_t | beginAPB (uint32_t addr, uint8_t net, uint8_t *nwkSKey, uint8_t *appSKey)
| Join network by performing activation by personalization. In this procedure, all necessary configuration must be provided by the user. More...
int16_t | uplink (const char *str, uint8_t port)
| Send a message to the server. More...
int16_t | uplink (uint8_t *data, size_t len, uint8_t port)
| Send a message to the server. More...
int16_t | configureChannel (uint8_t chan, uint8_t dr)
| Configure the radio to a given channel frequency and data rate. More...

## Detailed Description

LoRaWAN-compatible node (class A device).

## Constructor & Destructor Documentation

## LoRaWANNode()

LoRaWANNode::LoRaWANNode | ( | PhysicalLayer * | phy,
|  | const LoRaWANBand_t * | band
| ) |  |

Default constructor.

Parameters

  phy | Pointer to the PhysicalLayer radio module.
  band | Pointer to the LoRaWAN band to use.

## Member Function Documentation

## begin()

int16_t LoRaWANNode::begin | ( |  | ) |

Join network by loading information from persistent storage.

Returns
  Status Codes

## beginAPB()

int16_t LoRaWANNode::beginAPB | ( | uint32_t | addr,
|  | uint8_t | net,
|  | uint8_t * | nwkSKey,
|  | uint8_t * | appSKey
| ) |  |

Join network by performing activation by personalization. In this procedure, all necessary configuration must be provided by the user.

Parameters

  addr | Device address.
  net | Network ID.
  nwkSKey | Pointer to the network session AES-128 key.
  appSKey | Pointer to the application session AES-128 key.

Returns
  Status Codes

## beginOTAA()

int16_t LoRaWANNode::beginOTAA | ( | uint64_t | appEUI,
|  | uint64_t | devEUI,
|  | uint8_t * | nwkKey,
|  | uint8_t * | appKey,
|  | bool | force = `false`
| ) |  |

Join network by performing over-the-air activation. By this procedure, the device will perform an exchange with the network server and set all necessary configuration.

Parameters

  appEUI | 8-byte application identifier.
  devEUI | 8-byte device identifier.
  nwkKey | Pointer to the network AES-128 key.
  appKey | Pointer to the application AES-128 key.
  force | Set to true to force joining even if previously joined.

Returns
  Status Codes

## configureChannel()

int16_t LoRaWANNode::configureChannel | ( | uint8_t | chan,
|  | uint8_t | dr
| ) |  |

Configure the radio to a given channel frequency and data rate.

Parameters

  chan | Channel ID to set.
  dr | Data rate to set, DR0 - DR15.

Returns
  Status Codes

## uplink() [1/2]

int16_t LoRaWANNode::uplink | ( | const char * | str,
|  | uint8_t | port
| ) |  |

Send a message to the server.

Parameters

  str | C-string that will be transmitted.
  port | Port number to send the message to.

Returns
  Status Codes

## uplink() [2/2]

int16_t LoRaWANNode::uplink | ( | uint8_t * | data,
|  | size_t | len,
|  | uint8_t | port
| ) |  |

Send a message to the server.

Parameters

  data | Data to send.
  len | Length of the data.
  port | Port number to send the message to.

Returns
  Status Codes

The documentation for this class was generated from the following files:

- src/protocols/LoRaWAN/LoRaWAN.h
- src/protocols/LoRaWAN/LoRaWAN.cpp