LoRaMAC  4.4.5
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 
128 
137 
145 void* LoRaMacCommandsGetNvmCtx( size_t* commandsNvmCtxSize );
146 
156 LoRaMacCommandStatus_t LoRaMacCommandsAddCmd( uint8_t cid, uint8_t* payload, size_t payloadSize );
157 
165 LoRaMacCommandStatus_t LoRaMacCommandsRemoveCmd( MacCommand_t* macCmd );
166 
175 LoRaMacCommandStatus_t LoRaMacCommandsGetCmd( uint8_t cid, MacCommand_t** macCmd );
176 
183 
190 
199 
209 LoRaMacCommandStatus_t LoRaMacCommandsSerializeCmds( size_t availableSize, size_t* effectiveSize, uint8_t* buffer );
210 
219 
227 uint8_t LoRaMacCommandsGetCmdSize( uint8_t cid );
228 
231 #ifdef __cplusplus
232 }
233 #endif
234 
235 #endif // __LORAMAC_COMMANDS_H__
236 
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
LoRaMacCommandsStickyCmdsPending
LoRaMacCommandStatus_t LoRaMacCommandsStickyCmdsPending(bool *cmdsPending)
Determines if there are sticky MAC commands pending.
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.
LoRaMacCommandsInit
LoRaMacCommandStatus_t LoRaMacCommandsInit(LoRaMacCommandsNvmEvent commandsNvmCtxChanged)
Initialization of LoRaMac MAC commands module.
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
LoRaMacCommandsGetNvmCtx
void * LoRaMacCommandsGetNvmCtx(size_t *commandsNvmCtxSize)
LoRaMacCommandsRestoreNvmCtx
LoRaMacCommandStatus_t LoRaMacCommandsRestoreNvmCtx(void *commandsNvmCtx)
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.
LoRaMacCommandsNvmEvent
void(* LoRaMacCommandsNvmEvent)(void)
Definition: LoRaMacCommands.h:117