FreeCalypso > hg > fc-magnetite
comparison src/aci2/mfw/mfw_bt_dg.c @ 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_bt_dg.c $| | |
4 | $Author:: NDH $Revision:: 1 $| | |
5 | CREATED: 22.04.04 $Modtime:: 22.04.04 11:09 $| | |
6 | STATE : code | | |
7 +-------------------------------------------------------------------+ | |
8 | |
9 | |
10 MODULE : MFW_BT_DG | |
11 | |
12 PURPOSE : This module contains the functions for MFW Bluetooth Data 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 #include "mfw_bte.h" | |
40 #include "mfw_bt_dg.h" | |
41 #include "mfw_bt_geh.h" | |
42 | |
43 | |
44 | |
45 T_MFW_BT_STATUS mfw_bt_dg_init( void ) | |
46 { | |
47 MFW_BT_TRACE("mfw_bt_dg_init: starting the DG BT subsystem."); | |
48 } | |
49 | |
50 /* | |
51 ** MFW Bluetooth Data Gateway Callback Function Definitions | |
52 */ | |
53 /******************************************************************************* | |
54 | |
55 $Function: mfw_bt_Dg_Cb | |
56 | |
57 $Description: This is the Data Gateway Callback function, a pointer to it is passed | |
58 to the Bluetooth Module in the BTA DG Enable function and it is | |
59 used to return information from the Bluetooth Module | |
60 | |
61 $Returns: None | |
62 | |
63 $Arguments: event : Event Id returned from the Bluetooth Module | |
64 data : pointer to the relevant data returned from the Mluetooth Module | |
65 | |
66 *******************************************************************************/ | |
67 void mfw_bt_dg_cb(T_MFW_BT_DG_EVT event, T_MFW_BT_DG_SIG_DATA *data) | |
68 { | |
69 int dataLen; | |
70 T_MFW_BT_STATUS geRetVal = MFW_BT_SUCCESS; | |
71 | |
72 MFW_BT_TRACE("mfw_bt_Dg_Cb"); | |
73 | |
74 /* | |
75 ** Set the expected data size according to the received event | |
76 */ | |
77 switch (event) | |
78 { | |
79 case BTA_DG_ENABLE_EVT: | |
80 dataLen = 0; | |
81 break; | |
82 | |
83 case BTA_DG_LISTEN_EVT: | |
84 dataLen = sizeof(tBTA_DG_LISTEN); | |
85 break; | |
86 | |
87 | |
88 case BTA_DG_OPENING_EVT: | |
89 dataLen = sizeof(tBTA_DG_OPENING); | |
90 break; | |
91 | |
92 case BTA_DG_OPEN_EVT: | |
93 dataLen = sizeof(tBTA_DG_OPEN); | |
94 break; | |
95 | |
96 case BTA_DG_CLOSE_EVT: | |
97 dataLen = sizeof(tBTA_DG_CLOSE); | |
98 break; | |
99 | |
100 default: | |
101 /* | |
102 ** Unexpected Event, setthe data sized to -1 to exit with no further action | |
103 */ | |
104 MFW_BT_TRACE_P1("mfw_bt_Dg_Cb > Unexpected Event %d", event); | |
105 dataLen = -1; | |
106 | |
107 } | |
108 | |
109 | |
110 if (dataLen > 0) | |
111 { | |
112 /* | |
113 ** Data is expected with the received signal | |
114 */ | |
115 if ((void *)data == (void *)0) | |
116 { | |
117 /* | |
118 ** The data pointer is NULL, report the error | |
119 */ | |
120 MFW_BT_TRACE_P1("mfw_bt_Dg_Cb > Event : %d, Data Pointer is NULL, but data is expected", event); | |
121 } | |
122 else | |
123 { | |
124 /* | |
125 ** Post the event and data to the Generic event handler | |
126 */ | |
127 geRetVal = mfw_bt_ge_post_event(MFW_BT_DG, (ULONG)event, (void *)data, dataLen); | |
128 } | |
129 } | |
130 else if (dataLen == 0) | |
131 { | |
132 /* | |
133 ** There is no expected data with the received signal, post the event to the Generic event handler | |
134 */ | |
135 geRetVal = mfw_bt_ge_post_event(MFW_BT_DG, (ULONG)event, (void *)0, 0); | |
136 } | |
137 | |
138 if (geRetVal != MFW_BT_SUCCESS) | |
139 { | |
140 /* | |
141 ** There is an error, but there is nothing that can be done other than to report it. | |
142 */ | |
143 MFW_BT_TRACE_P1("mfw_bt_Dg_Cb > Failed to post the event. Error %d", geRetVal); | |
144 } | |
145 | |
146 return; | |
147 } | |
148 | |
149 | |
150 /* | |
151 ** MFW Bluetooth Data Gateway Signal Handler Function Definitions | |
152 */ | |
153 /******************************************************************************* | |
154 | |
155 $Function: mfw_bt_dg_hndlr | |
156 | |
157 $Description: This function recieves the BTA Data Gateway events from the Generic Event Handler | |
158 and either processes them in their entirety or passes them to the MMI for further | |
159 processing. | |
160 | |
161 $Returns: None | |
162 | |
163 $Arguments: event : Event Id returned from the Bluetooth Module | |
164 data : pointer to the relevant data returned from the Mluetooth Module | |
165 | |
166 *******************************************************************************/ | |
167 T_MFW_BT_STATUS mfw_bt_dg_hndlr (T_MFW_BT_DG_EVT event, T_MFW_BT_DG_SIG_DATA *data) | |
168 { | |
169 T_MFW_BT_STATUS retVal = MFW_BT_SUCCESS; | |
170 | |
171 MFW_BT_TRACE("mfw_bt_dg_hndlr"); | |
172 | |
173 switch (event) | |
174 { | |
175 case BTA_DG_ENABLE_EVT: | |
176 MFW_BT_TRACE("mfw_bt_dg_hndlr > BTA_DG_ENABLE_EVT event received"); | |
177 break; | |
178 | |
179 case BTA_DG_LISTEN_EVT: | |
180 MFW_BT_TRACE("mfw_bt_dg_hndlr > BTA_DG_LISTEN_EVT event received"); | |
181 break; | |
182 | |
183 | |
184 case BTA_DG_OPENING_EVT: | |
185 MFW_BT_TRACE("mfw_bt_dg_hndlr > BTA_DG_OPENING_EVT event received"); | |
186 break; | |
187 | |
188 case BTA_DG_OPEN_EVT: | |
189 MFW_BT_TRACE("mfw_bt_dg_hndlr > BTA_DG_OPEN_EVT event received"); | |
190 break; | |
191 | |
192 case BTA_DG_CLOSE_EVT: | |
193 MFW_BT_TRACE("mfw_bt_dg_hndlr > BTA_DG_CLOSE_EVT event received"); | |
194 break; | |
195 | |
196 default: | |
197 /* | |
198 ** Unexpected Event, setthe data sized to -1 to exit with no further action | |
199 */ | |
200 MFW_BT_TRACE_P1("mfw_bt_dg_hndlr > Unexpected Event %d", event); | |
201 retVal = MFW_BT_INVALID_EVENT; | |
202 | |
203 } | |
204 | |
205 return retVal; | |
206 } | |
207 |