Demo HCI Implementation for WiMOD-LR Devices  V1.3.1
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 
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 
116 
118  typedef void (*TRadioLinkUDataTxIndicationCallback)(void);
119 
122 
125 
128 
131 
134 
136  typedef void (*TRadioLinkAckTxIndicationCallback)(void);
137 
138 #endif
139 
140 
141 //------------------------------------------------------------------------------
142 //
143 // Section class
144 //
145 //------------------------------------------------------------------------------
146 
147 
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 
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_ */
TWiMDLRResultCodes
Result codes for the local serial communication itself.
Definition: WiMODLRHCI.h:149
basic low level HCI message structure used for all serial messages to/from WiMOD
Definition: WiMODLRHCI.h:120
Internal helper class for processing SLIP frames.
Definition: WiMODLRHCI.h:229
Structure containing information about an acknowledgment transmission.
Definition: WiMOD_SAP_RadioLink_IDs.h:189