LoRaMAC  4.4.6
Documentation of the API
LoRaMacCommands.h File Reference

LoRa MAC commands. More...

#include <stdint.h>
#include <stddef.h>
#include "LoRaMacTypes.h"

Go to the source code of this file.

Data Structures

struct  MacCommand_t
 
#define LORAMAC_COMMADS_MAX_NUM_OF_PARAMS   2
 
enum  LoRaMacCommandStatus_t {
  LORAMAC_COMMANDS_SUCCESS = 0, LORAMAC_COMMANDS_ERROR_NPE, LORAMAC_COMMANDS_ERROR_MEMORY, LORAMAC_COMMANDS_ERROR_CMD_NOT_FOUND,
  LORAMAC_COMMANDS_ERROR_UNKNOWN_CMD, LORAMAC_COMMANDS_ERROR
}
 
typedef void(* LoRaMacCommandsNvmEvent) (void)
 
LoRaMacCommandStatus_t LoRaMacCommandsInit (void)
 Initialization of LoRaMac MAC commands module. More...
 
LoRaMacCommandStatus_t LoRaMacCommandsAddCmd (uint8_t cid, uint8_t *payload, size_t payloadSize)
 Adds a new MAC command to be sent. More...
 
LoRaMacCommandStatus_t LoRaMacCommandsRemoveCmd (MacCommand_t *macCmd)
 Remove a MAC command. More...
 
LoRaMacCommandStatus_t LoRaMacCommandsGetCmd (uint8_t cid, MacCommand_t **macCmd)
 Get the MAC command with corresponding CID. More...
 
LoRaMacCommandStatus_t LoRaMacCommandsRemoveNoneStickyCmds (void)
 Remove all none sticky MAC commands. More...
 
LoRaMacCommandStatus_t LoRaMacCommandsRemoveStickyAnsCmds (void)
 Remove all sticky answer MAC commands. More...
 
LoRaMacCommandStatus_t LoRaMacCommandsGetSizeSerializedCmds (size_t *size)
 Get size of all MAC commands serialized as buffer. More...
 
LoRaMacCommandStatus_t LoRaMacCommandsSerializeCmds (size_t availableSize, size_t *effectiveSize, uint8_t *buffer)
 Get as many as possible MAC commands serialized. More...
 
LoRaMacCommandStatus_t LoRaMacCommandsStickyCmdsPending (bool *cmdsPending)
 Determines if there are sticky MAC commands pending. More...
 
uint8_t LoRaMacCommandsGetCmdSize (uint8_t cid)
 Get the MAC command size with corresponding CID. More...
 

Detailed Description

LoRa MAC commands.

______ _
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2013 Semtech
___ _____ _ ___ _ _____ ___ ___ ___ ___
/ __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __|
\__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _|
|___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
embedded.connectivity.solutions===============
Author
Miguel Luis ( Semtech )
Daniel Jaeckle ( STACKFORCE )
Johannes Bruder ( STACKFORCE )

addtogroup LORAMAC


Data Structure Documentation

◆ sMacCommand

struct sMacCommand

LoRaWAN MAC Command element

Data Fields
MacCommand_t * Next

The pointer to the next MAC Command element in the list

uint8_t CID

MAC command identifier

uint8_t Payload[LORAMAC_COMMADS_MAX_NUM_OF_PARAMS]

MAC command payload

size_t PayloadSize

Size of MAC command payload

bool IsSticky

Indicates if it's a sticky MAC command

Typedef Documentation

◆ LoRaMacCommandsNvmEvent

typedef void( * LoRaMacCommandsNvmEvent) (void)

Signature of callback function to be called by this module when the non-volatile needs to be saved.

Enumeration Type Documentation

◆ LoRaMacCommandStatus_t

LoRaMac Commands Status

Enumerator
LORAMAC_COMMANDS_SUCCESS 

No error occurred

LORAMAC_COMMANDS_ERROR_NPE 

Null pointer exception

LORAMAC_COMMANDS_ERROR_MEMORY 

There is no memory left to add a further MAC command

LORAMAC_COMMANDS_ERROR_CMD_NOT_FOUND 

MAC command not found.

LORAMAC_COMMANDS_ERROR_UNKNOWN_CMD 

Unknown or corrupted command error occurred.

LORAMAC_COMMANDS_ERROR 

Undefined Error occurred

Function Documentation

◆ LoRaMacCommandsInit()

LoRaMacCommandStatus_t LoRaMacCommandsInit ( void  )

Initialization of LoRaMac MAC commands module.

Return values
-Status of the operation

◆ LoRaMacCommandsAddCmd()

LoRaMacCommandStatus_t LoRaMacCommandsAddCmd ( uint8_t  cid,
uint8_t *  payload,
size_t  payloadSize 
)

Adds a new MAC command to be sent.

Parameters
[IN]cid - MAC command identifier
[IN]payload - MAC command payload containing parameters
[IN]payloadSize - Size of MAC command payload
Return values
-Status of the operation

◆ LoRaMacCommandsRemoveCmd()

LoRaMacCommandStatus_t LoRaMacCommandsRemoveCmd ( MacCommand_t *  macCmd)

Remove a MAC command.

Parameters
[OUT]cmd - MAC command
Return values
-Status of the operation

◆ LoRaMacCommandsGetCmd()

LoRaMacCommandStatus_t LoRaMacCommandsGetCmd ( uint8_t  cid,
MacCommand_t **  macCmd 
)

Get the MAC command with corresponding CID.

Parameters
[IN]cid - MAC command identifier
[OUT]cmd - MAC command
Return values
-Status of the operation

◆ LoRaMacCommandsRemoveNoneStickyCmds()

LoRaMacCommandStatus_t LoRaMacCommandsRemoveNoneStickyCmds ( void  )

Remove all none sticky MAC commands.

Return values
-Status of the operation

◆ LoRaMacCommandsRemoveStickyAnsCmds()

LoRaMacCommandStatus_t LoRaMacCommandsRemoveStickyAnsCmds ( void  )

Remove all sticky answer MAC commands.

Return values
-Status of the operation

◆ LoRaMacCommandsGetSizeSerializedCmds()

LoRaMacCommandStatus_t LoRaMacCommandsGetSizeSerializedCmds ( size_t *  size)

Get size of all MAC commands serialized as buffer.

Parameters
[out]size- Available size of memory for MAC commands
Return values
-Status of the operation

◆ LoRaMacCommandsSerializeCmds()

LoRaMacCommandStatus_t LoRaMacCommandsSerializeCmds ( size_t  availableSize,
size_t *  effectiveSize,
uint8_t *  buffer 
)

Get as many as possible MAC commands serialized.

Parameters
[IN]availableSize - Available size of memory for MAC commands
[out]effectiveSize- Size of memory which was effectively used for serializing.
[out]buffer- Destination data buffer
Return values
-Status of the operation

◆ LoRaMacCommandsStickyCmdsPending()

LoRaMacCommandStatus_t LoRaMacCommandsStickyCmdsPending ( bool *  cmdsPending)

Determines if there are sticky MAC commands pending.

Parameters
[IN]cmdsPending - Indicates if there are sticky MAC commands in the queue.
Return values
-Status of the operation

◆ LoRaMacCommandsGetCmdSize()

uint8_t LoRaMacCommandsGetCmdSize ( uint8_t  cid)

Get the MAC command size with corresponding CID.

Parameters
[IN]cid - MAC command identifier
Return values
Sizeof the command.