comparison g23m/condat/ms/src/mfw/mfw_bt_op.c @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 /*
2 +-------------------------------------------------------------------+
3 | PROJECT: MMI-Framework (8445) $Workfile:: mfw_bt_op.c $|
4 | $Author:: NDH $Revision:: 1 $|
5 | CREATED: 22.04.04 $Modtime:: 22.04.04 11:16 $|
6 | STATE : code |
7 +-------------------------------------------------------------------+
8
9
10 MODULE : MFW_BT_OP
11
12 PURPOSE : This module contains the functions for MFW Bluetooth Object Push Profile
13
14
15 */
16
17 #define ENTITY_MFW
18
19 #include <string.h>
20
21 #if defined (NEW_FRAME)
22
23 #include "typedefs.h"
24 #include "vsi.h"
25 #include "pei.h"
26 #include "custom.h"
27 #include "gsm.h"
28
29 #else
30
31 #include "STDDEFS.H"
32 #include "custom.h"
33 #include "gsm.h"
34 #include "vsi.h"
35
36 #endif
37 #include "bta_riviera.h"
38
39 #include "mfw_bte.h"
40 #include "mfw_bt_op.h"
41 #include "mfw_bt_geh.h"
42
43
44 /*******************************************************************************
45
46 $Function: mfw_bt_op_init
47
48 $Description: Start the OPP subsystem.
49
50 $Returns: T_MFW_BT_STATUS
51
52 $Arguments: none
53
54 *******************************************************************************/
55 T_MFW_BT_STATUS mfw_bt_op_init( void )
56 {
57 MFW_BT_TRACE("mfw_bt_op_init: starting the OPP BT subsystem.");
58 return MFW_BT_SUCCESS;
59 }
60
61
62 /*
63 ** MFW Bluetooth Object Push Callback Function Definitions
64 */
65 /*******************************************************************************
66
67 $Function: mfw_bt_opc_cb
68
69 $Description: This is the Object Push Client Callback function, a pointer to it is passed
70 to the Bluetooth Module in the BTA OPC Enable function and it is
71 used to return information from the Bluetooth Module
72
73 $Returns: None
74
75 $Arguments: event : Event Id returned from the Bluetooth Module
76 data : pointer to the relevant data returned from the Mluetooth Module
77
78 *******************************************************************************/
79 void mfw_bt_opc_cb(T_MFW_BT_OPC_EVT event, T_MFW_BT_OPC_SIG_DATA *data)
80 {
81 int dataLen;
82 T_MFW_BT_STATUS geRetVal = MFW_BT_SUCCESS;
83
84 MFW_BT_TRACE("mfw_bt_opc_cb");
85
86 /*
87 ** Set the expected data size according to the received event
88 */
89 switch (event)
90 {
91 case BTA_OPC_ENABLE_EVT:
92 case BTA_OPC_OPEN_EVT:
93 dataLen = 0;
94 break;
95
96 #if 0
97 case BTA_OPC_PROGRESS_EVT:
98 dataLen = sizeof(tBTA_OPC_PROGRESS); /* This structure is in the BTA interface document, but not in the header files!!! */
99 break;
100 #endif
101
102 case BTA_OPC_OBJECT_EVT:
103 dataLen = sizeof(tBTA_OPC_OBJECT);
104 break;
105
106 case BTA_OPC_CLOSE_EVT:
107 dataLen = sizeof(tBTA_OPC_STATUS);
108 break;
109
110 default:
111 /*
112 ** Unexpected Event, setthe data sized to -1 to exit with no further action
113 */
114 MFW_BT_TRACE_P1("mfw_bt_opc_cb > Unexpected Event %d", event);
115 dataLen = -1;
116
117 }
118
119
120 if (dataLen > 0)
121 {
122 /*
123 ** Data is expected with the received signal
124 */
125 if ((void *)data == (void *)0)
126 {
127 /*
128 ** The data pointer is NULL, report the error
129 */
130 MFW_BT_TRACE_P1("mfw_bt_opc_cb > Event : %d, Data Pointer is NULL, but data is expected", event);
131 }
132 else
133 {
134 /*
135 ** Post the event and data to the Generic event handler
136 */
137 geRetVal = mfw_bt_ge_post_event(MFW_BT_OPC, (ULONG)event, (void *)data, dataLen);
138 }
139 }
140 else if (dataLen == 0)
141 {
142 /*
143 ** There is no expected data with the received signal, post the event to the Generic event handler
144 */
145 geRetVal = mfw_bt_ge_post_event(MFW_BT_OPC, (ULONG)event, (void *)0, 0);
146 }
147
148 if (geRetVal != MFW_BT_SUCCESS)
149 {
150 /*
151 ** There is an error, but there is nothing that can be done other than to report it.
152 */
153 MFW_BT_TRACE_P1("mfw_bt_opc_cb > Failed to post the event. Error %d", geRetVal);
154 }
155
156 return;
157 }
158
159 /*******************************************************************************
160
161 $Function: mfw_bt_ops_cb
162
163 $Description: This is the Object Push Server Callback function, a pointer to it is passed
164 to the Bluetooth Module in the BTA OPS Enable function and it is
165 used to return information from the Bluetooth Module
166
167 $Returns: None
168
169 $Arguments: event : Event Id returned from the Bluetooth Module
170 data : pointer to the relevant data returned from the Mluetooth Module
171
172 *******************************************************************************/
173 void mfw_bt_ops_cb(T_MFW_BT_OPS_EVT event, T_MFW_BT_OPS_SIG_DATA *data)
174 {
175 int dataLen;
176 T_MFW_BT_STATUS geRetVal = MFW_BT_SUCCESS;
177
178 MFW_BT_TRACE("mfw_bt_ops_cb");
179
180 /*
181 ** Set the expected data size according to the received event
182 */
183 switch (event)
184 {
185 case BTA_OPS_ENABLE_EVT:
186 case BTA_OPS_OPEN_EVT:
187 case BTA_OPS_CLOSE_EVT:
188 dataLen = 0;
189 break;
190
191 #if 0
192 case BTA_OPS_PROGRESS_EVT:
193 dataLen = sizeof(tBTA_OPS_PROGRESS); /* This structure is in the BTA interface document, but not in the header files!!! */
194 break;
195 #endif
196
197 case BTA_OPS_OBJECT_EVT:
198 dataLen = sizeof(tBTA_OPS_OBJECT);
199 break;
200
201 #if 0 /* This event is in the BTA interface document, but not in the header files!!! */
202 case BTA_OPS_ACCESS_EVT:
203 dataLen = sizeof(tBTA_OPS_ACCESS); /* This structure is in the BTA interface document, but not in the header files!!! */
204 break;
205 #endif
206
207 default:
208 /*
209 ** Unexpected Event, setthe data sized to -1 to exit with no further action
210 */
211 MFW_BT_TRACE_P1("mfw_bt_ops_cb > Unexpected Event %d", event);
212 dataLen = -1;
213
214 }
215
216
217 if (dataLen > 0)
218 {
219 /*
220 ** Data is expected with the received signal
221 */
222 if ((void *)data == (void *)0)
223 {
224 /*
225 ** The data pointer is NULL, report the error
226 */
227 MFW_BT_TRACE_P1("mfw_bt_ops_cb > Event : %d, Data Pointer is NULL, but data is expected", event);
228 }
229 else
230 {
231 /*
232 ** Post the event and data to the Generic event handler
233 */
234 geRetVal = mfw_bt_ge_post_event(MFW_BT_OPS, (ULONG)event, (void *)data, dataLen);
235 }
236 }
237 else if (dataLen == 0)
238 {
239 /*
240 ** There is no expected data with the received signal, post the event to the Generic event handler
241 */
242 geRetVal = mfw_bt_ge_post_event(MFW_BT_OPS, (ULONG)event, (void *)0, 0);
243 }
244
245 if (geRetVal != MFW_BT_SUCCESS)
246 {
247 /*
248 ** There is an error, but there is nothing that can be done other than to report it.
249 */
250 MFW_BT_TRACE_P1("mfw_bt_ops_cb > Failed to post the event. Error %d", geRetVal);
251 }
252
253 return;
254 }
255
256
257 /*
258 ** MFW Bluetooth Object Push Signal Handler Function Definitions
259 */
260 /*******************************************************************************
261
262 $Function: mfw_bt_opc_hndlr
263
264 $Description: This function recieves the BTA Object Push Client events from the Generic Event Handler
265 and either processes them in their entirety or passes them to the MMI for further
266 processing.
267
268 $Returns: None
269
270 $Arguments: event : Event Id returned from the Bluetooth Module
271 data : pointer to the relevant data returned from the Mluetooth Module
272
273 *******************************************************************************/
274 T_MFW_BT_STATUS mfw_bt_opc_hndlr (T_MFW_BT_OPC_EVT event, T_MFW_BT_OPC_SIG_DATA *data)
275 {
276 T_MFW_BT_STATUS retVal = MFW_BT_SUCCESS;
277
278 MFW_BT_TRACE("mfw_bt_opc_hndlr");
279
280 switch (event)
281 {
282 case BTA_OPC_ENABLE_EVT:
283 MFW_BT_TRACE("mfw_bt_opc_hndlr > BTA_OPC_ENABLE_EVT event received");
284 break;
285
286 case BTA_OPC_OPEN_EVT:
287 MFW_BT_TRACE("mfw_bt_opc_hndlr > BTA_OPC_OPEN_EVT event received");
288 break;
289
290 case BTA_OPC_PROGRESS_EVT:
291 MFW_BT_TRACE("mfw_bt_opc_hndlr > BTA_OPC_PROGRESS_EVT event received");
292 break;
293
294 case BTA_OPC_OBJECT_EVT:
295 MFW_BT_TRACE("mfw_bt_opc_hndlr > BTA_OPC_OBJECT_EVT event received");
296 break;
297
298 case BTA_OPC_CLOSE_EVT:
299 MFW_BT_TRACE("mfw_bt_opc_hndlr > BTA_OPC_CLOSE_EVT event received");
300 break;
301
302 default:
303 /*
304 ** Unexpected Event, setthe data sized to -1 to exit with no further action
305 */
306 MFW_BT_TRACE_P1("mfw_bt_opc_hndlr > Unexpected Event %d", event);
307 retVal = MFW_BT_INVALID_EVENT;
308 }
309
310 return retVal;
311 }
312
313 /*******************************************************************************
314
315 $Function: mfw_bt_ops_hndlr
316
317 $Description: This function recieves the BTA Object Push Server events from the Generic Event Handler
318 and either processes them in their entirety or passes them to the MMI for further
319 processing.
320
321 $Returns: None
322
323 $Arguments: event : Event Id returned from the Bluetooth Module
324 data : pointer to the relevant data returned from the Mluetooth Module
325
326 *******************************************************************************/
327 T_MFW_BT_STATUS mfw_bt_ops_hndlr (T_MFW_BT_OPS_EVT event, T_MFW_BT_OPS_SIG_DATA *data)
328 {
329 T_MFW_BT_STATUS retVal = MFW_BT_SUCCESS;
330
331 MFW_BT_TRACE("mfw_bt_ops_hndlr");
332
333 switch (event)
334 {
335 case BTA_OPS_ENABLE_EVT:
336 MFW_BT_TRACE("mfw_bt_ops_hndlr > BTA_OPS_ENABLE_EVT event received");
337 break;
338
339 case BTA_OPS_OPEN_EVT:
340 MFW_BT_TRACE("mfw_bt_ops_hndlr > BTA_OPS_OPEN_EVT event received");
341 break;
342
343 case BTA_OPS_CLOSE_EVT:
344 MFW_BT_TRACE("mfw_bt_ops_hndlr > BTA_OPS_CLOSE_EVT event received");
345 break;
346
347 case BTA_OPS_PROGRESS_EVT:
348 MFW_BT_TRACE("mfw_bt_ops_hndlr > BTA_OPS_PROGRESS_EVT event received");
349 break;
350
351 case BTA_OPS_OBJECT_EVT:
352 MFW_BT_TRACE("mfw_bt_ops_hndlr > BTA_OPS_OBJECT_EVT event received");
353 break;
354
355 #if 0 /* This event is in the BTA interface document, but not in the header files!!! */
356 case BTA_OPS_ACCESS_EVT:
357 MFW_BT_TRACE("mfw_bt_ops_hndlr > event received");
358 break;
359 #endif
360
361 default:
362 /*
363 ** Unexpected Event, setthe data sized to -1 to exit with no further action
364 */
365 MFW_BT_TRACE_P1("mfw_bt_ops_hndlr > Unexpected Event %d", event);
366 retVal = MFW_BT_INVALID_EVENT;
367 }
368
369 return retVal;
370 }
371