Demo HCI Implementation for WiMOD-LR Devices  V1.3.1
WiMOD_SAP_LoRaWAN Class Reference

Implementation for the ServiceAccessPoint LoRaWAN (End Node Modem firmware only) More...

#include <SAP/WiMOD_SAP_LORAWAN.h>

Public Member Functions

 WiMOD_SAP_LoRaWAN (TWiMODLRHCI *hci, UINT8 *buffer, UINT16 bufferSize)
 Constructor. More...
 
 ~WiMOD_SAP_LoRaWAN (void)
 Destructor.
 
TWiMDLRResultCodes ActivateDevice (TWiMODLORAWAN_ActivateDeviceData &activationData, UINT8 *statusRsp)
 Activates the device via the APB procedure. More...
 
TWiMDLRResultCodes ReactivateDevice (UINT32 *devAdr, UINT8 *statusRsp)
 Re-Activates the device via the APB procedure. More...
 
TWiMDLRResultCodes SetJoinParameter (TWiMODLORAWAN_JoinParams &joinParams, UINT8 *statusRsp)
 Sets the parameters used for the OTAA activation procedure. More...
 
TWiMDLRResultCodes JoinNetwork (UINT8 *statusRsp)
 Start joining the network via the OTAA procedure. Asynchronous process. More...
 
void RegisterJoinTxIndicationClient (TJoinTxIndicationCallback cb)
 Register a callback function for the event "TX Join Indication". More...
 
bool convert (TWiMODLR_HCIMessage &RxMsg, TWiMODLORAWAN_RX_Data *loraWanRxData)
 Convert a received low level HCI-Msg to a high-level Rx Data structure. More...
 
bool convert (TWiMODLR_HCIMessage &rxMsg, TWiMODLORAWAN_TxIndData *sendIndData)
 Convert a received low level HCI-Msg to a high-level tx ind structure. More...
 
bool convert (TWiMODLR_HCIMessage &RxMsg, TWiMODLORAWAN_RX_MacCmdData *loraWanMacCmdData)
 Convert a received low level HCI-Msg to a high-level MAC-Cmd structure. More...
 
bool convert (TWiMODLR_HCIMessage &RxMsg, TWiMODLORAWAN_RX_JoinedNwkData *joinedNwkData)
 Convert a received low level HCI-Msg to a high-level NwkJoined structure. More...
 
bool convert (TWiMODLR_HCIMessage &RxMsg, TWiMODLORAWAN_RX_ACK_Data *ackData)
 Convert a received low level HCI-Msg to a high-level AckData structure. More...
 
void RegisterNoDataIndicationClient (TNoDataIndicationCallback cb)
 Register a callback function for the event "TX Join Indication". More...
 
void RegisterTxCDataIndicationClient (TTxCDataIndicationCallback cb)
 Register a callback function for the event "TX C-Data Indication". More...
 
void RegisterTxUDataIndicationClient (TTxUDataIndicationCallback cb)
 Register a callback function for the event "TX U Data Indication". More...
 
void RegisterRxUDataIndicationClient (TRxUDataIndicationCallback cb)
 Register a callback function for the event "RX U-Data Indication". More...
 
void RegisterRxCDataIndicationClient (TRxCDataIndicationCallback cb)
 Register a callback function for the event "RX C-Data Indication". More...
 
void RegisterRxMacCmdIndicationClient (TRxMacCmdIndicationCallback cb)
 Register a callback function for the event "RX MAC Cmd Indication". More...
 
void RegisterJoinedNwkIndicationClient (TJoinedNwkIndicationCallback cb)
 Register a callback function for the event "Joined Nwk Indication". More...
 
void RegisterRxAckIndicationClient (TRxAckIndicationCallback cb)
 Register a callback function for the event "RX ACK (data) Indication". More...
 
TWiMDLRResultCodes SendUData (const TWiMODLORAWAN_TX_Data *data, UINT8 *statusRsp)
 Tries to send transmit U-Data to network server via RF link. More...
 
TWiMDLRResultCodes SendCData (const TWiMODLORAWAN_TX_Data *data, UINT8 *statusRsp)
 Tries to send transmit C-Data to network server via RF link. More...
 
TWiMDLRResultCodes SetRadioStackConfig (const TWiMODLORAWAN_RadioStackConfig *data, UINT8 *statusRsp)
 Sets a new radio config parameter set of the WiMOD. More...
 
TWiMDLRResultCodes GetRadioStackConfig (TWiMODLORAWAN_RadioStackConfig *data, UINT8 *statusRsp)
 Gets the current radio config parameter set of the WiMOD. More...
 
TWiMDLRResultCodes DeactivateDevice (UINT8 *statusRsp)
 Deactivate the device (logical disconnect from lora network) More...
 
TWiMDLRResultCodes FactoryReset (UINT8 *statusRsp)
 Reset all internal settings to default values (incl. DevEUI) More...
 
TWiMDLRResultCodes SetDeviceEUI (const UINT8 *deviceEUI, UINT8 *statusRsp)
 Sets a new DeviceEUI (aka. IEEE-Address) to the WiMOD. More...
 
TWiMDLRResultCodes GetDeviceEUI (UINT8 *deviceEUI, UINT8 *statusRsp)
 Gets the DeviceEUI (aka. IEEE-Address) of the WiMOD. More...
 
TWiMDLRResultCodes GetNwkStatus (TWiMODLORAWAN_NwkStatus_Data *nwkStatus, UINT8 *statusRsp)
 Gets the current status of the network "connection". More...
 
TWiMDLRResultCodes SendMacCmd (const TWiMODLORAWAN_MacCmd *cmd, UINT8 *statusRsp)
 Send a MAC command to the server; expert level only. More...
 
TWiMDLRResultCodes SetCustomConfig (const INT8 txPwrOffset, UINT8 *statusRsp)
 Setup a custom config for tx power settings; expert level only. More...
 
TWiMDLRResultCodes GetCustomConfig (INT8 *txPwrOffset, UINT8 *statusRsp)
 Get the current offet for tx power level; expert level only. More...
 
void DispatchLoRaWANMessage (TWiMODLR_HCIMessage &rxMsg)
 

Detailed Description

Implementation for the ServiceAccessPoint LoRaWAN (End Node Modem firmware only)

Constructor & Destructor Documentation

WiMOD_SAP_LoRaWAN::WiMOD_SAP_LoRaWAN ( TWiMODLRHCI hci,
UINT8 *  buffer,
UINT16  bufferSize 
)

Constructor.

Parameters
hciPointer to HCI processor object
bufferpointer to storage area for building tx frames; MUST BE VALID
bufferSizesize of the buffer

Member Function Documentation

TWiMDLRResultCodes WiMOD_SAP_LoRaWAN::ActivateDevice ( TWiMODLORAWAN_ActivateDeviceData activationData,
UINT8 *  statusRsp 
)

Activates the device via the APB procedure.

See also
TWiMDLRResultCodes for interpretation of the values
Parameters
activationDatastructure holding the necessary parameters
statusRspStatus byte contained in the local response of the module
Return values
WiMODLR_RESULT_OKif command transmit to WiMOD was ok
bool WiMOD_SAP_LoRaWAN::convert ( TWiMODLR_HCIMessage RxMsg,
TWiMODLORAWAN_RX_Data loraWanRxData 
)

Convert a received low level HCI-Msg to a high-level Rx Data structure.

This function should be used by the Rx Data Indication Callback functions prior processing the received data message.

Parameters
RxMsgReference to low-level HCI message.
Warning
DO NOT MANIPULATE THESE VALUES !!!
Parameters
loraWanRxDataPointer to the buffer where to store the received data
Return values
trueif the conversion was successful
bool WiMOD_SAP_LoRaWAN::convert ( TWiMODLR_HCIMessage RxMsg,
TWiMODLORAWAN_TxIndData sendIndData 
)

Convert a received low level HCI-Msg to a high-level tx ind structure.

This function should be used by the Tx Data Indication Callback functions prior processing the received data message.

Parameters
RxMsgReference to low-level HCI message.
Warning
DO NOT MANIPULATE THESE VALUES !!!
Parameters
sendIndDataPointer to the buffer where to store the received data
Return values
trueif the conversion was successful
bool WiMOD_SAP_LoRaWAN::convert ( TWiMODLR_HCIMessage RxMsg,
TWiMODLORAWAN_RX_MacCmdData loraWanMacCmdData 
)

Convert a received low level HCI-Msg to a high-level MAC-Cmd structure.

This function should be used by the Rx Mac Cmd Indication Callback function prior processing the received data message.

Parameters
RxMsgReference to low-level HCI message.
Warning
DO NOT MANIPULATE THESE VALUES !!!
Parameters
loraWanMacCmdDataPointer to the buffer where to store the received data
Return values
trueif the conversion was successful
bool WiMOD_SAP_LoRaWAN::convert ( TWiMODLR_HCIMessage RxMsg,
TWiMODLORAWAN_RX_JoinedNwkData joinedNwkData 
)

Convert a received low level HCI-Msg to a high-level NwkJoined structure.

This function should be used by the JoinedNwk Indication Callback function prior processing the received data message.

Parameters
RxMsgReference to low-level HCI message.
Warning
DO NOT MANIPULATE THESE VALUES !!!
Parameters
joinedNwkDataPointer to the buffer where to store the received data
Return values
trueif the conversion was successful
bool WiMOD_SAP_LoRaWAN::convert ( TWiMODLR_HCIMessage RxMsg,
TWiMODLORAWAN_RX_ACK_Data ackData 
)

Convert a received low level HCI-Msg to a high-level AckData structure.

This function should be used by the Rx Ack Indication Callback function prior processing the received data message.

Parameters
RxMsgReference to low-level HCI message.
Warning
DO NOT MANIPULATE THESE VALUES !!!
Parameters
ackDataPointer to the buffer where to store the received data
Return values
trueif the conversion was successful
TWiMDLRResultCodes WiMOD_SAP_LoRaWAN::DeactivateDevice ( UINT8 *  statusRsp)

Deactivate the device (logical disconnect from lora network)

Parameters
statusRspStatus byte contained in the local response of the module
Return values
WiMODLR_RESULT_OKif command transmit to WiMOD was ok
TWiMDLRResultCodes WiMOD_SAP_LoRaWAN::FactoryReset ( UINT8 *  statusRsp)

Reset all internal settings to default values (incl. DevEUI)

Parameters
statusRspStatus byte contained in the local response of the module
Return values
WiMODLR_RESULT_OKif command transmit to WiMOD was ok
TWiMDLRResultCodes WiMOD_SAP_LoRaWAN::GetCustomConfig ( INT8 *  txPwrOffset,
UINT8 *  statusRsp 
)

Get the current offet for tx power level; expert level only.

Parameters
txPwrOffsetpointer to store the offset value for tx power settings
statusRspStatus byte contained in the local response of the module
Return values
WiMODLR_RESULT_OKif command transmit to WiMOD was ok
TWiMDLRResultCodes WiMOD_SAP_LoRaWAN::GetDeviceEUI ( UINT8 *  deviceEUI,
UINT8 *  statusRsp 
)

Gets the DeviceEUI (aka. IEEE-Address) of the WiMOD.

Parameters
deviceEUIpointer for storing the received 64bit address
statusRspStatus byte contained in the local response of the module
Return values
WiMODLR_RESULT_OKif command transmit to WiMOD was ok
TWiMDLRResultCodes WiMOD_SAP_LoRaWAN::GetNwkStatus ( TWiMODLORAWAN_NwkStatus_Data nwkStatus,
UINT8 *  statusRsp 
)

Gets the current status of the network "connection".

Parameters
nwkStatuspointer for storing the requested information
See also
LORAWAN_NWK_SATUS defines; e.g.:
  • LORAWAN_NWK_SATUS_INACTIVE,
  • LORAWAN_NWK_STATUS_ACTIVE_ABP,
  • LORAWAN_NWK_STATUS_ACTIVE_OTAA,
  • LORAWAN_NWK_STATUS_JOINING_OTAA
Parameters
statusRspStatus byte contained in the local response of the module
Return values
WiMODLR_RESULT_OKif command transmit to WiMOD was ok
TWiMDLRResultCodes WiMOD_SAP_LoRaWAN::GetRadioStackConfig ( TWiMODLORAWAN_RadioStackConfig data,
UINT8 *  statusRsp 
)

Gets the current radio config parameter set of the WiMOD.

Parameters
datapointer to data structure for storing the requested information
See also
TWiMODLORAWAN_TX_Data for details
Parameters
statusRspStatus byte contained in the local response of the module
Return values
WiMODLR_RESULT_OKif command transmit to WiMOD was ok
TWiMDLRResultCodes WiMOD_SAP_LoRaWAN::JoinNetwork ( UINT8 *  statusRsp)

Start joining the network via the OTAA procedure. Asynchronous process.

This functions starts an asynchronous process of joining to a network. It will take a time until a (final) result is ready. Therefore the callback interface (e.g. RegisterJoinedNwkIndicationClient) should be used.

See also
TWiMDLRResultCodes for interpretation of the values
Parameters
statusRspStatus byte contained in the local response of the module
Return values
WiMODLR_RESULT_OKif command transmit to WiMOD was ok
TWiMDLRResultCodes WiMOD_SAP_LoRaWAN::ReactivateDevice ( UINT32 *  devAdr,
UINT8 *  statusRsp 
)

Re-Activates the device via the APB procedure.

See also
TWiMDLRResultCodes for interpretation of the values
Parameters
devAdrpointer where to store the "received" device address
statusRspStatus byte contained in the local response of the module
Return values
WiMODLR_RESULT_OKif command transmit to WiMOD was ok
void WiMOD_SAP_LoRaWAN::RegisterJoinedNwkIndicationClient ( TJoinedNwkIndicationCallback  cb)

Register a callback function for the event "Joined Nwk Indication".

This registered callback is called when the specified event is called by the WiMOD stack.

Parameters
cbpointer to a callback function that should be called if the event occurs.
void WiMOD_SAP_LoRaWAN::RegisterJoinTxIndicationClient ( TJoinTxIndicationCallback  cb)

Register a callback function for the event "TX Join Indication".

This registered callback is called when the specified event is called by the WiMOD stack.

Parameters
cbpointer to a callback function that should be called if the event occurs.
void WiMOD_SAP_LoRaWAN::RegisterNoDataIndicationClient ( TNoDataIndicationCallback  cb)

Register a callback function for the event "TX Join Indication".

This registered callback is called when the specified event is called by the WiMOD stack.

Parameters
cbpointer to a callback function that should be called if the event occurs.
void WiMOD_SAP_LoRaWAN::RegisterRxAckIndicationClient ( TRxAckIndicationCallback  cb)

Register a callback function for the event "RX ACK (data) Indication".

This registered callback is called when the specified event is called by the WiMOD stack.

Parameters
cbpointer to a callback function that should be called if the event occurs.
void WiMOD_SAP_LoRaWAN::RegisterRxCDataIndicationClient ( TRxCDataIndicationCallback  cb)

Register a callback function for the event "RX C-Data Indication".

This registered callback is called when the specified event is called by the WiMOD stack.

Parameters
cbpointer to a callback function that should be called if the event occurs.
void WiMOD_SAP_LoRaWAN::RegisterRxMacCmdIndicationClient ( TRxMacCmdIndicationCallback  cb)

Register a callback function for the event "RX MAC Cmd Indication".

This registered callback is called when the specified event is called by the WiMOD stack.

Parameters
cbpointer to a callback function that should be called if the event occurs.
void WiMOD_SAP_LoRaWAN::RegisterRxUDataIndicationClient ( TRxUDataIndicationCallback  cb)

Register a callback function for the event "RX U-Data Indication".

This registered callback is called when the specified event is called by the WiMOD stack.

Parameters
cbpointer to a callback function that should be called if the event occurs.
void WiMOD_SAP_LoRaWAN::RegisterTxCDataIndicationClient ( TTxCDataIndicationCallback  cb)

Register a callback function for the event "TX C-Data Indication".

This registered callback is called when the specified event is called by the WiMOD stack.

Parameters
cbpointer to a callback function that should be called if the event occurs.
void WiMOD_SAP_LoRaWAN::RegisterTxUDataIndicationClient ( TTxUDataIndicationCallback  cb)

Register a callback function for the event "TX U Data Indication".

This registered callback is called when the specified event is called by the WiMOD stack.

Parameters
cbpointer to a callback function that should be called if the event occurs.
TWiMDLRResultCodes WiMOD_SAP_LoRaWAN::SendCData ( const TWiMODLORAWAN_TX_Data data,
UINT8 *  statusRsp 
)

Tries to send transmit C-Data to network server via RF link.

Parameters
datapointer to data structure containing the TX-data and options.
See also
TWiMODLORAWAN_TX_Data for details
Parameters
statusRspStatus byte contained in the local response of the module
Return values
WiMODLR_RESULT_OKif command transmit to WiMOD was ok
TWiMDLRResultCodes WiMOD_SAP_LoRaWAN::SendMacCmd ( const TWiMODLORAWAN_MacCmd cmd,
UINT8 *  statusRsp 
)

Send a MAC command to the server; expert level only.

Parameters
cmdpointer containing the MAC command and parameters
statusRspStatus byte contained in the local response of the module
Return values
WiMODLR_RESULT_OKif command transmit to WiMOD was ok
TWiMDLRResultCodes WiMOD_SAP_LoRaWAN::SendUData ( const TWiMODLORAWAN_TX_Data data,
UINT8 *  statusRsp 
)

Tries to send transmit U-Data to network server via RF link.

Parameters
datapointer to data structure containing the TX-data and options.
See also
TWiMODLORAWAN_TX_Data for details
Parameters
statusRspStatus byte contained in the local response of the module
Return values
WiMODLR_RESULT_OKif command transmit to WiMOD was ok
TWiMDLRResultCodes WiMOD_SAP_LoRaWAN::SetCustomConfig ( const INT8  txPwrOffset,
UINT8 *  statusRsp 
)

Setup a custom config for tx power settings; expert level only.

Parameters
txPwrOffsetnew offset value for tx power settings
statusRspStatus byte contained in the local response of the module
Return values
WiMODLR_RESULT_OKif command transmit to WiMOD was ok
TWiMDLRResultCodes WiMOD_SAP_LoRaWAN::SetDeviceEUI ( const UINT8 *  deviceEUI,
UINT8 *  statusRsp 
)

Sets a new DeviceEUI (aka. IEEE-Address) to the WiMOD.

Note: Setting a new DeviceEUI is requires to switch to customer operation mode. In "normal" application mode, this command is locked.

Parameters
deviceEUIpointer to data structure containing the new parameters (Must be an pointer of a 64bit address)
statusRspStatus byte contained in the local response of the module
Return values
WiMODLR_RESULT_OKif command transmit to WiMOD was ok
TWiMDLRResultCodes WiMOD_SAP_LoRaWAN::SetJoinParameter ( TWiMODLORAWAN_JoinParams joinParams,
UINT8 *  statusRsp 
)

Sets the parameters used for the OTAA activation procedure.

See also
TWiMDLRResultCodes for interpretation of the values
Parameters
joinParamsstructure holding the necessary parameters
statusRspStatus byte contained in the local response of the module
Return values
WiMODLR_RESULT_OKif command transmit to WiMOD was ok
TWiMDLRResultCodes WiMOD_SAP_LoRaWAN::SetRadioStackConfig ( const TWiMODLORAWAN_RadioStackConfig data,
UINT8 *  statusRsp 
)

Sets a new radio config parameter set of the WiMOD.

Parameters
datapointer to data structure containing the new parameters
See also
TWiMODLORAWAN_TX_Data for details
Parameters
statusRspStatus byte contained in the local response of the module
Return values
WiMODLR_RESULT_OKif command transmit to WiMOD was ok

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