FreeCalypso > hg > leo2moko-debug
comparison g23m/condat/ms/src/mfw/mfw_bt_ft.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_ft.c $| | |
4 | $Author:: NDH $Revision:: 1 $| | |
5 | CREATED: 22.04.04 $Modtime:: 22.04.04 11:17 $| | |
6 | STATE : code | | |
7 +-------------------------------------------------------------------+ | |
8 | |
9 | |
10 MODULE : MFW_BT_FT | |
11 | |
12 PURPOSE : This module contains the functions for MFW Bluetooth File Transfer 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 | |
38 #include "bta_riviera.h" | |
39 | |
40 #include "mfw_bte.h" | |
41 #include "mfw_bt_ft.h" | |
42 #include "mfw_bt_geh.h" | |
43 | |
44 | |
45 | |
46 /******************************************************************************* | |
47 | |
48 $Function: mfw_bt_ft_init | |
49 | |
50 $Description: Start the FTP subsystem. | |
51 | |
52 $Returns: T_MFW_BT_STATUS | |
53 | |
54 $Arguments: none | |
55 | |
56 *******************************************************************************/ | |
57 T_MFW_BT_STATUS mfw_bt_ft_init( void ) | |
58 { | |
59 MFW_BT_TRACE("mfw_bt_ft_init: starting the FTP BT subsystem."); | |
60 return MFW_BT_SUCCESS; | |
61 } | |
62 | |
63 | |
64 /* | |
65 ** MFW Bluetooth File Transfer Callback Function Definitions | |
66 */ | |
67 /******************************************************************************* | |
68 | |
69 $Function: | |
70 | |
71 $Description: This is the File Transfer Client Callback function, a pointer to it is passed | |
72 to the Bluetooth Module in the BTA FTC Enable function and it is | |
73 used to return information from the Bluetooth Module | |
74 | |
75 $Returns: None | |
76 | |
77 $Arguments: event : Event Id returned from the Bluetooth Module | |
78 data : pointer to the relevant data returned from the Mluetooth Module | |
79 | |
80 *******************************************************************************/ | |
81 void mfw_bt_ftc_cb(T_MFW_BT_FTC_EVT event, T_MFW_BT_FTC_SIG_DATA *data) | |
82 { | |
83 int dataLen; | |
84 T_MFW_BT_STATUS geRetVal = MFW_BT_SUCCESS; | |
85 | |
86 MFW_BT_TRACE("mfw_bt_ftc_cb"); | |
87 | |
88 /* | |
89 ** Set the expected data size according to the received event | |
90 */ | |
91 switch (event) | |
92 { | |
93 case BTA_FTC_ENABLE_EVT: | |
94 case BTA_FTC_CLOSE_EVT: | |
95 dataLen = 0; | |
96 break; | |
97 | |
98 case BTA_FTC_OPEN_EVT: | |
99 dataLen = sizeof(tBTA_FTC_OPEN); | |
100 break; | |
101 | |
102 case BTA_FTC_AUTH_EVT: | |
103 dataLen = sizeof(tBTA_FTC_AUTH); | |
104 break; | |
105 | |
106 case BTA_FTC_LIST_EVT: | |
107 dataLen = sizeof(tBTA_FTC_LIST); | |
108 break; | |
109 | |
110 case BTA_FTC_PROGRESS_EVT: | |
111 dataLen = sizeof(tBTA_FTC_PROGRESS); | |
112 break; | |
113 | |
114 case BTA_FTC_GETFILE_EVT: | |
115 case BTA_FTC_PUTFILE_EVT: | |
116 dataLen = sizeof(tBTA_FTC_STATUS); | |
117 break; | |
118 | |
119 default: | |
120 /* | |
121 ** Unexpected Event, setthe data sized to -1 to exit with no further action | |
122 */ | |
123 MFW_BT_TRACE_P1("mfw_bt_ftc_cb > Unexpected Event %d", event); | |
124 dataLen = -1; | |
125 | |
126 } | |
127 | |
128 | |
129 if (dataLen > 0) | |
130 { | |
131 /* | |
132 ** Data is expected with the received signal | |
133 */ | |
134 if ((void *)data == (void *)0) | |
135 { | |
136 /* | |
137 ** The data pointer is NULL, report the error | |
138 */ | |
139 MFW_BT_TRACE_P1("mfw_bt_ftc_cb > Event : %d, Data Pointer is NULL, but data is expected", event); | |
140 } | |
141 else | |
142 { | |
143 /* | |
144 ** Post the event and data to the Generic event handler | |
145 */ | |
146 geRetVal = mfw_bt_ge_post_event(MFW_BT_FTC, (ULONG)event, (void *)data, dataLen); | |
147 } | |
148 } | |
149 else if (dataLen == 0) | |
150 { | |
151 /* | |
152 ** There is no expected data with the received signal, post the event to the Generic event handler | |
153 */ | |
154 geRetVal = mfw_bt_ge_post_event(MFW_BT_FTC, (ULONG)event, (void *)0, 0); | |
155 } | |
156 | |
157 if (geRetVal != MFW_BT_SUCCESS) | |
158 { | |
159 /* | |
160 ** There is an error, but there is nothing that can be done other than to report it. | |
161 */ | |
162 MFW_BT_TRACE_P1("mfw_bt_ftc_cb > Failed to post the event. Error %d", geRetVal); | |
163 } | |
164 | |
165 return; | |
166 } | |
167 | |
168 /******************************************************************************* | |
169 | |
170 $Function: | |
171 | |
172 $Description: This is the File Transfer Server Callback function, a pointer to it is passed | |
173 to the Bluetooth Module in the BTA FTS Enable function and it is | |
174 used to return information from the Bluetooth Module | |
175 | |
176 $Returns: None | |
177 | |
178 $Arguments: event : Event Id returned from the Bluetooth Module | |
179 data : pointer to the relevant data returned from the Mluetooth Module | |
180 | |
181 *******************************************************************************/ | |
182 void mfw_bt_fts_cb(T_MFW_BT_FTS_EVT event, T_MFW_BT_FTS_SIG_DATA *data) | |
183 { | |
184 int dataLen; | |
185 T_MFW_BT_STATUS geRetVal = MFW_BT_SUCCESS; | |
186 | |
187 MFW_BT_TRACE("mfw_bt_fts_cb"); | |
188 | |
189 /* | |
190 ** Set the expected data size according to the received event | |
191 */ | |
192 switch (event) | |
193 { | |
194 case BTA_FTS_ENABLE_EVT: | |
195 case BTA_FTS_OPEN_EVT: | |
196 case BTA_FTS_CLOSE_EVT: | |
197 dataLen = 0; | |
198 break; | |
199 | |
200 case BTA_FTS_AUTH_EVT: | |
201 dataLen = sizeof(tBTA_FTS_AUTH); | |
202 break; | |
203 | |
204 #if 0 /* These events and their structures are in the BTA interface document, but not in the header files!!! */ | |
205 case BTA_FTS_ACCESS_EVT: | |
206 dataLen = sizeof(tBTA_FTS_ACCESS); | |
207 break; | |
208 | |
209 case BTA_FTS_PROGRESS_EVT: | |
210 dataLen = sizeof(tBTA_FTS_PROGRESS); | |
211 break; | |
212 #endif | |
213 | |
214 default: | |
215 /* | |
216 ** Unexpected Event, setthe data sized to -1 to exit with no further action | |
217 */ | |
218 MFW_BT_TRACE_P1("mfw_bt_fts_cb > Unexpected Event %d", event); | |
219 dataLen = -1; | |
220 | |
221 } | |
222 | |
223 | |
224 if (dataLen > 0) | |
225 { | |
226 /* | |
227 ** Data is expected with the received signal | |
228 */ | |
229 if ((void *)data == (void *)0) | |
230 { | |
231 /* | |
232 ** The data pointer is NULL, report the error | |
233 */ | |
234 MFW_BT_TRACE_P1("mfw_bt_fts_cb > Event : %d, Data Pointer is NULL, but data is expected", event); | |
235 } | |
236 else | |
237 { | |
238 /* | |
239 ** Post the event and data to the Generic event handler | |
240 */ | |
241 geRetVal = mfw_bt_ge_post_event(MFW_BT_FTS, (ULONG)event, (void *)data, dataLen); | |
242 } | |
243 } | |
244 else if (dataLen == 0) | |
245 { | |
246 /* | |
247 ** There is no expected data with the received signal, post the event to the Generic event handler | |
248 */ | |
249 geRetVal = mfw_bt_ge_post_event(MFW_BT_FTS, (ULONG)event, (void *)0, 0); | |
250 } | |
251 | |
252 if (geRetVal != MFW_BT_SUCCESS) | |
253 { | |
254 /* | |
255 ** There is an error, but there is nothing that can be done other than to report it. | |
256 */ | |
257 MFW_BT_TRACE_P1("mfw_bt_fts_cb > Failed to post the event. Error %d", geRetVal); | |
258 } | |
259 | |
260 return; | |
261 } | |
262 | |
263 | |
264 /* | |
265 ** MFW Bluetooth File Transfer Signal Handler Function Definitions | |
266 */ | |
267 /******************************************************************************* | |
268 | |
269 $Function: mfw_bt_ftc_hndlr | |
270 | |
271 $Description: This function recieves the BTA File Transfer Client events from the Generic Event Handler | |
272 and either processes them in their entirety or passes them to the MMI for further | |
273 processing. | |
274 | |
275 $Returns: None | |
276 | |
277 $Arguments: event : Event Id returned from the Bluetooth Module | |
278 data : pointer to the relevant data returned from the Mluetooth Module | |
279 | |
280 *******************************************************************************/ | |
281 T_MFW_BT_STATUS mfw_bt_ftc_hndlr (T_MFW_BT_FTC_EVT event, T_MFW_BT_FTC_SIG_DATA *data) | |
282 { | |
283 T_MFW_BT_STATUS retVal = MFW_BT_SUCCESS; | |
284 | |
285 MFW_BT_TRACE("mfw_bt_ftc_hndlr"); | |
286 | |
287 switch (event) | |
288 { | |
289 case BTA_FTC_ENABLE_EVT: | |
290 MFW_BT_TRACE("mfw_bt_ftc_hndlr > BTA_FTC_ENABLE_EVT event received"); | |
291 break; | |
292 | |
293 case BTA_FTC_CLOSE_EVT: | |
294 MFW_BT_TRACE("mfw_bt_ftc_hndlr > BTA_FTC_CLOSE_EVT event received"); | |
295 break; | |
296 | |
297 case BTA_FTC_OPEN_EVT: | |
298 MFW_BT_TRACE("mfw_bt_ftc_hndlr > BTA_FTC_OPEN_EVT event received"); | |
299 break; | |
300 | |
301 case BTA_FTC_AUTH_EVT: | |
302 MFW_BT_TRACE("mfw_bt_ftc_hndlr > BTA_FTC_AUTH_EVT event received"); | |
303 break; | |
304 | |
305 case BTA_FTC_LIST_EVT: | |
306 MFW_BT_TRACE("mfw_bt_ftc_hndlr > BTA_FTC_LIST_EVT event received"); | |
307 break; | |
308 | |
309 case BTA_FTC_PROGRESS_EVT: | |
310 MFW_BT_TRACE("mfw_bt_ftc_hndlr > BTA_FTC_PROGRESS_EVT event received"); | |
311 break; | |
312 | |
313 case BTA_FTC_GETFILE_EVT: | |
314 MFW_BT_TRACE("mfw_bt_ftc_hndlr > BTA_FTC_GETFILE_EVT event received"); | |
315 break; | |
316 | |
317 case BTA_FTC_PUTFILE_EVT: | |
318 MFW_BT_TRACE("mfw_bt_ftc_hndlr > BTA_FTC_PUTFILE_EVT event received"); | |
319 break; | |
320 | |
321 default: | |
322 /* | |
323 ** Unexpected Event, setthe data sized to -1 to exit with no further action | |
324 */ | |
325 MFW_BT_TRACE_P1("mfw_bt_ftc_hndlr > Unexpected Event %d", event); | |
326 retVal = MFW_BT_INVALID_EVENT; | |
327 } | |
328 | |
329 return retVal; | |
330 } | |
331 | |
332 /******************************************************************************* | |
333 | |
334 $Function: mfw_bt_fts_hndlr | |
335 | |
336 $Description: This function recieves the BTA File Transfer Server events from the Generic Event Handler | |
337 and either processes them in their entirety or passes them to the MMI for further | |
338 processing. | |
339 | |
340 $Returns: None | |
341 | |
342 $Arguments: event : Event Id returned from the Bluetooth Module | |
343 data : pointer to the relevant data returned from the Mluetooth Module | |
344 | |
345 *******************************************************************************/ | |
346 T_MFW_BT_STATUS mfw_bt_fts_hndlr (T_MFW_BT_FTS_EVT event, T_MFW_BT_FTS_SIG_DATA *data) | |
347 { | |
348 T_MFW_BT_STATUS retVal = MFW_BT_SUCCESS; | |
349 | |
350 MFW_BT_TRACE("mfw_bt_fts_hndlr"); | |
351 | |
352 switch (event) | |
353 { | |
354 case BTA_FTS_ENABLE_EVT: | |
355 MFW_BT_TRACE("mfw_bt_fts_hndlr > BTA_FTS_ENABLE_EVT event received"); | |
356 break; | |
357 | |
358 case BTA_FTS_OPEN_EVT: | |
359 MFW_BT_TRACE("mfw_bt_fts_hndlr > BTA_FTS_OPEN_EVT event received"); | |
360 break; | |
361 | |
362 case BTA_FTS_CLOSE_EVT: | |
363 MFW_BT_TRACE("mfw_bt_fts_hndlr > BTA_FTS_CLOSE_EVT event received"); | |
364 break; | |
365 | |
366 case BTA_FTS_AUTH_EVT: | |
367 MFW_BT_TRACE("mfw_bt_fts_hndlr > BTA_FTS_AUTH_EVT event received"); | |
368 break; | |
369 | |
370 #if 0 /* These events are in the BTA interface document, but not in the header files!!! */ | |
371 case BTA_FTS_ACCESS_EVT: | |
372 MFW_BT_TRACE("mfw_bt_fts_hndlr > BTA_FTS_ACCESS_EVT event received"); | |
373 break; | |
374 | |
375 case BTA_FTS_PROGRESS_EVT: | |
376 MFW_BT_TRACE("mfw_bt_fts_hndlr > BTA_FTS_PROGRESS_EVT event received"); | |
377 break; | |
378 #endif | |
379 | |
380 default: | |
381 /* | |
382 ** Unexpected Event, setthe data sized to -1 to exit with no further action | |
383 */ | |
384 MFW_BT_TRACE_P1("mfw_bt_fts_hndlr > Unexpected Event %d", event); | |
385 retVal = MFW_BT_INVALID_EVENT; | |
386 } | |
387 | |
388 return retVal; | |
389 } | |
390 |