LoRaMAC  4.6.0
Documentation of the API
LoRaMacCommands.h
Go to the documentation of this file.
1 
35 #ifndef __LORAMAC_COMMANDS_H__
36 #define __LORAMAC_COMMANDS_H__
37 
38 #ifdef __cplusplus
39 extern "C"
40 {
41 #endif
42 
43 #include <stdint.h>
44 #include <stddef.h>
45 #include "LoRaMacTypes.h"
46 
47 
48 /*
49  * Number of MAC Command slots
50  */
51 #define LORAMAC_COMMADS_MAX_NUM_OF_PARAMS 2
52 
56 typedef struct sMacCommand MacCommand_t;
57 
59 {
63  MacCommand_t* Next;
67  uint8_t CID;
71  uint8_t Payload[LORAMAC_COMMADS_MAX_NUM_OF_PARAMS];
75  size_t PayloadSize;
79  bool IsSticky;
80 };
81 
85 typedef enum eLoRaMacCommandsStatus
86 {
112 
117 typedef void ( *LoRaMacCommandsNvmEvent )( void );
118 
125 
135 LoRaMacCommandStatus_t LoRaMacCommandsAddCmd( uint8_t cid, uint8_t* payload, size_t payloadSize );
136 
144 LoRaMacCommandStatus_t LoRaMacCommandsRemoveCmd( MacCommand_t* macCmd );
145 
154 LoRaMacCommandStatus_t LoRaMacCommandsGetCmd( uint8_t cid, MacCommand_t** macCmd );
155 
162 
169 
178 
188 LoRaMacCommandStatus_t LoRaMacCommandsSerializeCmds( size_t availableSize, size_t* effectiveSize, uint8_t* buffer );
189 
197 uint8_t LoRaMacCommandsGetCmdSize( uint8_t cid );
198 
201 #ifdef __cplusplus
202 }
203 #endif
204 
205 #endif // __LORAMAC_COMMANDS_H__
206 
sMacCommand::Payload
uint8_t Payload[LORAMAC_COMMADS_MAX_NUM_OF_PARAMS]
Definition: LoRaMacCommands.h:71
LoRaMacCommandsRemoveStickyAnsCmds
LoRaMacCommandStatus_t LoRaMacCommandsRemoveStickyAnsCmds(void)
Remove all sticky answer MAC commands.
LoRaMacCommandsGetCmdSize
uint8_t LoRaMacCommandsGetCmdSize(uint8_t cid)
Get the MAC command size with corresponding CID.
LORAMAC_COMMANDS_ERROR_MEMORY
Definition: LoRaMacCommands.h:98
LoRaMacTypes.h
LoRa MAC layer internal types definition. Please do not include in application sources.
sMacCommand::Next
MacCommand_t * Next
Definition: LoRaMacCommands.h:63
sMacCommand
Definition: LoRaMacCommands.h:58
LoRaMacCommandsGetSizeSerializedCmds
LoRaMacCommandStatus_t LoRaMacCommandsGetSizeSerializedCmds(size_t *size)
Get size of all MAC commands serialized as buffer.
LORAMAC_COMMANDS_ERROR_CMD_NOT_FOUND
Definition: LoRaMacCommands.h:102
LoRaMacCommandsGetCmd
LoRaMacCommandStatus_t LoRaMacCommandsGetCmd(uint8_t cid, MacCommand_t **macCmd)
Get the MAC command with corresponding CID.
LoRaMacCommandsRemoveCmd
LoRaMacCommandStatus_t LoRaMacCommandsRemoveCmd(MacCommand_t *macCmd)
Remove a MAC command.
sMacCommand::PayloadSize
size_t PayloadSize
Definition: LoRaMacCommands.h:75
LoRaMacCommandsSerializeCmds
LoRaMacCommandStatus_t LoRaMacCommandsSerializeCmds(size_t availableSize, size_t *effectiveSize, uint8_t *buffer)
Get as many as possible MAC commands serialized.
sMacCommand::CID
uint8_t CID
Definition: LoRaMacCommands.h:67
LORAMAC_COMMANDS_ERROR_NPE
Definition: LoRaMacCommands.h:94
LORAMAC_COMMANDS_ERROR_UNKNOWN_CMD
Definition: LoRaMacCommands.h:106
LoRaMacCommandStatus_t
LoRaMacCommandStatus_t
Definition: LoRaMacCommands.h:85
LoRaMacCommandsRemoveNoneStickyCmds
LoRaMacCommandStatus_t LoRaMacCommandsRemoveNoneStickyCmds(void)
Remove all none sticky MAC commands.
LORAMAC_COMMANDS_SUCCESS
Definition: LoRaMacCommands.h:90
sMacCommand::IsSticky
bool IsSticky
Definition: LoRaMacCommands.h:79
LORAMAC_COMMANDS_ERROR
Definition: LoRaMacCommands.h:110
LoRaMacCommandsAddCmd
LoRaMacCommandStatus_t LoRaMacCommandsAddCmd(uint8_t cid, uint8_t *payload, size_t payloadSize)
Adds a new MAC command to be sent.
LoRaMacCommandsInit
LoRaMacCommandStatus_t LoRaMacCommandsInit(void)
Initialization of LoRaMac MAC commands module.
LoRaMacCommandsNvmEvent
void(* LoRaMacCommandsNvmEvent)(void)
Definition: LoRaMacCommands.h:117