comparison g23m/condat/ms/src/mfw/mfw_bt_ag.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_ag.c $|
4 | $Author:: NDH $Revision:: 1 $|
5 | CREATED: 22.04.04 $Modtime:: 22.04.04 11:07 $|
6 | STATE : code |
7 +-------------------------------------------------------------------+
8
9
10 MODULE : MFW_BT_AG
11
12 PURPOSE : This module contains the functions for MFW Bluetooth Audio Gateway 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_ag.h"
42 #include "mfw_bt_geh.h"
43
44
45 /*******************************************************************************
46
47 $Function: mfw_bt_ag_init
48
49 $Description: Start the audio gateway subsystem.
50
51 $Returns: T_MFW_BT_STATUS
52
53 $Arguments: none
54
55 *******************************************************************************/
56 T_MFW_BT_STATUS mfw_bt_ag_init( void )
57 {
58 MFW_BT_TRACE("mfw_bt_ag_init: starting the AG BT subsystem.");
59 return MFW_BT_SUCCESS;
60 }
61
62
63
64 /*
65 ** MFW Bluetooth Audio Gateway Callback Function Definitions
66 */
67 /*******************************************************************************
68
69 $Function: mfw_bt_Ag_Cb
70
71 $Description: This is the Audio Gateway Callback function, a pointer to it is passed
72 to the Bluetooth Module in the BTA AG 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
82
83 void mfw_bt_ag_cb(T_MFW_BT_AG_EVT event, T_MFW_BT_AG_SIG_DATA *data)
84 {
85 int dataLen;
86 T_MFW_BT_STATUS geRetVal = MFW_BT_SUCCESS;
87
88 MFW_BT_TRACE("mfw_bt_Ag_Cb");
89
90 /*
91 ** Set the expected data size according to the received event
92 */
93 switch (event)
94 {
95 case BTA_AG_ENABLE_EVT:
96 dataLen = 0;
97 break;
98
99 case BTA_AG_OPEN_EVT:
100 dataLen = sizeof(tBTA_AG_OPEN);
101 break;
102
103 #if 0
104 case BTA_AG_CONN_EVT: /* This event is in the BTA interface document, but not in the header files!!! */
105 case BTA_AG_CLOSE_EVT:
106 case BTA_AG_AUDIO_OPEN_EVT:
107 case BTA_AG_AUDIO_CLOSE_EVT:
108 dataLen = sizeof(tBTA_AG_HDR); /* This structure is in the BTA interface document, but not in the header files!!! */
109 break;
110
111 case BTA_AG_SPK_EVT:
112 case BTA_AG_MIC_EVT:
113 case BTA_AG_CKPD_EVT:
114 case BTA_AG_AT_A_EVT:
115 case BTA_AG_AT_D_EVT:
116 case BTA_AG_AT_CHLD_EVT:
117 case BTA_AG_AT_CHUP_EVT:
118 case BTA_AG_AT_CIND_EVT:
119 case BTA_AG_AT_VTS_EVT:
120 case BTA_AG_AT_BINP_EVT:
121 case BTA_AG_AT_BLDN_EVT:
122 case BTA_AG_AT_BVRA_EVT:
123 case BTA_AG_AT_NREC_EVT:
124 case BTA_AG_AT_CNUM_EVT:
125 dataLen = sizeof(tBTA_AG_VAL); /* This structure is in the BTA interface document, but not in the header files!!! */
126 break;
127 #endif
128
129 default:
130 /*
131 ** Unexpected Event, setthe data sized to -1 to exit with no further action
132 */
133 MFW_BT_TRACE_P1("mfw_bt_Ag_Cb > Unexpected Event %d", event);
134 dataLen = -1;
135
136 }
137
138
139 if (dataLen > 0)
140 {
141 /*
142 ** Data is expected with the received signal
143 */
144 if ((void *)data == (void *)0)
145 {
146 /*
147 ** The data pointer is NULL, report the error
148 */
149 MFW_BT_TRACE_P1("mfw_bt_Ag_Cb > Event : %d, Data Pointer is NULL, but data is expected", event);
150 }
151 else
152 {
153 /*
154 ** Post the event and data to the Generic event handler
155 */
156 geRetVal = mfw_bt_ge_post_event(MFW_BT_AG, (ULONG)event, (void *)data, dataLen);
157 }
158 }
159 else if (dataLen == 0)
160 {
161 /*
162 ** There is no expected data with the received signal, post the event to the Generic event handler
163 */
164 geRetVal = mfw_bt_ge_post_event(MFW_BT_AG, (ULONG)event, (void *)0, 0);
165 }
166
167 if (geRetVal != MFW_BT_SUCCESS)
168 {
169 /*
170 ** There is an error, but there is nothing that can be done other than to report it.
171 */
172 MFW_BT_TRACE_P1("mfw_bt_Ag_Cb > Failed to post the event. Error %d", geRetVal);
173 }
174
175 return;
176 }
177
178
179 /*
180 ** MFW Bluetooth Audio Gateway Signal Handler Function Definitions
181 */
182 /*******************************************************************************
183
184 $Function: mfw_bt_ag_hndlr
185
186 $Description: This function recieves the BTA Audio Gateway events from the Generic Event Handler
187 and either processes them in their entirety or passes them to the MMI for further
188 processing.
189
190 $Returns: None
191
192 $Arguments: event : Event Id returned from the Bluetooth Module
193 data : pointer to the relevant data returned from the Mluetooth Module
194
195 *******************************************************************************/
196 T_MFW_BT_STATUS mfw_bt_ag_hndlr(T_MFW_BT_AG_EVT event, T_MFW_BT_AG_SIG_DATA * data)
197 {
198 T_MFW_BT_STATUS retVal = MFW_BT_SUCCESS;
199
200 MFW_BT_TRACE("mfw_bt_Ag_Cb");
201
202 switch (event)
203 {
204 case BTA_AG_ENABLE_EVT:
205 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_ENABLE_EVT event received");
206 break;
207
208 case BTA_AG_OPEN_EVT:
209 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_OPEN_EVT event received");
210 break;
211
212 #if 0 /* This event is in the BTA interface document, but not in the header files!!! */
213 case BTA_AG_CONN_EVT:
214 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_CONN_EVT event received");
215 break;
216 #endif
217
218 case BTA_AG_CLOSE_EVT:
219 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_CLOSE_EVT event received");
220 break;
221
222 case BTA_AG_AUDIO_OPEN_EVT:
223 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_AUDIO_OPEN_EVT event received");
224 break;
225
226 case BTA_AG_AUDIO_CLOSE_EVT:
227 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_AUDIO_CLOSE_EVT event received");
228 break;
229
230 case BTA_AG_SPK_EVT:
231 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_SPK_EVT event received");
232 break;
233
234 case BTA_AG_MIC_EVT:
235 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_MIC_EVT event received");
236 break;
237
238 case BTA_AG_CKPD_EVT:
239 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_CKPD_EVT event received");
240 break;
241
242 case BTA_AG_AT_A_EVT:
243 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_AT_A_EVT event received");
244 break;
245
246 case BTA_AG_AT_D_EVT:
247 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_AT_D_EVT event received");
248 break;
249
250 case BTA_AG_AT_CHLD_EVT:
251 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_AT_CHLD_EVT event received");
252 break;
253
254 case BTA_AG_AT_CHUP_EVT:
255 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_AT_CHUP_EVT event received");
256 break;
257
258 case BTA_AG_AT_CIND_EVT:
259 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_AT_CIND_EVT event received");
260 break;
261
262 case BTA_AG_AT_VTS_EVT:
263 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_AT_VTS_EVT event received");
264 break;
265
266 case BTA_AG_AT_BINP_EVT:
267 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_AT_BINP_EVT event received");
268 break;
269
270 case BTA_AG_AT_BLDN_EVT:
271 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_AT_BLDN_EVT event received");
272 break;
273
274 case BTA_AG_AT_BVRA_EVT:
275 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_AT_BVRA_EVT event received");
276 break;
277
278 case BTA_AG_AT_NREC_EVT:
279 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_AT_NREC_EVT event received");
280 break;
281
282 case BTA_AG_AT_CNUM_EVT:
283 MFW_BT_TRACE("mfw_bt_ag_hndlr > BTA_AG_AT_CNUM_EVT event received");
284 break;
285
286 default:
287 /*
288 ** Unexpected Event, setthe data sized to -1 to exit with no further action
289 */
290 MFW_BT_TRACE_P1("mfw_bt_ag_hndlr > Unexpected Event %d", event);
291 retVal = MFW_BT_INVALID_EVENT;
292 }
293
294 return retVal;
295
296 }
297