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

WiMOD_SAP_Trace.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
31 //------------------------------------------------------------------------------
32
33
34 #ifndef ARDUINO_SAP_WIMOD_SAP_TRACE_H_
35 #define ARDUINO_SAP_WIMOD_SAP_TRACE_H_
36
37 //------------------------------------------------------------------------------
38 //
39 // Section Includes Files
40 //
41 //------------------------------------------------------------------------------
42
43
44 //------------------------------------------------------------------------------
45 //
46 // Section Includes Files
47 //
48 //------------------------------------------------------------------------------
49
50 #include "WiMOD_SAP_Trace_IDs.h"
51 #include "../HCI/WiMODLRHCI.h"
52
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 //
65 // types for callback functions
66 //
67 //-----------------------------------------------------------------------------l
68
69 // C++11 check
70 #ifdef WIMOD_USE_CPP11
71 /* C++11 function callback definitions */
72
74 typedef std::function<void (TWiMODLR_HCIMessage& rxMsg)> TWiMODLRTraceStringEvtCallback;
75
76
78 typedef std::function<void (TWiMODLR_HCIMessage& rxMsg)> TWiMODLRTraceSingleU16EvtCallback;
79
81 typedef std::function<void (TWiMODLR_HCIMessage& rxMsg)> TWiMODLRTraceDoubleU16EvtCallback;
82
84 typedef std::function<void (TWiMODLR_HCIMessage& rxMsg)> TWiMODLRTraceBufferU8Callback;
85
87 typedef std::function<void (TWiMODLR_HCIMessage& rxMsg)> TWiMODLRTraceSingleU32EvtCallback;
88
89 #else
90 /* pre C++11 function callback definitions */
91
92 typedef void (*TWiMODLRTraceStringEvtCallback)(TWiMODLR_HCIMessage& rxMsg);
93 typedef void (*TWiMODLRTraceSingleU16EvtCallback)(TWiMODLR_HCIMessage& rxMsg);
94 typedef void (*TWiMODLRTraceDoubleU16EvtCallback)(TWiMODLR_HCIMessage& rxMsg);
95 typedef void (*TWiMODLRTraceBufferU8Callback)(TWiMODLR_HCIMessage& rxMsg);
96 typedef void (*TWiMODLRTraceSingleU32EvtCallback)(TWiMODLR_HCIMessage& rxMsg);
97
98 #endif
99
100
101 #define TRACE_DBG_STRING_EVENT_IND 0x01
102 #define TRACE_DBG_SIGNLE_UINT16_EVENT_IND 0x02
103 #define TRACE_DBG_DOUBLE_UINT16_EVENT_IND 0x03
104 #define TRACE_DBG_BUFFER_UINT8_EVENT_IND 0x04
105 #define TRACE_DBG_SINGLE_UINT32_EVENT_IND 0x05
106
107
109
110 //------------------------------------------------------------------------------
111 //
112 // Section class
113 //
114 //------------------------------------------------------------------------------
115
116
122 class WiMOD_SAP_Trace {
123 public:
124
125 WiMOD_SAP_Trace(TWiMODLRHCI* hci, UINT8* buffer, UINT16 bufferSize);
126 ~WiMOD_SAP_Trace(void);
127
128 void RegisterStringClient(TWiMODLRTraceStringEvtCallback cb);
129 void RegisterSingleU16Client(TWiMODLRTraceSingleU16EvtCallback cb);
130 void RegisterDoubleU16Client(TWiMODLRTraceDoubleU16EvtCallback cb);
131 void RegisterBufU8Client(TWiMODLRTraceBufferU8Callback cb);
132 void RegisterSingleU32Client(TWiMODLRTraceSingleU32EvtCallback cb);
133
134 void DispatchTraceMessage(TWiMODLR_HCIMessage& rxMsg);
135
136 protected:
138
140 private:
142 UINT8* txPayload;
143 UINT16 txPayloadSize;
144
145 TWiMODLRHCI* HciParser;
146
147 TWiMODLRTraceStringEvtCallback StringCallback;
148 TWiMODLRTraceSingleU16EvtCallback SU16Callback;
149 TWiMODLRTraceDoubleU16EvtCallback DU16Callback;
150 TWiMODLRTraceBufferU8Callback U8Callback;
151 TWiMODLRTraceSingleU32EvtCallback SU32Callback;
153 };
154
155
156
157 #endif /* ARDUINO_SAP_WIMOD_SAP_TRACE_H_ */
WiMOD_SAP_Trace.h
TWiMODLRHCI
Internal helper class for processing SLIP frames.
Definition: WiMODLRHCI.h:235
TWiMODLR_HCIMessage
basic low level HCI message structure used for all serial messages to/from WiMOD
Definition: WiMODLRHCI.h:120
WiMOD_SAP_Trace_IDs.h
TWiMODLR_HCIMessage::MsgID
UINT8 MsgID
Definition: WiMODLRHCI.h:129
WiMOD_SAP_Trace
Definition: WiMOD_SAP_Trace.h:122