comparison src/aci2/mfw/mfw_bte.h @ 3:93999a60b835

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
1 /*
2 +-------------------------------------------------------------------+
3 | PROJECT: MMI-Framework (8445) $Workfile:: mfw_bte.h $|
4 | $Author:: NDH $Revision:: 1 $|
5 | CREATED: 17.04.04 $Modtime:: 17.04.04 10:48 $|
6 | STATE : code |
7 +-------------------------------------------------------------------+
8
9
10 MODULE : MFW_BT
11
12 PURPOSE : This module contains the definitions for MFW Bluetooth Management
13
14 */
15
16 #ifndef DEF_MFW_BT_HEADER
17 #define DEF_MFW_BT_HEADER
18
19 #define BT_INTERFACE
20 #include "bta_riviera.h"
21
22 #include "target.h"
23 #include "buildcfg.h"
24
25 #include "bta_api.h"
26 #include "mfw_mfw.h"
27 #include "mfw_win.h"
28
29 typedef enum {
30 MFW_BT_UNKNOWN_DEVICE = -8,
31 MFW_BT_DATA_BASE_FULL = -7,
32 MFW_BT_NOT_INITIALISED = -6,
33 MFW_BT_FAILED_TO_STORE_EVENT = -5,
34 MFW_BT_INVALID_DATA = -4,
35 MFW_BT_INVALID_EVENT = -3,
36 MFW_BT_INVALID_ORIG = -2,
37 MFW_BT_UNABLE_TO_CREATE_EVT_BUF = -1,
38 MFW_BT_FAIL = 0,
39 MFW_BT_SUCCESS = 1
40 } T_MFW_BT_STATUS;
41
42
43
44 typedef enum
45 {
46 MFW_BT_DEFAULT_VIS = -1,
47 MFW_BT_SHOWN = BTA_DM_GENERAL_DISC,
48 MFW_BT_HIDDEN = BTA_DM_NON_DISC
49 }T_MFW_STARTUP_VISIBILITY;
50
51
52
53 /*
54 ** Debug Macros : These will enable easy enabling/disabling of tracing within the Bluetooth environment
55 */
56 #define MFW_BT_DEBUG 1
57
58 #ifdef MFW_BT_DEBUG
59
60 #define MFW_BT_TRACE(a) TRACE_EVENT(a)
61 #define MFW_BT_TRACE_P1(s, a) TRACE_EVENT_P1(s, a)
62 #define MFW_BT_TRACE_P2(s, a, b) TRACE_EVENT_P2(s, a, b)
63 #define MFW_BT_TRACE_P3(s, a, b, c) TRACE_EVENT_P3(s, a, b, c)
64 #define MFW_BT_TRACE_P4(s, a, b, c, d) TRACE_EVENT_P4(s, a, b, c, d)
65 #define MFW_BT_TRACE_P5(s, a, b, c, d, e) TRACE_EVENT_P5(s, a, b, c, d, e)
66 #define MFW_BT_TRACE_P6(s, a, b, c, d, e, f) TRACE_EVENT_P6(s, a, b, c, d, e, f)
67 #define MFW_BT_TRACE_P7(s, a, b, c, d, e, f, g) TRACE_EVENT_P7(s, a, b, c, d, e, f, g)
68 #define MFW_BT_TRACE_P8(s, a, b, c, d, e, f, g, h) TRACE_EVENT_P8(s, a, b, c, d, e, f, g, h)
69 #define MFW_BT_TRACE_P9(s, a, b, c, d, e, f, g, h, i) TRACE_EVENT_P9(s, a, b, c, d, e, f, g, h, i)
70
71 #else
72
73 #define MFW_BT_TRACE(a)
74 #define MFW_BT_TRACE_P1(s, a)
75 #define MFW_BT_TRACE_P2(s, a, b)
76 #define MFW_BT_TRACE_P3(s, a, b, c)
77 #define MFW_BT_TRACE_P4(s, a, b, c, d)
78 #define MFW_BT_TRACE_P5(s, a, b, c, d, e)
79 #define MFW_BT_TRACE_P6(s, a, b, c, d, e, f)
80 #define MFW_BT_TRACE_P7(s, a, b, c, d, e, f, g)
81 #define MFW_BT_TRACE_P8(s, a, b, c, d, e, f, g, h)
82 #define MFW_BT_TRACE_P9(s, a, b, c, d, e, f, g, h, i)
83
84 #endif
85
86
87 /*
88 ** Status return values : The Bluetooth module will use meaningful return values to the functions so the software
89 ** can be engineered to react appropriately to specific events
90 */
91
92
93
94 /**********************************************************************************************
95 **
96 ** Mfw -> BMI Interface (Event related definitions)
97 **
98 **********************************************************************************************/
99
100 /*
101 * Events are organised as bitmaps
102 */
103 #define E_BT_ENABLE_CMPL (T_MFW_EVENT)0x00000001
104 #define E_BT_DISABLE_CMPL (T_MFW_EVENT)0x00000002
105
106 #define E_BT_ALL_GENERIC_SERVICES (T_MFW_EVENT)0x0000000F
107
108
109 #define E_BT_ALL_SERVICES ( (T_MFW_EVENT)(E_BT_ALL_GENERIC_SERVICES) \
110 | (T_MFW_EVENT)(E_BT_ALL_DM_SERVICES))
111 /*#if 0 Not Implemented yet
112 | (T_MFW_EVENT)(E_BT_ALL_DG_SERVICES) \
113 | (T_MFW_EVENT)(E_BT_ALL_AG_SERVICES) \
114 | (T_MFW_EVENT)(E_BT_ALL_OP_SERVICES) \
115 | (T_MFW_EVENT)(E_BT_ALL_FT_SERVICES) \
116 #endif
117 */
118
119 /*
120 ** Signal Parameter Structure Definitions
121 */
122 typedef struct {
123 BOOL Success;
124 } T_MFW_BT_ENABLE_CMPL;
125
126
127
128 #include "mfw_bt_dm.h"
129 #include "mfw_bt_dg.h"
130 #include "mfw_bt_ag.h"
131 #include "mfw_bt_op.h"
132 #include "mfw_bt_ft.h"
133 /*
134 * BT Mfw -> BMI signal parameter
135 */
136 typedef union
137 {
138 /*
139 ** Generic Service Signal Parameters
140 */
141 T_MFW_BT_ENABLE_CMPL enable_cmpl;
142
143 /*
144 ** Device Manager Signal Parameters
145 */
146 T_MFW_BT_DM_LINK_UP link_up;
147 T_MFW_BT_DM_LINK_DOWN link_down;
148 T_MFW_BT_DM_INQ_RES inq_res;
149 T_MFW_BT_DM_INQ_CMPL inq_cmpl;
150 T_MFW_BT_DM_DISC_RES disc_res;
151 T_MFW_BT_DM_PIN_REQ pin_req;
152 T_MFW_BT_DM_AUTH_CMPL auth_cmpl;
153 T_MFW_BT_DM_AUTHORIZE_REQ authorize_req;
154 T_MFW_BT_DM_SIG_STRENGTH_IND sig_strength_ind;
155
156 }
157 T_MFW_BT_PARA;
158
159 /*
160 * BT Control Block
161 */
162 typedef struct
163 {
164 T_MFW_EVENT emask; /* events of interest */
165 T_MFW_EVENT event; /* current event */
166 T_MFW_CB handler;
167 T_MFW_BT_PARA para;
168 } T_MFW_BT;
169
170
171 void mfw_bt_signal(T_MFW_EVENT event, void *para);
172
173
174 /*******************************************************************************
175
176 $Function: mfw_bt_enable
177
178 $Description: This function will start the whole process of enabling Bluetooth.
179
180 $Returns: MFW_BT_FAIL if the chip is not stopped or if the generic event handler
181 doesn't start correctly.
182
183 $Arguments: Specify the visibility parameter at start-up.
184 MFW_BT_DEFAULT => use value in flash
185 MFW_BT_SHOWN => device will be visible ( that doesn't update the flash )
186 MFW_BT_HIDDEN => device will be hidden ( ... )
187
188 *******************************************************************************/
189 T_MFW_BT_STATUS mfw_bt_enable(T_MFW_STARTUP_VISIBILITY startup_visibility );
190
191 /* */
192 /*******************************************************************************
193
194 $Function: mfw_bt_enable_cb
195
196 $Description: mfw_bt_enable will cause a BTA_DM_SYS_START_EVT to be sent. At this
197 moment we call BTA_EnableBluetooth. When we receive
198 BTA_DM_ENABLE_EVT, we call this function.
199
200 $Returns: Will send a BMI signal if there is no default name. If the user cancels the
201 input, BT will then be stopped.
202 Will send a E_BT_ENABLE_CMPL event when the initialization is done.
203
204 $Arguments: none
205
206 *******************************************************************************/
207 void mfw_bt_enable_cb(void);
208
209 /*******************************************************************************
210 $Function: mfw_bt_disable
211 $Description: This function stops the BT system.
212 $Returns: None
213 $Arguments:
214 *******************************************************************************/
215 void mfw_bt_disable(void);
216
217
218 /*******************************************************************************
219 $Function: mfw_bt_init
220 $Description: This function initialises the Mfw Bluetooth Persistent Data on Power Up.
221 $Returns: None
222 $Arguments: None
223 *******************************************************************************/
224 void mfw_bt_init(void);
225 /*******************************************************************************
226 $Function: mfw_bt_exit
227 $Description: This function will tidy up any resources used by the Mfw Bluetooth Module
228 on Power Down
229 $Returns: None
230 $Arguments: None
231 *******************************************************************************/
232 void mfw_bt_exit(void);
233 /*******************************************************************************
234 $Function: mfw_bt_create
235 $Description: This function initialises an Mfw Bluetooth entity and adds it to the Window Stack
236 $Returns: T_MFW_HND : A handle for the entity
237 $Arguments: T_MFW_HND : Parent Window Handle
238 T_MFW_EVENT : Event Mask of the events to be handled
239 T_MFW_CB : Callback function to handle the events
240 *******************************************************************************/
241 T_MFW_HND mfw_bt_create(T_MFW_HND hWin, T_MFW_EVENT event, T_MFW_CB cbfunc);
242 /*******************************************************************************
243 $Function: mfw_bt_delete
244 $Description: This function clears down an Mfw Bluetooth entity and removes it from the
245 Window Stack
246 $Returns: T_MFW_RES : The result of the function
247 $Arguments: T_MFW_HND : The Handle of the entity to be removed
248 *******************************************************************************/
249 T_MFW_RES mfw_bt_delete(T_MFW_HND hnd);
250 /*******************************************************************************
251 $Function: mfw_bt_signal
252 $Description: This function sends the Mfw Bluetooth events from the Mfw to the BMI.
253 $Returns: None
254 $Arguments: T_MFW_EVENT : The event to be sent to the BMI
255 void * : Pointer to the Event data
256 *******************************************************************************/
257 void mfw_bt_signal(T_MFW_EVENT event, void *para);
258 /*******************************************************************************
259 $Function: mfw_bt_sign_exec
260 $Description: This function sends the Mfw Bluetooth events from the Mfw to the BMI.
261 $Returns: None
262 $Arguments: None
263 *******************************************************************************/
264 BOOL mfw_bt_sign_exec (T_MFW_HDR * cur_elem, T_MFW_EVENT event, T_MFW_BT_PARA * para);
265
266 #endif
267