comparison src/ui/bmi/mmiGprs.c @ 150:abaee5bdfdc9

mmiGprs.c: bogotab fixes
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 16 Nov 2020 06:49:22 +0000
parents c0052fe355d3
children
comparison
equal deleted inserted replaced
149:163b839c55de 150:abaee5bdfdc9
1 /******************************************************************************* 1 /*******************************************************************************
2 2
3 CONDAT (UK) 3 CONDAT (UK)
4 4
5 ******************************************************************************** 5 ********************************************************************************
6 6
7 This software product is the property of Condat (UK) Ltd and may not be 7 This software product is the property of Condat (UK) Ltd and may not be
8 disclosed to any third party without the express permission of the owner. 8 disclosed to any third party without the express permission of the owner.
10 ******************************************************************************** 10 ********************************************************************************
11 11
12 $Project name: 12 $Project name:
13 $Project code: 13 $Project code:
14 $Module: 14 $Module:
15 $File: MmiGprs.c 15 $File: MmiGprs.c
16 $Revision: 16 $Revision:
17 17
18 $Author: Condat(UK) 18 $Author: Condat(UK)
19 $Date: 19 $Date:
20 20
21 ******************************************************************************** 21 ********************************************************************************
22 22
23 Description: 23 Description:
24 GPRS handling for MMI. 24 GPRS handling for MMI.
25 25
26 26
27 ******************************************************************************** 27 ********************************************************************************
28 28
29 $History: MmiGprs.c 29 $History: MmiGprs.c
35 May 29,2006 REF: DR OMAPS00078997 x0043641 35 May 29,2006 REF: DR OMAPS00078997 x0043641
36 Description: GPRS - DETACH (ERROR) 36 Description: GPRS - DETACH (ERROR)
37 Solution: A condition is added when not regeistered, no searching the gprs status 37 Solution: A condition is added when not regeistered, no searching the gprs status
38 is updated as not attached. 38 is updated as not attached.
39 39
40 Feb 24, 2006 REF:DR OMAPS00068976 x0035544 40 Feb 24, 2006 REF:DR OMAPS00068976 x0035544
41 Description: GPRS attach icon - MMI follow up issue of OMAPS00051034 41 Description: GPRS attach icon - MMI follow up issue of OMAPS00051034
42 solution: a Check is added for the idle mode display and querry the GPRS status of 42 solution: a Check is added for the idle mode display and querry the GPRS status of
43 network registration and update the GPRS state and attach icon display accordingly. 43 network registration and update the GPRS state and attach icon display accordingly.
44 44
45 15/05/2003 - SPR#1983 - SH - Updated to latest from 1.6.3 version. 45 15/05/2003 - SPR#1983 - SH - Updated to latest from 1.6.3 version.
46 46
47 Dec 02, 2005 REF: DR OMAPS00048551 x0039928 47 Dec 02, 2005 REF: DR OMAPS00048551 x0039928
48 Description: MMI Cloud displays ""GPRS Detached"" in place 48 Description: MMI Cloud displays ""GPRS Detached"" in place
49 of ""GPRS Not Attached"" when unable to attach.. 49 of ""GPRS Not Attached"" when unable to attach..
50 Solution: A condition is added to check if the request is for attach and then display 50 Solution: A condition is added to check if the request is for attach and then display
51 "GPRS Not Attached" in case it fails. 51 "GPRS Not Attached" in case it fails.
52 52
53 Dec 01, 2005 REF: DR OMAPS00048530 x0039928 53 Dec 01, 2005 REF: DR OMAPS00048530 x0039928
54 Description: After the GPRS detach the MMI shows it is attached. 54 Description: After the GPRS detach the MMI shows it is attached.
55 Solution: A check is made to display "GPRS Attached" only when an GPRS attach is 55 Solution: A check is made to display "GPRS Attached" only when an GPRS attach is
56 requested but not when GPRS detach is request. 56 requested but not when GPRS detach is request.
57 57
58 Jun 14, 2005 REF: MMI-FIX-30439 x0018858 58 Jun 14, 2005 REF: MMI-FIX-30439 x0018858
59 Description: The homezone/cityzone tags were not being displayed properly. 59 Description: The homezone/cityzone tags were not being displayed properly.
60 Solution: Modified to save the tags properly in caches and also made the 60 Solution: Modified to save the tags properly in caches and also made the
61 appropriate modifications to update the same properly during mobility. 61 appropriate modifications to update the same properly during mobility.
62 62
63 $End 63 $End
64 64
65 *******************************************************************************/ 65 *******************************************************************************/
66 66
68 68
69 /* Switch for tracing*/ 69 /* Switch for tracing*/
70 #define TRACE_MMIGPRS 70 #define TRACE_MMIGPRS
71 71
72 #ifdef TRACE_MMIGPRS 72 #ifdef TRACE_MMIGPRS
73 #define trace(x) TRACE_EVENT(x) 73 #define trace(x) TRACE_EVENT(x)
74 #define tracefunction(x) TRACE_FUNCTION(x) 74 #define tracefunction(x) TRACE_FUNCTION(x)
75 #define trace_P1(x,a) TRACE_EVENT_P1(x,a) 75 #define trace_P1(x,a) TRACE_EVENT_P1(x,a)
76 #define trace_P2(x,a,b) TRACE_EVENT_P2(x,a,b) 76 #define trace_P2(x,a,b) TRACE_EVENT_P2(x,a,b)
77 #define trace_P3(x,a,b,c) TRACE_EVENT_P3(x,a,b,c) 77 #define trace_P3(x,a,b,c) TRACE_EVENT_P3(x,a,b,c)
78 #define trace_P4(x,a,b,c,d) TRACE_EVENT_P4(x,a,b,c,d) 78 #define trace_P4(x,a,b,c,d) TRACE_EVENT_P4(x,a,b,c,d)
79 #define trace_P5(x,a,b,c,d,e) TRACE_EVENT_P5(x,a,b,c,d,e) 79 #define trace_P5(x,a,b,c,d,e) TRACE_EVENT_P5(x,a,b,c,d,e)
80 #define trace_P6(x,a,b,c,d,e,f) TRACE_EVENT_P6(x,a,b,c,d,e,f) 80 #define trace_P6(x,a,b,c,d,e,f) TRACE_EVENT_P6(x,a,b,c,d,e,f)
81 #else 81 #else
82 #define trace(x) /* */ 82 #define trace(x) /* */
83 #define tracefunction(x) /* */ 83 #define tracefunction(x) /* */
84 #define trace_P1(x,a) /* */ 84 #define trace_P1(x,a) /* */
85 #define trace_P2(x,a,b) /* */ 85 #define trace_P2(x,a,b) /* */
86 #define trace_P3(x,a,b,c) /* */ 86 #define trace_P3(x,a,b,c) /* */
87 #define trace_P4(x,a,b,c,d) /* */ 87 #define trace_P4(x,a,b,c,d) /* */
88 #define trace_P5(x,a,b,c,d,e) /* */ 88 #define trace_P5(x,a,b,c,d,e) /* */
89 #define trace_P6(x,a,b,c,d,e,f) /* */ 89 #define trace_P6(x,a,b,c,d,e,f) /* */
90 #endif 90 #endif
91 91
92 #include <string.h> 92 #include <string.h>
164 #include "dspl.h" 164 #include "dspl.h"
165 165
166 #include "MmiGprs.h" 166 #include "MmiGprs.h"
167 #include "MmiBookShared.h" 167 #include "MmiBookShared.h"
168 168
169 #include "Mmiicons.h" /* Including this header allows us to access the global icon status, for the GPRS icon.*/ 169 #include "Mmiicons.h" /* Including this header allows us to access the global icon status, for the GPRS icon.*/
170 #include "mmiSmsBroadcast.h" /* Including this to get the info_screen function */ 170 #include "mmiSmsBroadcast.h" /* Including this to get the info_screen function */
171 /* New Editor changes. Need editor for counter display */ 171 /* New Editor changes. Need editor for counter display */
172 #ifdef NEW_EDITOR 172 #ifdef NEW_EDITOR
173 #include "ATBCommon.h" 173 #include "ATBCommon.h"
174 #include "ATBDisplay.h" 174 #include "ATBDisplay.h"
176 #include "AUIEditor.h" 176 #include "AUIEditor.h"
177 #else 177 #else
178 #include "MmiEditor.h" 178 #include "MmiEditor.h"
179 #endif 179 #endif
180 #include "MmiBookUtils.h" 180 #include "MmiBookUtils.h"
181 #include "MmiBookMenuWindow.h" /* So we can use bookMenuStart() to create our own menus */ 181 #include "MmiBookMenuWindow.h" /* So we can use bookMenuStart() to create our own menus */
182 182
183 #include "mmiColours.h" 183 #include "mmiColours.h"
184 184
185 #ifdef NEPTUNE_BOARD 185 #ifdef NEPTUNE_BOARD
186 #define GPRS_ICON_SET 1 186 #define GPRS_ICON_SET 1
189 189
190 static T_MMI_GPRS_DATA *gprs_data=NULL; 190 static T_MMI_GPRS_DATA *gprs_data=NULL;
191 191
192 /******************************************************************************* 192 /*******************************************************************************
193 193
194 $Function: GPRS_Data 194 $Function: GPRS_Data
195 195
196 $Description: Initialise GPRS 196 $Description: Initialise GPRS
197 197
198 $Returns: Handler for MFW GPRS events. 198 $Returns: Handler for MFW GPRS events.
199 199
200 $Arguments: None. 200 $Arguments: None.
201 201
202 *******************************************************************************/ 202 *******************************************************************************/
203 203
204 T_MMI_GPRS_DATA *GPRS_Data(void) 204 T_MMI_GPRS_DATA *GPRS_Data(void)
205 { 205 {
206 if (gprs_data==NULL) 206 if (gprs_data==NULL)
207 { 207 {
208 TRACE_EVENT("***ERROR*** MMI GPRS not initialised properly"); 208 TRACE_EVENT("***ERROR*** MMI GPRS not initialised properly");
209 } 209 }
210 210
211 return gprs_data; 211 return gprs_data;
212 } 212 }
213 213
214 /******************************************************************************* 214 /*******************************************************************************
215 215
216 $Function: GPRS_Init 216 $Function: GPRS_Init
217 217
218 $Description: Initialise GPRS 218 $Description: Initialise GPRS
219 219
220 $Returns: Handler for MFW GPRS events. 220 $Returns: Handler for MFW GPRS events.
221 221
222 $Arguments: None. 222 $Arguments: None.
223 223
224 *******************************************************************************/ 224 *******************************************************************************/
225 225
226 void GPRS_Init(void) 226 void GPRS_Init(void)
227 { 227 {
228 T_MMI_GPRS_DATA *data; 228 T_MMI_GPRS_DATA *data;
229 229
230 tracefunction("GPRS_Init()"); 230 tracefunction("GPRS_Init()");
231 231
232 gprs_init(); 232 gprs_init();
233 233
234 /* Allocate memory for mmi data */ 234 /* Allocate memory for mmi data */
235 data = (T_MMI_GPRS_DATA *)ALLOC_MEMORY(sizeof(T_MMI_GPRS_DATA)); 235 data = (T_MMI_GPRS_DATA *)ALLOC_MEMORY(sizeof(T_MMI_GPRS_DATA));
236 gprs_data = data; 236 gprs_data = data;
237 memset(data, 0, sizeof(T_MMI_GPRS_DATA)); 237 memset(data, 0, sizeof(T_MMI_GPRS_DATA));
238 238
239 data->mfw_gprs = gprs_create(0, E_MFW_GPRS_ALL_EVENTS, (MfwCb)GPRS_MfwCb); 239 data->mfw_gprs = gprs_create(0, E_MFW_GPRS_ALL_EVENTS, (MfwCb)GPRS_MfwCb);
240 data->cid = GPRS_CID_OMITTED; 240 data->cid = GPRS_CID_OMITTED;
241 data->uplink_counter = 0; 241 data->uplink_counter = 0;
242 data->downlink_counter = 0; 242 data->downlink_counter = 0;
243 data->sms_service = SMS_SERVICE_OMITTED; 243 data->sms_service = SMS_SERVICE_OMITTED;
244 data->display = FALSE; 244 data->display = FALSE;
245 data->notify_win = NULL; 245 data->notify_win = NULL;
246 data->callback = NULL; 246 data->callback = NULL;
247 data->reg_status = GPRS_OFF; 247 data->reg_status = GPRS_OFF;
248 248
249 return; 249 return;
250 } 250 }
251 251
252 252
253 /******************************************************************************* 253 /*******************************************************************************
254 254
255 $Function: GPRS_SetCallback 255 $Function: GPRS_SetCallback
256 256
257 $Description: Specify a callback function, where GPRS connection information will 257 $Description: Specify a callback function, where GPRS connection information will
258 be sent, or NULL to switch off notification. 258 be sent, or NULL to switch off notification.
259 259
260 $Returns: None. 260 $Returns: None.
261 261
262 $Arguments: win - window handler, or NULL 262 $Arguments: win - window handler, or NULL
263 callback - callback function, or NULL 263 callback - callback function, or NULL
264 264
265 *******************************************************************************/ 265 *******************************************************************************/
266 266
267 void GPRS_SetCallback(T_MFW_HND win, T_GPRS_CB callback) 267 void GPRS_SetCallback(T_MFW_HND win, T_GPRS_CB callback)
268 { 268 {
269 T_MMI_GPRS_DATA *data = GPRS_Data(); 269 T_MMI_GPRS_DATA *data = GPRS_Data();
270 270
271 tracefunction("GPRS_SetCallback()"); 271 tracefunction("GPRS_SetCallback()");
272 272
273 if (!data) 273 if (!data)
274 { 274 {
275 return; 275 return;
276 } 276 }
277 277
278 data->notify_win = win; 278 data->notify_win = win;
279 data->callback = callback; 279 data->callback = callback;
280 280
281 return; 281 return;
282 } 282 }
283 283
284 284
285 /******************************************************************************* 285 /*******************************************************************************
286 286
287 $Function: GPRS_Exit 287 $Function: GPRS_Exit
288 288
289 $Description: Exit GPRS 289 $Description: Exit GPRS
290 290
291 $Returns: None. 291 $Returns: None.
292 292
293 $Arguments: None. 293 $Arguments: None.
294 294
295 *******************************************************************************/ 295 *******************************************************************************/
296 296
297 void GPRS_Exit(void) 297 void GPRS_Exit(void)
298 { 298 {
299 T_MMI_GPRS_DATA *data = GPRS_Data(); 299 T_MMI_GPRS_DATA *data = GPRS_Data();
300 300
301 tracefunction("GPRS_Exit()"); 301 tracefunction("GPRS_Exit()");
302 302
303 if (data) 303 if (data)
304 { 304 {
305 /* Delete any remaining please wait window (just in case!)*/ 305 /* Delete any remaining please wait window (just in case!)*/
306 GPRS_PleaseWaitDestroy(); 306 GPRS_PleaseWaitDestroy();
307 307
308 /* Delete the MFW module */ 308 /* Delete the MFW module */
309 if (data->mfw_gprs) 309 if (data->mfw_gprs)
310 { 310 {
311 gprs_delete(data->mfw_gprs); 311 gprs_delete(data->mfw_gprs);
312 } 312 }
313 313
314 /* Delete MMI data */ 314 /* Delete MMI data */
315 FREE_MEMORY((void *)data, sizeof(T_MMI_GPRS_DATA)); 315 FREE_MEMORY((void *)data, sizeof(T_MMI_GPRS_DATA));
316 gprs_data = NULL; 316 gprs_data = NULL;
317 } 317 }
318 318
319 gprs_exit(); 319 gprs_exit();
320 return; 320 return;
321 } 321 }
322 322
323 323
324 /******************************************************************************* 324 /*******************************************************************************
325 325
326 $Function: GPRS_Status 326 $Function: GPRS_Status
327 327
328 $Description: Return status of GPRS. 328 $Description: Return status of GPRS.
329 329
330 $Returns: GPRS_OFF, GPRS_NOT_ATTACHED, GPRS_ATTACHED 330 $Returns: GPRS_OFF, GPRS_NOT_ATTACHED, GPRS_ATTACHED
331 331
332 $Arguments: None. 332 $Arguments: None.
333 333
334 *******************************************************************************/ 334 *******************************************************************************/
335 335
336 int GPRS_Status(void) 336 int GPRS_Status(void)
337 { 337 {
338 T_MMI_GPRS_DATA *data = GPRS_Data(); 338 T_MMI_GPRS_DATA *data = GPRS_Data();
339 T_MFW_GPRS *gprs; 339 T_MFW_GPRS *gprs;
340 int result; 340 int result;
341 341
342 #ifdef NEPTUNE_BOARD 342 #ifdef NEPTUNE_BOARD
343 int iStatus = 0; 343 int iStatus = 0;
344 int iDisplayIcn = 0; 344 int iDisplayIcn = 0;
345 #endif 345 #endif
346 346
347 tracefunction("GPRS_Status()"); 347 tracefunction("GPRS_Status()");
348 348
349 if (!data) 349 if (!data)
350 { 350 {
351 return GPRS_OFF; 351 return GPRS_OFF;
352 } 352 }
353 353
354 /* Keeps track of last status value, so we only need to call callback when a change occurs. 354 /* Keeps track of last status value, so we only need to call callback when a change occurs.
355 * Default state is GPRS OFF */ 355 * Default state is GPRS OFF */
356 356
357 iconsDeleteState(iconIdGPRSOn); 357 iconsDeleteState(iconIdGPRSOn);
358 358
359 #ifdef NEPTUNE_BOARD 359 #ifdef NEPTUNE_BOARD
360 /* OMAPS00074454 - For Edge Icon Display */ 360 /* OMAPS00074454 - For Edge Icon Display */
361 iconsDeleteState(iconIdEdgeOn); 361 iconsDeleteState(iconIdEdgeOn);
362 /* END */ 362 /* END */
363 #endif 363 #endif
364 result = GPRS_OFF; 364 result = GPRS_OFF;
365 365
366 /* Check if searching or attached */ 366 /* Check if searching or attached */
367 367
368 if (data->mfw_gprs) 368 if (data->mfw_gprs)
369 { 369 {
370 gprs = ((T_MFW_HDR *)data->mfw_gprs)->data; 370 gprs = ((T_MFW_HDR *)data->mfw_gprs)->data;
371 //x0035544 Feb 23, 2006 DR:OMAPS00068976 371 //x0035544 Feb 23, 2006 DR:OMAPS00068976
372 /* Check for the idle mode and querry the status of network registration 372 /* Check for the idle mode and querry the status of network registration
373 *and update the GPRS state and attach icon display accordingly */ 373 *and update the GPRS state and attach icon display accordingly */
374 if (gprs && (idleIsFocussed() ||data->menu_win == NULL) ) 374 if (gprs && (idleIsFocussed() ||data->menu_win == NULL) )
375 { 375 {
376 #ifdef NEPTUNE_BOARD 376 #ifdef NEPTUNE_BOARD
377 iDisplayIcn = mfw_gprs_edge_status (&iStatus); 377 iDisplayIcn = mfw_gprs_edge_status (&iStatus);
378 378
379 /* Status is obtained from AT command and assigned. */ 379 /* Status is obtained from AT command and assigned. */
380 gprs->data.Reg_state.p_reg_State = (T_P_CGREG_STAT) iStatus; 380 gprs->data.Reg_state.p_reg_State = (T_P_CGREG_STAT) iStatus;
381 381
382 if ((gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_SEARCHING) && 382 if ((gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_SEARCHING) &&
383 (iDisplayIcn == GPRS_ICON_SET)) 383 (iDisplayIcn == GPRS_ICON_SET))
384 { 384 {
385 result = GPRS_SEARCHING; 385 result = GPRS_SEARCHING;
386 } 386 }
387 387
388 else if((gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_SEARCHING) && 388 else if((gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_SEARCHING) &&
389 (iDisplayIcn == EDGE_ICON_SET)) 389 (iDisplayIcn == EDGE_ICON_SET))
390 { 390 {
391 result = EDGE_SEARCHING; 391 result = EDGE_SEARCHING;
392 } 392 }
393 393
394 /* Check regState and iDisplayIcn For display of GPRS*/ 394 /* Check regState and iDisplayIcn For display of GPRS*/
395 else if ((gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_HOME || 395 else if ((gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_HOME ||
396 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_ROAM ) && 396 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_ROAM ) &&
397 (iDisplayIcn == GPRS_ICON_SET)) 397 (iDisplayIcn == GPRS_ICON_SET))
398 { 398 {
399 iconsSetState(iconIdGPRSOn); 399 iconsSetState(iconIdGPRSOn);
400 result = GPRS_ATTACHED; 400 result = GPRS_ATTACHED;
401 } 401 }
402 402
403 /* Check regState and iDisplayIcn For display of EDGE*/ 403 /* Check regState and iDisplayIcn For display of EDGE*/
404 else if ((gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_HOME || 404 else if ((gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_HOME ||
405 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_ROAM ) && 405 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_ROAM ) &&
406 (iDisplayIcn == EDGE_ICON_SET)) 406 (iDisplayIcn == EDGE_ICON_SET))
407 { 407 {
408 iconsSetState(iconIdEdgeOn); 408 iconsSetState(iconIdEdgeOn);
409 result = EDGE_ATTACHED; 409 result = EDGE_ATTACHED;
410 } 410 }
411 else if ((gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_NO_CELL || 411 else if ((gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_NO_CELL ||
412 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_LIMITED || 412 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_LIMITED ||
413 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_UNKN || 413 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_UNKN ||
414 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_DEN ) && 414 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_DEN ) &&
415 (iDisplayIcn == EDGE_ICON_SET)) 415 (iDisplayIcn == EDGE_ICON_SET))
416 { 416 {
417 iconsDeleteState(iconIdGPRSOn ); 417 iconsDeleteState(iconIdGPRSOn );
418 result = GPRS_ERROR; 418 result = GPRS_ERROR;
419 } 419 }
420 else if ((gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_NO_CELL || 420 else if ((gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_NO_CELL ||
421 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_LIMITED || 421 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_LIMITED ||
422 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_UNKN || 422 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_UNKN ||
423 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_DEN ) && 423 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_DEN ) &&
424 (iDisplayIcn == EDGE_ICON_SET)) 424 (iDisplayIcn == EDGE_ICON_SET))
425 { 425 {
426 iconsDeleteState(iconIdEdgeOn ); 426 iconsDeleteState(iconIdEdgeOn );
427 result = EDGE_ERROR; 427 result = EDGE_ERROR;
428 } 428 }
429 /* May 29, 2006 Ref bug OMAPS00078997 */ 429 /* May 29, 2006 Ref bug OMAPS00078997 */
430 else if (gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_NOT_REG ) 430 else if (gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_NOT_REG )
431 { 431 {
432 iconsDeleteState(iconIdGPRSOn ); 432 iconsDeleteState(iconIdGPRSOn );
433 iconsDeleteState(iconIdEdgeOn ); 433 iconsDeleteState(iconIdEdgeOn );
434 result = GPRS_OFF; 434 result = GPRS_OFF;
435 } 435 }
436 else 436 else
437 { 437 {
438 iconsDeleteState(iconIdGPRSOn); 438 iconsDeleteState(iconIdGPRSOn);
439 iconsDeleteState(iconIdEdgeOn); 439 iconsDeleteState(iconIdEdgeOn);
440 } 440 }
441 441
442 #else 442 #else
443 443
444 gprs->data.Reg_state.p_reg_State = p_gprs_status(); 444 gprs->data.Reg_state.p_reg_State = p_gprs_status();
445 445
446 trace_P1("GPRS_Status: p_regState = %d", gprs->data.Reg_state.p_reg_State); 446 trace_P1("GPRS_Status: p_regState = %d", gprs->data.Reg_state.p_reg_State);
447 447
448 if (gprs->data.Reg_state.p_reg_State ==P_CGREG_STAT_SEARCHING) 448 if (gprs->data.Reg_state.p_reg_State ==P_CGREG_STAT_SEARCHING)
449 { 449 {
450 result = GPRS_SEARCHING; 450 result = GPRS_SEARCHING;
451 } 451 }
452 452
453 /* Check regState rather than attached to find GPRS status */ 453 /* Check regState rather than attached to find GPRS status */
454 454
455 else if (gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_HOME || 455 else if (gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_HOME ||
456 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_ROAM ) 456 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_ROAM )
457 { 457 {
458 iconsSetState(iconIdGPRSOn); 458 iconsSetState(iconIdGPRSOn);
459 result = GPRS_ATTACHED; 459 result = GPRS_ATTACHED;
460 } 460 }
461 else if(gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_NO_CELL || 461 else if(gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_NO_CELL ||
462 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_LIMITED || 462 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_LIMITED ||
463 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_UNKN || 463 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_UNKN ||
464 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_DEN) 464 gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_REG_DEN)
465 465
466 { 466 {
467 iconsDeleteState(iconIdGPRSOn ); 467 iconsDeleteState(iconIdGPRSOn );
468 result = GPRS_ERROR; 468 result = GPRS_ERROR;
469 } 469 }
470 //Oct 18,2006 REF:DR OMAPS00099409 x0047075 470 //Oct 18,2006 REF:DR OMAPS00099409 x0047075
471 // Description:TC2.1.5(BMI/MFW) - GPRS - GPRS Detach error 471 // Description:TC2.1.5(BMI/MFW) - GPRS - GPRS Detach error
472 //Solution : The response P_CGREG_STAT_NOT_REG from the lower layer is now translated as GPRS_OFF by BMI. 472 //Solution : The response P_CGREG_STAT_NOT_REG from the lower layer is now translated as GPRS_OFF by BMI.
473 else if (gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_NOT_REG ) 473 else if (gprs->data.Reg_state.p_reg_State == P_CGREG_STAT_NOT_REG )
474 { 474 {
475 iconsDeleteState(iconIdGPRSOn ); 475 iconsDeleteState(iconIdGPRSOn );
476 result = GPRS_OFF; 476 result = GPRS_OFF;
477 } 477 }
478 #endif 478 #endif
479 479
480 } 480 }
481 else if (gprs ) 481 else if (gprs )
482 { 482 {
483 483
484 #ifdef NEPTUNE_BOARD 484 #ifdef NEPTUNE_BOARD
485 iDisplayIcn = mfw_gprs_edge_status (&iStatus); 485 iDisplayIcn = mfw_gprs_edge_status (&iStatus);
486 486
487 /* Status is obtained from AT command and assigned. */ 487 /* Status is obtained from AT command and assigned. */
488 /* x0045876, 14-Aug-2006 (WR - enumerated type mixed with another type) */ 488 /* x0045876, 14-Aug-2006 (WR - enumerated type mixed with another type) */
489 /* gprs->data.Reg_state.regState = iStatus; */ 489 /* gprs->data.Reg_state.regState = iStatus; */
490 gprs->data.Reg_state.regState = (T_CGREG_STAT) iStatus; 490 gprs->data.Reg_state.regState = (T_CGREG_STAT) iStatus;
491 491
492 if ((gprs->data.Reg_state.regState==CGREG_STAT_SEARCHING) && 492 if ((gprs->data.Reg_state.regState==CGREG_STAT_SEARCHING) &&
493 (iDisplayIcn == GPRS_ICON_SET)) 493 (iDisplayIcn == GPRS_ICON_SET))
494 { 494 {
495 result = GPRS_SEARCHING; 495 result = GPRS_SEARCHING;
496 } 496 }
497 497
498 else if((gprs->data.Reg_state.regState==CGREG_STAT_SEARCHING) && 498 else if((gprs->data.Reg_state.regState==CGREG_STAT_SEARCHING) &&
499 (iDisplayIcn == EDGE_ICON_SET)) 499 (iDisplayIcn == EDGE_ICON_SET))
500 { 500 {
501 result = EDGE_SEARCHING; 501 result = EDGE_SEARCHING;
502 } 502 }
503 503
504 /* Check regState and iDisplayIcn For display of GPRS*/ 504 /* Check regState and iDisplayIcn For display of GPRS*/
505 else if ((gprs->data.Reg_state.regState==CGREG_STAT_REG_HOME || 505 else if ((gprs->data.Reg_state.regState==CGREG_STAT_REG_HOME ||
506 gprs->data.Reg_state.regState==CGREG_STAT_REG_ROAM) && 506 gprs->data.Reg_state.regState==CGREG_STAT_REG_ROAM) &&
507 (iDisplayIcn == GPRS_ICON_SET)) 507 (iDisplayIcn == GPRS_ICON_SET))
508 { 508 {
509 iconsSetState(iconIdGPRSOn); 509 iconsSetState(iconIdGPRSOn);
510 result = GPRS_ATTACHED; 510 result = GPRS_ATTACHED;
511 } 511 }
512 512
513 /* Check regState and iDisplayIcn For display of EDGE*/ 513 /* Check regState and iDisplayIcn For display of EDGE*/
514 else if ((gprs->data.Reg_state.regState==CGREG_STAT_REG_HOME || 514 else if ((gprs->data.Reg_state.regState==CGREG_STAT_REG_HOME ||
515 gprs->data.Reg_state.regState==CGREG_STAT_REG_ROAM) && 515 gprs->data.Reg_state.regState==CGREG_STAT_REG_ROAM) &&
516 (iDisplayIcn == EDGE_ICON_SET)) 516 (iDisplayIcn == EDGE_ICON_SET))
517 { 517 {
518 iconsSetState(iconIdEdgeOn); 518 iconsSetState(iconIdEdgeOn);
519 result = EDGE_ATTACHED; 519 result = EDGE_ATTACHED;
520 } 520 }
521 #else 521 #else
522 522
523 //x0035544 Feb 23, 2006 DR:OMAPS00068976 523 //x0035544 Feb 23, 2006 DR:OMAPS00068976
524 gprs->data.Reg_state.regState = gprs_status(); 524 gprs->data.Reg_state.regState = gprs_status();
525 525
526 trace_P1("GPRS_Status: regState = %d", gprs->data.Reg_state.regState); 526 trace_P1("GPRS_Status: regState = %d", gprs->data.Reg_state.regState);
527 //x0035544 Feb 23, 2006 DR:OMAPS00068976 527 //x0035544 Feb 23, 2006 DR:OMAPS00068976
528 if (gprs->data.Reg_state.regState==CGREG_STAT_SEARCHING) 528 if (gprs->data.Reg_state.regState==CGREG_STAT_SEARCHING)
529 { 529 {
530 result = GPRS_SEARCHING; 530 result = GPRS_SEARCHING;
531 } 531 }
532 532
533 /* Check regState rather than attached to find GPRS status */ 533 /* Check regState rather than attached to find GPRS status */
534 //x0035544 Feb 23, 2006 DR:OMAPS00068976 534 //x0035544 Feb 23, 2006 DR:OMAPS00068976
535 else if (gprs->data.Reg_state.regState==CGREG_STAT_REG_HOME || 535 else if (gprs->data.Reg_state.regState==CGREG_STAT_REG_HOME ||
536 gprs->data.Reg_state.regState ==CGREG_STAT_REG_ROAM) 536 gprs->data.Reg_state.regState ==CGREG_STAT_REG_ROAM)
537 { 537 {
538 iconsSetState(iconIdGPRSOn); 538 iconsSetState(iconIdGPRSOn);
539 result = GPRS_ATTACHED; 539 result = GPRS_ATTACHED;
540 } 540 }
541 #endif 541 #endif
542 } 542 }
543 } 543 }
544 544
545 /* If status has changed, notify */ 545 /* If status has changed, notify */
546 if (data->callback!=NULL && result!=data->reg_status) 546 if (data->callback!=NULL && result!=data->reg_status)
547 { 547 {
548 data->callback(result); 548 data->callback(result);
549 } 549 }
550 550
551 data->reg_status = result; 551 data->reg_status = result;
552 552
553 return result; 553 return result;
554 } 554 }
555 555
556 /******************************************************************************* 556 /*******************************************************************************
557 557
558 $Function: GPRS_ResultScreen 558 $Function: GPRS_ResultScreen
559 559
560 $Description: Displays a result and returns GPRS to idle status 560 $Description: Displays a result and returns GPRS to idle status
561 561
562 $Returns: None. 562 $Returns: None.
563 563
564 $Arguments: parent_win - the parent window 564 $Arguments: parent_win - the parent window
565 TextId1 - the first text string to be shown 565 TextId1 - the first text string to be shown
566 TextId2 - the second text string to be shown 566 TextId2 - the second text string to be shown
567 567
568 [afo 03/10/03] Moved function to an earlier location in the file and changed 568 [afo 03/10/03] Moved function to an earlier location in the file and changed
569 the return type to void. We were taking liberties with C which we 569 the return type to void. We were taking liberties with C which we
570 got away with using the TI compiler but which Visual C flagged as 570 got away with using the TI compiler but which Visual C flagged as
571 an error. 571 an error.
572 572
573 We seem to be a bit slack on function scope and return values in 573 We seem to be a bit slack on function scope and return values in
574 some cases in this file. 574 some cases in this file.
575 575
576 *******************************************************************************/ 576 *******************************************************************************/
577 577
578 static void GPRS_ResultScreen(T_MFW_HND parent_win, USHORT TextId1, USHORT TextId2) 578 static void GPRS_ResultScreen(T_MFW_HND parent_win, USHORT TextId1, USHORT TextId2)
579 { 579 {
580 T_MMI_GPRS_DATA *data = GPRS_Data(); 580 T_MMI_GPRS_DATA *data = GPRS_Data();
581 581
582 tracefunction("GPRS_ResultScreen()"); 582 tracefunction("GPRS_ResultScreen()");
583 583
584 if (!data) 584 if (!data)
585 { 585 {
586 return; 586 return;
587 } 587 }
588 588
589 GPRS_PleaseWaitDestroy(); 589 GPRS_PleaseWaitDestroy();
590 590
591 info_screen(parent_win, TextId1, TextId2, NULL); 591 info_screen(parent_win, TextId1, TextId2, NULL);
592 592
593 data->display = FALSE; 593 data->display = FALSE;
594 594
595 return; 595 return;
596 } 596 }
597 597
598 /******************************************************************************* 598 /*******************************************************************************
599 599
600 $Function: GPRS_Attach 600 $Function: GPRS_Attach
601 601
602 $Description: Attempts an attach to the GPRS network. 602 $Description: Attempts an attach to the GPRS network.
603 603
604 $Returns: MMI_GPRS_STATUS_ATTACHING or MMI_GPRS_STATUS_IDLE 604 $Returns: MMI_GPRS_STATUS_ATTACHING or MMI_GPRS_STATUS_IDLE
605 605
606 $Arguments: win - Parent window - if this is provided, status dialogues will be shown 606 $Arguments: win - Parent window - if this is provided, status dialogues will be shown
607 607
608 *******************************************************************************/ 608 *******************************************************************************/
609 609
610 int GPRS_Attach(T_MFW_HND win) 610 int GPRS_Attach(T_MFW_HND win)
611 { 611 {
612 T_MMI_GPRS_DATA *data = GPRS_Data(); 612 T_MMI_GPRS_DATA *data = GPRS_Data();
613 613
614 tracefunction("GPRS_Attach()"); 614 tracefunction("GPRS_Attach()");
615 615
616 if (!data) 616 if (!data)
617 { 617 {
618 /* x0045876, 14-Aug-2006 (WR - non-void function "GPRS_Attach" should return a value) */ 618 /* x0045876, 14-Aug-2006 (WR - non-void function "GPRS_Attach" should return a value) */
619 /* return; */ 619 /* return; */
620 return 0; 620 return 0;
621 } 621 }
622 622
623 data->status = MMI_GPRS_STATUS_ATTACHING; 623 data->status = MMI_GPRS_STATUS_ATTACHING;
624 624
625 if (win) 625 if (win)
626 { 626 {
627 GPRS_PleaseWait(win, TxtPleaseWait, NULL); 627 GPRS_PleaseWait(win, TxtPleaseWait, NULL);
628 } 628 }
629 629
630 /* Perform the attach */ 630 /* Perform the attach */
631 631
632 if (gprs_attach(CGATT_STATE_ATTACHED)==MFW_RES_OK) 632 if (gprs_attach(CGATT_STATE_ATTACHED)==MFW_RES_OK)
633 { 633 {
634 trace("GPRSAttach executing, awaiting confirmation."); 634 trace("GPRSAttach executing, awaiting confirmation.");
635 } 635 }
636 else 636 else
637 { 637 {
638 /* Show result */ 638 /* Show result */
639 if (win) 639 if (win)
640 { 640 {
641 GPRS_ResultScreen(win, TxtFailed, TxtNull); 641 GPRS_ResultScreen(win, TxtFailed, TxtNull);
642 } 642 }
643 data->status = MMI_GPRS_STATUS_IDLE; 643 data->status = MMI_GPRS_STATUS_IDLE;
644 } 644 }
645 645
646 return data->status; 646 return data->status;
647 } 647 }
648 648
649 649
650 /******************************************************************************* 650 /*******************************************************************************
651 651
652 $Function: GPRS_Detach 652 $Function: GPRS_Detach
653 653
654 $Description: Detach from the GPRS network. 654 $Description: Detach from the GPRS network.
655 655
656 $Returns: MMI_GPRS_STATUS_DETACHING or MMI_GPRS_STATUS_IDLE 656 $Returns: MMI_GPRS_STATUS_DETACHING or MMI_GPRS_STATUS_IDLE
657 657
658 $Arguments: None 658 $Arguments: None
659 659
660 *******************************************************************************/ 660 *******************************************************************************/
661 661
662 int GPRS_Detach(T_MFW_HND win) 662 int GPRS_Detach(T_MFW_HND win)
663 { 663 {
664 T_MMI_GPRS_DATA *data = GPRS_Data(); 664 T_MMI_GPRS_DATA *data = GPRS_Data();
665 665
666 tracefunction("GPRS_Detach()"); 666 tracefunction("GPRS_Detach()");
667 667
668 if (!data) 668 if (!data)
669 { 669 {
670 /* x0045876, 14-Aug-2006 (WR - non-void function "GPRS_Detach" should return a value) */ 670 /* x0045876, 14-Aug-2006 (WR - non-void function "GPRS_Detach" should return a value) */
671 /* return; */ 671 /* return; */
672 return 0; 672 return 0;
673 } 673 }
674 674
675 data->status = MMI_GPRS_STATUS_DETACHING; 675 data->status = MMI_GPRS_STATUS_DETACHING;
676 676
677 if (win) 677 if (win)
678 { 678 {
679 GPRS_PleaseWait(win, TxtPleaseWait, NULL); 679 GPRS_PleaseWait(win, TxtPleaseWait, NULL);
680 } 680 }
681 681
682 if (gprs_attach(CGATT_STATE_DETACHED)==MFW_RES_OK) 682 if (gprs_attach(CGATT_STATE_DETACHED)==MFW_RES_OK)
683 { 683 {
684 trace("GPRSDetach executing, awaiting confirmation."); 684 trace("GPRSDetach executing, awaiting confirmation.");
685 } 685 }
686 else 686 else
687 { 687 {
688 if (win) 688 if (win)
689 { 689 {
690 GPRS_ResultScreen(win, TxtFailed, TxtNull); 690 GPRS_ResultScreen(win, TxtFailed, TxtNull);
691 } 691 }
692 data->status = MMI_GPRS_STATUS_IDLE; 692 data->status = MMI_GPRS_STATUS_IDLE;
693 } 693 }
694 694
695 return data->status; 695 return data->status;
696 } 696 }
697 697
698 698
699 /******************************************************************************* 699 /*******************************************************************************
700 700
701 $Function: GPRS_ContextDefine 701 $Function: GPRS_ContextDefine
702 702
703 $Description: Define a PDP context 703 $Description: Define a PDP context
704 704
705 $Returns: TRUE if successful, FALSE otherwise 705 $Returns: TRUE if successful, FALSE otherwise
706 706
707 $Arguments: cid - Context ID 707 $Arguments: cid - Context ID
708 IPAddress - IP address of context 708 IPAddress - IP address of context
709 APN - Access Point Name of context 709 APN - Access Point Name of context
710 710
711 *******************************************************************************/ 711 *******************************************************************************/
712 #ifdef FF_2TO1_PS 712 #ifdef FF_2TO1_PS
713 int GPRS_ContextDefine(SHORT cid, char *IPAddress, char *APN) 713 int GPRS_ContextDefine(SHORT cid, char *IPAddress, char *APN)
714 { 714 {
715 static T_PDP_CONTEXT context; 715 static T_PDP_CONTEXT context;
716 716
717 strcpy(context.pdp_apn, APN); 717 strcpy(context.pdp_apn, APN);
718 strcpy(context.pdp_type, "IP"); 718 strcpy(context.pdp_type, "IP");
719 strcpy((char*)context.pdp_addr.ip_address.ipv4_addr.a4, (char*)IPAddress); 719 strcpy((char*)context.pdp_addr.ip_address.ipv4_addr.a4, (char*)IPAddress);
720 720
721 context.pdp_addr.ctrl_ip_address = NAS_is_ipv4; 721 context.pdp_addr.ctrl_ip_address = NAS_is_ipv4;
722 722
723 /* x0045876, 14-Aug-2006 (WR - integer conversion resulted in a change of sign) */ 723 /* x0045876, 14-Aug-2006 (WR - integer conversion resulted in a change of sign) */
724 /* 724 /*
725 context.d_comp = CGDCONT_D_COMP_OMITTED; 725 context.d_comp = CGDCONT_D_COMP_OMITTED;
726 context.h_comp = CGDCONT_H_COMP_OMITTED; 726 context.h_comp = CGDCONT_H_COMP_OMITTED;
727 */ 727 */
728 context.d_comp = (U8) CGDCONT_D_COMP_OMITTED; 728 context.d_comp = (U8) CGDCONT_D_COMP_OMITTED;
729 context.h_comp = (U8) CGDCONT_H_COMP_OMITTED; 729 context.h_comp = (U8) CGDCONT_H_COMP_OMITTED;
730 730
731 // memset(&context.qos,0,sizeof(T_PS_qos)); 731 // memset(&context.qos,0,sizeof(T_PS_qos));
732 // memset(&context.min_qos,0,sizeof(T_PS_qos)); 732 // memset(&context.min_qos,0,sizeof(T_PS_qos));
733 733
734 if (gprs_definePDPContext(cid, &context)!=MFW_RES_OK) 734 if (gprs_definePDPContext(cid, &context)!=MFW_RES_OK)
735 { 735 {
736 return FALSE; 736 return FALSE;
737 } 737 }
738 738
739 return TRUE; 739 return TRUE;
740 } 740 }
741 #else 741 #else
742 int GPRS_ContextDefine(SHORT cid, char *IPAddress, char *APN) 742 int GPRS_ContextDefine(SHORT cid, char *IPAddress, char *APN)
743 { 743 {
744 static T_PDP_CONTEXT context; 744 static T_PDP_CONTEXT context;
745 745
746 strcpy(context.pdp_apn, APN); 746 strcpy(context.pdp_apn, APN);
747 strcpy(context.pdp_type, "IP"); 747 strcpy(context.pdp_type, "IP");
748 strcpy((char*)context.pdp_addr.ip_address.ipv4_addr.a4, (char*)IPAddress); 748 strcpy((char*)context.pdp_addr.ip_address.ipv4_addr.a4, (char*)IPAddress);
749 context.pdp_addr.ctrl_ip_address = NAS_is_ipv4; 749 context.pdp_addr.ctrl_ip_address = NAS_is_ipv4;
750 context.d_comp = (U8)CGDCONT_D_COMP_OMITTED; 750 context.d_comp = (U8)CGDCONT_D_COMP_OMITTED;
751 context.h_comp = (U8)CGDCONT_H_COMP_OMITTED; 751 context.h_comp = (U8)CGDCONT_H_COMP_OMITTED;
752 // memset(&context.qos,0,sizeof(T_QOS)); 752 // memset(&context.qos,0,sizeof(T_QOS));
753 // memset(&context.min_qos,0,sizeof(T_QOS)); 753 // memset(&context.min_qos,0,sizeof(T_QOS));
754 754
755 if (gprs_definePDPContext(cid, &context)!=MFW_RES_OK) 755 if (gprs_definePDPContext(cid, &context)!=MFW_RES_OK)
756 { 756 {
757 return FALSE; 757 return FALSE;
758 } 758 }
759 759
760 return TRUE; 760 return TRUE;
761 } 761 }
762 #endif 762 #endif
763 763
764 764
765 /******************************************************************************* 765 /*******************************************************************************
766 766
767 $Function: GPRS_ContextActivate 767 $Function: GPRS_ContextActivate
768 768
769 $Description: Activates a PDP context 769 $Description: Activates a PDP context
770 770
771 $Returns: TRUE if successful, FALSE otherwise 771 $Returns: TRUE if successful, FALSE otherwise
772 772
773 $Arguments: cid - Context ID 773 $Arguments: cid - Context ID
774 774
775 *******************************************************************************/ 775 *******************************************************************************/
776 776
777 int GPRS_ContextActivate(SHORT cid) 777 int GPRS_ContextActivate(SHORT cid)
778 { 778 {
779 SHORT cids[2]; 779 SHORT cids[2];
780 780
781 tracefunction("GPRS_ContextActivate()"); 781 tracefunction("GPRS_ContextActivate()");
782 782
783 cids[0] = cid; 783 cids[0] = cid;
784 cids[1] = 0; 784 cids[1] = 0;
785 785
786 if (gprs_contextActivation(CGACT_STATE_ACTIVATED, cids)==MFW_RES_OK) 786 if (gprs_contextActivation(CGACT_STATE_ACTIVATED, cids)==MFW_RES_OK)
787 { 787 {
788 trace("GPRS_ContextActivate: Failed."); 788 trace("GPRS_ContextActivate: Failed.");
789 return FALSE; 789 return FALSE;
790 } 790 }
791 791
792 trace("GPRS_ContextActivate: Executing, awaiting confirmation."); 792 trace("GPRS_ContextActivate: Executing, awaiting confirmation.");
793 return TRUE; 793 return TRUE;
794 } 794 }
795 795
796 796
797 /******************************************************************************* 797 /*******************************************************************************
798 798
799 $Function: GPRS_ContextDeactivate 799 $Function: GPRS_ContextDeactivate
800 800
801 $Description: Dectivates a PDP context 801 $Description: Dectivates a PDP context
802 802
803 $Returns: TRUE if successful, FALSE otherwise 803 $Returns: TRUE if successful, FALSE otherwise
804 804
805 $Arguments: cid - Context ID 805 $Arguments: cid - Context ID
806 806
807 *******************************************************************************/ 807 *******************************************************************************/
808 808
809 int GPRS_ContextDeactivate(SHORT cid) 809 int GPRS_ContextDeactivate(SHORT cid)
810 { 810 {
811 SHORT cids[2]; 811 SHORT cids[2];
812 812
813 tracefunction("GPRS_ContextDeactivate()"); 813 tracefunction("GPRS_ContextDeactivate()");
814 814
815 cids[0] = cid; 815 cids[0] = cid;
816 cids[1] = 0; 816 cids[1] = 0;
817 817
818 if (gprs_contextActivation(CGACT_STATE_DEACTIVATED, cids)==MFW_RES_OK) 818 if (gprs_contextActivation(CGACT_STATE_DEACTIVATED, cids)==MFW_RES_OK)
819 { 819 {
820 trace("GPRS_ContextDeactivate: Failed."); 820 trace("GPRS_ContextDeactivate: Failed.");
821 return FALSE; 821 return FALSE;
822 } 822 }
823 823
824 trace("GPRS_ContextDeactivate: Executing, awaiting confirmation."); 824 trace("GPRS_ContextDeactivate: Executing, awaiting confirmation.");
825 return TRUE; 825 return TRUE;
826 } 826 }
827 827
828 828
829 /******************************************************************************* 829 /*******************************************************************************
830 830
831 $Function: GPRS_SetQOS 831 $Function: GPRS_SetQOS
832 832
833 $Description: Set quality of service 833 $Description: Set quality of service
834 834
835 $Returns: TRUE if succeeded, FALSE if failed 835 $Returns: TRUE if succeeded, FALSE if failed
836 836
837 $Arguments: cid - context ID 837 $Arguments: cid - context ID
838 preced...etc. - quality of service parameters 838 preced...etc. - quality of service parameters
839 839
840 *******************************************************************************/ 840 *******************************************************************************/
841 841
842 #ifdef FF_2TO1_PS 842 #ifdef FF_2TO1_PS
843 int GPRS_SetQOS(SHORT cid, UBYTE preced, UBYTE delay, UBYTE relclass, UBYTE peak, UBYTE mean) 843 int GPRS_SetQOS(SHORT cid, UBYTE preced, UBYTE delay, UBYTE relclass, UBYTE peak, UBYTE mean)
844 { 844 {
845 T_PS_qos QOS; 845 T_PS_qos QOS;
846 846
847 tracefunction("GPRS_SetQOS()"); 847 tracefunction("GPRS_SetQOS()");
848 848
849 QOS.qos_r97.preced = preced; 849 QOS.qos_r97.preced = preced;
850 QOS.qos_r97.delay = delay; 850 QOS.qos_r97.delay = delay;
851 QOS.qos_r97.relclass = relclass; 851 QOS.qos_r97.relclass = relclass;
852 QOS.qos_r97.peak = peak; 852 QOS.qos_r97.peak = peak;
853 QOS.qos_r97.mean = mean; 853 QOS.qos_r97.mean = mean;
854 854
855 if (gprs_setQOS(cid, &QOS)!=MFW_RES_OK) 855 if (gprs_setQOS(cid, &QOS)!=MFW_RES_OK)
856 { 856 {
857 trace("GPRS_MenuSetQOS: Failed"); 857 trace("GPRS_MenuSetQOS: Failed");
858 return FALSE; 858 return FALSE;
859 } 859 }
860 860
861 trace("GPRS_MenuSetQOS: OK"); 861 trace("GPRS_MenuSetQOS: OK");
862 862
863 return TRUE; 863 return TRUE;
864 } 864 }
865 #else 865 #else
866 int GPRS_SetQOS(SHORT cid, UBYTE preced, UBYTE delay, UBYTE relclass, UBYTE peak, UBYTE mean) 866 int GPRS_SetQOS(SHORT cid, UBYTE preced, UBYTE delay, UBYTE relclass, UBYTE peak, UBYTE mean)
867 { 867 {
868 T_PS_qos QOS; 868 T_PS_qos QOS;
869 869
870 tracefunction("GPRS_SetQOS()"); 870 tracefunction("GPRS_SetQOS()");
871 871
872 QOS.qos_r97.preced = preced; 872 QOS.qos_r97.preced = preced;
873 QOS.qos_r97.delay = delay; 873 QOS.qos_r97.delay = delay;
874 QOS.qos_r97.relclass = relclass; 874 QOS.qos_r97.relclass = relclass;
875 QOS.qos_r97.peak = peak; 875 QOS.qos_r97.peak = peak;
876 QOS.qos_r97.mean = mean; 876 QOS.qos_r97.mean = mean;
877 877
878 878
879 if (gprs_setQOS(cid, &QOS)!=MFW_RES_OK) 879 if (gprs_setQOS(cid, &QOS)!=MFW_RES_OK)
880 { 880 {
881 trace("GPRS_MenuSetQOS: Failed"); 881 trace("GPRS_MenuSetQOS: Failed");
882 return FALSE; 882 return FALSE;
883 } 883 }
884 884
885 trace("GPRS_MenuSetQOS: OK"); 885 trace("GPRS_MenuSetQOS: OK");
886 886
887 return TRUE; 887 return TRUE;
888 } 888 }
889 #endif 889 #endif
890 890
891 /******************************************************************************* 891 /*******************************************************************************
892 892
893 $Function: GPRS_SetMinQOS 893 $Function: GPRS_SetMinQOS
894 894
895 $Description: Set minimum quality of service 895 $Description: Set minimum quality of service
896 896
897 $Returns: TRUE if succeeded, FALSE if failed 897 $Returns: TRUE if succeeded, FALSE if failed
898 898
899 $Arguments: cid - context ID 899 $Arguments: cid - context ID
900 preced...etc. - quality of service parameters 900 preced...etc. - quality of service parameters
901 901
902 *******************************************************************************/ 902 *******************************************************************************/
903 903
904 #ifdef FF_2TO1_PS 904 #ifdef FF_2TO1_PS
905 int GPRS_SetMinQOS(SHORT cid, UBYTE preced, UBYTE delay, UBYTE relclass, UBYTE peak, UBYTE mean) 905 int GPRS_SetMinQOS(SHORT cid, UBYTE preced, UBYTE delay, UBYTE relclass, UBYTE peak, UBYTE mean)
906 { 906 {
907 T_PS_qos QOS; 907 T_PS_qos QOS;
908 908
909 tracefunction("GPRS_SetMinQOS()"); 909 tracefunction("GPRS_SetMinQOS()");
910 910
911 QOS.qos_r97.preced = preced; 911 QOS.qos_r97.preced = preced;
912 QOS.qos_r97.delay = delay; 912 QOS.qos_r97.delay = delay;
913 QOS.qos_r97.relclass = relclass; 913 QOS.qos_r97.relclass = relclass;
914 QOS.qos_r97.peak = peak; 914 QOS.qos_r97.peak = peak;
915 QOS.qos_r97.mean = mean; 915 QOS.qos_r97.mean = mean;
916 916
917 if (gprs_setQOSMin(cid, &QOS)!=MFW_RES_OK) 917 if (gprs_setQOSMin(cid, &QOS)!=MFW_RES_OK)
918 { 918 {
919 trace("GPRS_MenuSetMinQOS: Failed"); 919 trace("GPRS_MenuSetMinQOS: Failed");
920 return FALSE; 920 return FALSE;
921 } 921 }
922 922
923 trace("GPRS_MenuSetMinQOS: OK"); 923 trace("GPRS_MenuSetMinQOS: OK");
924 924
925 return TRUE; 925 return TRUE;
926 } 926 }
927 #else 927 #else
928 int GPRS_SetMinQOS(SHORT cid, UBYTE preced, UBYTE delay, UBYTE relclass, UBYTE peak, UBYTE mean) 928 int GPRS_SetMinQOS(SHORT cid, UBYTE preced, UBYTE delay, UBYTE relclass, UBYTE peak, UBYTE mean)
929 { 929 {
930 T_PS_qos QOS; 930 T_PS_qos QOS;
931 931
932 tracefunction("GPRS_SetMinQOS()"); 932 tracefunction("GPRS_SetMinQOS()");
933 933
934 QOS.qos_r97.preced = preced; 934 QOS.qos_r97.preced = preced;
935 QOS.qos_r97.delay = delay; 935 QOS.qos_r97.delay = delay;
936 QOS.qos_r97.relclass = relclass; 936 QOS.qos_r97.relclass = relclass;
937 QOS.qos_r97.peak = peak; 937 QOS.qos_r97.peak = peak;
938 QOS.qos_r97.mean = mean; 938 QOS.qos_r97.mean = mean;
939 939
940 if (gprs_setQOSMin(cid, &QOS)!=MFW_RES_OK) 940 if (gprs_setQOSMin(cid, &QOS)!=MFW_RES_OK)
941 { 941 {
942 trace("GPRS_MenuSetMinQOS: Failed"); 942 trace("GPRS_MenuSetMinQOS: Failed");
943 return FALSE; 943 return FALSE;
944 } 944 }
945 945
946 trace("GPRS_MenuSetMinQOS: OK"); 946 trace("GPRS_MenuSetMinQOS: OK");
947 947
948 return TRUE; 948 return TRUE;
949 } 949 }
950 #endif 950 #endif
951 951
952 /******************************************************************************* 952 /*******************************************************************************
953 953
954 $Function: GPRS_SmsService 954 $Function: GPRS_SmsService
955 955
956 $Description: Return SMS Service type 956 $Description: Return SMS Service type
957 957
958 $Returns: SMS_SERVICE_xxx 958 $Returns: SMS_SERVICE_xxx
959 959
960 $Arguments: None. 960 $Arguments: None.
961 961
962 *******************************************************************************/ 962 *******************************************************************************/
963 963
964 UBYTE GPRS_SmsService(void) 964 UBYTE GPRS_SmsService(void)
965 { 965 {
966 T_MMI_GPRS_DATA *data = GPRS_Data(); 966 T_MMI_GPRS_DATA *data = GPRS_Data();
967 967
968 tracefunction("GPRS_SmsService"); 968 tracefunction("GPRS_SmsService");
969 969
970 if (!data) 970 if (!data)
971 { 971 {
972 return SMS_SERVICE_OMITTED; 972 return SMS_SERVICE_OMITTED;
973 } 973 }
974 974
975 return data->sms_service; 975 return data->sms_service;
976 } 976 }
977 977
978 978
979 /******************************************************************************* 979 /*******************************************************************************
980 980
981 $Function: GPRS_SetSmsService 981 $Function: GPRS_SetSmsService
982 982
983 $Description: Set SMS Service type 983 $Description: Set SMS Service type
984 984
985 $Returns: TRUE if set proceeded OK 985 $Returns: TRUE if set proceeded OK
986 986
987 $Arguments: None. 987 $Arguments: None.
988 988
989 *******************************************************************************/ 989 *******************************************************************************/
990 990
991 UBYTE GPRS_SetSmsService(UBYTE service) 991 UBYTE GPRS_SetSmsService(UBYTE service)
992 { 992 {
993 T_MMI_GPRS_DATA *data = GPRS_Data(); 993 T_MMI_GPRS_DATA *data = GPRS_Data();
994 T_CGSMS_SERVICE ACISmsService; 994 T_CGSMS_SERVICE ACISmsService;
995 UBYTE old_service = 0; /* Warning Correction - 29-11-2005 */ 995 UBYTE old_service = 0; /* Warning Correction - 29-11-2005 */
996 tracefunction("GPRS_SetSmsService"); 996 tracefunction("GPRS_SetSmsService");
997 trace_P1("Service: %d", service); 997 trace_P1("Service: %d", service);
998 998
999 switch(service) 999 switch(service)
1000 { 1000 {
1001 case SMS_SERVICE_GPRS: 1001 case SMS_SERVICE_GPRS:
1002 ACISmsService = CGSMS_SERVICE_GPRS; 1002 ACISmsService = CGSMS_SERVICE_GPRS;
1003 break; 1003 break;
1004 case SMS_SERVICE_CS: 1004 case SMS_SERVICE_CS:
1005 ACISmsService = CGSMS_SERVICE_CS; 1005 ACISmsService = CGSMS_SERVICE_CS;
1006 break; 1006 break;
1007 case SMS_SERVICE_GPRS_PREF: 1007 case SMS_SERVICE_GPRS_PREF:
1008 ACISmsService = CGSMS_SERVICE_GPRS_PREFERRED; 1008 ACISmsService = CGSMS_SERVICE_GPRS_PREFERRED;
1009 break; 1009 break;
1010 case SMS_SERVICE_CS_PREF: 1010 case SMS_SERVICE_CS_PREF:
1011 ACISmsService = CGSMS_SERVICE_CS_PREFERRED; 1011 ACISmsService = CGSMS_SERVICE_CS_PREFERRED;
1012 break; 1012 break;
1013 default: 1013 default:
1014 ACISmsService = CGSMS_SERVICE_CS; 1014 ACISmsService = CGSMS_SERVICE_CS;
1015 break; 1015 break;
1016 } 1016 }
1017 1017
1018 if (data) 1018 if (data)
1019 { 1019 {
1020 old_service = data->sms_service; 1020 old_service = data->sms_service;
1021 data->sms_service = service; 1021 data->sms_service = service;
1022 } 1022 }
1023 1023
1024 if (gprs_setServiceSMS(ACISmsService) != MFW_RES_OK) 1024 if (gprs_setServiceSMS(ACISmsService) != MFW_RES_OK)
1025 { 1025 {
1026 trace("gprs_setServiceSMS failed"); 1026 trace("gprs_setServiceSMS failed");
1027 /* Failed - set service back to old value */ 1027 /* Failed - set service back to old value */
1028 if (data) 1028 if (data)
1029 { 1029 {
1030 data->sms_service = old_service; 1030 data->sms_service = old_service;
1031 } 1031 }
1032 return FALSE; 1032 return FALSE;
1033 } 1033 }
1034 1034
1035 return TRUE; 1035 return TRUE;
1036 } 1036 }
1037 1037
1038 1038
1039 /******************************************************************************* 1039 /*******************************************************************************
1040 1040
1041 $Function: GPRS_MfwCb 1041 $Function: GPRS_MfwCb
1042 1042
1043 $Description: Callback function for MFW GPRS events. 1043 $Description: Callback function for MFW GPRS events.
1044 1044
1045 $Returns: 1045 $Returns:
1046 1046
1047 $Arguments: Event number and generic parameter. 1047 $Arguments: Event number and generic parameter.
1048 1048
1049 *******************************************************************************/ 1049 *******************************************************************************/
1050 1050
1051 static int GPRS_MfwCb(T_MFW_EVENT event, void* para) 1051 static int GPRS_MfwCb(T_MFW_EVENT event, void* para)
1052 { 1052 {
1053 1053
1054 T_MMI_GPRS_DATA *data = GPRS_Data(); 1054 T_MMI_GPRS_DATA *data = GPRS_Data();
1055 T_MFW_HND win = mfwParent( mfw_header()); 1055 T_MFW_HND win = mfwParent( mfw_header());
1056 T_MFW_GPRS_DATA *gprs_data = (T_MFW_GPRS_DATA *)para; // Structure that stores data from mfw 1056 T_MFW_GPRS_DATA *gprs_data = (T_MFW_GPRS_DATA *)para; // Structure that stores data from mfw
1057 USHORT textId; 1057 USHORT textId;
1058 int result; 1058 int result;
1059 1059
1060 tracefunction("GPRS_MfwCb()"); 1060 tracefunction("GPRS_MfwCb()");
1061 1061
1062 if (!data) 1062 if (!data)
1063 { 1063 {
1064 return FALSE; /* Warning Correction - provide return value */ 1064 return FALSE; /* Warning Correction - provide return value */
1065 } 1065 }
1066 1066
1067 /* Result of GPRS_NOTHING will not be sent */ 1067 /* Result of GPRS_NOTHING will not be sent */
1068 1068
1069 result = GPRS_NOTHING; 1069 result = GPRS_NOTHING;
1070 1070
1071 /* Find GPRS status */ 1071 /* Find GPRS status */
1072 1072
1073 if (idleIsFocussed()) 1073 if (idleIsFocussed())
1074 { 1074 {
1075 /* Update idle screen icons to show any change in GPRS status */ 1075 /* Update idle screen icons to show any change in GPRS status */
1076 iconsShow(); 1076 iconsShow();
1077 } 1077 }
1078 else 1078 else
1079 { 1079 {
1080 /* iconsShow calls GPRS_Status; if we don't call that, call this on its own */ 1080 /* iconsShow calls GPRS_Status; if we don't call that, call this on its own */
1081 GPRS_Status(); 1081 GPRS_Status();
1082 } 1082 }
1083 1083
1084 switch(event) 1084 switch(event)
1085 { 1085 {
1086 case E_MFW_GPRS_S_CNTXT: 1086 case E_MFW_GPRS_S_CNTXT:
1087 trace("GPRS_MfwCb: E_MFW_GPRS_S_CNTXT"); 1087 trace("GPRS_MfwCb: E_MFW_GPRS_S_CNTXT");
1088 break; 1088 break;
1089 1089
1090 case E_MFW_GPRS_S_ATT: 1090 case E_MFW_GPRS_S_ATT:
1091 trace("GPRS_MfwCb: E_MFW_GPRS_S_ATT"); 1091 trace("GPRS_MfwCb: E_MFW_GPRS_S_ATT");
1092 1092
1093 // Dec 01, 2005 REF: DR OMAPS00048530 x0039928 1093 // Dec 01, 2005 REF: DR OMAPS00048530 x0039928
1094 // Fix : Set the current status to attaching or detaching depending on the request. 1094 // Fix : Set the current status to attaching or detaching depending on the request.
1095 if (data->reg_status!= GPRS_ATTACHED) 1095 if (data->reg_status!= GPRS_ATTACHED)
1096 data->status = MMI_GPRS_STATUS_ATTACHING; 1096 data->status = MMI_GPRS_STATUS_ATTACHING;
1097 else 1097 else
1098 data->status = MMI_GPRS_STATUS_DETACHING; 1098 data->status = MMI_GPRS_STATUS_DETACHING;
1099 1099
1100 if (data->display) 1100 if (data->display)
1101 { 1101 {
1102 if (data->reg_status!= GPRS_ATTACHED) 1102 if (data->reg_status!= GPRS_ATTACHED)
1103 { 1103 {
1104 /* Previous please wait will be destroyed and this new message shown */ 1104 /* Previous please wait will be destroyed and this new message shown */
1105 GPRS_PleaseWait(win, TxtGPRS, TxtAttaching); 1105 GPRS_PleaseWait(win, TxtGPRS, TxtAttaching);
1106 } 1106 }
1107 else 1107 else
1108 { 1108 {
1109 /* MZ cq10952 Info string */ 1109 /* MZ cq10952 Info string */
1110 GPRS_PleaseWait(win, TxtGPRS, TxtDetaching); 1110 GPRS_PleaseWait(win, TxtGPRS, TxtDetaching);
1111 } 1111 }
1112 } 1112 }
1113 break; 1113 break;
1114 1114
1115 case E_MFW_GPRS_S_ACT: 1115 case E_MFW_GPRS_S_ACT:
1116 trace("GPRS_MfwCb: E_MFW_GPRS_S_ACT"); 1116 trace("GPRS_MfwCb: E_MFW_GPRS_S_ACT");
1117 1117
1118 /* Notify of context activation */ 1118 /* Notify of context activation */
1119 result = GPRS_CONTEXT_ACTIVATE; 1119 result = GPRS_CONTEXT_ACTIVATE;
1120 break; 1120 break;
1121 1121
1122 case E_MFW_GPRS_R_ACT: 1122 case E_MFW_GPRS_R_ACT:
1123 trace("GPRS_MfwCb: E_MFW_GPRS_R_ACT"); 1123 trace("GPRS_MfwCb: E_MFW_GPRS_R_ACT");
1124 1124
1125 /* Notify of context activation */ 1125 /* Notify of context activation */
1126 result = GPRS_CONTEXT_ACTIVATE; 1126 result = GPRS_CONTEXT_ACTIVATE;
1127 break; 1127 break;
1128 1128
1129 case E_MFW_GPRS_S_DATA: 1129 case E_MFW_GPRS_S_DATA:
1130 trace("GPRS_MfwCb: E_MFW_GPRS_S_DATA"); 1130 trace("GPRS_MfwCb: E_MFW_GPRS_S_DATA");
1131 break; 1131 break;
1132 1132
1133 case E_MFW_GPRS_R_DATA: 1133 case E_MFW_GPRS_R_DATA:
1134 trace("GPRS_MfwCb: E_MFW_GPRS_R_DATA"); 1134 trace("GPRS_MfwCb: E_MFW_GPRS_R_DATA");
1135 break; 1135 break;
1136 1136
1137 case E_MFW_GPRS_S_QOS: 1137 case E_MFW_GPRS_S_QOS:
1138 trace("GPRS_MfwCb: E_MFW_GPRS_S_QOS"); 1138 trace("GPRS_MfwCb: E_MFW_GPRS_S_QOS");
1139 break; 1139 break;
1140 1140
1141 case E_MFW_GPRS_R_QOS: 1141 case E_MFW_GPRS_R_QOS:
1142 trace("GPRS_MfwCb: E_MFW_GPRS_R_QOS"); 1142 trace("GPRS_MfwCb: E_MFW_GPRS_R_QOS");
1143 break; 1143 break;
1144 1144
1145 case E_MFW_GPRS_S_QOS_MIN: 1145 case E_MFW_GPRS_S_QOS_MIN:
1146 trace("GPRS_MfwCb: E_MFW_GPRS_S_QOS_MIN"); 1146 trace("GPRS_MfwCb: E_MFW_GPRS_S_QOS_MIN");
1147 break; 1147 break;
1148 1148
1149 case E_MFW_GPRS_S_CLASS: 1149 case E_MFW_GPRS_S_CLASS:
1150 trace("GPRS_MfwCb: E_MFW_GPRS_S_CLASS"); 1150 trace("GPRS_MfwCb: E_MFW_GPRS_S_CLASS");
1151 break; 1151 break;
1152 1152
1153 case E_MFW_GPRS_S_PDPADDR: 1153 case E_MFW_GPRS_S_PDPADDR:
1154 trace("GPRS_MfwCb: E_MFW_GPRS_S_PDPADDR"); 1154 trace("GPRS_MfwCb: E_MFW_GPRS_S_PDPADDR");
1155 break; 1155 break;
1156 1156
1157 case E_MFW_GPRS_S_AUTORESP: 1157 case E_MFW_GPRS_S_AUTORESP:
1158 trace("GPRS_MfwCb: E_MFW_GPRS_S_AUTORESP"); 1158 trace("GPRS_MfwCb: E_MFW_GPRS_S_AUTORESP");
1159 break; 1159 break;
1160 1160
1161 case E_MFW_GPRS_S_ANS: 1161 case E_MFW_GPRS_S_ANS:
1162 trace("GPRS_MfwCb: E_MFW_GPRS_S_ANS"); 1162 trace("GPRS_MfwCb: E_MFW_GPRS_S_ANS");
1163 break; 1163 break;
1164 1164
1165 case E_MFW_GPRS_R_ANS: 1165 case E_MFW_GPRS_R_ANS:
1166 trace("GPRS_MfwCb: E_MFW_GPRS_R_ANS"); 1166 trace("GPRS_MfwCb: E_MFW_GPRS_R_ANS");
1167 break; 1167 break;
1168 1168
1169 case E_MFW_GPRS_S_EREP: 1169 case E_MFW_GPRS_S_EREP:
1170 trace("GPRS_MfwCb: E_MFW_GPRS_S_EREPG"); 1170 trace("GPRS_MfwCb: E_MFW_GPRS_S_EREPG");
1171 break; 1171 break;
1172 1172
1173 case E_MFW_GPRS_R_EREP_RJ: 1173 case E_MFW_GPRS_R_EREP_RJ:
1174 trace("GPRS_MfwCb: E_MFW_GPRS_R_EREP_RJ"); 1174 trace("GPRS_MfwCb: E_MFW_GPRS_R_EREP_RJ");
1175 1175
1176 /* Notify of context deactivation */ 1176 /* Notify of context deactivation */
1177 1177
1178 result = GPRS_CONTEXT_DEACTIVATE; 1178 result = GPRS_CONTEXT_DEACTIVATE;
1179 break; 1179 break;
1180 1180
1181 case E_MFW_GPRS_R_EREP_ATT: 1181 case E_MFW_GPRS_R_EREP_ATT:
1182 trace("GPRS_MfwCb: E_MFW_GPRS_R_EREP_ATT"); 1182 trace("GPRS_MfwCb: E_MFW_GPRS_R_EREP_ATT");
1183 1183
1184 /* Attach status has changed, display message as appropriate */ 1184 /* Attach status has changed, display message as appropriate */
1185 1185
1186 if (data->display) 1186 if (data->display)
1187 { 1187 {
1188 if (data->reg_status==GPRS_ATTACHED) 1188 if (data->reg_status==GPRS_ATTACHED)
1189 textId = TxtAttached; 1189 textId = TxtAttached;
1190 else 1190 else
1191 textId = TxtNotAttached; 1191 textId = TxtNotAttached;
1192 1192
1193 /* Show result */ 1193 /* Show result */
1194 GPRS_ResultScreen(win, TxtGPRS, textId); 1194 GPRS_ResultScreen(win, TxtGPRS, textId);
1195 } 1195 }
1196 data->status = MMI_GPRS_STATUS_IDLE; 1196 data->status = MMI_GPRS_STATUS_IDLE;
1197 1197
1198 break; 1198 break;
1199 1199
1200 case E_MFW_GPRS_R_EREP_ACT: 1200 case E_MFW_GPRS_R_EREP_ACT:
1201 trace("GPRS_MfwCb: E_MFW_GPRS_R_EREP_ACT"); 1201 trace("GPRS_MfwCb: E_MFW_GPRS_R_EREP_ACT");
1202 1202
1203 /* Notify of context activation */ 1203 /* Notify of context activation */
1204 result = GPRS_CONTEXT_ACTIVATE; 1204 result = GPRS_CONTEXT_ACTIVATE;
1205 break; 1205 break;
1206 1206
1207 case E_MFW_GPRS_R_EREP_DEACT: 1207 case E_MFW_GPRS_R_EREP_DEACT:
1208 trace("GPRS_MfwCb: E_MFW_GPRS_R_EREP_DEACT"); 1208 trace("GPRS_MfwCb: E_MFW_GPRS_R_EREP_DEACT");
1209 1209
1210 /* Notify of context deactivation */ 1210 /* Notify of context deactivation */
1211 result = GPRS_CONTEXT_DEACTIVATE; 1211 result = GPRS_CONTEXT_DEACTIVATE;
1212 break; 1212 break;
1213 1213
1214 case E_MFW_GPRS_R_EREP_CLASS: 1214 case E_MFW_GPRS_R_EREP_CLASS:
1215 trace("GPRS_MfwCb: E_MFW_GPRS_R_EREP_CLASS"); 1215 trace("GPRS_MfwCb: E_MFW_GPRS_R_EREP_CLASS");
1216 break; 1216 break;
1217 1217
1218 case E_MFW_GPRS_R_REG: 1218 case E_MFW_GPRS_R_REG:
1219 trace("GPRS_MfwCb: E_MFW_GPRS_R_REG"); 1219 trace("GPRS_MfwCb: E_MFW_GPRS_R_REG");
1220 //x0035544 Feb 23, 2006 DR:OMAPS00068976 1220 //x0035544 Feb 23, 2006 DR:OMAPS00068976
1221 trace_P1("regState: %d", gprs_data->Reg_state.p_reg_State); 1221 trace_P1("regState: %d", gprs_data->Reg_state.p_reg_State);
1222 1222
1223 switch (data->reg_status) 1223 switch (data->reg_status)
1224 { 1224 {
1225 case GPRS_ATTACHED: 1225 case GPRS_ATTACHED:
1226 #ifdef MMI_HOMEZONE_ENABLED 1226 #ifdef MMI_HOMEZONE_ENABLED
1227 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 1227 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858
1228 //begin 30439 1228 //begin 30439
1229 /* Cell reselection for homezone */ 1229 /* Cell reselection for homezone */
1230 homezoneUpdate(gprs_data->lac, gprs_data->ci, 0); 1230 homezoneUpdate(gprs_data->lac, gprs_data->ci, 0);
1231 //end 30439 1231 //end 30439
1232 #endif 1232 #endif
1233 // Dec 01, 2005 REF: DR OMAPS00048530 x0039928 1233 // Dec 01, 2005 REF: DR OMAPS00048530 x0039928
1234 // Fix : Display GPRS attached only if the request is for attaching. 1234 // Fix : Display GPRS attached only if the request is for attaching.
1235 if(data->status == MMI_GPRS_STATUS_ATTACHING) 1235 if(data->status == MMI_GPRS_STATUS_ATTACHING)
1236 { 1236 {
1237 /* Show result */ 1237 /* Show result */
1238 if (data->display) 1238 if (data->display)
1239 { 1239 {
1240 GPRS_ResultScreen(win, TxtGPRS, TxtAttached); 1240 GPRS_ResultScreen(win, TxtGPRS, TxtAttached);
1241 } 1241 }
1242 } 1242 }
1243 data->status = MMI_GPRS_STATUS_IDLE; 1243 data->status = MMI_GPRS_STATUS_IDLE;
1244 break; 1244 break;
1245 1245
1246 case GPRS_OFF: 1246 case GPRS_OFF:
1247 #ifdef MMI_HOMEZONE_ENABLED 1247 #ifdef MMI_HOMEZONE_ENABLED
1248 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 1248 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858
1249 //begin 30439 1249 //begin 30439
1250 /* Cell reselection for homezone */ 1250 /* Cell reselection for homezone */
1251 homezoneUpdate(0,0,0); 1251 homezoneUpdate(0,0,0);
1252 //end 30439 1252 //end 30439
1253 #endif 1253 #endif
1254 // Dec 02, 2005 REF: DR OMAPS00048551 x0039928 1254 // Dec 02, 2005 REF: DR OMAPS00048551 x0039928
1255 // Fix : Display GPRS not attached if gprs attach fails 1255 // Fix : Display GPRS not attached if gprs attach fails
1256 // and the current status is attaching. 1256 // and the current status is attaching.
1257 if(data->status == MMI_GPRS_STATUS_ATTACHING) 1257 if(data->status == MMI_GPRS_STATUS_ATTACHING)
1258 { 1258 {
1259 /* Show result */ 1259 /* Show result */
1260 if (data->display) 1260 if (data->display)
1261 { 1261 {
1262 GPRS_ResultScreen(win, TxtGPRS, TxtNotAttached); 1262 GPRS_ResultScreen(win, TxtGPRS, TxtNotAttached);
1263 } 1263 }
1264 } 1264 }
1265 else 1265 else
1266 { 1266 {
1267 /* Show result */ 1267 /* Show result */
1268 if (data->display) 1268 if (data->display)
1269 { 1269 {
1270 GPRS_ResultScreen(win, TxtGPRS, TxtDetached); 1270 GPRS_ResultScreen(win, TxtGPRS, TxtDetached);
1271 } 1271 }
1272 } 1272 }
1273 data->status = MMI_GPRS_STATUS_IDLE; 1273 data->status = MMI_GPRS_STATUS_IDLE;
1274 break; 1274 break;
1275 1275
1276 case GPRS_SEARCHING: /* not registered, searching */ 1276 case GPRS_SEARCHING: /* not registered, searching */
1277 #ifdef MMI_HOMEZONE_ENABLED 1277 #ifdef MMI_HOMEZONE_ENABLED
1278 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 1278 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858
1279 //begin 30439 1279 //begin 30439
1280 /* Cell reselection for homezone */ 1280 /* Cell reselection for homezone */
1281 homezoneUpdate(0, 0, 0); 1281 homezoneUpdate(0, 0, 0);
1282 //end 30439 1282 //end 30439
1283 #endif 1283 #endif
1284 data->status = MMI_GPRS_STATUS_ATTACHING; 1284 data->status = MMI_GPRS_STATUS_ATTACHING;
1285 if (data->display) 1285 if (data->display)
1286 { 1286 {
1287 GPRS_PleaseWait(win, TxtGPRS, TxtSearching); /* SPR#1986 */ 1287 GPRS_PleaseWait(win, TxtGPRS, TxtSearching); /* SPR#1986 */
1288 } 1288 }
1289 break; 1289 break;
1290 1290
1291 default: 1291 default:
1292 data->status = MMI_GPRS_STATUS_IDLE; 1292 data->status = MMI_GPRS_STATUS_IDLE;
1293 /* Show result */ 1293 /* Show result */
1294 if (data->display) 1294 if (data->display)
1295 { 1295 {
1296 GPRS_ResultScreen(win, TxtGPRS, TxtError); 1296 GPRS_ResultScreen(win, TxtGPRS, TxtError);
1297 } 1297 }
1298 break; 1298 break;
1299 } 1299 }
1300 1300
1301 break; 1301 break;
1302 1302
1303 case E_MFW_GPRS_S_SMSSERV: 1303 case E_MFW_GPRS_S_SMSSERV:
1304 trace("GPRS_MfwCb: E_MFW_GPRS_S_SMSSERV"); 1304 trace("GPRS_MfwCb: E_MFW_GPRS_S_SMSSERV");
1305 trace_P1("Service: %d", data->sms_service); 1305 trace_P1("Service: %d", data->sms_service);
1306 1306
1307 data->status = MMI_GPRS_STATUS_IDLE; 1307 data->status = MMI_GPRS_STATUS_IDLE;
1308 1308
1309 /* Display "Using <service>" */ 1309 /* Display "Using <service>" */
1310 1310
1311 if (data->display) 1311 if (data->display)
1312 { 1312 {
1313 USHORT TxtId2, TxtId1 = TxtUsing; 1313 USHORT TxtId2, TxtId1 = TxtUsing;
1314 switch(data->sms_service) 1314 switch(data->sms_service)
1315 { 1315 {
1316 case SMS_SERVICE_GPRS: /* GPRS */ 1316 case SMS_SERVICE_GPRS: /* GPRS */
1317 TxtId2 = TxtGPRS; 1317 TxtId2 = TxtGPRS;
1318 break; 1318 break;
1319 case SMS_SERVICE_CS: /* circuit switched */ 1319 case SMS_SERVICE_CS: /* circuit switched */
1320 TxtId2 = TxtCSD; 1320 TxtId2 = TxtCSD;
1327 break; 1327 break;
1328 default: /* Shouldn't happen, but... */ 1328 default: /* Shouldn't happen, but... */
1329 TxtId1 = TxtFailed; 1329 TxtId1 = TxtFailed;
1330 TxtId2 = TxtNull; 1330 TxtId2 = TxtNull;
1331 break; 1331 break;
1332 } 1332 }
1333 1333
1334 /* Show result */ 1334 /* Show result */
1335 GPRS_ResultScreen(win, TxtId1, TxtId2); 1335 GPRS_ResultScreen(win, TxtId1, TxtId2);
1336 } 1336 }
1337 break; 1337 break;
1338 1338
1339 case E_MFW_GPRS_OK: 1339 case E_MFW_GPRS_OK:
1340 trace("GPRS_MfwCb: E_MFW_GPRS_OK"); 1340 trace("GPRS_MfwCb: E_MFW_GPRS_OK");
1341 break; 1341 break;
1342 1342
1343 case E_MFW_GPRS_ERROR: 1343 case E_MFW_GPRS_ERROR:
1344 trace("GPRS_MfwCb: E_MFW_GPRS_ERROR"); 1344 trace("GPRS_MfwCb: E_MFW_GPRS_ERROR");
1345 1345
1346 data->status = MMI_GPRS_STATUS_IDLE; 1346 data->status = MMI_GPRS_STATUS_IDLE;
1347 1347
1348 /* Display "GPRS Error" */ 1348 /* Display "GPRS Error" */
1349 1349
1350 if (data->display) 1350 if (data->display)
1351 { 1351 {
1352 /* Delete please wait window */ 1352 /* Delete please wait window */
1353 GPRS_PleaseWaitDestroy(); 1353 GPRS_PleaseWaitDestroy();
1354 1354
1355 /* Show result */ 1355 /* Show result */
1356 GPRS_ResultScreen(win, TxtGPRS, TxtFailed); 1356 GPRS_ResultScreen(win, TxtGPRS, TxtFailed);
1357 } 1357 }
1358 1358
1359 /* Notify of error */ 1359 /* Notify of error */
1360 result = GPRS_ERROR; 1360 result = GPRS_ERROR;
1361 break; 1361 break;
1362 1362
1363 case E_MFW_GPRS_CONNECT: 1363 case E_MFW_GPRS_CONNECT:
1364 trace("GPRS_MfwCb: E_MFW_GPRS_CONNECT"); 1364 trace("GPRS_MfwCb: E_MFW_GPRS_CONNECT");
1365 1365
1366 data->status = MMI_GPRS_STATUS_IDLE; 1366 data->status = MMI_GPRS_STATUS_IDLE;
1367 1367
1368 if (data->display) 1368 if (data->display)
1369 { 1369 {
1370 /* Delete please wait window */ 1370 /* Delete please wait window */
1371 GPRS_PleaseWaitDestroy(); 1371 GPRS_PleaseWaitDestroy();
1372 1372
1373 /* Display "CONNECTED" window */ 1373 /* Display "CONNECTED" window */
1374 info_screen(win, TxtGPRS, TxtConnected, NULL); 1374 info_screen(win, TxtGPRS, TxtConnected, NULL);
1375 } 1375 }
1376 break; 1376 break;
1377 1377
1378 case E_MFW_GPRS_ERR_CONNECT: 1378 case E_MFW_GPRS_ERR_CONNECT:
1379 trace("GPRS_MfwCb: E_MFW_GPRS_ERR_CONNECT"); 1379 trace("GPRS_MfwCb: E_MFW_GPRS_ERR_CONNECT");
1380 1380
1381 data->status = MMI_GPRS_STATUS_IDLE; 1381 data->status = MMI_GPRS_STATUS_IDLE;
1382 1382
1383 /* Display "GPRS No Answer" */ 1383 /* Display "GPRS No Answer" */
1384 if (data->display) 1384 if (data->display)
1385 { 1385 {
1386 /* Show result */ 1386 /* Show result */
1387 GPRS_ResultScreen(win, TxtGPRS, TxtNoAnswer); 1387 GPRS_ResultScreen(win, TxtGPRS, TxtNoAnswer);
1388 } 1388 }
1389 break; 1389 break;
1390 1390
1391 case E_MFW_GPRS_COUNTER: 1391 case E_MFW_GPRS_COUNTER:
1392 trace("GPRS_MfwCb: E_MFW_GPRS_COUNTER"); 1392 trace("GPRS_MfwCb: E_MFW_GPRS_COUNTER");
1393 1393
1394 /* Add values returned from ACI 1394 /* Add values returned from ACI
1395 * to total counter */ 1395 * to total counter */
1396 1396
1397 data->uplink_counter += (ULONG)(gprs_data->counter.octets_uplink); 1397 data->uplink_counter += (ULONG)(gprs_data->counter.octets_uplink);
1398 data->downlink_counter += (ULONG)(gprs_data->counter.octets_downlink); 1398 data->downlink_counter += (ULONG)(gprs_data->counter.octets_downlink);
1399 1399
1400 /* Only display counter if user has requested it */ 1400 /* Only display counter if user has requested it */
1401 1401
1402 if (data->display) 1402 if (data->display)
1403 { 1403 {
1404 data->display = FALSE; 1404 data->display = FALSE;
1405 /* Delete please wait window */ 1405 /* Delete please wait window */
1406 GPRS_PleaseWaitDestroy(); 1406 GPRS_PleaseWaitDestroy();
1407 1407
1408 GPRS_ShowCounter(win); 1408 GPRS_ShowCounter(win);
1409 } 1409 }
1410 break; 1410 break;
1411 1411
1412 default: 1412 default:
1413 trace_P1("GPRS_MfwCb: event = %d", event); 1413 trace_P1("GPRS_MfwCb: event = %d", event);
1414 break; 1414 break;
1415 } 1415 }
1416 1416
1417 /* Send a notification if appropriate */ 1417 /* Send a notification if appropriate */
1418 1418
1419 if (data->callback!=NULL && result!=GPRS_NOTHING) 1419 if (data->callback!=NULL && result!=GPRS_NOTHING)
1420 { 1420 {
1421 data->callback(result); 1421 data->callback(result);
1422 } 1422 }
1423 1423
1424 return TRUE; 1424 return TRUE;
1425 } 1425 }
1426 1426
1427 1427
1428 /******************************************************************************* 1428 /*******************************************************************************
1429 1429
1430 $Function: GPRS_MenuAttach 1430 $Function: GPRS_MenuAttach
1431 1431
1432 $Description: Attempts an attach to the GPRS network. 1432 $Description: Attempts an attach to the GPRS network.
1433 1433
1434 $Returns: TRUE if proceeding, FALSE if failed 1434 $Returns: TRUE if proceeding, FALSE if failed
1435 1435
1436 $Arguments: Standard menu option parameters 1436 $Arguments: Standard menu option parameters
1437 1437
1438 *******************************************************************************/ 1438 *******************************************************************************/
1439 1439
1440 int GPRS_MenuAttach(MfwMnu* m, MfwMnuItem* i) 1440 int GPRS_MenuAttach(MfwMnu* m, MfwMnuItem* i)
1441 { 1441 {
1442 T_MMI_GPRS_DATA *data = GPRS_Data(); 1442 T_MMI_GPRS_DATA *data = GPRS_Data();
1443 T_MFW_HND win = mfw_parent(mfw_header()); 1443 T_MFW_HND win = mfw_parent(mfw_header());
1444 /* int gprsStatus; */ /* Warning Correction */ 1444 /* int gprsStatus; */ /* Warning Correction */
1445 1445
1446 tracefunction("GPRS_MenuAttach()"); 1446 tracefunction("GPRS_MenuAttach()");
1447 1447
1448 if (!data) 1448 if (!data)
1449 { 1449 {
1450 return FALSE; 1450 return FALSE;
1451 } 1451 }
1452 1452
1453 if (!data->mfw_gprs) 1453 if (!data->mfw_gprs)
1454 { 1454 {
1455 data->mfw_gprs = gprs_create(0, E_MFW_GPRS_ALL_EVENTS, (MfwCb)GPRS_MfwCb); 1455 data->mfw_gprs = gprs_create(0, E_MFW_GPRS_ALL_EVENTS, (MfwCb)GPRS_MfwCb);
1456 /* Set CID to 0; on increment will become 1. */ 1456 /* Set CID to 0; on increment will become 1. */
1457 data->cid = GPRS_CID_OMITTED; 1457 data->cid = GPRS_CID_OMITTED;
1458 } 1458 }
1459 1459
1460 if (data->reg_status==(int)GPRS_ATTACHED) 1460 if (data->reg_status==(int)GPRS_ATTACHED)
1461 { 1461 {
1462 /* Show result */ 1462 /* Show result */
1463 GPRS_ResultScreen(win, TxtAlreadyAttached, TxtAttached); 1463 GPRS_ResultScreen(win, TxtAlreadyAttached, TxtAttached);
1464 return FALSE; 1464 return FALSE;
1465 } 1465 }
1466 1466
1467 GPRS_Attach(win); 1467 GPRS_Attach(win);
1468 1468
1469 return TRUE; 1469 return TRUE;
1470 } 1470 }
1471 1471
1472 1472
1473 /******************************************************************************* 1473 /*******************************************************************************
1474 1474
1475 $Function: GPRS_MenuDetach 1475 $Function: GPRS_MenuDetach
1476 1476
1477 $Description: Attempts a detach from the GPRS network. 1477 $Description: Attempts a detach from the GPRS network.
1478 1478
1479 $Returns: TRUE if proceeding, FALSE if failed 1479 $Returns: TRUE if proceeding, FALSE if failed
1480 1480
1481 $Arguments: Standard menu option parameters 1481 $Arguments: Standard menu option parameters
1482 1482
1483 *******************************************************************************/ 1483 *******************************************************************************/
1484 1484
1485 int GPRS_MenuDetach(MfwMnu* m, MfwMnuItem* i) 1485 int GPRS_MenuDetach(MfwMnu* m, MfwMnuItem* i)
1486 { 1486 {
1487 T_MMI_GPRS_DATA *data = GPRS_Data(); 1487 T_MMI_GPRS_DATA *data = GPRS_Data();
1488 T_MFW_HND win = mfw_parent(mfw_header()); 1488 T_MFW_HND win = mfw_parent(mfw_header());
1489 /* int gprsStatus; */ /* Warning Correction */ 1489 /* int gprsStatus; */ /* Warning Correction */
1490 1490
1491 tracefunction("GPRS_MenuDetach()"); 1491 tracefunction("GPRS_MenuDetach()");
1492 1492
1493 if (!data) 1493 if (!data)
1494 { 1494 {
1495 return FALSE; 1495 return FALSE;
1496 } 1496 }
1497 1497
1498 /* Check to make sure gprs handle exists */ 1498 /* Check to make sure gprs handle exists */
1499 1499
1500 if (!data->mfw_gprs) 1500 if (!data->mfw_gprs)
1501 { 1501 {
1502 /* Show result */ 1502 /* Show result */
1503 GPRS_ResultScreen(win, TxtNotAttached, TxtNull); 1503 GPRS_ResultScreen(win, TxtNotAttached, TxtNull);
1504 return FALSE; 1504 return FALSE;
1505 } 1505 }
1506 1506
1507 if (data->reg_status==(int)GPRS_OFF) 1507 if (data->reg_status==(int)GPRS_OFF)
1508 { 1508 {
1509 GPRS_ResultScreen(win, TxtNotAttached, TxtNull); 1509 GPRS_ResultScreen(win, TxtNotAttached, TxtNull);
1510 return FALSE; 1510 return FALSE;
1511 } 1511 }
1512 1512
1513 if (data->reg_status==(int)GPRS_SEARCHING) 1513 if (data->reg_status==(int)GPRS_SEARCHING)
1514 { 1514 {
1515 GPRS_ResultScreen(win, TxtGPRS, TxtNotAvailable); 1515 GPRS_ResultScreen(win, TxtGPRS, TxtNotAvailable);
1516 return FALSE; 1516 return FALSE;
1517 } 1517 }
1518 1518
1519 /* Try to detach */ 1519 /* Try to detach */
1520 1520
1521 GPRS_Detach(win); 1521 GPRS_Detach(win);
1522 1522
1523 return TRUE; 1523 return TRUE;
1524 } 1524 }
1525 1525
1526 1526
1527 /******************************************************************************* 1527 /*******************************************************************************
1528 1528
1529 $Function: GPRS_MenuIncomingDataCount 1529 $Function: GPRS_MenuIncomingDataCount
1530 1530
1531 $Description: Show data counter for last incoming call 1531 $Description: Show data counter for last incoming call
1532 1532
1533 $Returns: TRUE if proceeding, FALSE if failed 1533 $Returns: TRUE if proceeding, FALSE if failed
1534 1534
1535 $Arguments: Standard menu option parameters 1535 $Arguments: Standard menu option parameters
1536 1536
1537 *******************************************************************************/ 1537 *******************************************************************************/
1538 1538
1539 int GPRS_MenuIncomingDataCount(MfwMnu* m, MfwMnuItem* i) 1539 int GPRS_MenuIncomingDataCount(MfwMnu* m, MfwMnuItem* i)
1540 { 1540 {
1541 T_MMI_GPRS_DATA *data = GPRS_Data(); 1541 T_MMI_GPRS_DATA *data = GPRS_Data();
1542 T_MFW_HND win = mfw_parent(mfw_header()); 1542 T_MFW_HND win = mfw_parent(mfw_header());
1543 T_MFW_RES result; 1543 T_MFW_RES result;
1544 1544
1545 tracefunction("GPRS_MenuIncomingDataCount()"); 1545 tracefunction("GPRS_MenuIncomingDataCount()");
1546 1546
1547 if (!data) 1547 if (!data)
1548 { 1548 {
1549 return FALSE; 1549 return FALSE;
1550 } 1550 }
1551 1551
1552 data->counter_type = MMI_GPRS_COUNTER_DOWNLINK; /* SPR#1875 - SH - Now DOWNLINK */ 1552 data->counter_type = MMI_GPRS_COUNTER_DOWNLINK; /* SPR#1875 - SH - Now DOWNLINK */
1553 data->display = TRUE; 1553 data->display = TRUE;
1554 data->status = MMI_GPRS_STATUS_DATA_COUNTER; 1554 data->status = MMI_GPRS_STATUS_DATA_COUNTER;
1555 GPRS_PleaseWait(win, TxtPleaseWait, NULL); /* SPR#1986 */ 1555 GPRS_PleaseWait(win, TxtPleaseWait, NULL); /* SPR#1986 */
1556 1556
1557 /* If a data call is in progress, counter is now reset every 1557 /* If a data call is in progress, counter is now reset every
1558 * time we check it - MMI keeps track of total. 1558 * time we check it - MMI keeps track of total.
1559 * If a data call is not in progress, display current total from MMI */ 1559 * If a data call is not in progress, display current total from MMI */
1560 1560
1561 result = gprs_counter(TRUE); 1561 result = gprs_counter(TRUE);
1562 1562
1563 switch(result) 1563 switch(result)
1564 { 1564 {
1565 /* Waiting for rAT_PercentSNCNT callback, don't update display yet */ 1565 /* Waiting for rAT_PercentSNCNT callback, don't update display yet */
1566 1566
1567 case MFW_RES_OK: 1567 case MFW_RES_OK:
1568 trace("gprs_counter executing, awaiting confirmation."); 1568 trace("gprs_counter executing, awaiting confirmation.");
1569 break; 1569 break;
1570 1570
1571 /* We're not connected - display current total */ 1571 /* We're not connected - display current total */
1572 1572
1573 case MfwResDone: 1573 case MfwResDone:
1574 GPRS_PleaseWaitDestroy(); 1574 GPRS_PleaseWaitDestroy();
1575 data->display = FALSE; 1575 data->display = FALSE;
1576 GPRS_ShowCounter(win); 1576 GPRS_ShowCounter(win);
1577 break; 1577 break;
1578 1578
1579 /* Error has occurred */ 1579 /* Error has occurred */
1580 1580
1581 default: 1581 default:
1582 GPRS_PleaseWaitDestroy(); 1582 GPRS_PleaseWaitDestroy();
1583 data->display = FALSE; 1583 data->display = FALSE;
1584 info_screen(win, TxtGPRS,TxtError, NULL); 1584 info_screen(win, TxtGPRS,TxtError, NULL);
1585 break; 1585 break;
1586 } 1586 }
1587 1587
1588 return TRUE; 1588 return TRUE;
1589 } 1589 }
1590 1590
1591 1591
1592 /******************************************************************************* 1592 /*******************************************************************************
1593 1593
1594 $Function: GPRS_MenuOutgoingDataCount 1594 $Function: GPRS_MenuOutgoingDataCount
1595 1595
1596 $Description: Show data counter for last incoming call 1596 $Description: Show data counter for last incoming call
1597 1597
1598 $Returns: TRUE if proceeding, FALSE if failed 1598 $Returns: TRUE if proceeding, FALSE if failed
1599 1599
1600 $Arguments: Standard menu option parameters 1600 $Arguments: Standard menu option parameters
1601 1601
1602 *******************************************************************************/ 1602 *******************************************************************************/
1603 1603
1604 int GPRS_MenuOutgoingDataCount(MfwMnu* m, MfwMnuItem* i) 1604 int GPRS_MenuOutgoingDataCount(MfwMnu* m, MfwMnuItem* i)
1605 { 1605 {
1606 T_MMI_GPRS_DATA *data = GPRS_Data(); 1606 T_MMI_GPRS_DATA *data = GPRS_Data();
1607 T_MFW_HND win = mfw_parent(mfw_header()); 1607 T_MFW_HND win = mfw_parent(mfw_header());
1608 T_MFW_RES result; 1608 T_MFW_RES result;
1609 1609
1610 tracefunction("GPRS_MenuOutgoingDataCount()"); 1610 tracefunction("GPRS_MenuOutgoingDataCount()");
1611 1611
1612 if (!data) 1612 if (!data)
1613 { 1613 {
1614 return FALSE; 1614 return FALSE;
1615 } 1615 }
1616 1616
1617 data->counter_type = MMI_GPRS_COUNTER_UPLINK; /* SPR#1875 - SH - Now UPLINK */ 1617 data->counter_type = MMI_GPRS_COUNTER_UPLINK; /* SPR#1875 - SH - Now UPLINK */
1618 data->display = TRUE; 1618 data->display = TRUE;
1619 data->status = MMI_GPRS_STATUS_DATA_COUNTER; 1619 data->status = MMI_GPRS_STATUS_DATA_COUNTER;
1620 GPRS_PleaseWait(win, TxtPleaseWait, NULL); /* SPR#1986 */ 1620 GPRS_PleaseWait(win, TxtPleaseWait, NULL); /* SPR#1986 */
1621 1621
1622 /* If a data call is in progress, counter is now reset every 1622 /* If a data call is in progress, counter is now reset every
1623 * time we check it - MMI keeps track of total. 1623 * time we check it - MMI keeps track of total.
1624 * If a data call is not in progress, display current total from MMI */ 1624 * If a data call is not in progress, display current total from MMI */
1625 1625
1626 result = gprs_counter(TRUE); 1626 result = gprs_counter(TRUE);
1627 1627
1628 switch(result) 1628 switch(result)
1629 { 1629 {
1630 /* Waiting for rAT_PercentSNCNT callback, don't update display yet */ 1630 /* Waiting for rAT_PercentSNCNT callback, don't update display yet */
1631 1631
1632 case MFW_RES_OK: 1632 case MFW_RES_OK:
1633 trace("gprs_counter executing, awaiting confirmation."); 1633 trace("gprs_counter executing, awaiting confirmation.");
1634 break; 1634 break;
1635 1635
1636 /* We're not connected - display current total */ 1636 /* We're not connected - display current total */
1637 1637
1638 case MfwResDone: 1638 case MfwResDone:
1639 GPRS_PleaseWaitDestroy(); 1639 GPRS_PleaseWaitDestroy();
1640 data->display = FALSE; 1640 data->display = FALSE;
1641 GPRS_ShowCounter(win); 1641 GPRS_ShowCounter(win);
1642 break; 1642 break;
1643 1643
1644 /* Error has occurred */ 1644 /* Error has occurred */
1645 1645
1646 default: 1646 default:
1647 GPRS_PleaseWaitDestroy(); 1647 GPRS_PleaseWaitDestroy();
1648 data->display = FALSE; 1648 data->display = FALSE;
1649 info_screen(win, TxtGPRS,TxtError, NULL); 1649 info_screen(win, TxtGPRS,TxtError, NULL);
1650 break; 1650 break;
1651 } 1651 }
1652 1652
1653 return TRUE; 1653 return TRUE;
1654 } 1654 }
1655 1655
1656 1656
1657 1657
1658 /******************************************************************************* 1658 /*******************************************************************************
1659 1659
1660 $Function: GPRS_MenuSelectSms 1660 $Function: GPRS_MenuSelectSms
1661 1661
1662 $Description: Sets cursor position for this menu based on the current settings 1662 $Description: Sets cursor position for this menu based on the current settings
1663 1663
1664 $Returns: TRUE if proceeding, FALSE if failed 1664 $Returns: TRUE if proceeding, FALSE if failed
1665 1665
1666 $Arguments: menu - pointer to the current menu 1666 $Arguments: menu - pointer to the current menu
1667 item - pointer to the current menu item 1667 item - pointer to the current menu item
1668 1668
1669 *******************************************************************************/ 1669 *******************************************************************************/
1670 1670
1671 int GPRS_MenuSelectSms(MfwMnu* menu, MfwMnuItem* item) 1671 int GPRS_MenuSelectSms(MfwMnu* menu, MfwMnuItem* item)
1672 { 1672 {
1673 T_MMI_GPRS_DATA *data = GPRS_Data(); 1673 T_MMI_GPRS_DATA *data = GPRS_Data();
1674 T_MFW_HND win = mfwParent( mfw_header()); /* GPRS menu window */ 1674 T_MFW_HND win = mfwParent( mfw_header()); /* GPRS menu window */
1675 /* T_MFW_GPRS *gprs; */ /* Warning Correction */ 1675 /* T_MFW_GPRS *gprs; */ /* Warning Correction */
1676 1676
1677 tracefunction("GPRS_MenuSelectSms()"); 1677 tracefunction("GPRS_MenuSelectSms()");
1678 1678
1679 if (!data) 1679 if (!data)
1680 { 1680 {
1681 return FALSE; 1681 return FALSE;
1682 } 1682 }
1683 1683
1684 data->menu_win = bookMenuStart(win, SMSServiceAttributes(), 0); 1684 data->menu_win = bookMenuStart(win, SMSServiceAttributes(), 0);
1685 1685
1686 SEND_EVENT(data->menu_win, DEFAULT_OPTION, NULL, &data->sms_service); // Add our own callback 1686 SEND_EVENT(data->menu_win, DEFAULT_OPTION, NULL, &data->sms_service); // Add our own callback
1687 1687
1688 return TRUE; 1688 return TRUE;
1689 } 1689 }
1690 1690
1691 1691
1692 /******************************************************************************* 1692 /*******************************************************************************
1693 1693
1694 $Function: GPRS_MenuSelectSms_set 1694 $Function: GPRS_MenuSelectSms_set
1695 1695
1696 $Description: Send SMS by GPRS/CSD 1696 $Description: Send SMS by GPRS/CSD
1697 1697
1698 $Returns: TRUE if proceeding, FALSE if failed 1698 $Returns: TRUE if proceeding, FALSE if failed
1699 1699
1700 $Arguments: menu - pointer to the current menu 1700 $Arguments: menu - pointer to the current menu
1701 item - pointer to the current menu item 1701 item - pointer to the current menu item
1702 1702
1703 *******************************************************************************/ 1703 *******************************************************************************/
1704 1704
1705 int GPRS_MenuSelectSms_set(MfwMnu* menu, MfwMnuItem* item) 1705 int GPRS_MenuSelectSms_set(MfwMnu* menu, MfwMnuItem* item)
1706 { 1706 {
1707 T_MMI_GPRS_DATA *data = GPRS_Data(); 1707 T_MMI_GPRS_DATA *data = GPRS_Data();
1708 T_MFW_HND win = mfwParent( mfw_header()); /* GPRS menu window */ 1708 T_MFW_HND win = mfwParent( mfw_header()); /* GPRS menu window */
1709 1709
1710 tracefunction("GPRS_MenuSelectSms_set()"); 1710 tracefunction("GPRS_MenuSelectSms_set()");
1711 trace_P1("Menu level: %d", menu->lCursor[menu->level]); 1711 trace_P1("Menu level: %d", menu->lCursor[menu->level]);
1712 1712
1713 if (!data) 1713 if (!data)
1714 { 1714 {
1715 return FALSE; 1715 return FALSE;
1716 } 1716 }
1717 1717
1718 if (!data->mfw_gprs) 1718 if (!data->mfw_gprs)
1719 { 1719 {
1720 TRACE_EVENT("** No MFW gprs **"); 1720 TRACE_EVENT("** No MFW gprs **");
1721 return FALSE; 1721 return FALSE;
1722 } 1722 }
1723 1723
1724 data->display = TRUE; 1724 data->display = TRUE;
1725 1725
1726 if(!GPRS_SetSmsService(menu->lCursor[menu->level])) 1726 if(!GPRS_SetSmsService(menu->lCursor[menu->level]))
1727 { 1727 {
1728 info_screen(win, TxtFailed, NULL, NULL); 1728 info_screen(win, TxtFailed, NULL, NULL);
1729 } 1729 }
1730 1730
1731 return TRUE; 1731 return TRUE;
1732 } 1732 }
1733 1733
1734 1734
1735 /******************************************************************************* 1735 /*******************************************************************************
1736 1736
1737 $Function: GPRS_PleaseWait 1737 $Function: GPRS_PleaseWait
1738 1738
1739 $Description: Creates a "Please Wait" message that will hang around until an "OK" or 1739 $Description: Creates a "Please Wait" message that will hang around until an "OK" or
1740 "Error" message is received by GPRS_MfwCb 1740 "Error" message is received by GPRS_MfwCb
1741 1741
1742 $Returns: Pointer to the created window 1742 $Returns: Pointer to the created window
1743 1743
1744 $Arguments: parent_win - the parent window 1744 $Arguments: parent_win - the parent window
1745 TextId1 - the first text string to be shown 1745 TextId1 - the first text string to be shown
1746 TextId2 - the second text string to be shown 1746 TextId2 - the second text string to be shown
1747 1747
1748 *******************************************************************************/ 1748 *******************************************************************************/
1749 1749
1750 static T_MFW_HND GPRS_PleaseWait(T_MFW_HND parent_win, USHORT TextId1, USHORT TextId2) 1750 static T_MFW_HND GPRS_PleaseWait(T_MFW_HND parent_win, USHORT TextId1, USHORT TextId2)
1751 { 1751 {
1752 T_MMI_GPRS_DATA *data = GPRS_Data(); 1752 T_MMI_GPRS_DATA *data = GPRS_Data();
1753 T_DISPLAY_DATA display_info; 1753 T_DISPLAY_DATA display_info;
1754 1754
1755 tracefunction("GPRS_PleaseWait()"); 1755 tracefunction("GPRS_PleaseWait()");
1756 1756
1757 if (!data) 1757 if (!data)
1758 { 1758 {
1759 return NULL; 1759 return NULL;
1760 } 1760 }
1761 1761
1762 /* Delete any previous window */ 1762 /* Delete any previous window */
1763 GPRS_PleaseWaitDestroy(); 1763 GPRS_PleaseWaitDestroy();
1764 1764
1765 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtCancel, TextId1, TextId2, COLOUR_STATUS); 1765 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtCancel, TextId1, TextId2, COLOUR_STATUS);
1766 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)GPRS_PleaseWaitCb, PLEASEWAIT_TIMEOUT, KEY_HUP | KEY_RIGHT ); 1766 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)GPRS_PleaseWaitCb, PLEASEWAIT_TIMEOUT, KEY_HUP | KEY_RIGHT );
1767 1767
1768 data->display = TRUE; /* Allow OK and Fail messages to appear. */ 1768 data->display = TRUE; /* Allow OK and Fail messages to appear. */
1769 data->menu_win = parent_win; /* Store parent window */ 1769 data->menu_win = parent_win; /* Store parent window */
1770 1770
1771 /* Show information screen, storing window pointer */ 1771 /* Show information screen, storing window pointer */
1772 data->pleasewait_win = info_dialog(parent_win,&display_info); 1772 data->pleasewait_win = info_dialog(parent_win,&display_info);
1773 1773
1774 return data->pleasewait_win; 1774 return data->pleasewait_win;
1775 } 1775 }
1776 1776
1777 1777
1778 /******************************************************************************* 1778 /*******************************************************************************
1779 1779
1780 $Function: GPRS_PleaseWaitCb 1780 $Function: GPRS_PleaseWaitCb
1781 1781
1782 $Description: Please wait window callback function. 1782 $Description: Please wait window callback function.
1783 1783
1784 $Returns: None 1784 $Returns: None
1785 1785
1786 $Arguments: win - the parent window 1786 $Arguments: win - the parent window
1787 identifier - not used 1787 identifier - not used
1788 reason - the reason for the callback 1788 reason - the reason for the callback
1789 1789
1790 *******************************************************************************/ 1790 *******************************************************************************/
1791 1791
1792 static void GPRS_PleaseWaitCb(T_MFW_HND win, UBYTE identifier, UBYTE reason) 1792 static void GPRS_PleaseWaitCb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
1793 { 1793 {
1794 T_MMI_GPRS_DATA *data = GPRS_Data(); 1794 T_MMI_GPRS_DATA *data = GPRS_Data();
1795 1795
1796 tracefunction("GPRS_PleaseWaitCb()"); 1796 tracefunction("GPRS_PleaseWaitCb()");
1797 1797
1798 if (!data) 1798 if (!data)
1799 { 1799 {
1800 return; 1800 return;
1801 } 1801 }
1802 1802
1803 /* Dialog already destroyed by this point */ 1803 /* Dialog already destroyed by this point */
1804 1804
1805 data->pleasewait_win = NULL; 1805 data->pleasewait_win = NULL;
1806 1806
1807 switch(reason) 1807 switch(reason)
1808 { 1808 {
1809 case INFO_TIMEOUT: 1809 case INFO_TIMEOUT:
1810 1810
1811 /* Delete window */ 1811 /* Delete window */
1812 1812
1813 info_screen(data->menu_win, TxtTimedOut, NULL, NULL); 1813 info_screen(data->menu_win, TxtTimedOut, NULL, NULL);
1814 data->status = MMI_GPRS_STATUS_IDLE; 1814 data->status = MMI_GPRS_STATUS_IDLE;
1815 break; 1815 break;
1816 1816
1817 case INFO_KCD_HUP: 1817 case INFO_KCD_HUP:
1818 case INFO_KCD_RIGHT: 1818 case INFO_KCD_RIGHT:
1819 1819
1820 /*Cancel current operation */ 1820 /*Cancel current operation */
1821 1821
1822 switch(data->status) 1822 switch(data->status)
1823 { 1823 {
1824 case MMI_GPRS_STATUS_ATTACHING: 1824 case MMI_GPRS_STATUS_ATTACHING:
1825 case MMI_GPRS_STATUS_DETACHING: 1825 case MMI_GPRS_STATUS_DETACHING:
1826 gprs_attach_abort(); 1826 gprs_attach_abort();
1827 data->status = MMI_GPRS_STATUS_IDLE; 1827 data->status = MMI_GPRS_STATUS_IDLE;
1828 data->display = FALSE; 1828 data->display = FALSE;
1829 break; 1829 break;
1830 case MMI_GPRS_STATUS_DATA_COUNTER: 1830 case MMI_GPRS_STATUS_DATA_COUNTER:
1831 gprs_counter_abort(); 1831 gprs_counter_abort();
1832 data->status = MMI_GPRS_STATUS_IDLE; 1832 data->status = MMI_GPRS_STATUS_IDLE;
1833 data->display = FALSE; 1833 data->display = FALSE;
1834 break; 1834 break;
1835 } 1835 }
1836 break; 1836 break;
1837 } 1837 }
1838 1838
1839 return; 1839 return;
1840 } 1840 }
1841 1841
1842 1842
1843 /******************************************************************************* 1843 /*******************************************************************************
1844 1844
1845 $Function: GPRS_PleaseWaitDestroy 1845 $Function: GPRS_PleaseWaitDestroy
1846 1846
1847 $Description: Check to see if the "Please Wait" window is present, and destroys it 1847 $Description: Check to see if the "Please Wait" window is present, and destroys it
1848 if so. 1848 if so.
1849 1849
1850 $Returns: None. 1850 $Returns: None.
1851 1851
1852 $Arguments: None. 1852 $Arguments: None.
1853 1853
1854 *******************************************************************************/ 1854 *******************************************************************************/
1855 1855
1856 static void GPRS_PleaseWaitDestroy(void) 1856 static void GPRS_PleaseWaitDestroy(void)
1857 { 1857 {
1858 T_MMI_GPRS_DATA *data = GPRS_Data(); 1858 T_MMI_GPRS_DATA *data = GPRS_Data();
1859 1859
1860 tracefunction("GPRS_PleaseWaitDestroy()"); 1860 tracefunction("GPRS_PleaseWaitDestroy()");
1861 1861
1862 if (!data) 1862 if (!data)
1863 { 1863 {
1864 return; 1864 return;
1865 } 1865 }
1866 1866
1867 if (data->pleasewait_win) 1867 if (data->pleasewait_win)
1868 { 1868 {
1869 SEND_EVENT(data->pleasewait_win, DIALOG_DESTROY, NULL, NULL); 1869 SEND_EVENT(data->pleasewait_win, DIALOG_DESTROY, NULL, NULL);
1870 data->pleasewait_win = NULL; 1870 data->pleasewait_win = NULL;
1871 } 1871 }
1872 1872
1873 return; 1873 return;
1874 } 1874 }
1875 1875
1876 1876
1877 /******************************************************************************* 1877 /*******************************************************************************
1878 1878
1879 $Function: GPRS_ShowCounter 1879 $Function: GPRS_ShowCounter
1880 1880
1881 $Description: Generic counter displaying function 1881 $Description: Generic counter displaying function
1882 1882
1883 $Returns: 1883 $Returns:
1884 1884
1885 $Arguments: Standard menu option parameters 1885 $Arguments: Standard menu option parameters
1886 1886
1887 *******************************************************************************/ 1887 *******************************************************************************/
1888 1888
1889 static void GPRS_ShowCounter(T_MFW_HND win) 1889 static void GPRS_ShowCounter(T_MFW_HND win)
1890 { 1890 {
1891 T_MMI_GPRS_DATA *data = GPRS_Data(); 1891 T_MMI_GPRS_DATA *data = GPRS_Data();
1892 #ifdef NEW_EDITOR 1892 #ifdef NEW_EDITOR
1893 T_AUI_EDITOR_DATA editor_data; 1893 T_AUI_EDITOR_DATA editor_data;
1894 #else 1894 #else
1895 T_EDITOR_DATA editor_data; 1895 T_EDITOR_DATA editor_data;
1896 #endif 1896 #endif
1897 /* T_MFW_GPRS *gprs; */ /* Warning Correction */ 1897 /* T_MFW_GPRS *gprs; */ /* Warning Correction */
1898 USHORT titleId; 1898 USHORT titleId;
1899 1899
1900 tracefunction("GPRS_ShowCounter()"); 1900 tracefunction("GPRS_ShowCounter()");
1901 1901
1902 if (!data) 1902 if (!data)
1903 { 1903 {
1904 return; 1904 return;
1905 } 1905 }
1906 1906
1907 /* Destroy old editor if it exists */ 1907 /* Destroy old editor if it exists */
1908 1908
1909 if (data->edit_win) 1909 if (data->edit_win)
1910 { 1910 {
1911 GPRS_DestroyCounter(); 1911 GPRS_DestroyCounter();
1912 } 1912 }
1913 1913
1914 /* Set appropriate title string (corrected) */ 1914 /* Set appropriate title string (corrected) */
1915 1915
1916 switch(data->counter_type) 1916 switch(data->counter_type)
1917 { 1917 {
1918 case MMI_GPRS_COUNTER_DOWNLINK: 1918 case MMI_GPRS_COUNTER_DOWNLINK:
1919 titleId = TxtIncomingData; 1919 titleId = TxtIncomingData;
1920 break; 1920 break;
1921 1921
1922 case MMI_GPRS_COUNTER_UPLINK: 1922 case MMI_GPRS_COUNTER_UPLINK:
1923 titleId = TxtOutgoingData; 1923 titleId = TxtOutgoingData;
1924 break; 1924 break;
1925 1925
1926 default: 1926 default:
1927 titleId = TxtNull; 1927 titleId = TxtNull;
1928 break; 1928 break;
1929 } 1929 }
1930 1930
1931 data->counterstring = (char *)ALLOC_MEMORY(ULONG_SIZE_IN_DECIMAL); 1931 data->counterstring = (char *)ALLOC_MEMORY(ULONG_SIZE_IN_DECIMAL);
1932 GPRS_UpdateCounter(); 1932 GPRS_UpdateCounter();
1933 1933
1934 /* New Editor */ 1934 /* New Editor */
1935 #ifdef NEW_EDITOR 1935 #ifdef NEW_EDITOR
1936 AUI_edit_SetDefault(&editor_data); 1936 AUI_edit_SetDefault(&editor_data);
1937 AUI_edit_SetDisplay(&editor_data, ZONE_FULL_SK_TITLE, COLOUR_EDITOR_XX, EDITOR_FONT); 1937 AUI_edit_SetDisplay(&editor_data, ZONE_FULL_SK_TITLE, COLOUR_EDITOR_XX, EDITOR_FONT);
1938 AUI_edit_SetEvents(&editor_data, data->counter_type, FALSE, FOREVER, (T_AUI_EDIT_CB)GPRS_ShowCounterCb); 1938 AUI_edit_SetEvents(&editor_data, data->counter_type, FALSE, FOREVER, (T_AUI_EDIT_CB)GPRS_ShowCounterCb);
1939 AUI_edit_SetTextStr(&editor_data, TxtReset, TxtSoftBack, titleId, NULL); 1939 AUI_edit_SetTextStr(&editor_data, TxtReset, TxtSoftBack, titleId, NULL);
1940 AUI_edit_SetMode(&editor_data, ED_MODE_READONLY, ED_CURSOR_NONE); 1940 AUI_edit_SetMode(&editor_data, ED_MODE_READONLY, ED_CURSOR_NONE);
1941 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)data->counterstring, ULONG_SIZE_IN_DECIMAL); 1941 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)data->counterstring, ULONG_SIZE_IN_DECIMAL);
1942 1942
1943 data->edit_win = AUI_edit_Start(win, &editor_data); 1943 data->edit_win = AUI_edit_Start(win, &editor_data);
1944 #else /* NEW_EDITOR */ 1944 #else /* NEW_EDITOR */
1945 editor_data.TextString = NULL; 1945 editor_data.TextString = NULL;
1946 editor_data.LeftSoftKey = TxtSoftOK; 1946 editor_data.LeftSoftKey = TxtSoftOK;
1947 editor_data.RightSoftKey = TxtReset; 1947 editor_data.RightSoftKey = TxtReset;
1948 editor_data.AlternateLeftSoftKey = NULL; 1948 editor_data.AlternateLeftSoftKey = NULL;
1949 editor_data.Callback = (T_EDIT_CB)GPRS_ShowCounterCb; 1949 editor_data.Callback = (T_EDIT_CB)GPRS_ShowCounterCb;
1950 editor_data.Identifier = data->counter_type; 1950 editor_data.Identifier = data->counter_type;
1951 editor_data.hide = FALSE; 1951 editor_data.hide = FALSE;
1952 editor_data.mode = READ_ONLY_MODE; 1952 editor_data.mode = READ_ONLY_MODE;
1953 editor_data.timeout = FOREVER; 1953 editor_data.timeout = FOREVER;
1954 editor_data.min_enter = 0; 1954 editor_data.min_enter = 0;
1955 editor_data.destroyEditor = FALSE; 1955 editor_data.destroyEditor = FALSE;
1956 editor_data.editor_attr.win.px = 0; 1956 editor_data.editor_attr.win.px = 0;
1957 editor_data.editor_attr.win.py = Mmi_layout_line(1)+4; 1957 editor_data.editor_attr.win.py = Mmi_layout_line(1)+4;
1958 editor_data.editor_attr.win.sx = SCREEN_SIZE_X; 1958 editor_data.editor_attr.win.sx = SCREEN_SIZE_X;
1959 editor_data.editor_attr.win.sy = Mmi_layout_line(2)+4; 1959 editor_data.editor_attr.win.sy = Mmi_layout_line(2)+4;
1960 editor_data.editor_attr.edtCol = COLOUR_EDITOR_XX; 1960 editor_data.editor_attr.edtCol = COLOUR_EDITOR_XX;
1961 editor_data.editor_attr.font = 0; 1961 editor_data.editor_attr.font = 0;
1962 editor_data.editor_attr.mode = edtCurNone; 1962 editor_data.editor_attr.mode = edtCurNone;
1963 editor_data.editor_attr.controls = 0; 1963 editor_data.editor_attr.controls = 0;
1964 editor_data.editor_attr.size = ULONG_SIZE_IN_DECIMAL; 1964 editor_data.editor_attr.size = ULONG_SIZE_IN_DECIMAL;
1965 editor_data.TextId = titleId; 1965 editor_data.TextId = titleId;
1966 1966
1967 editor_data.editor_attr.text = data->counterstring; 1967 editor_data.editor_attr.text = data->counterstring;
1968 1968
1969 /* Create the dialog handler */ 1969 /* Create the dialog handler */
1970 1970
1971 data->edit_win = editor_start(win, &editor_data); /* start the editor */ 1971 data->edit_win = editor_start(win, &editor_data); /* start the editor */
1972 #endif /* NEW_EDITOR */ 1972 #endif /* NEW_EDITOR */
1973 1973
1974 return; 1974 return;
1975 } 1975 }
1976 1976
1977 1977
1978 /******************************************************************************* 1978 /*******************************************************************************
1979 1979
1980 $Function: GPRS_ShowCounterCb 1980 $Function: GPRS_ShowCounterCb
1981 1981
1982 $Description: Change text string for the counter we've just changed 1982 $Description: Change text string for the counter we've just changed
1983 1983
1984 $Returns: nothing. 1984 $Returns: nothing.
1985 1985
1986 $Arguments: win - the editor window 1986 $Arguments: win - the editor window
1987 identifier - the type of counter we're updating 1987 identifier - the type of counter we're updating
1988 reason - the event that caused the callback 1988 reason - the event that caused the callback
1989 1989
1990 *******************************************************************************/ 1990 *******************************************************************************/
1991 1991
1992 static void GPRS_ShowCounterCb(T_MFW_HND win, USHORT identifier, USHORT reason) 1992 static void GPRS_ShowCounterCb(T_MFW_HND win, USHORT identifier, USHORT reason)
1993 { 1993 {
1994 T_MMI_GPRS_DATA *data = GPRS_Data(); 1994 T_MMI_GPRS_DATA *data = GPRS_Data();
1995 T_DISPLAY_DATA display_info; 1995 T_DISPLAY_DATA display_info;
1996 1996
1997 tracefunction("GPRS_ShowCounterCb()"); 1997 tracefunction("GPRS_ShowCounterCb()");
1998 1998
1999 if (!data) 1999 if (!data)
2000 { 2000 {
2001 return; 2001 return;
2002 } 2002 }
2003 2003
2004 switch(reason) 2004 switch(reason)
2005 { 2005 {
2006 /* Prompt whether to reset */ 2006 /* Prompt whether to reset */
2007 2007
2008 case INFO_KCD_LEFT: 2008 case INFO_KCD_LEFT:
2009 dlg_initDisplayData_TextId(&display_info, TxtCancel, TxtReset, TxtDataCounterReset, TxtNull, COLOUR_STATUS); 2009 dlg_initDisplayData_TextId(&display_info, TxtCancel, TxtReset, TxtDataCounterReset, TxtNull, COLOUR_STATUS);
2010 dlg_initDisplayData_events(&display_info, (T_VOID_FUNC) GPRS_ResetCounter, TEN_SECS, KEY_HUP|KEY_CLEAR|KEY_LEFT|KEY_RIGHT ); 2010 dlg_initDisplayData_events(&display_info, (T_VOID_FUNC) GPRS_ResetCounter, TEN_SECS, KEY_HUP|KEY_CLEAR|KEY_LEFT|KEY_RIGHT );
2011 2011
2012 info_dialog(win, &display_info); 2012 info_dialog(win, &display_info);
2013 break; 2013 break;
2014 2014
2015 /* Press hangup key or select OK 2015 /* Press hangup key or select OK
2016 * Calls GPRS_DestroyCounter to destroy window */ 2016 * Calls GPRS_DestroyCounter to destroy window */
2017 case INFO_KCD_RIGHT: 2017 case INFO_KCD_RIGHT:
2018 case INFO_KCD_HUP: 2018 case INFO_KCD_HUP:
2019 GPRS_DestroyCounter(); 2019 GPRS_DestroyCounter();
2020 break; 2020 break;
2021 } 2021 }
2022 2022
2023 return; 2023 return;
2024 } 2024 }
2025 2025
2026 2026
2027 /******************************************************************************* 2027 /*******************************************************************************
2028 2028
2029 $Function: GPRS_ResetCounter 2029 $Function: GPRS_ResetCounter
2030 2030
2031 $Description: Callback from dialogue prompting whether to reset the data counter 2031 $Description: Callback from dialogue prompting whether to reset the data counter
2032 2032
2033 $Returns: None 2033 $Returns: None
2034 2034
2035 $Arguments: Standard callback parameters 2035 $Arguments: Standard callback parameters
2036 2036
2037 *******************************************************************************/ 2037 *******************************************************************************/
2038 2038
2039 static void GPRS_ResetCounter(T_MFW_HND win, UBYTE identifier, UBYTE reason) 2039 static void GPRS_ResetCounter(T_MFW_HND win, UBYTE identifier, UBYTE reason)
2040 { 2040 {
2041 T_MMI_GPRS_DATA *data = GPRS_Data(); 2041 T_MMI_GPRS_DATA *data = GPRS_Data();
2042 2042
2043 tracefunction("GPRS_ResetCounter()"); 2043 tracefunction("GPRS_ResetCounter()");
2044 2044
2045 if (!data) 2045 if (!data)
2046 { 2046 {
2047 return; 2047 return;
2048 } 2048 }
2049 2049
2050 switch(reason) 2050 switch(reason)
2051 { 2051 {
2052 /* RSK - Reset counter */ 2052 /* RSK - Reset counter */
2053 2053
2054 case INFO_KCD_RIGHT: 2054 case INFO_KCD_RIGHT:
2055 if (data->counter_type==MMI_GPRS_COUNTER_UPLINK) 2055 if (data->counter_type==MMI_GPRS_COUNTER_UPLINK)
2056 { 2056 {
2057 data->uplink_counter = 0; 2057 data->uplink_counter = 0;
2058 } 2058 }
2059 else 2059 else
2060 { 2060 {
2061 data->downlink_counter = 0; 2061 data->downlink_counter = 0;
2062 } 2062 }
2063 2063
2064 GPRS_ShowCounter(win); 2064 GPRS_ShowCounter(win);
2065 break; 2065 break;
2066 2066
2067 /* LSK or HUP - cancel without resetting */ 2067 /* LSK or HUP - cancel without resetting */
2068 2068
2069 case INFO_KCD_LEFT: 2069 case INFO_KCD_LEFT:
2070 case INFO_KCD_HUP: 2070 case INFO_KCD_HUP:
2071 break; 2071 break;
2072 } 2072 }
2073 2073
2074 return; 2074 return;
2075 } 2075 }
2076 2076
2077 2077
2078 /******************************************************************************* 2078 /*******************************************************************************
2079 2079
2080 $Function: GPRS_DestroyCounter 2080 $Function: GPRS_DestroyCounter
2081 2081
2082 $Description: Destroy counter display 2082 $Description: Destroy counter display
2083 2083
2084 $Returns: None 2084 $Returns: None
2085 2085
2086 $Arguments: None 2086 $Arguments: None
2087 2087
2088 *******************************************************************************/ 2088 *******************************************************************************/
2089 2089
2090 static void GPRS_DestroyCounter() 2090 static void GPRS_DestroyCounter()
2091 { 2091 {
2092 T_MMI_GPRS_DATA *data = GPRS_Data(); 2092 T_MMI_GPRS_DATA *data = GPRS_Data();
2093 2093
2094 tracefunction("GPRS_DestroyCounter()"); 2094 tracefunction("GPRS_DestroyCounter()");
2095 2095
2096 if (!data) 2096 if (!data)
2097 { 2097 {
2098 return; 2098 return;
2099 } 2099 }
2100 2100
2101 if (data->edit_win) 2101 if (data->edit_win)
2102 { 2102 {
2103 2103
2104 /* New Editor */ 2104 /* New Editor */
2105 2105
2106 #ifdef NEW_EDITOR 2106 #ifdef NEW_EDITOR
2107 AUI_edit_Destroy(data->edit_win); 2107 AUI_edit_Destroy(data->edit_win);
2108 #else 2108 #else
2109 editor_destroy(data->edit_win); 2109 editor_destroy(data->edit_win);
2110 #endif 2110 #endif
2111 FREE_MEMORY((void *)data->counterstring, ULONG_SIZE_IN_DECIMAL); 2111 FREE_MEMORY((void *)data->counterstring, ULONG_SIZE_IN_DECIMAL);
2112 data->counterstring = NULL; 2112 data->counterstring = NULL;
2113 data->edit_win = NULL; 2113 data->edit_win = NULL;
2114 } 2114 }
2115 2115
2116 return; 2116 return;
2117 } 2117 }
2118 2118
2119 /******************************************************************************* 2119 /*******************************************************************************
2120 2120
2121 $Function: GPRS_UpdateCounter 2121 $Function: GPRS_UpdateCounter
2122 2122
2123 $Description: Change text string for the counter we've just changed 2123 $Description: Change text string for the counter we've just changed
2124 2124
2125 $Returns: None 2125 $Returns: None
2126 2126
2127 $Arguments: None 2127 $Arguments: None
2128 2128
2129 *******************************************************************************/ 2129 *******************************************************************************/
2130 2130
2131 static void GPRS_UpdateCounter(void) 2131 static void GPRS_UpdateCounter(void)
2132 { 2132 {
2133 T_MMI_GPRS_DATA *data = GPRS_Data(); 2133 T_MMI_GPRS_DATA *data = GPRS_Data();
2134 ULONG counter; 2134 ULONG counter;
2135 2135
2136 tracefunction("GPRS_UpdateCounter()"); 2136 tracefunction("GPRS_UpdateCounter()");
2137 2137
2138 if (!data) 2138 if (!data)
2139 { 2139 {
2140 return; 2140 return;
2141 } 2141 }
2142 2142
2143 counter = 0; 2143 counter = 0;
2144 2144
2145 switch(data->counter_type) 2145 switch(data->counter_type)
2146 { 2146 {
2147 case MMI_GPRS_COUNTER_UPLINK: 2147 case MMI_GPRS_COUNTER_UPLINK:
2148 counter = data->uplink_counter; 2148 counter = data->uplink_counter;
2149 break; 2149 break;
2150 2150
2151 case MMI_GPRS_COUNTER_DOWNLINK: 2151 case MMI_GPRS_COUNTER_DOWNLINK:
2152 counter = data->downlink_counter; 2152 counter = data->downlink_counter;
2153 break; 2153 break;
2154 } 2154 }
2155 2155
2156 if (counter<1024) 2156 if (counter<1024)
2157 { 2157 {
2158 sprintf(data->counterstring, "%d bytes",counter); // Counter is <1K, display bytes 2158 sprintf(data->counterstring, "%d bytes",counter); // Counter is <1K, display bytes
2159 } 2159 }
2160 else 2160 else
2161 { 2161 {
2162 counter = counter/KILOBYTE; 2162 counter = counter/KILOBYTE;
2163 if (counter<1024) 2163 if (counter<1024)
2164 sprintf(data->counterstring, "%dKB",counter); // Counter is <1M, display Kbytes 2164 sprintf(data->counterstring, "%dKB",counter); // Counter is <1M, display Kbytes
2165 else 2165 else
2166 { 2166 {
2167 counter = counter/KILOBYTE; 2167 counter = counter/KILOBYTE;
2168 sprintf(data->counterstring, "%dMB",counter); // Display Mbytes 2168 sprintf(data->counterstring, "%dMB",counter); // Display Mbytes
2169 } 2169 }
2170 } 2170 }
2171 2171
2172 return; 2172 return;
2173 } 2173 }
2174 2174