| Demo HCI Implementation for WiMOD-LR Devices V1.3.1

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
WiMODLRBASE Class Reference

Main class representing the interface to the WiMOD running the firmware WiMODLR-BASE. More...

`#include <WiMODLR_BASE.h>`

Inheritance diagram for WiMODLRBASE:
[legend]
Collaboration diagram for WiMODLRBASE:
[legend]

## Public Member Functions
| WiMODLRBASE (Stream &s)
| Constructor. More...
| ~WiMODLRBASE (void)
| Destructor.
void | begin (void)
| Setup internal things. More...
void | end (void)
| De-Setup internal things.
bool | Ping (TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Ping Cmd - Checks serial connetion to WiMOD module. More...
bool | Reset (TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Reset Cmd - Do a local reboot of the WiMOD module. More...
bool | GetDeviceInfo (TWiMODLR_DevMgmt_DevInfo *info, TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Gets the basic DeviceInfo from WiMOD module. More...
bool | GetFirmwareInfo (TWiMODLR_DevMgmt_FwInfo *info, TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Gets the basic FirmwareInfo from WiMOD module. More...
bool | GetSystemStatus (TWiMODLR_DevMgmt_SystemStatus *info, TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Gets the bas SystemStatus info from WiMOD module. More...
bool | GetRtc (UINT32 *rtcTime, TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Gets the current RTC data info from WiMOD module. More...
bool | SetRtc (const UINT32 rtcTime, TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Sets the current RTC values to WiMOD module. More...
bool | GetRadioConfig (TWiMODLR_DevMgmt_RadioConfig *radioCfg, TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Gets the current configuration of the radio of the WiMOD module. More...
bool | SetRadioConfig (const TWiMODLR_DevMgmt_RadioConfig *radioCfg, TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Sets the current configuration for the radio of the WiMOD module. More...
bool | ResetRadioConfig (TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Resets the current configuration to defaults. More...
bool | GetOperationMode (TWiMOD_OperationMode *opMode, TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Gets the current operation mode of the WiMOD module. More...
bool | SetOperationMode (const TWiMOD_OperationMode opMode, TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Sets the current operation mode of the WiMOD module. More...
bool | SetAesKey (const UINT8 *key, TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Sets the security 128bit AES key to use for RF communication. More...
bool | GetAesKey (UINT8 *key, TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Gets the used security 128bit AES key. More...
bool | SetRtcAlarm (const TWiMODLR_DevMgmt_RtcAlarm *rtcAlarm, TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Sets and enables the RTC alarm feature of the WiMOD. More...
bool | GetRtcAlarm (TWiMODLR_DevMgmt_RtcAlarm *rtcAlarm, TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Gets information about the RTC alarm feature of the WiMOD. More...
bool | ClearRtcAlarm (TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Clears pending RTC Alarms of the WiMOD. More...
void | RegisterPowerUpIndicationClient (TDevMgmtPowerUpCallback cb)
| Register a callback function for the PowerUp Indication - optional -. More...
void | RegisterRtcAlarmIndicationClient (TDevMgmtRtcAlarmCallback cb)
| Register a callback function for the RTC Alarm Indication - optional -. More...
bool | SendUData (const TWiMODLR_RadioLink_Msg *txMsg, TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Tries to send transmit U-Data to peer module via RF link. More...
bool | SendCData (const TWiMODLR_RadioLink_Msg *txMsg, TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Tries to send transmit C-Data to peer module via RF link. More...
bool | SetAckData (const TWiMODLR_RadioLink_Msg *txMsg, TWiMDLRResultCodes *hciResult=NULL, UINT8 *rspStatus=NULL)
| Sets additional user payload for the next ack frame to send. More...
bool | convert (TWiMODLR_HCIMessage &RxMsg, TWiMODLR_RadioLink_Msg *radioLinkMsg)
| Convert a received low level HCI-Msg to a high-level RadioLink-Msg. More...
bool | convert (TWiMODLR_HCIMessage &RxMsg, TWiMODLR_RadioLink_CdataInd *cDataTxInfo)
| Convert a received low level HCI-Msg to a high-level CDataTx Info. More...
bool | convert (TWiMODLR_HCIMessage &RxMsg, TWiMODLR_AckTxInd_Msg *txAckIndInfo)
| Convert a received low level HCI-Msg to a high-level AckTxInd Info. More...
void | RegisterUDataRxClient (TRadioLinkUDataRxIndicationCallback cb)
| Register a callback function for the RX U-Data Indication - optional -. More...
void | RegisterUDataTxClient (TRadioLinkUDataTxIndicationCallback cb)
| Register a callback function for the TX U-Data Indication - optional -. More...
void | RegisterRawDataRxClient (TRadioLinkRawDataRxIndicationCallback cb)
void | RegisterCDataRxClient (TRadioLinkCDataRxIndicationCallback cb)
| Register a callback function for the RX C-Data Indication - optional -. More...
void | RegisterCDataTxClient (TRadioLinkCDataTxIndicationCallback cb)
| Register a callback function for the TX C-Data Indication - optional -. More...
void | RegisterAckRxClient (TRadioLinkAckRxIndicationCallback cb)
| Register a callback function for the RX Ack (+data) Indication - optional -. More...
void | RegisterAckRxTimeoutClient (TRadioLinkAckRxTimeoutIndicationCallback cb)
| Register a callback function for the Ack Timeout Indication - optional -. More...
void | RegisterAckTxCallback (TRadioLinkAckTxIndicationCallback cb)
| Register a callback function for the TX Ack Indication - optional -. More...
void | calcFreqToRegister (uint32_t freq, uint8_t *msb, uint8_t *mid, uint8_t *lsb)
| Convert a frequency in Hz to the corresponding low level register values. More...
uint32_t | calcRegisterToFreq (uint8_t msb, uint8_t mid, uint8_t lsb)
| Convert a frequency registers to frequency in Hz. More...
TWiMDLRResultCodes | GetLastHciResult (void)
| Gets the value of the last local HCI TX status. More...
UINT8 | GetLastResponseStatus (void)
| Gets the value of the last status response value of the WiMOD. More...
Public Member Functions inherited from TWiMODLRHCI
| TWiMODLRHCI (Stream &s)
| Constructor. More...
| ~TWiMODLRHCI (void)
| Destructor.
TWiMDLRResultCodes | SendHCIMessage (UINT8 dstSapID, UINT8 msgID, UINT8 rxMsgID, UINT8 *payload, UINT16 length)
| Generic function for transferring a HCI message to the WiMOD module. More...
void | Process (void)
| Handle the receiver path; process all incomming bytes from the WiMOD. More...
void | SendWakeUpSequence (void)
| : Send a sequence of dummy chars to give the WiMOD some time to wake up
void | RegisterStackErrorClient (TWiMODStackErrorClient cb)
const TWiMODLR_HCIMessage & | GetRxMessage (void)
Public Member Functions inherited from TComSlipClient
virtual UINT8 * | ProcessRxMessage (UINT8 *, UINT16)

## Protected Member Functions
bool | copyResultInfos (TWiMDLRResultCodes *hciResult, UINT8 *rspStatus, UINT8 successValue)
virtual void | ProcessUnexpectedRxMessage (TWiMODLR_HCIMessage &rxMsg)

## Protected Attributes
WiMOD_SAP_DevMgmt | SapDevMgmt
WiMOD_SAP_RadioLink | SapRadioLink

## Detailed Description

Main class representing the interface to the WiMOD running the firmware WiMODLR-BASE.

This class is the only API class a user should use for interacting with a WiMOD module that runs the IMST WiMODLR-Base firmware.

## Constructor & Destructor Documentation

WiMODLRBASE::WiMODLRBASE | ( | Stream & | s | ) |

Constructor.

Parameters

  s | Reference to the serial interace to be used for communication. The serial interface must be initialized outside of this class prior calling the first command in runtime.

#include <WiMODLR_BASE.h>
WiMODLRBASE wimod(Serial3); // use the Arduino Serial3 as serial interface
void setup() {
// init stack
wimod.begin();
...
}

## Member Function Documentation

void WiMODLRBASE::begin | ( | void |  | ) |
| virtual

Setup internal things.

This function must be executed at startup before any other service can be used.

#include <WiMODLR_BASE.h>
WiMODLRBASE wimod(Serial3); // use the Arduino Serial3 as serial interface
void setup() {
// init stack
wimod.begin();
...
}

Reimplemented from TWiMODLRHCI.

Here is the call graph for this function:

void WiMODLRBASE::calcFreqToRegister | ( | uint32_t | freq,
|  | uint8_t * | msb,
|  | uint8_t * | mid,
|  | uint8_t * | lsb
| ) |  |

Convert a frequency in Hz to the corresponding low level register values.

Parameters

  freq | Target frequencey in Hz
  msb | Pointer to register value for MSB-Part
  mid | Pointer to register value for MID-Part
  lsb | Pointer to register value for LSB-Part

Here is the call graph for this function:

uint32_t WiMODLRBASE::calcRegisterToFreq | ( | uint8_t | msb,
|  | uint8_t | mid,
|  | uint8_t | lsb
| ) |  |

Convert a frequency registers to frequency in Hz.

Parameters

  msb | register value for MSB-Part
  mid | register value for MID-Part
  lsb | register value for LSB-Part

return Frequency in Hz

Here is the call graph for this function:

bool WiMODLRBASE::ClearRtcAlarm | ( | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Clears pending RTC Alarms of the WiMOD.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

// clear a pending RTC alarm of WiMOD
wimod.ClearRtcAlarm();
...

Here is the call graph for this function:

bool WiMODLRBASE::convert | ( | TWiMODLR_HCIMessage & | RxMsg,
|  | TWiMODLR_RadioLink_Msg * | radioLinkMsg
| ) |  |

Convert a received low level HCI-Msg to a high-level RadioLink-Msg.

This function should be used by the RxUData / RxCData callback functions prior processing the received data message.

Parameters

  RxMsg | Reference to low-level HCI message.

Warning
  DO NOT MANIPULATE THESE VALUES !!!

Parameters

  radioLinkMsg | Pointer to the buffer where to store the received data

Return values

  true | if the conversion was successful

// global buffer for incomming messages
TWiMODLR_RadioLink_Msg radioRxMsg;
void myRxDataInd(TWiMODLR_HCIMessage& rxMsg) {
// convert/copy the raw message to RX radio buffer
if (wimod.convert(rxMsg, &radioRxMsg)) {
// access the radioRxMsg fields
// radioRxMsg.Length
// radioRxMsg.Payload
...
}
}
...
void setup() {
...
// init the communication stack
wimod.begin();
// register callbacks for incommig RF messages
wimod.RegisterUDataRxClient(myRxDataInd);
wimod.RegisterCDataRxClient(myRxDataInd);
...
}

Here is the call graph for this function:

bool WiMODLRBASE::convert | ( | TWiMODLR_HCIMessage & | RxMsg,
|  | TWiMODLR_RadioLink_CdataInd * | cDataTxInfo
| ) |  |

Convert a received low level HCI-Msg to a high-level CDataTx Info.

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

Parameters

  RxMsg | Reference to low-level HCI message.

Warning
  DO NOT MANIPULATE THESE VALUES !!!

Parameters

  cDataTxInfo | Pointer to the buffer where to store the received data

Return values

  true | if the conversion was successful

// global buffer for indication that CData has been send
TWiMODLR_RadioLink_CdataInd txDataMsg;
void myTxCDataInd(TWiMODLR_HCIMessage& rxMsg) {
// convert/copy the raw message to RX radio buffer
if (wimod.convert(rxMsg, &txDataMsg)) {
// access the fields folding information about the transmission
// txDataMsg.TxEventCounter
...
}
}
...
void setup() {
...
// init the communication stack
wimod.begin();
// register callback
wimod.RegisterCDataTxClient(myTxCDataInd);
...
}

Here is the call graph for this function:

bool WiMODLRBASE::convert | ( | TWiMODLR_HCIMessage & | RxMsg,
|  | TWiMODLR_AckTxInd_Msg * | txAckIndInfo
| ) |  |

Convert a received low level HCI-Msg to a high-level AckTxInd Info.

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

Parameters

  RxMsg | Reference to low-level HCI message.

Warning
  DO NOT MANIPULATE THESE VALUES !!!

Parameters

  txAckIndInfo | Pointer to the buffer where to store the received data

Return values

  true | if the conversion was successful

// global buffer
TWiMODLR_AckTxInd_Msg txAckData;
void myTxAckInd(TWiMODLR_HCIMessage& rxMsg) {
// convert/copy the raw message
if (wimod.convert(rxMsg, &txAckData)) {
// access the fields folding information about the ACK transmission
// txDataMsg.Status
...
}
}
...
void setup() {
...
// init the communication stack
wimod.begin();
// register callback
wimod.RegisterAckTxCallback(myTxAckInd);
...
}

Here is the call graph for this function:

bool WiMODLRBASE::copyResultInfos | ( | TWiMDLRResultCodes * | hciResult,
|  | UINT8 * | rspStatus,
|  | UINT8 | successValue
| ) |  |
| protected

bool WiMODLRBASE::GetAesKey | ( | UINT8 * | key,
|  | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Gets the used security 128bit AES key.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  key | Pointer to the 128bit AES key that is used
  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

const uint8_t AesKey[16];
// read AES key from WiMOD (LR-Base mode ONLY!)
if (wimod.GetAesKey(AesKey)) {
//ok;
}
...

Here is the call graph for this function:

bool WiMODLRBASE::GetDeviceInfo | ( | TWiMODLR_DevMgmt_DevInfo * | info,
|  | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Gets the basic DeviceInfo from WiMOD module.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  info | Pointer where to store the retrieved information

See also
  TWiMODLR_DevMgmt_DevInfo for details

Parameters

  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

//local variable
TWiMODLR_DevMgmt_DevInfo devInfo;
// get information of WiMOD
if (wimod.GetDeviceInfo(&devInfo)) {
// ok; process received information
...
}
...

Here is the call graph for this function:

bool WiMODLRBASE::GetFirmwareInfo | ( | TWiMODLR_DevMgmt_FwInfo * | info,
|  | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Gets the basic FirmwareInfo from WiMOD module.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  info | Pointer where to store the retrieved information

See also
  TWiMODLR_DevMgmt_FwInfo for details

Parameters

  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

//local variable
TWiMODLR_DevMgmt_FwInfo fwInfo;
// get information of WiMOD
if (wimod.GetFirmwareInfo(&fwInfo)) {
// ok; process received information
if (fwInfo.FirmwareMayorVersion = 0x01) {...}
}
...

Here is the call graph for this function:

TWiMDLRResultCodes WiMODLRBASE::GetLastHciResult | ( | void |  | ) |

Gets the value of the last local HCI TX status.

If the optional parameters have been left out (for the normal commands), the user can get the last value back by using this function

Return values

  the | last value of the last command issued

UINT8 WiMODLRBASE::GetLastResponseStatus | ( | void |  | ) |

Gets the value of the last status response value of the WiMOD.

If the optional parameters have been left out (for the normal commands), the user can get the last value back by using this function

Return values

  the | last value of the last command issued

- ...
  if (wimod.Ping() == false) {
  uint8_t rsp;
  // get (remote) response code
  rsp = wimod.GetLastResponseStatus();
  // check result code
  switch (rsp):
  case LoRaWAN_Status_Ok: // OK; No error;
  // --> check "remote" ResponseStatus
  case LoRaWAN_Status_Error: // general (un-specific) error
  case LoRaWAN_Status_Cmd_Not_Supported: // Command is not supported (or unknown)
  case LoRaWAN_Status_Wrong_parameter: // Wrong parameter applied
  case LoRaWAN_Status_Wrong_DeviceMode: // Device is in wong device mode for specific command
  case LoRaWAN_Status_Device_Not_Activated: // Device has NOT been activated; command has not been executed
  case LoRaWAN_Status_Device_Busy: // There is another operation pending; and or duty cycle restriction is active
  case LoRaWAN_Status_Queue_Full: // internal command queue is full
  case LoRaWAN_Status_Length_Error: // some error related to the given length information
  case LoRaWAN_Status_No_Factory_Settings: // Factory settings are not available
  case LoRaWAN_Status_Channel_Blocked: // Selected channel is blocked (duty cycle?)
  case LoRaWAN_Status_Channel_Not_Available: // Selected channel is not available
  ...
  }
  ...

bool WiMODLRBASE::GetOperationMode | ( | TWiMOD_OperationMode * | opMode,
|  | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Gets the current operation mode of the WiMOD module.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  opMode | Pointer where to store the information

See also
  TWiMOD_OperationMode for details

Parameters

  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

// local variable
TWiMOD_OperationMode opMode;
// get information from WiMOD
if (wimod.GetOperationMode(&opMode)) {
//ok
if (opMode != OperationMode_Application) {
// normal operation is disabled; only test functionality is enabled
}
}
...

Here is the call graph for this function:

bool WiMODLRBASE::GetRadioConfig | ( | TWiMODLR_DevMgmt_RadioConfig * | radioCfg,
|  | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Gets the current configuration of the radio of the WiMOD module.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  radioCfg | Pointer where to store the information

See also
  TWiMODLR_DevMgmt_RadioConfig for details

Parameters

  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

// create a local variable
TWiMODLR_DevMgmt_RadioConfig radioCfg;
// get information from WiMOD
if (wimod.GetRadioConfig(&radioCfg)) {
// access the fields
if (radioCfg.RadioMode != RadioMode_Standard) {
// error unsupported mode
}
if (radioCfg.Modulation == Modulation_LoRa) {...}
uint32_t freq = FreqCalc_calcRegisterToFreq(radioCfg.RfFreq_MSB,
radioCfg.RfFreq_MID,
radioCfg.RfFreq_LSB);
...
}
...

Here is the call graph for this function:

bool WiMODLRBASE::GetRtc | ( | UINT32 * | rtcTime,
|  | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Gets the current RTC data info from WiMOD module.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  rtcTime | Pointer where to store the RTC information

See also
  WIMOD_RTC_GET_* Macros for conversation of this value

Parameters

  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

// create a local variable
uint32_t timestamp;
// get information of WiMOD
wimod.GetRtc(&timestamp);
//access fields of structure
printf("Year : %d:", WIMOD_RTC_GET_YEARS(timestamp));
printf("Month: %d:", WIMOD_RTC_GET_MONTHS(timestamp));
printf("Day : %d:", WIMOD_RTC_GET_DAYS(timestamp));
printf("Hour : %d:", WIMOD_RTC_GET_HOURS(timestamp));
printf("Min : %d:", WIMOD_RTC_GET_MINUTES(timestamp));
printf("Sec : %d:", WIMOD_RTC_GET_SECONDS(timestamp));
...

Here is the call graph for this function:

bool WiMODLRBASE::GetRtcAlarm | ( | TWiMODLR_DevMgmt_RtcAlarm * | rtcAlarm,
|  | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Gets information about the RTC alarm feature of the WiMOD.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  rtcAlarm | Pointer to a structure where to store the RTC alarm related information
  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

// create a local variable
TWiMODLR_DevMgmt_RtcAlarm rtcAlarm;
// get information of WiMOD
wimod.GetRtcAlarm(&rtcAlarm);
...
// access values
if (rtcAlarm.AlarmStatus == RTC_Alarm_Alarm_Set) {
printf("Alarm is active");
...
}
...

Here is the call graph for this function:

bool WiMODLRBASE::GetSystemStatus | ( | TWiMODLR_DevMgmt_SystemStatus * | info,
|  | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Gets the bas SystemStatus info from WiMOD module.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  info | Pointer where to store the retrieved information

See also
  TWiMODLR_DevMgmt_SystemStatus for details

Parameters

  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

//local variable
TWiMODLR_DevMgmt_SystemStatus sysStatus;
// get information of WiMOD
if (wimod.GetSystemStatus(&sysStatus)) {
// ok; process received information
if (sysStatus.BatteryStatus < 2500) { //low batt. voltage detected }
}
...

Here is the call graph for this function:

bool WiMODLRBASE::Ping | ( | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Ping Cmd - Checks serial connetion to WiMOD module.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

if (wimod.Ping()) {
// success ...
} else {
// error ...
}

OR:

TWiMDLRResultCodes hciResult;
if (!wimod.Ping(&hciResult)) {
// error: check HCI result codes
if (WiMODLR_RESULT_TRANMIT_ERROR == hciResult) {...}
if (WiMODLR_RESULT_NO_RESPONSE == hciResult) {...}
}

OR:

TWiMDLRResultCodes hciResult;
uint8 rspCode;
if (!wimod.Ping(&hciResult, &rspCode)) {
// error: check HCI result codes
if (WiMODLR_RESULT_OK == hciResult) {
if (rspCode == DEVMGMT_STATUS_ERROR) {
// operation failed
}
...
}
...
}

Here is the call graph for this function:

void WiMODLRBASE::ProcessUnexpectedRxMessage | ( | TWiMODLR_HCIMessage & | rxMsg | ) |
| protected virtual

void WiMODLRBASE::RegisterAckRxClient | ( | TRadioLinkAckRxIndicationCallback | cb | ) |

Register a callback function for the RX Ack (+data) Indication - optional -.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  cb | Pointer a callback function

See also
  TRadioLinkAckRxIndicationCallback for details

Note
  The callback function should call the corresponding convert in order to decode the message properly

// callback for U data Tx indication
void myAckRxInd(TWiMODLR_HCIMessage& rxMsg) {
// use the convert function before accesing the data
...
}
void setup() {
...
// setup the callback
wimod.RegisterAckRxClient(myAckRxInd);
...
}
...

Here is the call graph for this function:

void WiMODLRBASE::RegisterAckRxTimeoutClient | ( | TRadioLinkAckRxTimeoutIndicationCallback | cb | ) |

Register a callback function for the Ack Timeout Indication - optional -.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  cb | Pointer a callback function

See also
  TRadioLinkAckRxTimeoutIndicationCallback for details

// callback for a missing ACK packet
void myAckRxTimemoutInd() {
// this is called if an expected ACK has NOT been received
// within expected time; it it up to the application to
// react accordingly! (e.g. retransmission the data)
...
}
void setup() {
...
// setup the callback
wimod.RegisterAckRxTimeoutClient(myAckRxTimemoutInd);
...
}
...

Here is the call graph for this function:

void WiMODLRBASE::RegisterAckTxCallback | ( | TRadioLinkAckTxIndicationCallback | cb | ) |

Register a callback function for the TX Ack Indication - optional -.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  cb | Pointer a callback function

See also
  TRadioLinkAckTxIndicationCallback for details

// callback for C data Ack Tx indication
void myAckTxInd() {
// this is called if an ACK has been send
...
}
void setup() {
...
// setup the callback
wimod.RegisterAckTxCallback(myAckTxInd);
...
}
...

Here is the call graph for this function:

void WiMODLRBASE::RegisterCDataRxClient | ( | TRadioLinkCDataRxIndicationCallback | cb | ) |

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

- See also
    TWiMDLRResultCodes for interpretation of the values
  Parameters

    cb | Pointer a callback function

  See also
    TRadioLinkCDataRxIndicationCallback for details
  Note
    The callback function should call the corresponding convert in order to decode the message properly

// callback for C data Rx indication
void myCDataRxInd(TWiMODLR_HCIMessage& rxMsg) {
// use the convert function before accessing the data
...
}
void setup() {
...
// setup the callback
wimod.RegisterCDataRxClient(myCDataRxInd);
...
}
...

Here is the call graph for this function:

void WiMODLRBASE::RegisterCDataTxClient | ( | TRadioLinkCDataTxIndicationCallback | cb | ) |

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

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  cb | Pointer a callback function

See also
  TRadioLinkCDataTxIndicationCallback for details

Note
  The callback function should call the corresponding convert in order to decode the message properly

// callback for U data Tx indication
void myCDataTxInd(TWiMODLR_HCIMessage& rxMsg) {
// use the convert function before accesing the data
...
}
void setup() {
...
// setup the callback
wimod.RegisterCDataTxClient(myCDataTxInd);
...
}
...

Here is the call graph for this function:

void WiMODLRBASE::RegisterPowerUpIndicationClient | ( | TDevMgmtPowerUpCallback | cb | ) |

Register a callback function for the PowerUp Indication - optional -.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  cb | Pointer a callback function

See also
  TDevMgmtPowerUpCallback for details

// user defined callback function
void myPowerUpCallback(void) {
// WiMOD just powered up
...
}
void setup() {
...
// "connect" the user defined to callback to the WiMOD callback feature
wimod.RegisterPowerUpIndicationClient(myPowerUpCallback);
...
}

Here is the call graph for this function:

void WiMODLRBASE::RegisterRtcAlarmIndicationClient | ( | TDevMgmtRtcAlarmCallback | cb | ) |

Register a callback function for the RTC Alarm Indication - optional -.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  cb | Pointer a callback function

See also
  TDevMgmtRtcAlarmCallback for details

// user defined callback function
void myRtcAlarmCallback(void) {
// RTC Alarm has just been triggered
...
}
void setup() {
...
// "connect" the user defined to callback to the WiMOD callback feature
wimod.RegisterRtcAlarmIndicationClient(myRtcAlarmCallback);
...
}

Here is the call graph for this function:

void WiMODLRBASE::RegisterUDataRxClient | ( | TRadioLinkUDataRxIndicationCallback | cb | ) |

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

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  cb | Pointer a callback function

See also
  TRadioLinkUDataRxIndicationCallback for details

Note
  The callback function should call the corresponding convert in order to decode the message properly

// callback for U data Rx indication
void myUDataRxInd(TWiMODLR_HCIMessage& rxMsg) {
// use the convert function before accessing the data
...
}
void setup() {
...
// setup the callback
wimod.RegisterUDataRxClient(myUDataRxInd);
...
}
...

Here is the call graph for this function:

void WiMODLRBASE::RegisterUDataTxClient | ( | TRadioLinkUDataTxIndicationCallback | cb | ) |

Register a callback function for the TX U-Data Indication - optional -.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  cb | Pointer a callback function

See also
  TRadioLinkUDataTxIndicationCallback for details

// callback for U data Tx indication
void myUDataTxInd() {
...
}
void setup() {
...
// setup the callback
wimod.RegisterUDataTxClient(myUDataTxInd);
...
}
...

Here is the call graph for this function:

bool WiMODLRBASE::Reset | ( | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Reset Cmd - Do a local reboot of the WiMOD module.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

// do a software reboot of the WiMOD device
if (wimod.Reset() {
// ok; reset procedure has been started
// wait a while for the reboot to be finished
}
...

Here is the call graph for this function:

bool WiMODLRBASE::ResetRadioConfig | ( | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Resets the current configuration to defaults.

See also
  HCI Documentation for details of default settings
  TWiMDLRResultCodes for interpretation of the values

Parameters

  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

...
// reset radio config from WiMOD to defaults
if (wimod.ResetRadioConfig()) {
//ok config has been setup to defaults
}
...

Here is the call graph for this function:

bool WiMODLRBASE::SendCData | ( | const TWiMODLR_RadioLink_Msg * | txMsg,
|  | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Tries to send transmit C-Data to peer module via RF link.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  txMsg | Data structure containing the TX-data and options.

See also
  TWiMODLR_RadioLink_Msg for details

Parameters

  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

...
// local variable
TWiMODLR_RadioLink_Msg txData;
// setup tx packet
txData.DestinationGroupAddress = 0x10;
txData.DestinationDeviceAddress = 0x1234;
txData.Length = strlen("Hello World!");
strncpy(txData.Payload, "Hello World!", WiMODLORAWAN_APP_PAYLOAD_LEN);
// send data
wimod.SendCData(&txData);
...
// if ACK callback has been registered: wait for callback
// to be called and check the received indication data
// in order to get the status of the transmission
...

Here is the call graph for this function:

bool WiMODLRBASE::SendUData | ( | const TWiMODLR_RadioLink_Msg * | txMsg,
|  | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Tries to send transmit U-Data to peer module via RF link.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  txMsg | Data structure containing the TX-data and options.

See also
  TWiMODLR_RadioLink_Msg for details

Parameters

  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

...
// local variable
TWiMODLR_RadioLink_Msg txData;
// setup tx packet
txData.DestinationGroupAddress = 0x10;
txData.DestinationDeviceAddress = 0x1234;
txData.Length = strlen("Hello World!");
strncpy(txData.Payload, "Hello World!", WiMODLORAWAN_APP_PAYLOAD_LEN);
// send data
wimod.SendUData(&txData);
...

Here is the call graph for this function:

bool WiMODLRBASE::SetAckData | ( | const TWiMODLR_RadioLink_Msg * | txMsg,
|  | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Sets additional user payload for the next ack frame to send.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  txMsg | Pointer to data structure containing the payload data. note: Max ack payload size is 8 byte!

See also
  TWiMODLR_RadioLink_Msg for details

Parameters

  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

// global buffer
TWiMODLR_RadioLink_Msg ackPayloadData;
...
// if you want that the next ack that will be send should contain
// additional payload: setup the data structure
ackPayloadData.DestinationGroupAddress = ...;
ackPayloadData.DestinationDeviceAddress = ...;
ackPayloadData.Length = ...;
ackPayloadData.Payload = ...;
// prepare the next ack packet
wimod.SetAckData(ackPayloadData);
...

Here is the call graph for this function:

bool WiMODLRBASE::SetAesKey | ( | const UINT8 * | key,
|  | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Sets the security 128bit AES key to use for RF communication.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  key | Pointer to the 128bit AES key to by used
  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

const uint8_t AesKey[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0C, 0x0D, 0x0E, 0x0F};
// write new AES key to WiMOD (LR-Base mode ONLY!)
if (wimod.SetAesKey(AesKey)) {
//ok;
}
...

Here is the call graph for this function:

bool WiMODLRBASE::SetOperationMode | ( | const TWiMOD_OperationMode | opMode,
|  | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Sets the current operation mode of the WiMOD module.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  opMode | The new operation mode to set

See also
  TWiMOD_OperationMode for details

Parameters

  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

// local variable
TWiMOD_OperationMode opMode;
// setup new opMode
opMode = OperationMode_Application;
// write information to WiMOD
if (wimod.SetOperationMode(opMode)) {
//ok; wait a little bit to setup everthing
}
...

Here is the call graph for this function:

bool WiMODLRBASE::SetRadioConfig | ( | const TWiMODLR_DevMgmt_RadioConfig * | radioCfg,
|  | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Sets the current configuration for the radio of the WiMOD module.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  radioCfg | Pointer where to read the information

See also
  TWiMODLR_DevMgmt_RadioConfig for details

Parameters

  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

// create a local variable
TWiMODLR_DevMgmt_RadioConfig radioCfg;
// setup new radio config
radioCfg.RadioMode = RadioMode_Standard;
radioCfg.StoreNwmFlag = 0x01; // store new config permanently
radioCfg.Modulation = Modulation_LoRa;
radioCfg.PowerLevel = TxPowerLevel_14_dBm;
...
FreqCalc_calcFreqToRegister(868300000,
&radioCfg.RfFreq_MSB,
&radioCfg.RfFreq_MID,
&radioCfg.RfFreq_LSB);
...
// set information from WiMOD
if (wimod.SetRadioConfig(&radioCfg)) {
//ok new config has been setup
}
...

Here is the call graph for this function:

bool WiMODLRBASE::SetRtc | ( | const UINT32 | rtcTime,
|  | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Sets the current RTC values to WiMOD module.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  rtcTime | RTC information to setup

See also
  WIMOD_RTC_MAKE_DATETIME_U32 Macro for conversation of this value

Parameters

  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

// create a local variable
uint32_t timestamp;
// convert date/time to timestamp format ( 1st Oct 2016 16:12:55 )
timestamp = WIMOD_RTC_MAKE_DATETIME_U32(55, 12, 16, 1, 10, 2016);
// set information to WiMOD
wimod.SetRtc(timestamp);
...

Here is the call graph for this function:

bool WiMODLRBASE::SetRtcAlarm | ( | const TWiMODLR_DevMgmt_RtcAlarm * | rtcAlarm,
|  | TWiMDLRResultCodes * | hciResult = `NULL`,
|  | UINT8 * | rspStatus = `NULL`
| ) |  |

Sets and enables the RTC alarm feature of the WiMOD.

See also
  TWiMDLRResultCodes for interpretation of the values

Parameters

  rtcAlarm | Pointer to a structure containing the RTC alarm related information
  hciResult | Result of the local command transmission to module This is an optional parameter.
  rspStatus | Status byte contained in the local response of the module This is an optional parameter.

Return values

  true | if everything is ok
  false | if something went wrong; see hciResult & rspStatus for details

// create a local variable
TWiMODLR_DevMgmt_RtcAlarm rtcAlarm;
// setup RTC Alarm
rtcAlarm.Options = RTC_Alarm_Single; // single, non repeated alarm
rtcAlarm.Hour = 13; // alarm at 13:45:20
rtcAlarm.Minutes = 32;
rtcAlarm.Seconds = 20;
// set information of WiMOD
wimod.SetRtcAlarm(&rtcAlarm);
...
// wait for alarm to occur

Here is the call graph for this function:

## Member Data Documentation

WiMOD_SAP_DevMgmt WiMODLRBASE::SapDevMgmt
| protected

Service Access Point for 'DeviceManagement'

WiMOD_SAP_RadioLink WiMODLRBASE::SapRadioLink
| protected

Service Access Point for 'RadioLink'

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

- WiMODLR_BASE.h
- LR-BASE/WiMODLR_BASE.cpp