| Demo HCI Implementation for WiMOD-LR Devices V2.0.3

WiMOD_SAP_SensorApp.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
31 //------------------------------------------------------------------------------
32
33
34 #ifndef ARDUINO_SAP_WIMOD_SAP_SENSORAPP_H_
35 #define ARDUINO_SAP_WIMOD_SAP_SENSORAPP_H_
36
37 //------------------------------------------------------------------------------
38 //
39 // Section Includes Files
40 //
41 //------------------------------------------------------------------------------
42
43
44 #include "WiMOD_SAP_SensorApp_IDs.h"
45 #include "../HCI/WiMODLRHCI.h"
46
47 /*
48 * C++11 supports a better way for function pointers / function objects
49 * But C++11 mode is not supported by all platforms.
50 */
51 #ifdef WIMOD_USE_CPP11
52 #include <functional>
53 #endif
54 //------------------------------------------------------------------------------
55 //
56 // Section defines
57 //
58 //------------------------------------------------------------------------------
59
60
63
64
65
66 //-----------------------------------------------------------------------------
67 //
68 // types for callback functions
69 //
70 //-----------------------------------------------------------------------------
71 // C++11 check
72 #ifdef WIMOD_USE_CPP11
73 /* C++11 function callback definitions */
74
76 typedef std::function<void (TWiMODLR_HCIMessage& rxMsg)> TSensorAppAckIndicationCallback;
77
79 typedef std::function<void (TWiMODLR_HCIMessage& rxMsg)> TSensorAppSensorDataIndicationCallback;
80 #else
81 /* pre C++11 function callback definitions */
82
84 typedef void (*TSensorAppAckIndicationCallback)(TWiMODLR_HCIMessage& rxMsg);
85
87 typedef void (*TSensorAppSensorDataIndicationCallback)(TWiMODLR_HCIMessage& rxMsg);
88 #endif
89
90
91 //------------------------------------------------------------------------------
92 //
93 // Section class
94 //
95 //------------------------------------------------------------------------------
96
97
101 class WiMOD_SAP_SensorApp {
102 public:
103 WiMOD_SAP_SensorApp(TWiMODLRHCI* hci, UINT8* buffer, UINT16 bufferSize);
104 virtual ~WiMOD_SAP_SensorApp(void);
105
106 virtual TWiMODLRResultCodes SetSensorAppConfig(const TWiMODLR_SensorApp_Config* config, UINT8* statusRsp);
107 virtual TWiMODLRResultCodes GetSensorAppConfig(TWiMODLR_SensorApp_Config* config, UINT8* statusRsp);
108
109 virtual bool convert(TWiMODLR_HCIMessage& RxMsg, TWiMODLR_SensorApp_SensorData* sensorData);
110 virtual bool convert(TWiMODLR_HCIMessage& RxMsg, TWiMODLR_SensorApp_AckSensorData* sensorAckData);
111
112 virtual void RegisterSensorAckIndClient(TSensorAppAckIndicationCallback cb);
113 virtual void RegisterSensorDataIndClient(TSensorAppSensorDataIndicationCallback cb);
114
115 virtual void DispatchSensorAppMessage(TWiMODLR_HCIMessage& rxMsg);
116
117 protected:
119 UINT8* txPayload;
120 UINT16 txPayloadSize;
122
123 private:
125
126 TWiMODLRHCI* HciParser;
127
128 TSensorAppAckIndicationCallback SensorAckIndCallback;
129 TSensorAppSensorDataIndicationCallback SensorDataIndCallback;
131 };
132
133
134
135
136 #endif /* ARDUINO_SAP_WIMOD_SAP_SENSORAPP_H_ */
TWiMODLR_SensorApp_SensorData::StatusFormat
UINT8 StatusFormat
Definition: WiMOD_SAP_SensorApp_IDs.h:140
TWiMODLR_SensorApp_SensorData::AdcValue
UINT16 AdcValue
Definition: WiMOD_SAP_SensorApp_IDs.h:147
TWiMODLR_SensorApp_AckSensorData::DigitalInputs
UINT8 DigitalInputs
Definition: WiMOD_SAP_SensorApp_IDs.h:173
TWiMODLR_SensorApp_AckSensorData::DestDevAddress
UINT16 DestDevAddress
Definition: WiMOD_SAP_SensorApp_IDs.h:169
WiMOD_SAP_SensorApp::RegisterSensorAckIndClient
virtual void RegisterSensorAckIndClient(TSensorAppAckIndicationCallback cb)
Register a callback function for the event "SensorApp Ack Data Indication".
Definition: WiMOD_SAP_SensorApp.cpp:289
TWiMODLRHCI
Internal helper class for processing SLIP frames.
Definition: WiMODLRHCI.h:235
TWiMODLR_SensorApp_SensorData::Temperature
UINT8 Temperature
Definition: WiMOD_SAP_SensorApp_IDs.h:148
WiMODLR_RESULT_TRANMIT_ERROR
@ WiMODLR_RESULT_TRANMIT_ERROR
Definition: WiMODLRHCI.h:154
TWiMODLR_SensorApp_AckSensorData::DestGroupAddress
UINT8 DestGroupAddress
Definition: WiMOD_SAP_SensorApp_IDs.h:168
TWiMODLR_SensorApp_SensorData::SourceDevAddress
UINT16 SourceDevAddress
Definition: WiMOD_SAP_SensorApp_IDs.h:144
TWiMODLR_SensorApp_AckSensorData::SourceDevAddress
UINT16 SourceDevAddress
Definition: WiMOD_SAP_SensorApp_IDs.h:171
TWiMODLR_HCIMessage
basic low level HCI message structure used for all serial messages to/from WiMOD
Definition: WiMODLRHCI.h:120
WiMODLR_RESULT_OK
@ WiMODLR_RESULT_OK
Definition: WiMODLRHCI.h:151
WiMOD_SAP_SensorApp::convert
virtual bool convert(TWiMODLR_HCIMessage &RxMsg, TWiMODLR_SensorApp_SensorData *sensorData)
Convert a received low level HCI-Msg to a high-level SensorData structure.
Definition: WiMOD_SAP_SensorApp.cpp:176
WiMOD_SAP_SensorApp::SetSensorAppConfig
virtual TWiMODLRResultCodes SetSensorAppConfig(const TWiMODLR_SensorApp_Config *config, UINT8 *statusRsp)
Sets a new SensorApp configuration to the WiMOD.
Definition: WiMOD_SAP_SensorApp.cpp:88
TWiMODLR_SensorApp_Config
Structure containing a general RadioLink HCI message.
Definition: WiMOD_SAP_SensorApp_IDs.h:121
TWiMODLR_SensorApp_AckSensorData
Structure containing the data of an Ack of the SensorApp.
Definition: WiMOD_SAP_SensorApp_IDs.h:164
TWiMODLR_SensorApp_SensorData
Structure containing SensorApp Data information.
Definition: WiMOD_SAP_SensorApp_IDs.h:137
TWiMODLR_HCIMessage::Length
UINT16 Length
Definition: WiMODLRHCI.h:123
TWiMODLR_HCIMessage::MsgID
UINT8 MsgID
Definition: WiMODLRHCI.h:129
TSensorApp_Mode
TSensorApp_Mode
SensorApp Modes.
Definition: WiMOD_SAP_SensorApp_IDs.h:111
TWiMODLR_SensorApp_SensorData::DestDevAddress
UINT16 DestDevAddress
Definition: WiMOD_SAP_SensorApp_IDs.h:142
TWiMODLR_HCIMessage::Payload
UINT8 Payload[WIMODLR_HCI_MSG_PAYLOAD_SIZE]
Definition: WiMODLRHCI.h:132
WiMOD_SAP_SensorApp::WiMOD_SAP_SensorApp
WiMOD_SAP_SensorApp(TWiMODLRHCI *hci, UINT8 *buffer, UINT16 bufferSize)
Constructor.
Definition: WiMOD_SAP_SensorApp.cpp:62
TWiMODLR_SensorApp_Config::Mode
TSensorApp_Mode Mode
Definition: WiMOD_SAP_SensorApp_IDs.h:126
TWiMODLR_SensorApp_SensorData::DigitalInputs
UINT8 DigitalInputs
Definition: WiMOD_SAP_SensorApp_IDs.h:149
TWiMODLR_SensorApp_AckSensorData::RxTime
UINT32 RxTime
Definition: WiMOD_SAP_SensorApp_IDs.h:178
TSensorAppAckIndicationCallback
void(* TSensorAppAckIndicationCallback)(TWiMODLR_HCIMessage &rxMsg)
Definition: WiMOD_SAP_SensorApp.h:84
TWiMODLR_SensorApp_AckSensorData::SourceGroupAddress
UINT8 SourceGroupAddress
Definition: WiMOD_SAP_SensorApp_IDs.h:170
TWiMODLR_SensorApp_SensorData::DestGroupAddress
UINT8 DestGroupAddress
Definition: WiMOD_SAP_SensorApp_IDs.h:141
TWiMODLR_SensorApp_SensorData::RSSI
INT16 RSSI
Definition: WiMOD_SAP_SensorApp_IDs.h:152
WiMODLR_RESULT_PAYLOAD_PTR_ERROR
@ WiMODLR_RESULT_PAYLOAD_PTR_ERROR
Definition: WiMODLRHCI.h:153
TWiMODLR_SensorApp_SensorData::Voltage
UINT16 Voltage
Definition: WiMOD_SAP_SensorApp_IDs.h:146
WiMOD_SAP_SensorApp_IDs.h
TWiMODLR_SensorApp_AckSensorData::RSSI
INT16 RSSI
Definition: WiMOD_SAP_SensorApp_IDs.h:176
TSensorAppSensorDataIndicationCallback
void(* TSensorAppSensorDataIndicationCallback)(TWiMODLR_HCIMessage &rxMsg)
Definition: WiMOD_SAP_SensorApp.h:87
TWiMODLR_SensorApp_SensorData::RxTime
UINT32 RxTime
Definition: WiMOD_SAP_SensorApp_IDs.h:154
TWiMODLR_SensorApp_SensorData::SourceGroupAddress
UINT8 SourceGroupAddress
Definition: WiMOD_SAP_SensorApp_IDs.h:143
TWiMODLR_SensorApp_AckSensorData::SNR
INT8 SNR
Definition: WiMOD_SAP_SensorApp_IDs.h:177
TWiMODLR_SensorApp_AckSensorData::StatusFormat
UINT8 StatusFormat
Definition: WiMOD_SAP_SensorApp_IDs.h:167
SENSORAPP_FORMAT_EXT_HCI_OUT_ACTIVE
#define SENSORAPP_FORMAT_EXT_HCI_OUT_ACTIVE
Definition: WiMOD_SAP_SensorApp_IDs.h:81
TWiMODLRResultCodes
TWiMODLRResultCodes
Result codes for the local serial communication itself.
Definition: WiMODLRHCI.h:149
WiMOD_SAP_SensorApp::GetSensorAppConfig
virtual TWiMODLRResultCodes GetSensorAppConfig(TWiMODLR_SensorApp_Config *config, UINT8 *statusRsp)
Gets the current SensorApp configuration from the WiMOD.
Definition: WiMOD_SAP_SensorApp.cpp:128
SENSORAPP_SAP_ID
#define SENSORAPP_SAP_ID
Definition: WiMOD_SAP_SensorApp_IDs.h:52
TWiMODLR_SensorApp_Config::LinkTimeout
UINT32 LinkTimeout
Definition: WiMOD_SAP_SensorApp_IDs.h:129
TWiMODLR_SensorApp_SensorData::SNR
INT8 SNR
Definition: WiMOD_SAP_SensorApp_IDs.h:153
TWiMODLR_SensorApp_SensorData::OptionalInfoAvaiable
bool OptionalInfoAvaiable
Definition: WiMOD_SAP_SensorApp_IDs.h:157
WiMOD_SAP_SensorApp
Implementation for the ServiceAccessPoint SensorApp (LR-Base_PLUS firmware only)
Definition: WiMOD_SAP_SensorApp.h:101
TWiMODLR_SensorApp_AckSensorData::OptionalInfoAvaiable
bool OptionalInfoAvaiable
Definition: WiMOD_SAP_SensorApp_IDs.h:181
TWiMODLR_SensorApp_Config::Options
UINT8 Options
Definition: WiMOD_SAP_SensorApp_IDs.h:127
TWiMODLR_SensorApp_Config::SendingPeriod
UINT32 SendingPeriod
Definition: WiMOD_SAP_SensorApp_IDs.h:128
WiMOD_SAP_SensorApp::RegisterSensorDataIndClient
virtual void RegisterSensorDataIndClient(TSensorAppSensorDataIndicationCallback cb)
Register a callback function for the event "SensorApp Data Indication".
Definition: WiMOD_SAP_SensorApp.cpp:304
TWiMODLR_SensorApp_Config::Status
UINT8 Status
Definition: WiMOD_SAP_SensorApp_IDs.h:124
WiMOD_SAP_SensorApp.h