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

- Main Page
- Classes
- Files

- File List
- File Members

WiMOD_SAP_RadioLink.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
31 //------------------------------------------------------------------------------
32
33
34 /*
35 * THIS IS AN EXAMPLE IMPLEMENTATION ACCORDING THE THE HCI SPEC: V1.8
36 * FOR FIRMWARE: LR-BASE
37 *
38 * SEE FILE: WiMOD_LR_Base_HCI_Spec_V1_8.pdf for detailed information
39 */
40
41
42
43 #ifndef ARDUINO_SAP_WIMOD_SAP_RADIOLINK_H_
44 #define ARDUINO_SAP_WIMOD_SAP_RADIOLINK_H_
45
46 //------------------------------------------------------------------------------
47 //
48 // Section Includes Files
49 //
50 //------------------------------------------------------------------------------
51
52 #include "WiMOD_SAP_RadioLink_IDs.h"
53 #include "../HCI/WiMODLRHCI.h"
54
55 /*
56 * C++11 supports a better way for function pointers / function objects
57 * But C++11 mode is not supported by all platforms.
58 */
59 #ifdef WIMOD_USE_CPP11
60 #include <functional>
61 #endif
62 //------------------------------------------------------------------------------
63 //
64 // Section defines
65 //
66 //------------------------------------------------------------------------------
67
69 #define WiMOD_RADIOLINK_MSG_SIZE (WiMODLRBASE_APP_PAYLOAD_LEN)
70
72
73
74 //-----------------------------------------------------------------------------
75 //
76 // types for callback functions
77 //
78 //-----------------------------------------------------------------------------
79
80
81 // C++11 check
82 #ifdef WIMOD_USE_CPP11
83 /* C++11 function callback definitions */
84
86 typedef std::function<void (TWiMODLR_HCIMessage& rxMsg)> TRadioLinkUDataRxIndicationCallback;
87
89 typedef std::function<void (void)> TRadioLinkUDataTxIndicationCallback;
90
92 typedef std::function<void (TWiMODLR_HCIMessage& rxMsg)> TRadioLinkRawDataRxIndicationCallback;
93
95 typedef std::function<void (TWiMODLR_HCIMessage& rxMsg)> TRadioLinkCDataRxIndicationCallback;
96
98 typedef std::function<void (TWiMODLR_HCIMessage& rxMsg)> TRadioLinkCDataTxIndicationCallback;
99
101 typedef std::function<void (TWiMODLR_HCIMessage& rxMsg)> TRadioLinkAckRxIndicationCallback;
102
104 typedef std::function<void (void)> TRadioLinkAckRxTimeoutIndicationCallback;
105
107 typedef std::function<void (void)> TRadioLinkAckTxIndicationCallback;
108
109 #else
110 /* pre C++11 function callback definitions */
111
112
113
115 typedef void (*TRadioLinkUDataRxIndicationCallback)(TWiMODLR_HCIMessage& rxMsg);
116
118 typedef void (*TRadioLinkUDataTxIndicationCallback)(void);
119
121 typedef void (*TRadioLinkRawDataRxIndicationCallback)(TWiMODLR_HCIMessage& rxMsg);
122
124 typedef void (*TRadioLinkCDataRxIndicationCallback)(TWiMODLR_HCIMessage& rxMsg);
125
127 typedef void (*TRadioLinkCDataTxIndicationCallback)(TWiMODLR_HCIMessage& rxMsg);
128
130 typedef void (*TRadioLinkAckRxIndicationCallback)(TWiMODLR_HCIMessage& rxMsg);
131
133 typedef void (*TRadioLinkAckRxTimeoutIndicationCallback)(void);
134
136 typedef void (*TRadioLinkAckTxIndicationCallback)(void);
137
138 #endif
139
140
141 //------------------------------------------------------------------------------
142 //
143 // Section class
144 //
145 //------------------------------------------------------------------------------
146
147
151 class WiMOD_SAP_RadioLink {
152 public:
153 WiMOD_SAP_RadioLink(TWiMODLRHCI* hci, UINT8* buffer, UINT16 bufferSize);
154 ~WiMOD_SAP_RadioLink(void);
155
156 TWiMDLRResultCodes SendUData(const TWiMODLR_RadioLink_Msg* txMsg, UINT8* statusRsp);
157 bool convert(TWiMODLR_HCIMessage& RxMsg, TWiMODLR_RadioLink_Msg* radioLinkMsg);
158 TWiMDLRResultCodes SendCData(const TWiMODLR_RadioLink_Msg* txMsg, UINT8* statusRsp);
159 bool convert(TWiMODLR_HCIMessage& RxMsg, TWiMODLR_RadioLink_CdataInd* cDataTxInfo);
160 bool convert(TWiMODLR_HCIMessage& RxMsg, TWiMODLR_AckTxInd_Msg* txAckIndInfo);
161 TWiMDLRResultCodes SetAckData(const TWiMODLR_RadioLink_Msg* txMsg, UINT8* statusRsp);
162
163 void RegisterUDataRxClient(TRadioLinkUDataRxIndicationCallback cb);
164 void RegisterUDataTxClient(TRadioLinkUDataTxIndicationCallback cb);
165 void RegisterRawDataRxClient(TRadioLinkRawDataRxIndicationCallback cb);
166 void RegisterCDataRxClient(TRadioLinkCDataRxIndicationCallback cb);
167 void RegisterCDataTxClient(TRadioLinkCDataTxIndicationCallback cb);
168 void RegisterAckRxClient(TRadioLinkAckRxIndicationCallback cb);
169 void RegisterAckRxTimeoutClient(TRadioLinkAckRxTimeoutIndicationCallback cb);
170 void RegisterAckTxCallback(TRadioLinkAckTxIndicationCallback cb);
171
172 void DispatchRadioLinkMessage(TWiMODLR_HCIMessage& rxMsg);
173
174 protected:
175
176 private:
178 UINT8* txPayload;
179 UINT16 txPayloadSize;
180
181 TWiMODLRHCI* HciParser;
182
183
184 TRadioLinkUDataRxIndicationCallback UDataRxIndCallback;
185 TRadioLinkUDataTxIndicationCallback UDataTxIndCallback;
186 TRadioLinkRawDataRxIndicationCallback RawDataRxIndCallback;
187 TRadioLinkCDataRxIndicationCallback CDataRxIndCallback;
188 TRadioLinkCDataTxIndicationCallback CDataTxIndCallback;
189 TRadioLinkAckRxIndicationCallback AckRxDataIndCallback;
190 TRadioLinkAckRxTimeoutIndicationCallback AckRxTimeoutIndCallback;
191 TRadioLinkAckTxIndicationCallback AckTxIndCallack;
193 };
194
195
196
197 #endif /* ARDUINO_SAP_WIMOD_SAP_RADIOLINK_H_ */
WiMOD_SAP_RadioLink::RegisterUDataRxClient
void RegisterUDataRxClient(TRadioLinkUDataRxIndicationCallback cb)
Register a callback function for the RX U-Data Indication - optional -.
Definition: WiMOD_SAP_RadioLink.cpp:379
TWiMODLR_RadioLink_CdataInd
Structure containing information about a C-Data indication (TX only)
Definition: WiMOD_SAP_RadioLink_IDs.h:179
TRadioLinkAckRxTimeoutIndicationCallback
void(* TRadioLinkAckRxTimeoutIndicationCallback)(void)
Definition: WiMOD_SAP_RadioLink.h:133
WiMOD_SAP_RadioLink::WiMOD_SAP_RadioLink
WiMOD_SAP_RadioLink(TWiMODLRHCI *hci, UINT8 *buffer, UINT16 bufferSize)
Constructor.
Definition: WiMOD_SAP_RadioLink.cpp:67
TRadioLinkCDataTxIndicationCallback
void(* TRadioLinkCDataTxIndicationCallback)(TWiMODLR_HCIMessage &rxMsg)
Definition: WiMOD_SAP_RadioLink.h:127
TWiMDLRResultCodes
TWiMDLRResultCodes
Result codes for the local serial communication itself.
Definition: WiMODLRHCI.h:149
WiMOD_SAP_RadioLink::RegisterCDataRxClient
void RegisterCDataRxClient(TRadioLinkCDataRxIndicationCallback cb)
Register a callback function for the RX C-Data Indication - optional -.
Definition: WiMOD_SAP_RadioLink.cpp:427
WiMOD_SAP_RadioLink::RegisterAckRxTimeoutClient
void RegisterAckRxTimeoutClient(TRadioLinkAckRxTimeoutIndicationCallback cb)
Register a callback function for the Ack Timeout Indication - optional -.
Definition: WiMOD_SAP_RadioLink.cpp:476
TWiMODLR_HCIMessage
basic low level HCI message structure used for all serial messages to/from WiMOD
Definition: WiMODLRHCI.h:120
WiMOD_SAP_RadioLink::RegisterCDataTxClient
void RegisterCDataTxClient(TRadioLinkCDataTxIndicationCallback cb)
Register a callback function for the TX C-Data Indication - optional -.
Definition: WiMOD_SAP_RadioLink.cpp:444
TWiMODLRHCI
Internal helper class for processing SLIP frames.
Definition: WiMODLRHCI.h:229
TRadioLinkUDataRxIndicationCallback
void(* TRadioLinkUDataRxIndicationCallback)(TWiMODLR_HCIMessage &rxMsg)
Definition: WiMOD_SAP_RadioLink.h:115
WiMOD_SAP_RadioLink::SetAckData
TWiMDLRResultCodes SetAckData(const TWiMODLR_RadioLink_Msg *txMsg, UINT8 *statusRsp)
Sets additional user payload for the next ack frame to send.
Definition: WiMOD_SAP_RadioLink.cpp:334
TWiMODLR_AckTxInd_Msg
Structure containing information about an acknowledgment transmission.
Definition: WiMOD_SAP_RadioLink_IDs.h:189
TWiMODLR_RadioLink_Msg
Structure containing a general RadioLink HCI message.
Definition: WiMOD_SAP_RadioLink_IDs.h:148
WiMOD_SAP_RadioLink::RegisterAckRxClient
void RegisterAckRxClient(TRadioLinkAckRxIndicationCallback cb)
Register a callback function for the RX Ack (+data) Indication - optional -.
Definition: WiMOD_SAP_RadioLink.cpp:461
WiMOD_SAP_RadioLink_IDs.h
Supporting IDs and definitions for the RadioLink ServiceAccessPoint.
WiMOD_SAP_RadioLink
Implementation for the ServiceAccessPoint RadioLink (LR-Base firmware only)
Definition: WiMOD_SAP_RadioLink.h:151
TRadioLinkUDataTxIndicationCallback
void(* TRadioLinkUDataTxIndicationCallback)(void)
Definition: WiMOD_SAP_RadioLink.h:118
WiMOD_SAP_RadioLink::RegisterRawDataRxClient
void RegisterRawDataRxClient(TRadioLinkRawDataRxIndicationCallback cb)
Register a callback function for the RX Raw-Data Indication - optional -.
Definition: WiMOD_SAP_RadioLink.cpp:410
WiMOD_SAP_RadioLink::RegisterAckTxCallback
void RegisterAckTxCallback(TRadioLinkAckTxIndicationCallback cb)
Register a callback function for the TX Ack Indication - optional -.
Definition: WiMOD_SAP_RadioLink.cpp:491
WiMOD_SAP_RadioLink::SendCData
TWiMDLRResultCodes SendCData(const TWiMODLR_RadioLink_Msg *txMsg, UINT8 *statusRsp)
Tries to send transmit C-Data to peer module via RF link.
Definition: WiMOD_SAP_RadioLink.cpp:232
WiMOD_SAP_RadioLink::convert
bool convert(TWiMODLR_HCIMessage &RxMsg, TWiMODLR_RadioLink_Msg *radioLinkMsg)
Convert a received low level HCI-Msg to a high-level RadioLink-Msg.
Definition: WiMOD_SAP_RadioLink.cpp:153
TRadioLinkRawDataRxIndicationCallback
void(* TRadioLinkRawDataRxIndicationCallback)(TWiMODLR_HCIMessage &rxMsg)
Definition: WiMOD_SAP_RadioLink.h:121
TRadioLinkAckTxIndicationCallback
void(* TRadioLinkAckTxIndicationCallback)(void)
Definition: WiMOD_SAP_RadioLink.h:136
WiMOD_SAP_RadioLink::SendUData
TWiMDLRResultCodes SendUData(const TWiMODLR_RadioLink_Msg *txMsg, UINT8 *statusRsp)
Tries to send transmit U-Data to peer module via RF link.
Definition: WiMOD_SAP_RadioLink.cpp:107
WiMOD_SAP_RadioLink::RegisterUDataTxClient
void RegisterUDataTxClient(TRadioLinkUDataTxIndicationCallback cb)
Register a callback function for the TX U-Data Indication - optional -.
Definition: WiMOD_SAP_RadioLink.cpp:393
TRadioLinkAckRxIndicationCallback
void(* TRadioLinkAckRxIndicationCallback)(TWiMODLR_HCIMessage &rxMsg)
Definition: WiMOD_SAP_RadioLink.h:130
TRadioLinkCDataRxIndicationCallback
void(* TRadioLinkCDataRxIndicationCallback)(TWiMODLR_HCIMessage &rxMsg)
Definition: WiMOD_SAP_RadioLink.h:124
WiMOD_SAP_RadioLink::~WiMOD_SAP_RadioLink
~WiMOD_SAP_RadioLink(void)
Destructor.
Definition: WiMOD_SAP_RadioLink.cpp:88