comparison src/ui3/bmi/MmiCPHS.c @ 420:e8ddbb0837ed

src/ui3: initial import of TCS3/LoCosto BMI & MFW code
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 21 Jan 2018 03:09:00 +0000
parents
children
comparison
equal deleted inserted replaced
419:59143cd42ec7 420:e8ddbb0837ed
1 /*******************************************************************************
2
3 CONDAT (UK)
4
5 ********************************************************************************
6
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.
9
10 ********************************************************************************
11
12 $Project name: Basic MMI
13 $Project code: BMI (6349)
14 $Module: CPHS
15 $File: MmiCPHS.c
16 $Revision: 1.0
17
18 $Author: Condat(UK)
19 $Date: 25/01/02
20
21 ********************************************************************************
22
23 Description
24
25 This module provides the CPHS functionality
26
27
28 ********************************************************************************
29 $History: MmiCall.c
30 Nov 27, 2006 OMAPS00098359 a0393213(R.Prabakar)
31 Description: CPHS 4.2 : Call Divert doesn't work properly for Line 2
32
33 Oct 11, 2006 REF:OMAPS00098287 x0039928
34 Description : CPHS 4.2: MMI variable als_status is not updated proplery with the SIM contents.
35 Solution : als_status update is deffered until the idle screen is displayed.
36
37 May 30, 2006 REF:OMAPS00079650 a0393213 (R.Prabakar)
38 Description : CPHS Call Forwarding feature implementation
39 Solution : As part of this implementation, E_CPHS_SET_DV_STAT and E_CPHS_GET_DV_STAT in cphs_mfw_cb()
40 are modified
41
42 May 26, 2006 ER: OMAPS00079607 x0012849 :Jagannatha M
43 Description: CPHS: Display 'charge/Timers' menu based on AOC ( Advice of charge ) and support info numbers.
44 Solution:Made the following changes
45 1. Aoc_flag variable is defined and it will be set based on the CSP information.
46 2. New function info_num_msg_cb() added to support info numbers.
47
48 May 30, 2006 DR: OMAPS00070657 x0pleela
49 Description: CPHS feature on Locosto-Lite
50 Solution: For ALS feature,
51 a) Defined a new macro "MAX_LINE_NAME_LEN"
52 b) Defined new structure "T_ALS_DATA" for editing Line 1 and 2 names
53 c) Defined new flag "Als_flag" to store the staus of ALS bit from CSP data
54 d) Added new functions cphs_Line_Edit_cb(), cphs_edit_line_exec_cb(),
55 cphs_edit_line_create(), cphs_edit_line1(), cphs_edit_line2(),
56 mmi_cphs_get_als_info(), mmi_cphs_get_als_info(), mmi_cphs_set_als_value(),
57 mmi_cphs_get_als_value(), mmi_get_als_selectedLine()
58
59 Jun 14, 2005 REF: MMI-FIX-30439 x0018858
60 Description: The homezone/cityzone tags were not being displayed properly.
61 Solution: Modified to save the tags properly in caches and also made the
62 appropriate modifications to update the same properly during mobility.
63
64 Aug 16, 2004 REF: CRR 24323 Deepa M.D
65 Bug:Clenup of sprintf used for tracing
66 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX
67
68 Jun 23, 2004 REF: CRR MMI-SPR-13599 Rashmi C N(Sasken)
69 Solution: The CF state is maintained in flash. During bootup the CF icon in the idle screen
70 is displayed depending upon its state in the ffs
71
72
73 // May 31, 2004 REF: CRR 17291 xvilliva
74 // Bug: After power cycle the setting of the used line which have been made
75 // from the BMI is lost.
76 // Fix: 1.The global g_pin2 is defined here.
77 // 2. sAT_PlusCLCK() is called while locking and unlocking ALS.
78 // 3. ALSPresent() is modified to call tAT_PercentALS() & qAT_PercentALS().
79 // NOTE:- ALSPresent() was giving faulty status earlier.
80
81
82 25/01/02 Original Condat(UK) BMI version. (MC)
83
84 $End
85
86 *******************************************************************************/
87
88
89 /******************************************************************************
90
91 Include Files
92
93 *******************************************************************************/
94
95 /* includes */
96 #include <string.h>
97 #include <stdio.h>
98 #include <stdlib.h>
99
100 #if defined (NEW_FRAME)
101
102 #include "typedefs.h"
103 #include "vsi.h"
104 #include "pei.h"
105 #include "custom.h"
106 #include "gsm.h"
107
108 #else
109
110 #include "STDDEFS.H"
111 #include "custom.h"
112 #include "gsm.h"
113 #include "vsi.h"
114
115 #endif
116 #include "mfw_sys.h"
117
118 #include "cus_aci.h"
119
120 #include "mfw_mfw.h"
121 #include "mfw_win.h"
122 #include "mfw_kbd.h"
123 /* SPR#1428 - SH - New Editor changes */
124 #ifndef NEW_EDITOR
125 #include "mfw_edt.h"
126 #endif
127 #include "mfw_tim.h"
128 #include "mfw_phb.h"
129 #include "ksd.h"
130 #include "psa.h"
131 #include "mfw_sms.h"
132 #include "mfw_icn.h"
133 #include "mfw_mnu.h"
134 #include "mfw_lng.h"
135 #include "mfw_sat.h"
136 #include "mfw_kbd.h"
137 #include "mfw_nm.h"
138 #include "mfw_str.h"
139 #include "mfw_cphs.h"
140 #include "dspl.h"
141
142 #include "MmiMain.h"
143 #include "MmiDummy.h"
144 #include "MmiMmi.h"
145 #include "MmiDialogs.h"
146 #include "MmiLists.h"
147 #include "MmiDialogs.h"
148 #include "MmiMenu.h"
149 #include "MmiSoftKeys.h"
150 /* SPR#1428 - SH - New Editor changes */
151 #ifdef NEW_EDITOR
152 #include "ATBCommon.h"
153 #include "ATBDisplay.h"
154 #include "ATBEditor.h"
155 #include "AUIEditor.h"
156 #else
157 #include "MmiEditor.h"
158 #endif
159 #include "MmiBookShared.h"
160 #include "mmiSmsMenu.h"
161 #include "Mmiicons.h"
162 #include "mmiColours.h"
163
164 #include "MmiCPHS.h"
165 // Jun 23 2004 REF: CRR MMI-SPR-13599 Rashmi C N(Sasken)
166 #include "mfw_ffs.h"
167 /* SPR759 - SH */
168 #ifdef MMI_HOMEZONE_ENABLED
169 #include "MmiHomezone.h"
170 #endif
171
172 /* 30th May,2006 OMAPS00079650 a0393213 (R.Prabakar)
173 Description : CPHS Call Forwarding feature implementation*/
174
175 #include "MmiServices.h"
176 //x0pleela 08 June, 2006 DR:OMAPS00079607
177 //Including this header file to get the definition of getRoamingStatus()
178 #ifdef FF_CPHS
179 #include "MmiNetwork.h"
180 #endif
181
182
183
184 /******************************************************************************
185
186 Definitions
187
188 *******************************************************************************/
189 //#define CPHS_PROV_TEST /*Test to bypass the reading of the CPHS field from the SIM card*/
190 char g_pin2[MAX_PIN+1];//xvilliva SPR17291
191
192 typedef enum
193
194
195 {
196 INFO_NUM_LIST,
197 MAILBOX_LIST,
198 MAILBOX_LIST_CALL
199 }
200 T_MENU_TYPE;
201
202
203 static MfwMnuAttr InfoNum_menuAttrib =
204 {
205 &melody_menuArea,
206 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
207 (U8)-1, /* use default font */
208 NULL, /* with these items */
209 0, /* number of items */
210 COLOUR_LIST_XX, TxtNull, NULL, MNUATTRSPARE
211
212 };
213
214 typedef struct
215 {
216 /* administrative data */
217
218 T_MMI_CONTROL mmi_control;
219 T_MFW_HND win;
220 T_MFW_HND parent_win;
221 #ifdef NEW_EDITOR
222 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */
223 #else /* NEW_EDITOR */
224 T_EDITOR_DATA editor_data;
225 #endif /* NEW_EDITOR */
226
227 /* associated handlers */
228
229 T_MFW_HND kbd;
230 T_MFW_HND kbd_long;
231 T_MFW_HND menu;
232 T_MFW_HND menu_tim;
233 UBYTE status_of_timer; /* use for the keypadlock */
234
235 T_MFW_HND mailbox_win;
236 T_MFW_CPHS_ENTRY cphs_voicemail_num;
237 T_MFW_CPHS_VC_STAT* cphs_voicemail_status;
238 T_MFW_CPHS_STATUS cphs_status;
239 T_MFW_CPHS_OP_NAME* operator_name;
240
241 } T_MMI_CPHS_DATA;
242
243
244 typedef struct
245 {
246 T_MMI_CONTROL mmi_control;
247 T_MFW_HND numbers_win; /* MFW win handler */
248 T_MFW_HND parent;
249 T_MFW_HND melody_handler; /* MFW sms handler */
250 unsigned char local_status;
251 ListMenuData * menu_list_data;
252 } T_INFO_NUM_INFO;
253
254 #ifdef FF_CPHS_REL4
255 typedef struct
256 {
257 T_MMI_CONTROL mmi_control;
258 T_MFW_HND msp_win; /* MFW win handler */
259 T_MFW_HND parent;
260 ListMenuData * menu_list_data;
261 } T_MSP_INFO;
262
263 typedef struct
264 {
265 T_MMI_CONTROL mmi_control;
266 T_MFW_HND mwis_win; /* MFW win handler */
267 T_MFW_HND parent;
268 ListMenuData * menu_list_data;
269 } T_MWIS_INFO;
270
271 #endif
272
273 //x0pleela 23 May, 2006 DR: OMAPS00070657
274 #ifdef FF_CPHS
275 #define MAX_LINE_NAME_LEN (20+1)
276
277 typedef struct
278 {
279 /* administrative data */
280
281 T_MMI_CONTROL mmi_control;
282 T_MFW_HND win;
283 T_MFW_HND parent_win;
284 T_MFW_HND input_number_win;
285 #ifndef NEW_EDITOR
286 MfwEdtAttr edt_attr_name;
287 #endif /* NEW_EDITOR */
288 UBYTE edt_buf_name[MAX_LINE_NAME_LEN];
289 } T_ALS_DATA;
290
291
292 #endif
293
294 #define E_INIT 1
295
296
297
298 #define CPHS_TELESERVICES_BYTE_VALUE 0x06
299 #define ALS_MASK 0x80
300
301 #define CPHS_INFONUMS_BYTE_VALUE 0xC0
302 #define INFONUM_MASK 0xFF
303
304 //x0pleela 23 May, 2006 DR: OMAPS00070657
305 #ifdef FF_CPHS
306 static UBYTE Als_flag; //Stores the status of ALS from CSP data
307 #endif
308
309 #ifdef FF_CPHS_REL4
310 static BOOL MSP_flag;
311 BOOL msp_register;
312 UBYTE msp_reg_profid;
313 UBYTE prof_sel;
314 BOOL interrogate= 0;
315 T_MFW_CPHS_MSP_INFO* msp_info;
316 BOOL mwis_flag = FALSE;
317 #endif
318
319
320
321
322 /******************************************************************************
323
324 Static Global variables
325
326 *******************************************************************************/
327
328 static T_MFW_HND cphs_wait_dialog_win = NULL;
329 static T_DISPLAY_DATA mmi_cphs_wait_dialog_data = {0};
330 static T_MFW_CPHS_ENTRY cphs_voicemail_num;
331 static T_MFW_CPHS_INFONUM_ENTRY current_info_num;
332 static T_MFW_CPHS_VC_NUM cphs_voicemail_numbers;
333 static T_MFW_CPHS_VC_STAT* cphs_voicemail_status;
334 static T_MFW_CPHS_STATUS cphs_status = CPHS_NotPresent;
335 static T_MFW_CPHS_OP_NAME operator_name;
336 static T_MFW_CPHS_DV_STAT call_forwarding_status;
337 #ifdef FF_CPHS_REL4
338 T_MFW_CPHS_REL4_DV_STAT call_forwarding_status_rel4;
339 static T_MFW_CPHS_REL4_MBI cphs_rel4_mbi; /*used to cache mbi info-should be updated immediately whenever mbi changes*/
340 static T_MFW_CPHS_REL4_MBDN cphs_rel4_mbdn; /*used to cache mbdn info-should be updated immediately whenever mbdn changes*/
341 static T_MFW_HND mailbox_waiting_dialog;
342 static T_MFW_CPHS_REL4_MAILBOX_TYPE mailbox_type; /*used to store the mailbox type for which an action is performed*/
343 #endif
344 static T_MFW_CPHS_CSP customer_service_profile;
345 static T_MFW_CPHS_INFONUM_LIST* info_numbers[4]= {NULL, NULL, NULL, NULL};
346 // Oct 11, 2006 REF:OMAPS00098287 x0039928
347 T_MFW_CPHS_ALS_STATUS als_status;
348 BOOL als_bootup;
349
350 static UBYTE info_num_level;
351 static USHORT info_num_index;
352
353 static T_MENU_TYPE type_of_list = INFO_NUM_LIST;
354
355 /******************************************************************************
356
357 Function Prototypes
358
359 *******************************************************************************/
360 int InfoNumbers2(void); // RAVI
361
362 int show_cphs_mb_number(T_MFW_CPHS_ENTRY* mb_number);
363 static void mailbox_edit_cb( T_MFW_HND win, USHORT Identifier,UBYTE reason);
364 static int cphs_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
365 #ifdef FF_CPHS_REL4
366 static int msp_cb (T_MFW_EVENT event, T_MFW_WIN * win);
367 #endif
368 int cphs_mfw_cb(T_MFW_EVENT event, void* para);
369 void cphs_dialog_cb(T_MFW_HND win, USHORT e, SHORT identifier, void *parameter);
370 T_MFW_HND mmi_cphs_create(T_MFW_HND parent_window);
371 T_MFW_HND edit_mailbox_start(T_MFW_HND parent_window);
372
373 static T_MFW_HND buildInfoNumberMenu( MfwHnd parent_window);
374 void info_num_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
375 void InfonumList_cb(T_MFW_HND * Parent, ListMenuData * ListData);
376 static void InfoNum_destroy(MfwHnd own_window);
377 static int info_num_win_cb (MfwEvt e, MfwWin *w) ;
378 void info_num_display_cb(T_MFW_HND win, USHORT identifier, UBYTE reason);
379 EXTERN void cphs_support_check(void); // ADDED BY RAVI - 29-11-2005
380
381 //x0pleela 23 May, 2006 DR:OMAPS00070657
382 #ifdef FF_CPHS
383 void mmi_cphs_get_als_info( void );
384
385 /* x0045876, 14-Aug-2006 (WR - function declared implicitly)*/
386 EXTERN void setAOCflag(int aocValue);
387 #endif
388
389
390
391
392 /******************************************************************************
393
394 Public functions
395
396 *******************************************************************************/
397 /*******************************************************************************
398
399 $Function: mmi_cphs_init()
400
401 $Description: initiatialise cphs module
402
403 $Returns: mfw handle
404
405 $Arguments: none
406
407 *******************************************************************************/
408 T_MFW_HND mmi_cphs_init()
409 {
410 T_MFW_HND status;
411
412 TRACE_FUNCTION("mmi_cphs_init()");
413 cphs_init(); //initialise MFW CPHS module
414
415 status = cphs_create(NULL, 0xFFFFF, cphs_mfw_cb); //create handler for MFW CPHS EVENTS
416
417 info_num_level = 0;
418 info_num_index = 1;
419
420
421 #ifndef FF_CPHS_REL4
422 #ifdef FF_CPHS
423 // Oct 11, 2006 REF:OMAPS00098287 x0039928
424 // Fix: als update is done in idle_draw_main_idle
425 // mmi_cphs_get_als_info();
426 als_bootup = TRUE;
427 #else
428 cphs_get_als_info(&als_status);
429 #endif
430 #endif
431
432 return status;
433 }
434
435 void mmi_cphs_refresh()
436 {
437 //x0pleela 02 June, 2006 DR: OMAPS00079688
438 //Initialising CPHS
439 #ifdef FF_CPHS
440 if (sAT_PercentCPHS(CMD_SRC_LCL,1) /* 1 => ACI_CPHS_INIT */
441 NEQ AT_EXCT)
442 {
443 TRACE_ERROR("Abnormal error Not able to turn on CPHS in ACI");
444 }
445 #endif
446 cphs_support_check(); //check if cphs supported
447 /*retrieval of other values set off by callback function cphs_mfw_cb
448 so when the CPHS status is retrieved, the operator name is then requested and
449 when it has returned, then the CSP is requested etc etec */
450
451 }
452 /*******************************************************************************
453
454 $Function: cphs_E_plus_ALS_supported
455
456 $Description: returns TRUE if SIM is from E-plus, FALSE otherwise
457
458 $Returns: status BOOL
459
460 $Arguments: none
461
462 *******************************************************************************/
463 BOOL cphs_E_plus_ALS_supported()
464 { char IMSI[17];
465 char MNC_MCC[6];
466 char E_plus_MNC_MCC[] = "26203";
467 int i=0;
468 T_ACI_RETURN result;
469 // char debug[40]; // RAVI
470
471 result = qAT_PlusCIMI(CMD_SRC_LCL, IMSI);
472 while (result != AT_CMPL && i < 5)
473 {
474 i++;
475 }
476
477 strncpy(MNC_MCC, IMSI, 5);
478 MNC_MCC[5] =0;//terminate string
479 TRACE_EVENT("E-plus IMSI?");
480 TRACE_EVENT(MNC_MCC);
481 if (!strncmp(E_plus_MNC_MCC, MNC_MCC, 5)) //if e-plus IMSI
482 {
483 return TRUE;
484
485 }
486 else
487 { TRACE_EVENT("Not e-plus IMSI");
488 return FALSE;
489 }
490
491 }
492 /*******************************************************************************
493
494 $Function: cphs_als_status
495
496 $Description: display which ALS line is enabled
497
498 $Returns: status int
499
500 $Arguments: menu, tag (not used)
501
502 *******************************************************************************/
503 int cphs_als_status(MfwMnu* m, MfwMnuItem* i)
504 { T_MFW_HND parent = mfwParent( mfw_header());
505 UBYTE line;
506 line = GetAlsLine();
507 #ifndef CPHS_PROV_TEST
508 if (CphsPresent() == TRUE || cphs_E_plus_ALS_supported())
509 #endif
510 {
511 if (als_status.selectedLine != MFW_SERV_NotPresent)
512 switch(line)
513 {
514 case (MFW_SERV_LINE1): ShowMessage(parent, TxtLine1, TxtActivated);break;
515 case (MFW_SERV_LINE2): ShowMessage(parent, TxtLine2, TxtActivated);break;
516 default: ShowMessage(parent, TxtReadError, TxtNull);break;
517 }
518 else
519 ShowMessage(parent, TxtReadError, TxtNull);
520 }
521 #ifndef CPHS_PROV_TEST
522 else
523 ShowMessage(parent, TxtNotSupported, TxtNull);
524 #else
525 cphs_support_check();
526 #endif
527
528 return MFW_EVENT_CONSUMED;
529 }
530
531 /*******************************************************************************
532
533 $Function: cphs_lock_als
534
535 $Description: Lock ALS Line Selection from menu
536
537 $Returns: status int
538
539 $Arguments: menu, tag (not used)
540
541 *******************************************************************************/
542 int cphs_lock_als(MfwMnu* m, MfwMnuItem* i)
543 {
544 T_MFW_HND parent = mfwParent( mfw_header());
545 T_MFW retVal;
546
547 TRACE_FUNCTION("cphs_lock_als");
548
549 #ifndef CPHS_PROV_TEST
550 if (!ALSPresent(NULL, NULL, NULL))
551 #endif
552 {
553 //xvilliva SPR17291
554 //We call sAT_PlusCLCK(), to update the value in FFS. This is the value used by
555 //ACI to estabilish a call on Line1 or Line2.
556 #ifndef FF_2TO1_PS
557 /*a0393213 warnings removal - CLCK_FAC_Al changed to FAC_Al as a result of ACI enum change*/
558 sAT_PlusCLCK(CMD_SRC_LCL,FAC_Al,CLCK_MOD_Lock,g_pin2,
559 ((als_status.selectedLine == MFW_SERV_LINE1) ? CLASS_Vce : CLASS_AuxVce));//
560 #endif
561 retVal = cphs_set_als_status(MFW_LINE_LOCKED);
562 //x0pleela 11 June, 2006 DR:OMAPS00079692
563 //changed from CPHS_OK to MFW_CPHS_OK
564 if (retVal == MFW_CPHS_OK)
565 {
566 als_status.status = MFW_LINE_LOCKED;
567 ShowMessage(parent, TxtAlsLocked, TxtNull);
568 }
569 }
570 #ifndef CPHS_PROV_TEST
571 else
572 ShowMessage(parent, TxtNotSupported, TxtNull);
573 #endif
574
575 return MFW_EVENT_CONSUMED;
576 }
577
578 /*******************************************************************************
579
580 $Function: cphs_unlock_als
581
582 $Description: Unlock ALS Line Selection from menu
583
584 $Returns: status int
585
586 $Arguments: menu, tag (not used)
587
588 *******************************************************************************/
589 int cphs_unlock_als(MfwMnu* m, MfwMnuItem* i)
590 {
591 T_MFW_HND parent = mfwParent( mfw_header());
592 T_MFW retVal;
593
594 TRACE_FUNCTION("cphs_unlock_als");
595
596 #ifndef CPHS_PROV_TEST
597 if (!ALSPresent(NULL, NULL, NULL))
598 #endif
599 {
600 //xvilliva SPR17291
601 //We call sAT_PlusCLCK(), to update the value in FFS. This is the value used by
602 //ACI to estabilish a call on Line1 or Line2.
603 #ifndef FF_2TO1_PS
604 /*a0393213 warnings removal - CLCK_FAC_Al changed to FAC_Al as a result of ACI enum change*/
605 sAT_PlusCLCK(CMD_SRC_LCL,FAC_Al,CLCK_MOD_Unlock,g_pin2,((als_status.selectedLine == MFW_SERV_LINE1) ? CLASS_Vce : CLASS_AuxVce));//
606 #endif
607 retVal = cphs_set_als_status(MFW_LINE_UNLOCKED);
608 //x0pleela 11 June, 2006 DR:OMAPS00079692
609 //changed from CPHS_OK to MFW_CPHS_OK
610 if (retVal == MFW_CPHS_OK)
611 {
612 als_status.status = MFW_LINE_UNLOCKED;
613 ShowMessage(parent, TxtAlsUnlocked, TxtNull);
614 }
615 }
616 #ifndef CPHS_PROV_TEST
617 else
618 ShowMessage(parent, TxtNotSupported, TxtNull);
619 #endif
620
621 return MFW_EVENT_CONSUMED;
622 }
623
624 #ifdef FF_CPHS_REL4
625
626 /*******************************************************************************
627
628 $Function: item_flag_isMWISFilePresent
629
630 $Description: return 0 if MWIS file is present else 1
631
632 *******************************************************************************/
633 int item_flag_isMWISFilePresent(struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi)
634 {
635 TRACE_FUNCTION("item_flag_isMBDNFilePresent");
636 if(isMWISFilePresent())
637 return 0;
638 else
639 return 1;
640 }
641
642 /*******************************************************************************
643
644 $Function: item_flag_isMBDNFileNotPresent
645
646 $Description: return 1 if MBDN file is present else 0
647
648 *******************************************************************************/
649 int item_flag_isMBDNFileNotPresent(struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi)
650 {
651 TRACE_FUNCTION("item_flag_isMBDNFilePresent");
652 if(isMBDNFilePresent())
653 return 1;
654 else
655 return 0;
656 }
657 /*******************************************************************************
658
659 $Function: item_flag_isMBDNFilePresent
660
661 $Description: return 0 if MBDN file is present else 1
662
663 *******************************************************************************/
664
665 int item_flag_isMBDNFilePresent(struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi)
666 {
667 TRACE_FUNCTION("item_flag_isMBDNFileNotPresent");
668 if(isMBDNFilePresent())
669 return 0;
670 else
671 return 1;
672 }
673
674
675 /*******************************************************************************
676
677 $Function: mmi_msp_interrogate_done
678
679 $Description: Interrogation is finished.
680
681 $Returns: void
682
683 $Arguments: void
684
685 *******************************************************************************/
686
687 void mmi_msp_interrogate_done(void)
688 {
689 TRACE_FUNCTION("mmi_msp_interrogate_done()");
690
691 /*a0393213 cphs rel4*/
692 if(isCFISFilePresent())
693 cphs_get_divert_status();
694
695 /*invalidate the local cache of mbi and mbdn*/
696 cphs_rel4_mbi.valid=0x00;
697 cphs_rel4_mbdn.valid=0x00;
698 }
699
700 /*******************************************************************************
701
702 $Function: mmi_msp_interrogate
703
704 $Description: Start MSP interrogation
705
706 $Returns: void
707
708 $Arguments: void
709
710 *******************************************************************************/
711
712 void mmi_msp_interrogate(void)
713 {
714 char actstr[8];
715 TRACE_FUNCTION("mmi_msp_interrogate()");
716
717 interrogate = 1;
718 strcpy(actstr, "*#59#");
719 ss_execute_transaction((UBYTE*)actstr, 0);
720 }
721
722 /*******************************************************************************
723
724 $Function: msp_cb
725
726 $Description: Window event handler
727
728 $Returns: status int
729
730 $Arguments: event, window handler
731
732 *******************************************************************************/
733
734 static int mwis_cb (MfwEvt e, MfwWin *w) /* yyy window event handler */
735 {
736 TRACE_EVENT ("mwis_cb()");
737
738 switch (e)
739 {
740 case MfwWinVisible: /* window is visible */
741 break;
742 case MfwWinFocussed: /* input focus / selected */
743 case MfwWinDelete: /* window will be deleted */
744
745 default:
746 return MFW_EVENT_REJECTED;
747 }
748 return MFW_EVENT_CONSUMED;
749 }
750
751 /*******************************************************************************
752
753 $Function: msp_cb
754
755 $Description: Window event handler
756
757 $Returns: status int
758
759 $Arguments: event, window handler
760
761 *******************************************************************************/
762
763 static int msp_cb (MfwEvt e, MfwWin *w) /* yyy window event handler */
764 {
765 TRACE_EVENT ("msp_cb()");
766
767 switch (e)
768 {
769 case MfwWinVisible: /* window is visible */
770 break;
771 case MfwWinFocussed: /* input focus / selected */
772 case MfwWinDelete: /* window will be deleted */
773
774 default:
775 return MFW_EVENT_REJECTED;
776 }
777 return MFW_EVENT_CONSUMED;
778 }
779
780 /*******************************************************************************
781
782 $Function: MSPPresent
783
784 $Description: MSP is provisioned.
785
786 $Returns: status USHORT
787
788 $Arguments: menu tag, attribute, item tag
789
790 *******************************************************************************/
791
792 USHORT MSPPresent( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi )
793 {
794 TRACE_EVENT_P1("MSPPresent - %d ", msp_info->count);
795 if(MSP_flag)
796 return 0;
797 else
798 return 1;
799 }
800
801 /*******************************************************************************
802
803 $Function: cphs_select_profile
804
805 $Description: Select a profile for registration
806
807 $Returns: void
808
809 $Arguments: profile id
810
811 *******************************************************************************/
812
813 void cphs_select_profile(int pf_id)
814 {
815 char seq[6];
816
817 TRACE_EVENT_P1("cphs_select_profile - %d", pf_id);
818 strcpy(seq,"*59");
819 switch(pf_id)
820 {
821 case 1:
822 strcat(seq,"1");
823 break;
824 case 2:
825 strcat(seq,"2");
826 break;
827 case 3:
828 strcat(seq,"3");
829 break;
830 case 4:
831 strcat(seq,"4");
832 break;
833 default:
834 break;
835 }
836 strcat(seq,"#");
837
838 msp_register = TRUE;
839 msp_reg_profid = pf_id;
840 sAT_Dn(CMD_SRC_LCL,seq,-1,-1,-1);
841 }
842
843 /*******************************************************************************
844
845 $Function: msp_menu_destroy
846
847 $Description: Destroy menu
848
849 $Returns: void
850
851 $Arguments: window handler
852
853 *******************************************************************************/
854
855 static void msp_menu_destroy(MfwHnd window)
856 {
857 T_MFW_WIN * win_data = ((T_MFW_HDR *)window)->data;
858 T_MSP_INFO * data = (T_MSP_INFO *)win_data->user;
859
860 TRACE_FUNCTION ("msp_menu_destroy");
861
862 if (window == NULL)
863 {
864 return;
865 }
866
867 if (data)
868 {
869 win_delete(data->msp_win);
870
871 /*
872 ** Free Memory
873 */
874 mfwFree((void *)data, sizeof (T_MSP_INFO));
875 }
876 }
877
878 /*******************************************************************************
879
880 $Function: mwis_menu_destroy
881
882 $Description: Destroy menu
883
884 $Returns: void
885
886 $Arguments: window handler
887
888 *******************************************************************************/
889
890 static void mwis_menu_destroy(MfwHnd window)
891 {
892 T_MFW_WIN * win_data = ((T_MFW_HDR *)window)->data;
893 T_MWIS_INFO * data = (T_MWIS_INFO *)win_data->user;
894
895 TRACE_FUNCTION ("mwis_menu_destroy");
896
897 if (window == NULL)
898 {
899 return;
900 }
901
902 if (data)
903 {
904 win_delete(data->mwis_win);
905
906 /*
907 ** Free Memory
908 */
909 mfwFree((void *)data, sizeof (T_MWIS_INFO));
910 }
911 }
912
913 /*******************************************************************************
914
915 $Function: MwisList_cb
916
917 $Description: Callback for MWIS list
918
919 $Returns: void
920
921 $Arguments: parent window, list data
922
923 *******************************************************************************/
924
925 void MwisList_cb(T_MFW_HND * Parent, ListMenuData * ListData)
926 {
927 T_MFW_WIN *win_data = ((T_MFW_HDR *)Parent)->data;
928 T_MWIS_INFO *data = (T_MWIS_INFO *)win_data->user;
929 TRACE_FUNCTION ("MwisList_cb()");
930
931 if ((ListData->Reason EQ LISTS_REASON_BACK) ||
932 (ListData->Reason EQ LISTS_REASON_CLEAR) ||
933 (ListData->Reason EQ LISTS_REASON_HANGUP))
934 {
935 /*
936 ** Destroy the window --- Not sure if this is required! ... leave it out for now
937 */
938 listsDestroy(ListData->win);
939
940 /*
941 ** Free the memory set aside for ALL the devices to be listed.
942 */
943 if (data->menu_list_data != NULL)
944 {
945 FREE_MEMORY ((void *)data->menu_list_data->List, (U16)(4 * sizeof (T_MFW_MNU_ITEM)));
946 FREE_MEMORY ((void *)data->menu_list_data, sizeof (ListMenuData));
947 }
948
949 mwis_menu_destroy(data->mwis_win);
950
951 }
952 }
953
954 /*******************************************************************************
955
956 $Function: mwis_exec_cb
957
958 $Description: Dialog function to display the mwis list
959
960 $Returns: void
961
962 $Arguments: window handler, event, value and parameter
963
964 *******************************************************************************/
965
966 void mwis_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
967 {
968 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
969 T_MWIS_INFO * data = (T_MWIS_INFO*)win_data->user;
970 T_MFW_CPHS_REL4_MWIS * mwis_ptr;
971 int i;
972 char temp[4][50];
973
974 switch (event)
975 {
976 case E_INIT:
977
978 TRACE_EVENT(">>>> mwis_exec_cb() Event:E_INIT");
979
980 /* initialization of administrative data */
981
982
983 data->menu_list_data = (ListMenuData *)ALLOC_MEMORY(sizeof(ListMenuData));
984
985 if(data->menu_list_data == 0)
986 {
987 TRACE_EVENT("Failed memory alloc 1 ");
988 return;
989 }
990
991 data->menu_list_data->List = (T_MFW_MNU_ITEM *)ALLOC_MEMORY( 4 * sizeof(T_MFW_MNU_ITEM) );
992
993 if(data->menu_list_data->List == 0)
994 {
995 TRACE_EVENT("Failed memory alloc 2");
996 return;
997 }
998
999 mwis_ptr = get_mwis_stat(prof_sel);
1000
1001 sprintf(temp[0],"Voice Mesage - %d ", mwis_ptr->voicemail);
1002 mnuInitDataItem(&data->menu_list_data->List[0]);
1003 data->menu_list_data->List[0].flagFunc = item_flag_none;
1004 data->menu_list_data->List[0].str = temp[0];
1005
1006 sprintf(temp[1],"Fax Message - %d ", mwis_ptr->fax);
1007 mnuInitDataItem(&data->menu_list_data->List[1]);
1008 data->menu_list_data->List[1].flagFunc = item_flag_none;
1009 data->menu_list_data->List[1].str = temp[1];
1010
1011 sprintf(temp[2],"Electronic Message - %d ", mwis_ptr->electronic);
1012 mnuInitDataItem(&data->menu_list_data->List[2]);
1013 data->menu_list_data->List[2].flagFunc = item_flag_none;
1014 data->menu_list_data->List[2].str = temp[2];
1015
1016 sprintf(temp[3],"Other Message - %d ", mwis_ptr->other);
1017 mnuInitDataItem(&data->menu_list_data->List[3]);
1018 data->menu_list_data->List[3].flagFunc = item_flag_none;
1019 data->menu_list_data->List[3].str = temp[3];
1020
1021 data->menu_list_data->ListLength = 4;
1022 data->menu_list_data->ListPosition = 0;
1023 data->menu_list_data->CursorPosition = 0;
1024 data->menu_list_data->SnapshotSize = 4;
1025 data->menu_list_data->Font = 0;
1026 data->menu_list_data->LeftSoftKey = TxtNull;
1027 data->menu_list_data->RightSoftKey = TxtSoftBack;
1028 data->menu_list_data->KeyEvents = KEY_RIGHT;
1029 data->menu_list_data->Reason = 0;
1030 data->menu_list_data->Strings = TRUE;
1031 data->menu_list_data->Attr = &InfoNum_menuAttrib;
1032 data->menu_list_data->autoDestroy = FALSE;
1033
1034 /* Create the dynamic menu window */
1035 listDisplayListMenu(win, data->menu_list_data,(ListCbFunc)MwisList_cb,0);
1036
1037 break;
1038 default:
1039 break;
1040 }
1041
1042 }
1043
1044 /*******************************************************************************
1045
1046 $Function: mmi_build_mwis_menu
1047
1048 $Description: Create mwis menu
1049
1050 $Returns: window handler
1051
1052 $Arguments: parent window handler
1053
1054 *******************************************************************************/
1055
1056 static T_MFW_HND mmi_build_mwis_menu( MfwHnd parent_window)
1057 {
1058 T_MWIS_INFO * data = (T_MWIS_INFO *)ALLOC_MEMORY (sizeof (T_MWIS_INFO));
1059 T_MFW_WIN * win;
1060 TRACE_FUNCTION("mmi_build_mwis_menu");
1061
1062 /*
1063 * Create window handler
1064 */
1065
1066 data->mwis_win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)mwis_cb);
1067 if (data->mwis_win EQ NULL)
1068 {
1069 return NULL;
1070 }
1071
1072 TRACE_EVENT(">>>> mwis menu window created: " );
1073 /*
1074 * connect the dialog data to the MFW-window
1075 */
1076
1077 data->mmi_control.dialog = (T_DIALOG_FUNC)mwis_exec_cb;
1078 data->mmi_control.data = data;
1079 win = ((T_MFW_HDR *)data->mwis_win)->data;
1080 win->user = (void *)data;
1081 data->parent = parent_window;
1082 winShow(data->mwis_win);
1083 /*
1084 * return window handle
1085 */
1086
1087 return data->mwis_win;
1088 }
1089
1090
1091 /*******************************************************************************
1092
1093 $Function: MspList_cb
1094
1095 $Description: Callback for MSP list
1096
1097 $Returns: void
1098
1099 $Arguments: parent window, list data
1100
1101 *******************************************************************************/
1102
1103 void MspList_cb(T_MFW_HND * Parent, ListMenuData * ListData)
1104 {
1105 T_MFW_WIN *win_data = ((T_MFW_HDR *)Parent)->data;
1106 T_MSP_INFO *data = (T_MSP_INFO *)win_data->user;
1107 TRACE_FUNCTION ("MspList_cb()");
1108
1109 if ((ListData->Reason EQ LISTS_REASON_BACK) ||
1110 (ListData->Reason EQ LISTS_REASON_CLEAR) ||
1111 (ListData->Reason EQ LISTS_REASON_HANGUP))
1112 {
1113 /*
1114 ** Destroy the window --- Not sure if this is required! ... leave it out for now
1115 */
1116 listsDestroy(ListData->win);
1117
1118 /*
1119 ** Free the memory set aside for ALL the devices to be listed.
1120 */
1121 if (data->menu_list_data != NULL)
1122 {
1123 FREE_MEMORY ((void *)data->menu_list_data->List, (U16)(msp_info->count * sizeof (T_MFW_MNU_ITEM)));
1124 FREE_MEMORY ((void *)data->menu_list_data, sizeof (ListMenuData));
1125 }
1126
1127 msp_menu_destroy(data->msp_win);
1128 mwis_flag = FALSE;
1129 }
1130 else if(ListData->Reason EQ LISTS_REASON_SELECT)
1131 {
1132 TRACE_EVENT_P1("list position is %d",ListData->ListPosition);
1133 if(mwis_flag == FALSE)
1134 cphs_select_profile(ListData->ListPosition);
1135 else
1136 {
1137 T_MFW_HND win;
1138 T_MFW_HND parent_win = mfw_parent(mfw_header());
1139
1140 TRACE_FUNCTION("build_mwis_list()");
1141
1142 mwis_flag = TRUE;
1143 prof_sel = ListData->ListPosition;
1144 win = mmi_build_mwis_menu(parent_win);
1145 if (win NEQ NULL)
1146 {
1147 SEND_EVENT (win, E_INIT, 0, 0);
1148 }
1149 }
1150 }
1151 }
1152
1153
1154 /*******************************************************************************
1155
1156 $Function: msp_exec_cb
1157
1158 $Description: Dialog function to display the msp list
1159
1160 $Returns: void
1161
1162 $Arguments: window handler, event, value and parameter
1163
1164 *******************************************************************************/
1165
1166 void msp_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
1167 {
1168 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
1169 T_MSP_INFO* data = (T_MSP_INFO*)win_data->user;
1170 int i;
1171
1172 switch (event)
1173 {
1174 case E_INIT:
1175
1176 TRACE_EVENT(">>>> msp_exec_cb() Event:E_INIT");
1177
1178 /* initialization of administrative data */
1179
1180
1181 data->menu_list_data = (ListMenuData *)ALLOC_MEMORY(sizeof(ListMenuData));
1182
1183 if(data->menu_list_data == 0)
1184 {
1185 TRACE_EVENT("Failed memory alloc 1 ");
1186 return;
1187 }
1188
1189 data->menu_list_data->List = (T_MFW_MNU_ITEM *)ALLOC_MEMORY( msp_info->count * sizeof(T_MFW_MNU_ITEM) );
1190
1191 if(data->menu_list_data->List == 0)
1192 {
1193 TRACE_EVENT("Failed memory alloc 2");
1194 return;
1195 }
1196
1197 for (i = 0; i < msp_info->count; i++)
1198 {
1199 mnuInitDataItem(&data->menu_list_data->List[i]);
1200 data->menu_list_data->List[i].flagFunc = item_flag_none;
1201 data->menu_list_data->List[i].str = (char *)msp_info->profile[i].alpha;
1202 }
1203
1204 data->menu_list_data->ListLength =msp_info->count;
1205 data->menu_list_data->ListPosition = 1;
1206 data->menu_list_data->CursorPosition = 1;
1207 data->menu_list_data->SnapshotSize = msp_info->count;
1208 data->menu_list_data->Font = 0;
1209 data->menu_list_data->LeftSoftKey = TxtSoftSelect;
1210 data->menu_list_data->RightSoftKey = TxtSoftBack;
1211 data->menu_list_data->KeyEvents = KEY_ALL;
1212 data->menu_list_data->Reason = 0;
1213 data->menu_list_data->Strings = TRUE;
1214 data->menu_list_data->Attr = &InfoNum_menuAttrib;
1215 data->menu_list_data->autoDestroy = FALSE;
1216
1217 /* Create the dynamic menu window */
1218 listDisplayListMenu(win, data->menu_list_data,(ListCbFunc)MspList_cb,0);
1219
1220 break;
1221 default:
1222 break;
1223 }
1224
1225 }
1226
1227
1228 /*******************************************************************************
1229
1230 $Function: mmi_build_msp_menu
1231
1232 $Description: Create MSP menu
1233
1234 $Returns: window handler
1235
1236 $Arguments: parent window handler
1237
1238 *******************************************************************************/
1239
1240 static T_MFW_HND mmi_build_msp_menu( MfwHnd parent_window)
1241 {
1242 T_MSP_INFO * data = (T_MSP_INFO *)ALLOC_MEMORY (sizeof (T_MSP_INFO));
1243 T_MFW_WIN * win;
1244 TRACE_FUNCTION("mmi_build_msp_menu");
1245
1246 /*
1247 * Create window handler
1248 */
1249
1250 data->msp_win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)msp_cb);
1251 if (data->msp_win EQ NULL)
1252 {
1253 return NULL;
1254 }
1255
1256 TRACE_EVENT(">>>> msp menu window created: " );
1257 /*
1258 * connect the dialog data to the MFW-window
1259 */
1260
1261 data->mmi_control.dialog = (T_DIALOG_FUNC)msp_exec_cb;
1262 data->mmi_control.data = data;
1263 win = ((T_MFW_HDR *)data->msp_win)->data;
1264 win->user = (void *)data;
1265 data->parent = parent_window;
1266 winShow(data->msp_win);
1267 /*
1268 * return window handle
1269 */
1270
1271 return data->msp_win;
1272 }
1273
1274 /*******************************************************************************
1275
1276 $Function: build_profile_list
1277
1278 $Description: generate profile list
1279
1280 $Returns: status int
1281
1282 $Arguments: menu, menu item
1283
1284 *******************************************************************************/
1285
1286 int build_profile_list(MfwMnu* m, MfwMnuItem* i)
1287 {
1288 T_MFW_HND win;
1289 T_MFW_HND parent_win = mfw_parent(mfw_header());
1290
1291 TRACE_FUNCTION("build_profile_list()");
1292
1293 win = mmi_build_msp_menu(parent_win);
1294 if (win NEQ NULL)
1295 {
1296 SEND_EVENT (win, E_INIT, 0, 0);
1297 }
1298 return MFW_EVENT_CONSUMED;
1299 }
1300
1301 int build_profile_list1(MfwMnu* m, MfwMnuItem* i)
1302 {
1303 T_MFW_HND win;
1304 T_MFW_HND parent_win = mfw_parent(mfw_header());
1305
1306 TRACE_FUNCTION("build_profile_list()");
1307
1308 mwis_flag = TRUE;
1309
1310 win = mmi_build_msp_menu(parent_win);
1311 if (win NEQ NULL)
1312 {
1313 SEND_EVENT (win, E_INIT, 0, 0);
1314 }
1315 return MFW_EVENT_CONSUMED;
1316 }
1317
1318 #endif
1319 /*******************************************************************************
1320
1321 $Function: cphs_line1_select
1322
1323 $Description: Enable ALS Line1 from menu
1324
1325 $Returns: status int
1326
1327 $Arguments: menu, tag (not used)
1328
1329 *******************************************************************************/
1330 int cphs_line1_select(MfwMnu* m, MfwMnuItem* i)
1331 {
1332 T_MFW_HND parent = mfwParent( mfw_header());
1333 TRACE_FUNCTION("cphs_line1_select");
1334 #ifndef CPHS_PROV_TEST
1335 if (!ALSPresent(NULL, NULL, NULL))
1336 #endif
1337 { cphs_select_line(MFW_SERV_LINE1);
1338 /*cphs_get_divert_status();*//*a0393213 - the call forward icon is now shown taking both the lines into consideration*/
1339 }
1340 #ifndef CPHS_PROV_TEST
1341 else
1342 ShowMessage(parent, TxtNotSupported, TxtNull);
1343 #endif
1344 return MFW_EVENT_CONSUMED;
1345 }
1346 /*******************************************************************************
1347
1348 $Function: cphs_line2_select
1349
1350 $Description: Enable ALS Line2 from menu
1351
1352 $Returns: status int
1353
1354 $Arguments: menu, tag (not used)
1355
1356 *******************************************************************************/
1357 int cphs_line2_select(MfwMnu* m, MfwMnuItem* i)
1358 {
1359
1360 T_MFW_HND parent = mfwParent( mfw_header());
1361 TRACE_FUNCTION("cphs_line2_select");
1362 #ifndef CPHS_PROV_TEST
1363 if (!ALSPresent(NULL, NULL, NULL))
1364 #endif
1365 {
1366 cphs_select_line(MFW_SERV_LINE2);
1367 /*cphs_get_divert_status();*//*a0393213 - the call forward icon is now shown taking both the lines into consideration*/
1368 }
1369 #ifndef CPHS_PROV_TEST
1370 else
1371 ShowMessage(parent, TxtNotSupported, TxtNull);
1372 #endif
1373 return MFW_EVENT_CONSUMED;
1374 }
1375
1376 //x0pleela 23 May, 2006 DR: OMAPS00070657
1377 #ifdef FF_CPHS
1378 /*******************************************************************************
1379
1380 $Function: cphs_Line_Edit_cb
1381
1382 $Description: Callback function for Line rename editor
1383
1384 $Returns: none
1385
1386 $Arguments: win - current window
1387 Identifier - unique id
1388 reason - event cause
1389 *******************************************************************************/
1390
1391 static void cphs_Line_Edit_cb(T_MFW_HND win, USHORT Identifier, SHORT reason)
1392 {
1393 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
1394 T_ALS_DATA* data = (T_ALS_DATA *)win_data->user;
1395 T_DISPLAY_DATA display_info;
1396
1397 switch (reason)
1398 {
1399 case INFO_KCD_ALTERNATELEFT:
1400 case INFO_KCD_LEFT:
1401 {
1402 if( Identifier == LINE1 )
1403 strcpy(FFS_flashData.line1,(char *)data->edt_buf_name);
1404 else
1405 strcpy(FFS_flashData.line2,(char *)data->edt_buf_name);
1406
1407 flash_write();
1408
1409
1410 dlg_initDisplayData_TextId(&display_info, TxtNull, TxtNull, TxtDone, TxtNull, COLOUR_STATUS_WELCOME);
1411
1412 dlg_initDisplayData_events( &display_info, NULL, TWO_SECS, KEY_ALL );
1413
1414 info_dialog(win,&display_info);
1415
1416 #ifdef NEW_EDITOR
1417 AUI_edit_Destroy(data->input_number_win);
1418 #else /* NEW_EDITOR */
1419 editor_destroy(data->input_number_win);
1420 #endif /* NEW_EDITOR */
1421 data->input_number_win = 0;
1422 //dspl_ClearAll();
1423
1424
1425 winDelete(win);
1426 }
1427 break;
1428 case INFO_KCD_RIGHT:
1429 case INFO_KCD_HUP:
1430 {
1431 /* SPR#1428 - SH - New Editor changes */
1432 #ifdef NEW_EDITOR
1433 AUI_edit_Destroy(data->input_number_win);
1434 #else /* NEW_EDITOR */
1435 editor_destroy(data->input_number_win);
1436 #endif /* NEW_EDITOR */
1437 data->input_number_win = 0;
1438 //dspl_ClearAll();
1439 winDelete(win);
1440
1441 }
1442 break;
1443
1444 default:
1445 TRACE_EVENT("Err: Default");
1446 break;
1447
1448
1449 }
1450 }
1451
1452 static void cphs_edit_line_exec_cb(T_MFW_HND win, USHORT event, SHORT identifier, void *parameter)
1453 {
1454 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
1455 T_ALS_DATA* data = (T_ALS_DATA *)win_data->user;
1456 #ifdef NEW_EDITOR
1457 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */
1458 #else
1459 T_EDITOR_DATA editor_data;
1460 #endif
1461 if( identifier==LINE1 )
1462 strcpy((char *) data->edt_buf_name,(char*)MmiRsrcGetText(TxtLine1));
1463 else
1464 strcpy((char *) data->edt_buf_name,(char*)MmiRsrcGetText(TxtLine2));
1465
1466 TRACE_FUNCTION ("cphs_edit_line_exec_cb()");
1467
1468 switch (event)
1469 {
1470 case E_INIT:
1471
1472 #ifdef NEW_EDITOR
1473 AUI_edit_SetDefault(&editor_data);
1474 AUI_edit_SetDisplay(&editor_data, PHNO_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT);
1475 AUI_edit_SetEvents(&editor_data, identifier, FALSE, FOREVER, (T_AUI_EDIT_CB)cphs_Line_Edit_cb);
1476 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtNull, NULL);
1477 AUI_edit_SetAltTextStr(&editor_data, 1, TxtSoftOK, TRUE, TxtSoftBack);
1478 AUI_edit_SetMode(&editor_data, ED_MODE_ALPHA, ED_CURSOR_NONE);
1479 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII,(UBYTE *) data->edt_buf_name, MAX_LINE_NAME_LEN);
1480 data->input_number_win=AUI_edit_Start(data->win, &editor_data);
1481 #else /* NEW_EDITOR */
1482
1483 SmsSend_loadEditDefault(&editor_data);
1484
1485 bookSetEditAttributes( PHNO_EDITOR, COLOUR_EDITOR_XX, 0, edtCurBar1, 0,
1486 (char *) data->edt_data.NumberBuffer, /*MAX_SEARCH_CHAR*/NUMBER_LENGTH, &editor_data.editor_attr);
1487 editor_data.editor_attr.text = (char *)data->edt_buf_name;
1488
1489 editor_data.editor_attr.size = MAX_LINE_NAME_LEN;
1490
1491 editor_data.TextId = TxtNull;
1492 editor_data.LeftSoftKey = TxtSoftOK;
1493 editor_data.AlternateLeftSoftKey = TxtSoftOK;
1494 editor_data.RightSoftKey = TxtDelete;
1495 editor_data.Identifier = identifier ;
1496 editor_data.mode = E_EDIT_DIGITS_MODE;
1497 editor_data.Callback = (T_EDIT_CB)cphs_Line_Edit_cb;
1498 editor_data.destroyEditor = FALSE;
1499 data->input_number_win =editor_start(data->win, &editor_data); /* start the editor */
1500
1501
1502 /* SPR#1428 - SH - New Editor changes */
1503
1504 #endif
1505
1506 break;
1507 default:
1508 TRACE_EVENT("Err: Default");
1509 break;
1510 }
1511 }
1512
1513 /*******************************************************************************
1514
1515 $Function: cphs_edit_line_create
1516
1517 $Description: Create a window for entering the text
1518
1519 $Returns: window handle
1520
1521 $Arguments: parent_window - parent window.
1522
1523 *******************************************************************************/
1524
1525
1526 static T_MFW_HND cphs_edit_line_create(MfwHnd parent_window)
1527 {
1528 T_ALS_DATA* data = (T_ALS_DATA *)ALLOC_MEMORY (sizeof (T_ALS_DATA));
1529 T_MFW_WIN * win;
1530
1531 TRACE_FUNCTION ("cphs_edit_line_create()");
1532
1533 // Create window handler
1534 data->win = win_create (parent_window, 0, E_WIN_VISIBLE, NULL);
1535 if (data->win EQ NULL)
1536 {
1537 return NULL;
1538 }
1539
1540 // connect the dialog data to the MFW-window
1541 data->mmi_control.dialog = (T_DIALOG_FUNC)cphs_edit_line_exec_cb;
1542 data->mmi_control.data = data;
1543 win = ((T_MFW_HDR *)data->win)->data;
1544 win->user = (MfwUserDataPtr)data;
1545 data->parent_win = parent_window;
1546
1547 winShow(data->win);
1548 return data->win;
1549 }
1550
1551 /*******************************************************************************
1552
1553 $Function: cphs_edit_line1
1554
1555 $Description: edit line name from menu
1556
1557 $Returns: status int
1558
1559 $Arguments: menu, tag (not used)
1560
1561 *******************************************************************************/
1562 int cphs_edit_line1(MfwMnu* m, MfwMnuItem* i)
1563 {
1564 T_MFW_HND parent_win = mfw_parent(mfw_header());
1565 T_MFW_HND win = cphs_edit_line_create(parent_win);
1566 SEND_EVENT(win,E_INIT,LINE1,0);
1567 /* a0393213 (WR - missing return statement at end of non-void function "cphs_edit_line1")*/
1568 return MFW_EVENT_CONSUMED;
1569 }
1570
1571
1572 /*******************************************************************************
1573
1574 $Function: cphs_edit_line2
1575
1576 $Description: edit line name from menu
1577
1578 $Returns: status int
1579
1580 $Arguments: menu, tag (not used)
1581
1582 *******************************************************************************/
1583 int cphs_edit_line2(MfwMnu* m, MfwMnuItem* i)
1584 {
1585 T_MFW_HND parent_win = mfw_parent(mfw_header());
1586 T_MFW_HND win = cphs_edit_line_create(parent_win);
1587 SEND_EVENT(win,E_INIT,LINE2,0);
1588 /* a0393213 (WR - missing return statement at end of non-void function "cphs_edit_line2")*/
1589 return MFW_EVENT_CONSUMED;
1590 }
1591 #endif /*FF_CPHS*/
1592
1593 /*******************************************************************************
1594
1595 $Function: menu_cphs_call_mailbox_number
1596
1597 $Description: edit mailbox numbers from menu
1598
1599 $Returns: status int
1600
1601 $Arguments: menu, tag (not used)
1602
1603 *******************************************************************************/
1604 int menu_cphs_call_mailbox_number(MfwMnu* m, MfwMnuItem* i)
1605 { T_MFW_HND parent = mfwParent( mfw_header());
1606 T_MFW_CPHS_INFO configuration;
1607
1608 TRACE_FUNCTION("menu_cphs_call_mailbox_number");
1609
1610 type_of_list = MAILBOX_LIST_CALL;
1611 cphs_config(&configuration);
1612 /***************************Go-lite Optimization changes Start***********************/
1613 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
1614 TRACE_EVENT_P2( "CPHS? %d Mailbox config info: %d", configuration.mbNum, CphsPresent());
1615 /***************************Go-lite Optimization changes end***********************/
1616 if (CphsMailboxPresent()==TRUE )
1617 cphs_get_mailbox();
1618 else
1619 M_callVoice(m, i);
1620 return MFW_EVENT_CONSUMED;
1621 }
1622 /*******************************************************************************
1623
1624 $Function: menu_cphs_edit_mailbox_number
1625
1626 $Description: edit mailbox numbers from menu
1627
1628 $Returns: status int
1629
1630 $Arguments: menu, tag (not used)
1631
1632 *******************************************************************************/
1633 int menu_cphs_edit_mailbox_number(MfwMnu* m, MfwMnuItem* i)
1634 { T_MFW_HND parent = mfwParent( mfw_header());
1635 T_MFW_CPHS_INFO configuration;
1636
1637 TRACE_FUNCTION("menu_cphs_edit_mailbox_number");
1638 type_of_list = MAILBOX_LIST;
1639
1640 cphs_config(&configuration);
1641 /***************************Go-lite Optimization changes Start***********************/
1642 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
1643 TRACE_EVENT_P2( "CPHS? %d Mailbox config info: %d", configuration.mbNum, CphsPresent());
1644 /***************************Go-lite Optimization changes end***********************/
1645 if (CphsMailboxPresent()==TRUE )
1646 cphs_get_mailbox();
1647 else
1648 M_exeVoice(m, i);
1649 return MFW_EVENT_CONSUMED;
1650 }
1651
1652
1653 #ifdef FF_CPHS_REL4
1654 /*******************************************************************************
1655
1656 $Function: menu_cphs_rel4_show_mailbox_number
1657
1658 $Description: menu handler function for any item in MailBox menu
1659
1660 *******************************************************************************/
1661 int menu_cphs_rel4_show_mailbox_number(MfwMnu* m, MfwMnuItem* i)
1662 {
1663 if(cphs_rel4_mbi.valid==1)
1664 {
1665 /*already cached - no need to read SIM*/
1666 sendCPHSSignal(E_CPHS_REL4_GET_MBI,&cphs_rel4_mbi );
1667 }
1668 else
1669 {
1670 /*local copy not valid - read from SIM*/
1671 UBYTE msp_id=mfw_cphs_get_reg_profile();
1672 T_DISPLAY_DATA display_info;
1673 TRACE_FUNCTION("menu_cphs_rel4_show_mailbox_number");
1674 switch (m->lCursor[m->level])
1675 {
1676 case 0:
1677 TRACE_EVENT("voice selected");
1678 mailbox_type=T_MFW_CPHS_REL4_MAILBOX_VOICE;
1679 break;
1680 case 1:
1681 TRACE_EVENT("fax selected");
1682 mailbox_type=T_MFW_CPHS_REL4_MAILBOX_FAX;
1683 break;
1684 case 2:
1685 TRACE_EVENT("electronic selected");
1686 mailbox_type=T_MFW_CPHS_REL4_MAILBOX_ELECTRONIC;
1687 break;
1688 case 3:
1689 TRACE_EVENT("other selected");
1690 mailbox_type=T_MFW_CPHS_REL4_MAILBOX_OTHER;
1691 break;
1692 default:
1693 TRACE_ERROR("menu index out of range");
1694 break;
1695 }
1696 qAT_PercentMBI(CMD_SRC_LCL,msp_id);
1697
1698 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtPleaseWait, TxtNull, COLOUR_STATUS_WAIT);
1699 dlg_initDisplayData_events( &display_info, NULL, FOREVER, 0 );
1700
1701 mailbox_waiting_dialog=info_dialog (mfw_parent(mfwFocus), &display_info);
1702
1703 }
1704 }
1705 #endif
1706 /*******************************************************************************
1707
1708 $Function: InfoNumbers
1709
1710 $Description: displays information number list from CPHS
1711
1712 $Returns: MFW_EVENT_CONSUMED always
1713
1714 $Arguments: m, menu, i, item
1715
1716 *******************************************************************************/
1717
1718 int InfoNumbers( MfwMnu *m, MfwMnuItem *i )
1719 {
1720 T_MFW_HND win;
1721 T_MFW_HND parent_win = mfw_parent(mfw_header());
1722 T_MFW_CPHS_INFO config_info;
1723
1724 cphs_config(&config_info);
1725 /***************************Go-lite Optimization changes Start***********************/
1726 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
1727 TRACE_EVENT_P1("Info Num config info: %d", config_info.iNum);
1728 /***************************Go-lite Optimization changes end***********************/
1729 if (CphsPresent() && config_info.iNum&0x03)
1730 { if (info_numbers[0] != NULL&& info_numbers[0]->count != 0)
1731 { type_of_list = INFO_NUM_LIST;
1732 info_num_level = 1;
1733 win = buildInfoNumberMenu(parent_win);
1734
1735 if (win NEQ NULL)
1736 {
1737 SEND_EVENT (win, E_INIT, 0, 0);
1738 }
1739 }
1740 else
1741 ShowMessage(parent_win, TxtEmptyList, TxtNull);
1742 }
1743 else
1744 ShowMessage(parent_win, TxtNotSupported, TxtNull);
1745
1746 return MFW_EVENT_CONSUMED;
1747 }
1748
1749
1750 /*******************************************************************************
1751
1752 $Function: CphsRequestOperatorName()
1753
1754 $Description: returns operator name data structure from CPHS SIM data
1755
1756 $Returns: see above
1757
1758 $Arguments: none
1759
1760 *******************************************************************************/
1761 T_MFW_CPHS_OP_NAME* CphsRequestOperatorName()
1762 {
1763 return &operator_name;
1764 }
1765
1766 /*******************************************************************************
1767
1768 $Function: CphsPresent()
1769
1770 $Description: indicates whether CPHS sim or not
1771
1772 $Returns: TRUE if it is, FALSe if it isn't
1773 $Arguments: none
1774
1775 *******************************************************************************/
1776 UBYTE CphsPresent()
1777 {
1778 //x0pleela 11 June, 2006 DR:OMAPS00079692
1779 //changed from CPHS_OK to MFW_CPHS_OK
1780 if (cphs_status == MFW_CPHS_OK)
1781 return TRUE;
1782 else
1783 { if (cphs_status == CPHS_NotPresent)
1784 return FALSE;
1785 else /*MC 21/05/02, CONQ5999->6007 Helps diagnose initialisation probs*/
1786 return CPHS_ERR;
1787 }
1788 }
1789 /*******************************************************************************
1790
1791 $Function: CphsMailboxPresent
1792
1793 $Description: indicates whether a CPHS SIM which supports mailbox numbers
1794
1795 $Returns: TRUE if it is, FALSe if it isn't
1796 $Arguments: none
1797
1798 *******************************************************************************/
1799 USHORT CphsMailboxPresent( /*struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi*/ )
1800 { T_MFW_CPHS_INFO config_info;
1801
1802 TRACE_FUNCTION("CphsMailboxPresent");
1803 cphs_config(&config_info);
1804
1805 if (config_info.mbNum &0x03 && CphsPresent())
1806 return /*0*/TRUE;
1807 else
1808 return /*1*/FALSE;
1809
1810 }
1811 /*******************************************************************************
1812
1813 $Function: ALSPresent
1814
1815 $Description: indicates whether a CPHS SIM supports ALS by checking CSP
1816
1817 $Returns: 0 if it does, 1 if it doesn't
1818 $Arguments: menu tag, menu attribute tag, menu item tag (none of them used,
1819 this is merely the format for menu display/suppression functions)
1820
1821 *******************************************************************************/
1822 USHORT ALSPresent( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi )
1823 {
1824 //xvilliva SPR17291 - The pre-existing code was returning ALS not supported
1825 // even if it the SIM supported. Changed the code to call
1826 // tAT_PercentALS() and qAT_PercentALS().
1827
1828 #ifndef FF_CPHS
1829 T_ACI_ALS_MOD ALSmode = (T_ACI_ALS_MOD)0; // RAVI
1830 #endif
1831
1832 //x0pleela 23 May, 2006 DR: OMAP00070657
1833 //Returning the status of ALS based on CSP data
1834 #ifdef FF_CPHS
1835 if( mmi_cphs_get_als_value() )
1836 return 0;
1837 else
1838 return 1;
1839 #else
1840
1841 tAT_PercentALS( CMD_SRC_NONE, &ALSmode );
1842 qAT_PercentALS( CMD_SRC_NONE, &ALSmode );
1843
1844 // ALSmode = 1;//xvilliva SPR17291 - IMP: Hardcoded for our SIMS - got to test on ALS sim.
1845
1846 return (!ALSmode);//returns 0 (if line1 or line2) returns 1 if not supported.
1847 #endif
1848 }
1849
1850 /*******************************************************************************
1851
1852 $Function: CphsALSUnlocked
1853
1854 $Description: Indicates whether a CPHS SIM's support of ALS has been locked by the User
1855
1856 $Returns: 0 if it hasn't, 1 if it has
1857 $Arguments: menu tag, menu attribute tag, menu item tag (none of them used,
1858 this is merely the format for menu display/suppression functions)
1859
1860 *******************************************************************************/
1861 USHORT CphsALSUnlocked( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi )
1862 {
1863 USHORT retVal = CphsALSLocked(m, ma, mi);
1864
1865 if (retVal == 0)
1866 retVal = 1;
1867 else
1868 retVal = 0;
1869
1870 return (retVal);
1871 }
1872 /*******************************************************************************
1873
1874 $Function: CphsALSUnlocked
1875
1876 $Description: Indicates whether a CPHS SIM's support of ALS has been locked by the User
1877
1878 $Returns: 0 if it has, 1 if it hasn't
1879 $Arguments: menu tag, menu attribute tag, menu item tag (none of them used,
1880 this is merely the format for menu display/suppression functions)
1881
1882 *******************************************************************************/
1883 USHORT CphsALSLocked( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi )
1884 {
1885 USHORT retVal;
1886
1887 if (als_status.status == MFW_LINE_LOCKED)
1888 retVal = 0;
1889 else
1890 retVal = 1;
1891
1892 return (retVal);
1893 }
1894 /*******************************************************************************
1895
1896 $Function: InfoNumbersPresent
1897
1898 $Description: indicates whether a CPHS SIM has Info Numbers by checking CSP
1899
1900 $Returns: 0 if it does, 1 if it doesn't
1901 $Arguments: none
1902
1903 *******************************************************************************/
1904 USHORT InfoNumbersPresent( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi )
1905 { T_MFW_CPHS_INFO config_info;
1906
1907 int i,len;
1908 cphs_config(&config_info);
1909 /***************************Go-lite Optimization changes Start***********************/
1910 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
1911 TRACE_EVENT_P1("InfoNum config: %d", config_info.iNum);
1912 /***************************Go-lite Optimization changes end***********************/
1913 len = strlen((char*)customer_service_profile.csp); /* x0039928 - Lint warning fix */
1914 for(i=0; i<len; i+=2)
1915 {
1916 if (customer_service_profile.csp[i] ==CPHS_INFONUMS_BYTE_VALUE)
1917 if (customer_service_profile.csp[(i+1)] & INFONUM_MASK)
1918 return 0; //ALS is supported
1919 }
1920 return 1;
1921 }
1922 /*******************************************************************************
1923
1924 $Function: GetCphsVoicemailStatus
1925
1926 $Description: Asks MFW to check voicemail status on CPHS SIM
1927 cphs_mfw_cb handles callback from this
1928 $Returns: status of line passed as parameter
1929 $Arguments: line
1930
1931 *******************************************************************************/
1932 T_MFW_CFLAG_STATUS GetCphsVoicemailStatus(UBYTE line)
1933 {
1934 cphs_get_mailbox_status ();
1935 TRACE_EVENT("Requesting voicemail status");
1936
1937 /*SPR 2653, removed unneccessary code*/
1938 /*requesting the mailbox status will trigger an event from the MFW if
1939 CPHS is supported and that event will cause a voicemail indication window if a
1940 voicemail flag has been set in the SIM*/
1941 return MFW_CFLAG_NotPresent;
1942
1943
1944 }
1945 /*******************************************************************************
1946
1947 $Function: GetCphsDivertStatus
1948
1949 $Description: get call forwarding status of specified line
1950 cphs_mfw_cb handles callback from this
1951 $Returns: status of line passed as parameter
1952 $Arguments: line
1953
1954 *******************************************************************************/
1955
1956 T_MFW_CFLAG_STATUS GetCphsDivertStatus(UBYTE line)
1957 {
1958 switch (line)
1959 {
1960 case MFW_SERV_LINE1: return call_forwarding_status.line1; //break; // RAVI
1961 case MFW_SERV_LINE2: return call_forwarding_status.line2; // break; // RAVI
1962 case MFW_SERV_FAX: return call_forwarding_status.fax; // break; // RAVI
1963 case MFW_SERV_DATA: return call_forwarding_status.data; // break; // RAVI
1964 default: return MFW_CFLAG_NotPresent;
1965 }
1966 }
1967
1968 /*******************************************************************************
1969
1970 $Function: GetCphsRel4DivertStatus
1971
1972 $Description: get current call forwarding status
1973 $Arguments: none
1974
1975 *******************************************************************************/
1976 #ifdef FF_CPHS_REL4
1977 T_MFW_CPHS_REL4_DV_STAT GetCphsRel4DivertStatus()
1978 {
1979 TRACE_FUNCTION("GetCphsRel4DivertStatus()");
1980 return call_forwarding_status_rel4;
1981 }
1982
1983
1984 /*******************************************************************************
1985
1986 $Function: isCFISFilePresent
1987
1988 $Description: says whether the file is allocated and activated or not
1989 $Arguments: none
1990 $Returns : TRUE - if present
1991 FALSE - if absent
1992
1993 *******************************************************************************/
1994 BOOL isCFISFilePresent()
1995 {
1996 TRACE_FUNCTION("isCFISFilePresent()");
1997 if(sim_serv_table_check((UBYTE)SRV_No_55) == ALLOCATED_AND_ACTIVATED)
1998 {
1999 TRACE_EVENT("CFIS PRESENT");
2000 TRUE;
2001 }
2002 else
2003 {
2004 TRACE_EVENT("CFIS NOT PRESENT");
2005 FALSE;
2006 }
2007 }
2008
2009 /*******************************************************************************
2010
2011 $Function: isMWISFilePresent
2012
2013 $Description: says whether the file is allocated and activated or not
2014 $Arguments: none
2015 $Returns : TRUE - if present
2016 FALSE - if absent
2017
2018 *******************************************************************************/
2019 BOOL isMWISFilePresent(void)
2020 {
2021 TRACE_FUNCTION("isMWISFilePresent()");
2022 if(sim_serv_table_check((UBYTE)SRV_No_54) == ALLOCATED_AND_ACTIVATED)
2023 {
2024 TRACE_EVENT("MWIS PRESENT");
2025 TRUE;
2026 }
2027 else
2028 {
2029 TRACE_EVENT("MWIS NOT PRESENT");
2030 FALSE;
2031 }
2032
2033 }
2034
2035 /*******************************************************************************
2036
2037 $Function: isMBDNFilePresent
2038
2039 $Description: says whether the file is allocated and activated or not
2040 $Arguments: none
2041 $Returns : TRUE - if present
2042 FALSE - if absent
2043
2044 *******************************************************************************/
2045 BOOL isMBDNFilePresent(void)
2046 {
2047 TRACE_FUNCTION("isMWISFilePresent()");
2048 if(sim_serv_table_check((UBYTE)SRV_No_53) == ALLOCATED_AND_ACTIVATED)
2049 {
2050 TRACE_EVENT("MBDN PRESENT");
2051 TRUE;
2052 }
2053 else
2054 {
2055 TRACE_EVENT("MBDN NOT PRESENT");
2056 FALSE;
2057 }
2058
2059 }
2060 #endif
2061
2062 /*******************************************************************************
2063
2064 $Function: GetAlsLine
2065 $Description: gets current als line
2066 $Returns: current als line
2067 $Arguments: line
2068
2069 *******************************************************************************/
2070 UBYTE GetAlsLine()
2071 {
2072 return als_status.selectedLine;
2073 }
2074
2075 /*******************************************************************************
2076
2077 $Function: ShowMessage
2078 $Description: Displays screen with passed text ids
2079 $Returns: nothing
2080 $Arguments: parent window, 2 text ids
2081
2082 *******************************************************************************/
2083 void ShowMessage(T_MFW_HND win, USHORT TextId1, USHORT TextId2)
2084 {
2085
2086 T_DISPLAY_DATA Dialog;
2087
2088 /* Initialise the dialog control block with default information
2089 */
2090 dlg_initDisplayData_TextId( &Dialog, TxtNull, TxtNull, TextId1, TextId2 , COLOUR_STATUS);
2091 dlg_initDisplayData_events( &Dialog, NULL, THREE_SECS, KEY_LEFT| KEY_RIGHT|KEY_CLEAR );
2092
2093 /* Show the dialog
2094 */
2095 info_dialog( win, &Dialog );
2096 }
2097
2098
2099 /*******************************************************************************
2100
2101 $Function: mmi_cphs_wait_dialog
2102 $Description: Displays the "Pls. wait" Dialog
2103 $Returns: Nothing
2104 $Arguments: parent window
2105
2106 *******************************************************************************/
2107 void mmi_cphs_wait_dialog(T_MFW_HND win)
2108 {
2109
2110 cphs_wait_dialog_win = NULL;
2111 memset( (void *)&mmi_cphs_wait_dialog_data, 0, sizeof(T_DISPLAY_DATA) );
2112
2113 /* Initialise the dialog control block with default information
2114 */
2115 dlg_initDisplayData_TextId( &mmi_cphs_wait_dialog_data, TxtNull, TxtNull, TxtPleaseWait, NULL , COLOUR_STATUS);
2116 dlg_initDisplayData_events( &mmi_cphs_wait_dialog_data, NULL, FOREVER, KEY_MAX );
2117
2118 /* Show the dialog */
2119 cphs_wait_dialog_win = info_dialog( win, &mmi_cphs_wait_dialog_data );
2120 }
2121
2122
2123 /*******************************************************************************
2124
2125 $Function: mmi_cphs_wait_dialog_destroy
2126 $Description: Deletes the "Pls. wait" Dialog
2127 $Returns: Nothing
2128 $Arguments: None
2129
2130 *******************************************************************************/
2131 void mmi_cphs_wait_dialog_destroy(void)
2132 {
2133 if ( cphs_wait_dialog_win != NULL )
2134 {
2135 SEND_EVENT( cphs_wait_dialog_win, DIALOG_DESTROY, 0, &mmi_cphs_wait_dialog_data );
2136 }
2137
2138 cphs_wait_dialog_win = NULL;
2139 memset( (void *)&mmi_cphs_wait_dialog_data, 0, sizeof(T_DISPLAY_DATA) );
2140 }
2141
2142
2143 /******************************************************************************
2144
2145 Private functions
2146
2147 *******************************************************************************/
2148
2149 T_MFW_HND edit_mailbox_start(T_MFW_HND parent_window)
2150 {
2151 T_MFW_HND win = mmi_cphs_create(parent_window);
2152 TRACE_FUNCTION("calc_start()");
2153 if (win NEQ NULL)
2154 {
2155 SEND_EVENT(win, MAILBOX, NULL, NULL);
2156
2157 }
2158
2159 return win;
2160 }
2161
2162
2163
2164
2165
2166 T_MFW_HND mmi_cphs_create(T_MFW_HND parent)
2167 { T_MMI_CPHS_DATA * data = (T_MMI_CPHS_DATA *)ALLOC_MEMORY (sizeof (T_MMI_CPHS_DATA ));
2168 T_MFW_WIN * mailbox_win;
2169
2170 if (data EQ NULL)
2171 {
2172 return NULL;
2173 }
2174
2175 // Create window handler
2176 data->mailbox_win = win_create (parent, 0, E_WIN_VISIBLE, (MfwCb)cphs_win_cb);
2177 if (data->mailbox_win EQ NULL)
2178 {
2179
2180 return NULL;
2181 }
2182 // connect the dialog data to the MFW-window
2183 data->mmi_control.dialog = (T_DIALOG_FUNC)cphs_dialog_cb;
2184 data->mmi_control.data = data;
2185 mailbox_win = ((T_MFW_HDR *)data->mailbox_win)->data;
2186 mailbox_win->user = (void *)data;
2187 data->parent_win = parent;
2188 data->win = mailbox_win;
2189 return data->mailbox_win;
2190
2191 }
2192
2193 void mailbox_destroy(MfwHnd own_window)
2194 {
2195 T_MFW_WIN * win_data;
2196 T_MMI_CPHS_DATA * data = NULL;
2197
2198 if (own_window)
2199 {
2200
2201 win_data = ((T_MFW_HDR *)own_window)->data;
2202 if (win_data != NULL) //PATCH TB
2203 data = (T_MMI_CPHS_DATA *)win_data->user;
2204
2205 if (data)
2206 {
2207 TRACE_EVENT ("mailbox_destroy()");
2208
2209 win_delete (data->win);
2210 // Free Memory
2211 FREE_MEMORY ((void *)data, sizeof (T_MMI_CPHS_DATA));
2212
2213 }
2214 else
2215 {
2216 TRACE_EVENT ("mailbox_destroy() called twice");
2217 }
2218 }
2219 }
2220
2221 void cphs_dialog_cb(T_MFW_HND win, USHORT e, SHORT identifier, void *parameter)
2222 { TRACE_EVENT("cphs_dialog_cb()");
2223 switch(e)
2224 { case (MAILBOX):
2225 cphs_get_mailbox();break;
2226 default: break;
2227 }
2228 }
2229
2230 static int cphs_win_cb (T_MFW_EVENT event, T_MFW_WIN * win)
2231 {
2232 T_MMI_CPHS_DATA * data = (T_MMI_CPHS_DATA *)win->user;
2233
2234 TRACE_FUNCTION ("cphs_win_cb()");
2235
2236 if(data EQ 0)
2237 return 1;
2238 switch (event)
2239 {
2240 case E_WIN_VISIBLE:
2241 if (win->flags & E_WIN_VISIBLE)
2242 {
2243 /* Print the information dialog */
2244 /* Clear Screen */
2245 dspl_ClearAll();
2246 }
2247 default:
2248 return 0;
2249 }
2250 }
2251 /*******************************************************************************
2252
2253 $Function: show_cphs_mb_numbers
2254 $Description: Show the list of mailbox numbers
2255 $Returns: nothing
2256 $Arguments: none
2257
2258 *******************************************************************************/
2259 void show_cphs_mb_numbers()
2260 {
2261 T_MFW_HND win;
2262 T_MFW_HND parent_win= mfw_parent(mfw_header());
2263
2264 TRACE_FUNCTION("show_cphs_mb_numbers");
2265
2266 {
2267 win = buildInfoNumberMenu(parent_win);
2268
2269 if (win NEQ NULL)
2270 {
2271 SEND_EVENT (win, E_INIT, 0, 0);
2272 }
2273 }
2274 }
2275 static UBYTE* temp_ed;
2276
2277 /*******************************************************************************
2278
2279 $Function: show_cphs_mb_number
2280 $Description: Show the passed mailbox number in editor
2281 $Returns: status int
2282 $Arguments: mailbox number entry
2283
2284 *******************************************************************************/
2285
2286 int show_cphs_mb_number(T_MFW_CPHS_ENTRY* mb_number)
2287 { T_MFW_HND parent_win = mfw_parent(mfw_header());
2288 #ifdef NEW_EDITOR
2289 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data*/
2290 #else
2291 T_EDITOR_DATA editor_data;
2292 #endif
2293 char temp_number[MFW_CPHS_VM_NUMBER_MAXLEN - 10];
2294
2295 TRACE_FUNCTION("show_cphs_mb_number");
2296
2297 memset( temp_number, 0, (MFW_CPHS_VM_NUMBER_MAXLEN - 10) );
2298
2299 //if it's an international number without a '+'
2300 if (mb_number->ton == MFW_TON_INTERNATIONAL && mb_number->number[0] != '+')
2301 { strcat(temp_number, "+"); //put a + in front of number
2302 strncat(temp_number, (char*)mb_number->number, (PHB_MAX_LEN - 1) );
2303 strcpy((char*)mb_number->number, temp_number);
2304 }
2305 /* SPR#1428 - SH - New Editor changes */
2306
2307 #ifdef NEW_EDITOR
2308 AUI_edit_SetDefault(&editor_data);
2309 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)mb_number->number, PHB_MAX_LEN - 1);
2310 AUI_edit_SetMode(&editor_data, 0, ED_CURSOR_UNDERLINE);
2311 AUI_edit_SetDisplay(&editor_data, 0, COLOUR_EDITOR, EDITOR_FONT);
2312 AUI_edit_SetEvents(&editor_data, 0, TRUE, FOREVER, (T_AUI_EDIT_CB)mailbox_edit_cb);
2313 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtNull, NULL);
2314
2315 temp_ed = (UBYTE *)mb_number->number;
2316
2317 AUI_edit_Start(parent_win, &editor_data);
2318 #else /* NEW_EDITOR */
2319 editor_attr_init(&editor_data.editor_attr, 0, edtCurBar1, NULL, (char*)mb_number->number, PHB_MAX_LEN-1, COLOUR_EDITOR);
2320 editor_data_init(&editor_data, (T_EDIT_CB)mailbox_edit_cb, TxtSoftOK, TxtDelete, NULL, 1, DIGITS_MODE, FOREVER);
2321 editor_data.Identifier = 0;
2322 editor_data.hide = FALSE;
2323 editor_data.destroyEditor = TRUE;
2324 editor_data.TextString = NULL; /*MC SPR 1257, stops glitch in Chinese*/
2325
2326
2327 editor_start(parent_win,&editor_data); /* start the editor */
2328 #endif /* NEW_EDITOR */
2329 return 1;
2330 }
2331
2332 #ifdef FF_CPHS_REL4
2333 /*******************************************************************************
2334
2335 $Function: show_cphs_rel4_mb_number
2336 $Description: Show the passed cphs rel4 mailbox number in editor
2337 $Returns: status int
2338 $Arguments: mailbox number entry
2339
2340 *******************************************************************************/
2341
2342 int show_cphs_rel4_mb_number(T_MFW_MBDN* mb_number)
2343 { T_MFW_HND parent_win = mfw_parent(mfw_header());
2344 #ifdef NEW_EDITOR
2345 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data*/
2346 #else
2347 T_EDITOR_DATA editor_data;
2348 #endif
2349 char temp_number[MAX_MB_NUM_LEN];
2350
2351 TRACE_FUNCTION("show_cphs_mb_number");
2352
2353 memset(temp_number, 0, MAX_MB_NUM_LEN);
2354
2355 //if it's an international number without a '+'
2356 if (mb_number->type.ton == MFW_TON_INTERNATIONAL && mb_number->number[0] != '+')
2357 { strcat(temp_number, "+"); //put a + in front of number
2358 strcat(temp_number, (char*)mb_number->number);
2359 strcpy((char*)mb_number->number, temp_number);
2360 }
2361 /* SPR#1428 - SH - New Editor changes */
2362
2363 #ifdef NEW_EDITOR
2364 AUI_edit_SetDefault(&editor_data);
2365 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)mb_number->number, MAX_MB_NUM_LEN-1);
2366 AUI_edit_SetMode(&editor_data, ED_MODE_READONLY, ED_CURSOR_NONE);
2367 AUI_edit_SetDisplay(&editor_data, 0, COLOUR_EDITOR, EDITOR_FONT);
2368 AUI_edit_SetEvents(&editor_data, 0, TRUE, FOREVER, NULL);
2369 switch(mailbox_type)
2370 {
2371 case T_MFW_CPHS_REL4_MAILBOX_VOICE:
2372 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, NULL, TxtVoice, NULL);
2373 break;
2374 case T_MFW_CPHS_REL4_MAILBOX_FAX:
2375 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, NULL, TxtFax, NULL);
2376 break;
2377 case T_MFW_CPHS_REL4_MAILBOX_ELECTRONIC:
2378 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, NULL, TxtElectronic, NULL);
2379 break;
2380 case T_MFW_CPHS_REL4_MAILBOX_OTHER:
2381 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, NULL, TxtOther, NULL);
2382 break;
2383 }
2384 AUI_edit_Start(parent_win, &editor_data);
2385 #else /* NEW_EDITOR */
2386 editor_attr_init(&editor_data.editor_attr, 0, edtCurNone, NULL, (char*)mb_number->number, MAX_MB_NUM_LEN-1, COLOUR_EDITOR);
2387 editor_data_init(&editor_data, NULL, TxtSoftOK, NULL, NULL, 1, DIGITS_MODE, FOREVER);
2388 editor_data.Identifier = 0;
2389 editor_data.hide = FALSE;
2390 editor_data.destroyEditor = TRUE;
2391 editor_data.TextString = NULL; /*MC SPR 1257, stops glitch in Chinese*/
2392
2393
2394 editor_start(parent_win,&editor_data); /* start the editor */
2395 #endif /* NEW_EDITOR */
2396 // ADDED BY RAVI - 29-11-2005
2397 #if (BOARD == 61)
2398 return 1;
2399 #endif
2400 // END RAVI
2401 }
2402 #endif
2403
2404 /*******************************************************************************
2405
2406 $Function: mailbox_edit_cb
2407 $Description: callback for mailbox editor screen
2408 $Returns: nothing
2409 $Arguments: window, identifier, reason
2410
2411 *******************************************************************************/
2412 static void mailbox_edit_cb( T_MFW_HND win, USHORT Identifier,UBYTE reason)
2413 {
2414 T_MFW set_mailbox_errcode = MFW_CPHS_OK;
2415 UBYTE write_error_number[MFW_CPHS_VM_NUMBER_MAXLEN];
2416
2417 TRACE_FUNCTION("mailbox_edit_cb()");
2418 switch (reason )
2419 {
2420 case INFO_KCD_LEFT:
2421 {
2422 memcpy( (void *)&write_error_number[0], (void *)&cphs_voicemail_num.number[0], MFW_CPHS_VM_NUMBER_MAXLEN );
2423 memset ( (void *)&cphs_voicemail_num.number[0], 0, MFW_CPHS_VM_NUMBER_MAXLEN );
2424 memcpy ( (void *)&cphs_voicemail_num.number[0], (void *)temp_ed, MFW_CPHS_VM_NUMBER_MAXLEN );
2425
2426 set_mailbox_errcode = cphs_set_mailbox(&cphs_voicemail_num);
2427
2428 if ( set_mailbox_errcode == MFW_CPHS_OK )
2429 {
2430 mmi_cphs_wait_dialog(win); /* Display the "Pls. wait" Dialog as SIM Write consumes quite some time */
2431 }
2432 else
2433 {
2434 memcpy( (void *)&cphs_voicemail_numbers.entries[cphs_voicemail_num.list_index].number[0],
2435 (void *)&write_error_number[0], MFW_CPHS_VM_NUMBER_MAXLEN);
2436 }
2437
2438 break;
2439 }
2440
2441
2442 default:
2443 {
2444 /* otherwise no action to be performed */
2445 break;
2446 }
2447 }
2448 }
2449
2450
2451
2452
2453 /*******************************************************************************
2454
2455 $Function: cphs_mfw_cb
2456 $Description: Callback handler for mfw_cphs events
2457 $Returns: status int
2458 $Arguments: event, parameter pointer
2459
2460 *******************************************************************************/
2461 int cphs_mfw_cb(T_MFW_EVENT event, void* para)
2462 { T_MFW_HND parent = mfwParent( mfw_header());
2463
2464 // T_MFW_CPHS_VC_NUM* number_list =(T_MFW_CPHS_VC_NUM* )para; // RAVI
2465
2466 // T_MFW_CPHS_PARA* parameter = (T_MFW_CPHS_PARA*)para; // RAVI
2467 // T_MFW_CPHS_STATUS temp; // RAVI
2468 TRACE_FUNCTION("cphs_mfw_cb");
2469 switch(event)
2470 { case E_CPHS_IND:
2471 TRACE_EVENT("Getting cphs status");
2472 if(para != NULL)
2473 { cphs_status =(* (T_MFW_CPHS_STATUS*)para);
2474 //x0pleela 11 June, 2006 DR:OMAPS00079692
2475 //changed from CPHS_OK to MFW_CPHS_OK
2476 if (cphs_status != MFW_CPHS_OK)
2477 {
2478 /***************************Go-lite Optimization changes Start***********************/
2479 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
2480 TRACE_EVENT_P1("cphs not supported, apparently%d", cphs_status);
2481 /***************************Go-lite Optimization changes end***********************/
2482 }
2483 cphs_operator_name();
2484 }
2485 break;
2486 case E_CPHS_OP_NAME:
2487 //x0012849: Jagannatha 26 May, 2006 ER: OMAPS00079607 -Support AOC in CPHS
2488 TRACE_EVENT("case: E_CPHS_OP_NAME");
2489 if(para != NULL)
2490 {
2491 int csp_status; //x0012849: Jagannatha 26 May, 2006 ER: OMAPS00079607 - No need to include this under FF_CPHS flag.
2492 memcpy(&operator_name, para, sizeof(T_MFW_CPHS_OP_NAME));
2493 TRACE_EVENT("operator name callback");
2494
2495 if (operator_name.longName.data[0] == NULL)
2496 TRACE_EVENT("Blank long name");
2497
2498 if (operator_name.shortName.data[0] == NULL)
2499 TRACE_EVENT("Blank short name");
2500 //x0012849: Jagannatha 26 May, 2006 ER: OMAPS00079607 -Support AOC in CPHS
2501 csp_status = cphs_get_csp();
2502 //x0012849: Jagannatha 26 May, 2006 ER: OMAPS00079607 -Support AOC in CPHS
2503 // In case if cphs_get_csp returns less than 'MFW_CPHS_OK' then either CPHS is not present or CPS is not allocated or activated in serice table.
2504 #ifdef FF_CPHS
2505 //x0pleela 11 June, 2006 DR:OMAPS00079692
2506 //changed from CPHS_OK to MFW_CPHS_OK
2507 if( csp_status < MFW_CPHS_OK)
2508 {
2509 TRACE_EVENT("E_CPHS_OP_NAME : AOC is set to TRUE");
2510 setAOCflag(TRUE);
2511 }
2512 #endif
2513 }
2514 break;
2515 case E_CPHS_GET_VC_NUM:
2516 {
2517 if (para!= NULL)
2518 {
2519 memcpy(&cphs_voicemail_numbers, para, sizeof(T_MFW_CPHS_VC_NUM));
2520 /***************************Go-lite Optimization changes Start***********************/
2521 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
2522 TRACE_EVENT_P1("Voicemail No %s", cphs_voicemail_numbers.entries[0].number);
2523 /***************************Go-lite Optimization changes end***********************/
2524 show_cphs_mb_numbers();
2525 }
2526
2527 }
2528 break;
2529 #ifdef FF_CPHS_REL4
2530 case E_CPHS_REL4_GET_MBI:
2531 if(para!=NULL)
2532 {
2533 /*update local cache*/
2534 memcpy(&cphs_rel4_mbi,para,sizeof(T_MFW_CPHS_REL4_MBI));
2535 /*get mbdn*/
2536 switch(mailbox_type)
2537 {
2538 case T_MFW_CPHS_REL4_MAILBOX_VOICE:
2539 if(cphs_rel4_mbdn.valid & 0x01)
2540 cphs_mfw_cb(E_CPHS_REL4_GET_MBDN,&(cphs_rel4_mbdn.mailbox_numbers[0]));
2541 else
2542 cphs_rel4_get_mailbox_no( cphs_rel4_mbi.voice);
2543 break;
2544 case T_MFW_CPHS_REL4_MAILBOX_FAX:
2545 if(cphs_rel4_mbdn.valid & 0x02)
2546 cphs_mfw_cb(E_CPHS_REL4_GET_MBDN,&(cphs_rel4_mbdn.mailbox_numbers[1]));
2547 else
2548 cphs_rel4_get_mailbox_no(cphs_rel4_mbi.fax);
2549 break;
2550 case T_MFW_CPHS_REL4_MAILBOX_ELECTRONIC:
2551 if(cphs_rel4_mbdn.valid & 0x04)
2552 cphs_mfw_cb(E_CPHS_REL4_GET_MBDN,&(cphs_rel4_mbdn.mailbox_numbers[2]));
2553 else
2554 cphs_rel4_get_mailbox_no(cphs_rel4_mbi.electronic);
2555 break;
2556 case T_MFW_CPHS_REL4_MAILBOX_OTHER:
2557 if(cphs_rel4_mbdn.valid & 0x08)
2558 cphs_mfw_cb(E_CPHS_REL4_GET_MBDN,&(cphs_rel4_mbdn.mailbox_numbers[3]));
2559 else
2560 cphs_rel4_get_mailbox_no( cphs_rel4_mbi.other);
2561 break;
2562 }
2563 }
2564 break;
2565 case E_CPHS_REL4_GET_MBDN:
2566 /*destroy the dialog showing waiting*/
2567 SEND_EVENT(mailbox_waiting_dialog, DIALOG_DESTROY, 0, 0);
2568 if(para!=NULL)
2569 {
2570
2571 /*update local cache and show mailbox number*/
2572 switch(mailbox_type)
2573 {
2574 case T_MFW_CPHS_REL4_MAILBOX_VOICE:
2575 memcpy(&cphs_rel4_mbdn.mailbox_numbers[0],para,sizeof(T_MFW_MBDN));
2576 cphs_rel4_mbdn.valid|=0x01;
2577 show_cphs_rel4_mb_number(&cphs_rel4_mbdn.mailbox_numbers[0]);
2578 break;
2579 case T_MFW_CPHS_REL4_MAILBOX_FAX:
2580 memcpy(&cphs_rel4_mbdn.mailbox_numbers[1],para,sizeof(T_MFW_MBDN));
2581 cphs_rel4_mbdn.valid|=0x02;
2582 show_cphs_rel4_mb_number(&cphs_rel4_mbdn.mailbox_numbers[1]);
2583 break;
2584 case T_MFW_CPHS_REL4_MAILBOX_ELECTRONIC:
2585 memcpy(&cphs_rel4_mbdn.mailbox_numbers[2],para,sizeof(T_MFW_MBDN));
2586 cphs_rel4_mbdn.valid|=0x04;
2587 show_cphs_rel4_mb_number(&cphs_rel4_mbdn.mailbox_numbers[2]);
2588 break;
2589 case T_MFW_CPHS_REL4_MAILBOX_OTHER:
2590 memcpy(&cphs_rel4_mbdn.mailbox_numbers[3],para,sizeof(T_MFW_MBDN));
2591 cphs_rel4_mbdn.valid|=0x08;
2592 show_cphs_rel4_mb_number(&cphs_rel4_mbdn.mailbox_numbers[3]);
2593 break;
2594 }
2595
2596 }
2597 break;
2598 #endif
2599 case E_CPHS_SET_VC_NUM:
2600 { //result of writing mailbox number
2601 UBYTE write_result;
2602 if(para != NULL)
2603 { write_result = *(UBYTE*)para;
2604 mmi_cphs_wait_dialog_destroy(); /* Delete the "Pls. wait" screen */
2605 if (write_result == MFW_SIMOP_WRITE_OK)
2606 ShowMessage(parent, TxtSaved, TxtNull);
2607 else
2608 ShowMessage(parent, TxtWriteError, TxtNull);//display "Write Error"
2609 }
2610 }
2611 break;
2612 case E_CPHS_GET_VC_STAT:
2613 {
2614 MfwHnd idle_win =idle_get_window();
2615 // UBYTE line; // RAVI
2616
2617 /*a0393213 cphs rel4 - the parameter sent are of different type for CPHS Rel4 and non-CPHS Rel4*/
2618 #ifdef FF_CPHS_REL4
2619 if(!isMWISFilePresent() )
2620 {
2621 #endif
2622 if(para != NULL)
2623 { cphs_voicemail_status = (T_MFW_CPHS_VC_STAT*)para;
2624
2625 TRACE_EVENT("Getting voicemail status");
2626 if (cphs_voicemail_status->line1 == MFW_CFLAG_SET)
2627 {
2628 //x0pleela 01 June, 2006 DR: OMAPS00079692
2629 //Commented below line to avoid displaying a popup msg showing the line #
2630 //Idle screen will be updated with the voice mail icon
2631 //ShowMessage(idle_win, TxtVoicemail, TxtLine1);
2632
2633 /* SPR#1929 - DS - Set voicemail icon on idle screen. Port of 1960 */
2634 iconsSetState(iconIdVoice);
2635 }
2636
2637
2638 if (cphs_voicemail_status->line2 == MFW_CFLAG_SET)
2639 {
2640 //x0pleela 01 June, 2006 DR: OMAPS00079692
2641 //Commented below line to avoid displaying a popup msg showing the line #
2642 //Idle screen will be updated with the voice mail icon
2643 //ShowMessage(idle_win, TxtVoicemail, TxtLine2);
2644
2645 /* SPR#1929 - DS - Set voicemail icon on idle screen. Port of 1960 */
2646 iconsSetState(iconIdVoice);
2647 }
2648
2649 /* SPR#1929 - DS - Remove voicemail icon from idle screen if
2650 * there is no voicemail waiting on either line1/line2. Port of 1960.
2651 */
2652 if ( (cphs_voicemail_status->line1 != MFW_CFLAG_SET) &&
2653 (cphs_voicemail_status->line2 != MFW_CFLAG_SET) )
2654 {
2655 iconsDeleteState(iconIdVoice);
2656 }
2657 }
2658 #ifdef FF_CPHS_REL4
2659 }
2660 else
2661 {
2662 if(is_message_waiting())
2663 {
2664 iconsSetState(iconIdVoice);
2665 }
2666 else
2667 {
2668 iconsDeleteState(iconIdVoice);
2669 }
2670
2671 }
2672 #endif
2673
2674 }
2675 break;
2676 case E_CPHS_SET_VC_STAT:
2677
2678 { //result of resetting mailbox status
2679 // UBYTE write_result; // RAVI
2680
2681 TRACE_EVENT("Mailbox status set");
2682 //Update our copy of the mailbox status
2683 GetCphsVoicemailStatus(0);
2684 }
2685 break;
2686 case E_CPHS_GET_DV_STAT:
2687 {
2688 /*a0393213 cphs rel4 - the parameter sent are of different type for CPHS Rel4 and non-CPHS Rel4*/
2689 #ifdef FF_CPHS_REL4
2690 if(!isCFISFilePresent() )
2691 {
2692 #endif
2693 UBYTE line;
2694 //check for divert on active line
2695 line = GetAlsLine();
2696
2697 TRACE_EVENT_P4("cphs_mfw_cb():E_CPHS_GET_DV_STAT %d %x %x %x", ((T_MFW_CPHS_DV_STAT*)para)->result,
2698 ((T_MFW_CPHS_DV_STAT*)para)->line1,((T_MFW_CPHS_DV_STAT*)para)->line2,line);
2699
2700 /* 30th May,2006 OMAPS00079650 a0393213 (R.Prabakar)
2701 Description : CPHS Call Forwarding feature implementation
2702 Solution : call_forwarding_status is updated. The data is not written into flash as it would be done
2703 in E_CPHS_SET_DV_STAT. However the present code is not disturbed*/
2704
2705 #ifdef FF_CPHS
2706 if(((T_MFW_CPHS_DV_STAT*)para)->result == MFW_SIMOP_READ_ERR)
2707 {
2708
2709 if(FFS_flashData.CFState==TRUE)
2710 {
2711 if (line == MFW_SERV_LINE2)
2712 ((T_MFW_CPHS_DV_STAT*)para)->line2=MFW_CFLAG_SET;
2713 else
2714 ((T_MFW_CPHS_DV_STAT*)para)->line1=MFW_CFLAG_SET;
2715
2716 }
2717 else
2718 {
2719 if (line == MFW_SERV_LINE2)
2720 ((T_MFW_CPHS_DV_STAT*)para)->line2=MFW_CFLAG_NOTSet;
2721 else
2722 ((T_MFW_CPHS_DV_STAT*)para)->line1=MFW_CFLAG_NOTSet;
2723 }
2724 }
2725 #endif
2726 if(para != NULL)
2727 memcpy(&call_forwarding_status, para, sizeof(T_MFW_CPHS_DV_STAT));
2728 {
2729
2730 //check if current outgoing line diverted
2731 /*a0393213 - the call forward icon is now shown taking both the lines into consideration*/
2732 /*if (line == MFW_SERV_LINE2)
2733 DivertStatus = GetCphsDivertStatus(MFW_SERV_LINE2);
2734 else//if (line == MFW_SERV_LINE1)
2735 DivertStatus = GetCphsDivertStatus(MFW_SERV_LINE1);*/
2736
2737 //set the call forwarding icon
2738 if ((GetCphsDivertStatus(MFW_SERV_LINE1)==MFW_CFLAG_SET) ||
2739 (GetCphsDivertStatus(MFW_SERV_LINE2)==MFW_CFLAG_SET))
2740 {
2741 iconsSetState(iconIdCallFor);
2742 #ifndef FF_CPHS
2743 // Jun 23, 2004 REF: CRR MMI-SPR-13599 Rashmi C N(Sasken)
2744 // Setting the Current state of CF in Flash
2745 FFS_flashData.CFState=TRUE;
2746 #endif
2747 }
2748 //gid rid of call forwarding icon
2749 if ((GetCphsDivertStatus(MFW_SERV_LINE1)==MFW_CFLAG_NOTSet) &&
2750 (GetCphsDivertStatus(MFW_SERV_LINE2)==MFW_CFLAG_NOTSet))
2751 {
2752 iconsDeleteState(iconIdCallFor);
2753 #ifndef FF_CPHS
2754 // Jun 23, 2004 REF: CRR MMI-SPR-13599 Rashmi C N(Sasken)
2755 // Setting the Current state of CF in Flash
2756 FFS_flashData.CFState=FALSE;
2757 #endif
2758 }
2759
2760 #ifndef FF_CPHS
2761 // Jun 23, 2004 REF: CRR MMI-SPR-13599 Rashmi C N(Sasken)
2762 // Writng the Current state of CF into ffs
2763 flash_write();
2764 #endif
2765 }
2766 #ifdef FF_CPHS_REL4
2767 }
2768 else
2769 {
2770 /*store info in call_forwarding_status_rel4*/
2771 memcpy(&call_forwarding_status_rel4, para, sizeof(T_MFW_CPHS_REL4_DV_STAT));
2772 if(((T_MFW_CPHS_REL4_DV_STAT*)para)->voice==MFW_CFLAG_SET)
2773 iconsSetState(iconIdCallFor);
2774 else
2775 iconsDeleteState(iconIdCallFor);
2776 }
2777 if(isMWISFilePresent())
2778 cphs_rel4_get_mailbox_status();
2779 #endif
2780 }
2781 break;
2782 case E_CPHS_SET_DV_STAT:
2783 {
2784 //result of setting divert status
2785 // UBYTE write_result; // RAVI
2786 /* 30th May,2006 OMAPS00079650 a0393213 (R.Prabakar)
2787 Description : CPHS Call Forwarding feature implementation
2788 Solution : CF status is written into flash if sim write had failed*/
2789 #ifdef FF_CPHS_REL4
2790 if(!isCFISFilePresent() )
2791 {
2792 #endif
2793 #ifdef FF_CPHS
2794 if(para != NULL)
2795 {
2796 UBYTE write_result;
2797 write_result = *(UBYTE*)para;
2798 if (write_result == MFW_SIMOP_WRITE_OK)
2799 TRACE_EVENT("cphs_mfw_cb:Call forward flag set in sim");
2800 if (write_result == MFW_SIMOP_WRITE_ERR)
2801 {
2802 TRACE_EVENT("cphs_mfw_cb:Unable to set call forward flag in sim");
2803
2804 if(ss_data.cfu_services&0x01)
2805 {
2806 FFS_flashData.CFState=TRUE;
2807 }
2808 else
2809 {
2810 FFS_flashData.CFState=FALSE;
2811 }
2812 flash_write();
2813 }
2814 }
2815 #endif
2816
2817 cphs_get_divert_status(); //refresh divert status
2818 #ifdef FF_CPHS_REL4
2819 }
2820 else/*a0393213 cphs rel4 supported*/
2821 {
2822 if(call_forwarding_status_rel4.voice==MFW_CFLAG_SET)
2823 iconsSetState(iconIdCallFor);
2824 else
2825 iconsDeleteState(iconIdCallFor);
2826 }
2827 #endif
2828
2829 }
2830 break;
2831 case E_CPHS_GET_ALS_STATUS:
2832 { if(para != NULL)
2833 memcpy(&als_status, para, sizeof(T_MFW_CPHS_ALS_STATUS));
2834 }
2835 break;
2836 case E_CPHS_SET_LINE:
2837 { //result of set ALS line
2838 UBYTE write_result;
2839 if(para != NULL)
2840 { write_result = *(UBYTE*)para;
2841 if (write_result == MFW_SIMOP_WRITE_OK)
2842 {
2843 TRACE_EVENT("cphs_mfw_cb() : ALS status written into flash");
2844 ShowMessage(parent, TxtChanged, TxtNull);
2845 }
2846 if (write_result == MFW_SIMOP_WRITE_ERR)
2847 {
2848 TRACE_EVENT("cphs_mfw_cb() : ALS status not written into flash");
2849 ShowMessage(parent, TxtWriteError, TxtNull);//display "Write Error"
2850 }
2851 }
2852 #ifdef FF_CPHS
2853 mmi_cphs_get_als_info();
2854 #else
2855 cphs_get_als_info(&als_status);//refresh current line
2856 #endif
2857 /*cphs_get_divert_status(); //refresh divert status*//*a0393213 - the call forward icon is now shown taking both the lines into consideration*/
2858 }
2859 break;
2860 case E_CPHS_SET_ALS_STATUS:
2861 { //result of setting ALS status
2862 UBYTE write_result;
2863 if(para != NULL)
2864 { write_result = *(UBYTE*)para;
2865 if (write_result == MFW_SIMOP_WRITE_OK)
2866 ShowMessage(parent, TxtSaved, TxtNull);
2867 if (write_result == MFW_SIMOP_WRITE_ERR)
2868 ShowMessage(parent, TxtWriteError, TxtNull);//display "Write Error"
2869 }
2870 }
2871 break;
2872 case E_CPHS_GET_CSP:
2873 {
2874 #ifdef FF_CPHS
2875 //x0012849: Jagannatha 26 May, 2006 ER: OMAPS00079607 -Support AOC in CPHS
2876 int i;
2877 #endif
2878 TRACE_EVENT("Reached E_CPHS_GET_CSP");
2879 if(para != NULL)
2880 {
2881 memcpy(&customer_service_profile, para, sizeof(T_MFW_CPHS_CSP));
2882
2883 /***************************Go-lite Optimization changes Start***********************/
2884 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
2885 TRACE_EVENT_P7("CSP: %x,%x,%x,%x,%x,%x,%x", customer_service_profile.csp[0], customer_service_profile.csp[1],
2886 customer_service_profile.csp[2], customer_service_profile.csp[3], customer_service_profile.csp[4], customer_service_profile.csp[5],
2887 customer_service_profile.csp[6]);
2888 TRACE_EVENT_P3("%x,%x,%x", customer_service_profile.csp[7], customer_service_profile.csp[8], customer_service_profile.csp[9]);
2889 TRACE_EVENT_P7("CSP: %x,%x,%x,%x,%x,%x,%x", customer_service_profile.csp[10], customer_service_profile.csp[11],
2890 customer_service_profile.csp[12], customer_service_profile.csp[13], customer_service_profile.csp[14], customer_service_profile.csp[15],
2891 customer_service_profile.csp[16]);
2892 TRACE_EVENT_P3("%x,%x,%x", customer_service_profile.csp[17], customer_service_profile.csp[18], customer_service_profile.csp[19]);
2893 /***************************Go-lite Optimization changes end***********************/
2894
2895 //x0012849: Jagannatha 26 May, 2006 ER: OMAPS00079607 -Support AOC in CPHS
2896 #ifdef FF_CPHS
2897 TRACE_EVENT_P2("AOC : Service group code =%d value =%d",
2898 customer_service_profile.csp[4], customer_service_profile.csp[5]);
2899 // No need to check if Aoc_flag is already set to TRUE.
2900
2901 /*check for Byte 1 service group code =03 and Byte2 bit 6 =1*/
2902 for (i=0;i<20; i++)
2903 {
2904 //check for AOC bit
2905 if( customer_service_profile.csp[i] EQ 0x03)
2906 {
2907 if(i == 19) break; /* x0039928 - Lint warning fix */
2908 i++;
2909 if( customer_service_profile.csp[i] & 0x20)
2910 {
2911 TRACE_EVENT("E_CPHS_GET_CSP: AOC flag is SET in CPHS ");
2912 setAOCflag(TRUE);
2913 break;
2914 }
2915 else {
2916 TRACE_EVENT("E_CPHS_GET_CSP: AOC flag is NOT SET in CPHS ");
2917 setAOCflag(FALSE);
2918 }
2919 }
2920 //check for ALS bit
2921 else if( customer_service_profile.csp[i] == 0x06)
2922 {
2923 if(i == 19) break; /* x0039928 - Lint warning fix */
2924 i++;
2925 if( customer_service_profile.csp[i] & 0x80 )
2926 {
2927 mmi_cphs_set_als_value( TRUE);
2928 break;
2929 }
2930 else
2931 mmi_cphs_set_als_value( FALSE);
2932 }
2933 else
2934 i++;
2935 }
2936
2937 #endif
2938 cphs_get_info_num(1, info_num_index);
2939 }
2940
2941 }break;
2942 case E_CPHS_GET_INFO_NUM:
2943 {
2944 if(para != NULL)
2945 {
2946 memcpy(&current_info_num, para, sizeof( T_MFW_CPHS_INFONUM_ENTRY));
2947
2948 TRACE_EVENT("Getting info number");
2949 if (current_info_num.result !=MFW_SIMOP_READ_ERR)
2950 { T_DISPLAY_DATA Dialog;
2951 TRACE_EVENT("Displaying num");
2952 /* Initialise the dialog control block with default information
2953 */
2954 dlg_initDisplayData_TextStr( &Dialog, TxtSoftCall, TxtSoftBack, (char*)current_info_num.alpha.data, (char*)current_info_num.number, COLOUR_STATUS);
2955 dlg_initDisplayData_events( &Dialog, (T_VOID_FUNC) info_num_display_cb, FOREVER, KEY_LEFT| KEY_RIGHT|KEY_CLEAR );
2956
2957 /* Show the dialog
2958 */
2959 info_dialog( parent, &Dialog );
2960 }
2961 }
2962 }
2963
2964 break;
2965 case E_CPHS_GET_INFO_LIST:
2966 {
2967 if (para == NULL)
2968 {
2969 TRACE_EVENT("Invalid info num list");
2970 }
2971 else
2972 { //populate next pointer
2973 //RAVI - 29-11-2005
2974 /* x0045876, 14-Aug-2006 (WR - assignment in condition)*/
2975 info_numbers[info_num_level] = (T_MFW_CPHS_INFONUM_LIST*) ALLOC_MEMORY(sizeof(T_MFW_CPHS_INFONUM_LIST));
2976 if (info_numbers[info_num_level])
2977 memcpy(info_numbers[info_num_level], para, sizeof(T_MFW_CPHS_INFONUM_LIST));
2978
2979
2980 TRACE_EVENT("Getting info numbers!!");
2981 if (info_numbers[info_num_level]->count != 0)
2982 {
2983 /***************************Go-lite Optimization changes Start***********************/
2984 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
2985 TRACE_EVENT_P1("Valid info num list, count:%d",info_numbers[info_num_level]->count);
2986 /***************************Go-lite Optimization changes end***********************/
2987 if (info_num_level)
2988 { info_num_level++;
2989 InfoNumbers2();
2990
2991 }
2992 }
2993 else
2994 info_numbers[info_num_level]=NULL;
2995 }
2996 }
2997 break;
2998 case E_CPHS_GET_SIM_FIELD:
2999 { T_MFW_CPHS_READ_SIM_ENTRY temp;
3000
3001 memcpy(&temp, para, sizeof(T_MFW_CPHS_READ_SIM_ENTRY));
3002 if (temp.data_len >0)
3003 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858
3004 //begin 30439
3005 //temp.exchange_data[temp.data_len-1] = 0;
3006 //end 30439
3007 /***************************Go-lite Optimization changes Start***********************/
3008 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
3009 TRACE_EVENT_P3("Sim Read, Field: %d (Record: %d) Errcode: %d",temp.requested_field, temp.record, temp.sim_result);
3010 /***************************Go-lite Optimization changes end***********************/
3011 /* SPR759 - SH - Read Sim for homezone, calls appropriate functions */
3012 #ifdef MMI_HOMEZONE_ENABLED
3013 if (temp.requested_field>=HZ_SIM_PARAMETERS
3014 && temp.requested_field < (HZ_SIM_CELL_CACHE+HZ_ZONES_MAX) )
3015 {
3016 homezoneReadSimCb(temp.requested_field, temp.record, temp.sim_result);
3017 }
3018 #endif
3019 }
3020 break;
3021
3022 case E_CPHS_SET_SIM_FIELD:
3023 {
3024 T_MFW_CPHS_READ_SIM_ENTRY temp;
3025
3026 memcpy(&temp, para, sizeof(T_MFW_CPHS_READ_SIM_ENTRY));
3027 if (temp.data_len >0)
3028 temp.exchange_data[temp.data_len-1] = 0;
3029 /***************************Go-lite Optimization changes Start***********************/
3030 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
3031 TRACE_EVENT_P2("Sim Write, Requested_field: %d Errcode: %d",temp.requested_field, temp.sim_result);
3032 /***************************Go-lite Optimization changes end***********************/
3033 /* SPR759 - SH - Read Sim for homezone, calls appropriate functions */
3034 #ifdef MMI_HOMEZONE_ENABLED
3035 if (temp.requested_field>=HZ_SIM_PARAMETERS
3036 && temp.requested_field < (HZ_SIM_CELL_CACHE+HZ_ZONES_MAX) )
3037 {
3038 homezoneWriteSimCb(temp.requested_field, temp.record, temp.sim_result);
3039 }
3040 #endif
3041 }
3042 break;
3043 #ifdef FF_CPHS_REL4
3044 case E_CPHS_MSP_IND:
3045 {
3046 if(para != NULL)
3047 {
3048 msp_info = mfw_cphs_get_msp();
3049 TRACE_EVENT_P1("E_CPHS_MSP_IND - mspcount %d",msp_info->count);
3050 if(msp_info->count < 2)
3051 {
3052 MSP_flag = FALSE;
3053 #ifdef FF_CPHS
3054 mmi_cphs_get_als_info();
3055 #else
3056 cphs_get_als_info(&als_status);
3057 #endif
3058 return TRUE;
3059 }
3060 else
3061 {
3062 MSP_flag = TRUE;
3063 mfw_cphs_set_default_profile(1);
3064 mfw_cphs_set_reg_profile(1);
3065 mmi_msp_interrogate();
3066 }
3067 }
3068 }
3069 break;
3070 #endif
3071 default: break;
3072 }
3073
3074
3075 return TRUE;
3076 }
3077
3078
3079
3080
3081
3082
3083
3084
3085 /*******************************************************************************
3086
3087 $Function: int InfoNumbers2( )
3088 $Description: Displays info number sub-menus
3089 $Returns: status int
3090 $Arguments: nothing
3091
3092 *******************************************************************************/
3093 //for sub-menus
3094 int InfoNumbers2( )
3095 {
3096 T_MFW_HND win;
3097 T_MFW_HND parent_win = mfw_parent(mfw_header());
3098
3099 TRACE_FUNCTION("InfoNumbers2");
3100
3101 if (info_numbers != NULL)
3102 { type_of_list = INFO_NUM_LIST;
3103 win = buildInfoNumberMenu(parent_win);
3104
3105 if (win NEQ NULL)
3106 {
3107 SEND_EVENT (win, E_INIT, 0, 0);
3108 }
3109 }
3110
3111 return MFW_EVENT_CONSUMED;
3112 }
3113 /*******************************************************************************
3114
3115 $Function: buildInfoNumberMenu
3116 $Description: Creates window for Information numbers
3117 $Returns: window created
3118 $Arguments: parent window
3119
3120 *******************************************************************************/
3121 static T_MFW_HND buildInfoNumberMenu( MfwHnd parent_window)
3122 {
3123 T_INFO_NUM_INFO * data = (T_INFO_NUM_INFO *)ALLOC_MEMORY (sizeof (T_INFO_NUM_INFO));
3124 T_MFW_WIN * win;
3125 TRACE_FUNCTION("buildInfoNumberMenu");
3126
3127 /*
3128 * Create window handler
3129 */
3130
3131 data->numbers_win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)info_num_win_cb);
3132 if (data->numbers_win EQ NULL)
3133 {
3134 return NULL;
3135 }
3136
3137 TRACE_EVENT(">>>> Info num window created: " );
3138 /*
3139 * connect the dialog data to the MFW-window
3140 */
3141
3142 data->mmi_control.dialog = (T_DIALOG_FUNC)info_num_exec_cb;
3143 data->mmi_control.data = data;
3144 win = ((T_MFW_HDR *)data->numbers_win)->data;
3145 win->user = (void *)data;
3146 data->parent = parent_window;
3147 winShow(data->numbers_win);
3148 /*
3149 * return window handle
3150 */
3151
3152 return data->numbers_win;
3153 }
3154
3155
3156 //x0012849: Jagannatha 01 June, 2006 ER: OMAPS00079607 -To Support AcC and Info numbers
3157 /*******************************************************************************
3158 $Function: info_num_msg_cb
3159 $Description: Dialogue callback function of the information Numbers message window
3160 $Returns: none
3161 $Arguments: win - window handler, dialogue id, key pressed
3162
3163 *******************************************************************************/
3164 #ifdef FF_CPHS
3165 void info_num_msg_cb(T_MFW_HND win, USHORT identifier, UBYTE reason)
3166 {
3167
3168 T_MFW_HND parent = mfwParent( mfw_header());
3169 TRACE_FUNCTION ("info_num_msg_cb");
3170 switch (reason)
3171 {
3172 case INFO_KCD_LEFT:
3173 // This code is not executed for the case - If mobile is in roaming and service is Network specific.
3174 if (info_numbers[info_num_level-1]->entry[identifier].entryStat & 0x80) //if bit 8 set/*a0393213 warnings removal - Dialog.Identifier changed to identifier*/
3175 {
3176 TRACE_EVENT("CPHS INFO:Should be number entry");
3177 if (info_num_level < 4)
3178 cphs_select_info_num(info_num_index);
3179 }
3180 else
3181 {
3182 if (info_num_level < 4)
3183 {
3184 TRACE_EVENT("CPHS INFO:Should be dir entry");
3185 cphs_get_info_num(info_num_level+1, info_num_index+1);
3186 }
3187 }
3188 break;
3189
3190 default:
3191 break;
3192 }
3193 }
3194 #endif
3195 /*******************************************************************************
3196 $Function: info_num_display_cb
3197
3198 $Description: Dialogue callback function of the information Numbers display window
3199
3200 $Returns: none
3201
3202 $Arguments: win - window handler, dialogue id, key pressed
3203
3204
3205 *******************************************************************************/
3206
3207 void info_num_display_cb(T_MFW_HND win, USHORT identifier, UBYTE reason)
3208 {
3209
3210 // char buf [40]; // RAVI
3211
3212 TRACE_FUNCTION ("info_num_display_cb");
3213
3214 switch (reason)
3215 {
3216 case INFO_KCD_LEFT: callNumber((UBYTE*)current_info_num.number);
3217 default: break; // RAVI - Deafault corrected to default.
3218
3219 }
3220 }
3221 /*******************************************************************************
3222
3223 $Function: info_num_exec_cb
3224
3225 $Description: Exec callback function of the information Numbers window
3226
3227 $Returns: none
3228
3229 $Arguments: win - window handler
3230 event - mfw event
3231 parameter - optional data.
3232
3233 *******************************************************************************/
3234 void info_num_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
3235 {
3236 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
3237 T_INFO_NUM_INFO * data = (T_INFO_NUM_INFO *)win_data->user;
3238 UBYTE i;
3239 UBYTE numberOfEntries;
3240 // ListWinInfo * mnu_data = (ListWinInfo *)parameter; // RAVI
3241
3242
3243 MmiRsrcGetText(TxtLine1);
3244 MmiRsrcGetText(TxtLine2);
3245 MmiRsrcGetText(TxtFax);
3246 MmiRsrcGetText(TxtData);
3247 TRACE_FUNCTION (">>>>> info_num_exec_cb()");
3248
3249 switch (event)
3250 {
3251 case E_INIT:
3252
3253 TRACE_EVENT(">>>> info_num_exec_cb() Event:E_INIT");
3254
3255 /* initialization of administrative data */
3256
3257
3258 data->menu_list_data = (ListMenuData *)ALLOC_MEMORY(sizeof(ListMenuData));
3259
3260 if(data->menu_list_data == 0)
3261 {
3262 TRACE_EVENT("Failed memory alloc 1 ");
3263 return;
3264 }
3265 if (type_of_list == MAILBOX_LIST || type_of_list == MAILBOX_LIST_CALL)
3266 { numberOfEntries = cphs_voicemail_numbers.count;
3267 if (numberOfEntries > 4)
3268 numberOfEntries = 4;
3269 }
3270 else
3271 numberOfEntries = info_numbers[info_num_level-1]->count;
3272
3273 data->menu_list_data->List = (T_MFW_MNU_ITEM *)ALLOC_MEMORY( 4 * sizeof(T_MFW_MNU_ITEM) );
3274
3275 if(data->menu_list_data->List == 0)
3276 {
3277 TRACE_EVENT("Failed memory alloc 2");
3278 return;
3279 }
3280
3281 for (i = 0; i < numberOfEntries ; i++)
3282 {
3283 mnuInitDataItem(&data->menu_list_data->List[i]);
3284 if (type_of_list == MAILBOX_LIST || type_of_list == MAILBOX_LIST_CALL)
3285 data->menu_list_data->List[i].str = (char *)cphs_voicemail_numbers.entries[i].alpha.data;
3286 else
3287 data->menu_list_data->List[i].str = (char *)info_numbers[info_num_level-1]->entry[i].alpha.data;
3288 data->menu_list_data->List[i].flagFunc = item_flag_none;
3289 }
3290
3291 data->menu_list_data->ListLength =numberOfEntries;
3292 data->menu_list_data->ListPosition = 1;
3293 data->menu_list_data->CursorPosition = 1;
3294 data->menu_list_data->SnapshotSize = numberOfEntries;
3295 data->menu_list_data->Font = 0;
3296 if (type_of_list == MAILBOX_LIST_CALL)
3297 data->menu_list_data->LeftSoftKey = TxtSoftCall;
3298 else
3299 data->menu_list_data->LeftSoftKey = TxtSoftSelect;
3300 data->menu_list_data->RightSoftKey = TxtSoftBack;
3301 data->menu_list_data->KeyEvents = KEY_ALL;
3302 data->menu_list_data->Reason = 0;
3303 data->menu_list_data->Strings = TRUE;
3304 data->menu_list_data->Attr = &InfoNum_menuAttrib;
3305 data->menu_list_data->autoDestroy = FALSE;
3306
3307
3308 /* Create the dynamic menu window */
3309 listDisplayListMenu(win, data->menu_list_data,(ListCbFunc)InfonumList_cb,0);
3310
3311 break;
3312
3313 case LISTS_REASON_VISIBLE:
3314 case LISTS_REASON_RESUME:
3315 {
3316 dspl_ClearAll(); // sbh - clear screen before update
3317
3318 if (type_of_list == MAILBOX_LIST)
3319 {
3320 softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, COLOUR_LIST_SUBMENU);
3321 }
3322 else if (type_of_list == MAILBOX_LIST_CALL)
3323 {
3324 softKeys_displayId( TxtSoftCall, TxtSoftBack, 0, COLOUR_LIST_SUBMENU);
3325 }
3326
3327 break;
3328 }
3329
3330 default:
3331 break;
3332 }
3333 }
3334 /*******************************************************************************
3335
3336 $Function: InfonumList_cb
3337
3338 $Description: Callback function for the info num list.
3339
3340 $Returns: none
3341
3342 $Arguments: Parent - parent window.
3343 ListData - Menu item list
3344 *******************************************************************************/
3345
3346 void InfonumList_cb(T_MFW_HND * Parent, ListMenuData * ListData)
3347 {
3348 T_MFW_WIN * win_data = ((T_MFW_HDR *)Parent)->data;
3349 T_INFO_NUM_INFO * data = (T_INFO_NUM_INFO *)win_data->user;
3350
3351 // char debug[40]; // RAVI
3352
3353 TRACE_FUNCTION("InfonumList_cb");
3354 if ((ListData->Reason EQ LISTS_REASON_BACK) || (ListData->Reason EQ LISTS_REASON_CLEAR))
3355 {
3356 listsDestroy(ListData->win);
3357 InfoNum_destroy(data->numbers_win);
3358 info_num_level--;
3359 }
3360 else if(ListData->Reason EQ LISTS_REASON_SELECT)
3361 {
3362 if (type_of_list == MAILBOX_LIST || type_of_list == MAILBOX_LIST_CALL) //get the correct voicemail num
3363 {
3364 cphs_voicemail_numbers.entries[ListData->ListPosition].list_index = ListData->ListPosition;
3365
3366 if (type_of_list == MAILBOX_LIST)
3367 { /*If we're editing*/
3368 TRACE_FUNCTION_P2("List Posn2: %d, MBN: %s", ListData->ListPosition, cphs_voicemail_numbers.entries[ListData->ListPosition].number );
3369 show_cphs_mb_number(&cphs_voicemail_numbers.entries[ListData->ListPosition]);
3370 memcpy(&cphs_voicemail_num, &cphs_voicemail_numbers.entries[ListData->ListPosition], sizeof(T_MFW_CPHS_ENTRY));
3371 }
3372 else
3373 {
3374 char temp_number[MFW_CPHS_VM_NUMBER_MAXLEN];
3375
3376 memcpy(&cphs_voicemail_num, &cphs_voicemail_numbers.entries[ListData->ListPosition], sizeof(T_MFW_CPHS_ENTRY));
3377 memset(temp_number, 0, MFW_CPHS_VM_NUMBER_MAXLEN);
3378
3379 /*If we're calling the number*/
3380 //if it's an international number without a '+'
3381 if (cphs_voicemail_num.ton == MFW_TON_INTERNATIONAL && cphs_voicemail_num.number[0] != '+')
3382 {
3383 strcat(temp_number, "+"); //put a + in front of number
3384 strncat(temp_number, (char*)cphs_voicemail_num.number, strlen((char*)cphs_voicemail_num.number));
3385 memset((void*)cphs_voicemail_num.number, 0, MFW_CPHS_VM_NUMBER_MAXLEN);
3386 strncpy((char*)cphs_voicemail_num.number, temp_number, strlen((char *)temp_number));
3387 }
3388
3389 callNumber(cphs_voicemail_num.number);
3390
3391 }
3392
3393
3394 }
3395 else
3396 {
3397 #ifdef FF_CPHS
3398 T_DISPLAY_DATA Dialog;
3399 //x0012849: Jagannatha 01 June, 2006 ER: OMAPS00079607 -To Support AcC and Info numbers
3400 UBYTE inRoaming;
3401 inRoaming = getRoamingStatus();
3402 TRACE_EVENT_P1("Roaming status = %d", inRoaming);
3403 #endif
3404 //get the number/directory
3405 info_num_index = info_numbers[info_num_level-1]->entry[ListData->ListPosition].index;
3406 /***************************Go-lite Optimization changes Start***********************/
3407 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
3408 TRACE_EVENT_P3("Index selected: %d, Level, %d, entryStat:%d",info_num_index, info_num_level,
3409 info_numbers[info_num_level-1]->entry[ListData->ListPosition].entryStat);
3410 /***************************Go-lite Optimization changes end***********************/
3411 //x0012849: Jagannatha 01 June, 2006 ER: OMAPS00079607 -To Support AcC and Info numbers
3412 //0x20 in Binary 0010 0000 - If bit 6 is set to 1 that indicates that service is specific to network.
3413 #ifdef FF_CPHS
3414 if( (current_info_num.entryStat & 0x20) && inRoaming )
3415 {
3416 dlg_initDisplayData_TextStr( &Dialog, TxtSoftOK, TxtSoftBack, (char*)MmiRsrcGetText(TxtNotAvailable), NULL, COLOUR_STATUS);
3417 dlg_initDisplayData_events( &Dialog, (T_VOID_FUNC) info_num_msg_cb, THREE_SECS, KEY_RIGHT|KEY_CLEAR );
3418 Dialog.Identifier = (USHORT)ListData->ListPosition;
3419 info_dialog( Parent, &Dialog );
3420 }
3421 //x0012849: Jagannatha 01 June, 2006 ER: OMAPS00079607 -To Support AcC and Info numbers
3422 //0x10 in Binary 0001 0000 - If bit 5 is set to 1 that indicates that service is charged at premium rate.
3423 else if(current_info_num.entryStat & 0x10)
3424 {
3425 dlg_initDisplayData_TextStr( &Dialog, TxtSoftOK, TxtSoftBack, (char*)"Charging will be done at a", (char*)"Premium Rate", COLOUR_STATUS);
3426 dlg_initDisplayData_events( &Dialog, (T_VOID_FUNC) info_num_msg_cb, FOREVER, KEY_LEFT|KEY_RIGHT|KEY_CLEAR );
3427 Dialog.Identifier = (USHORT)ListData->ListPosition;
3428 info_dialog( Parent, &Dialog );
3429 }
3430 else
3431 {
3432 #endif
3433 if (info_numbers[info_num_level-1]->entry[ListData->ListPosition].entryStat & 0x80) //if bit 8 set
3434 {
3435 TRACE_EVENT("CPHS INFO:Should be number entry");
3436 if (info_num_level < 4)
3437 cphs_select_info_num(info_num_index);
3438 }
3439 else
3440 {
3441 if (info_num_level < 4)
3442 {
3443 TRACE_EVENT("CPHS INFO:Should be dir entry");
3444 cphs_get_info_num(info_num_level+1, info_num_index+1);
3445 }
3446 }
3447 #ifdef FF_CPHS
3448 }
3449 #endif
3450
3451 }
3452
3453 }
3454
3455
3456 }
3457
3458 /*******************************************************************************
3459
3460 $Function: InfoNum_destroy
3461
3462 $Description: Destroy the info num window.
3463
3464 $Returns: none
3465
3466 $Arguments: own_window- current window
3467 *******************************************************************************/
3468
3469 static void InfoNum_destroy(MfwHnd own_window)
3470 {
3471 T_MFW_WIN * win_data;
3472 T_INFO_NUM_INFO * data;
3473 UBYTE numberOfEntries;
3474
3475 TRACE_FUNCTION ("InfoNum_destroy()");
3476
3477 if (own_window)
3478 {
3479 win_data = ((T_MFW_HDR *)own_window)->data;
3480 data = (T_INFO_NUM_INFO *)win_data->user;
3481
3482 if (data)
3483 {
3484 /*
3485 * Delete WIN handler
3486 */
3487 win_delete (data->numbers_win);
3488
3489 /*
3490 * Free Memory
3491 */
3492 if ( ( type_of_list == MAILBOX_LIST ) || ( type_of_list == MAILBOX_LIST_CALL ) )
3493 { numberOfEntries = cphs_voicemail_numbers.count;
3494 if (numberOfEntries > 4)
3495 numberOfEntries = 4;
3496 }
3497 else
3498 numberOfEntries =info_numbers[info_num_level-1]->count;
3499 if (data->menu_list_data != NULL)
3500 { //int i; // RAVI
3501 FREE_MEMORY ((void *)data->menu_list_data->List, numberOfEntries * sizeof (T_MFW_MNU_ITEM));
3502 FREE_MEMORY ((void *)data->menu_list_data, sizeof (ListMenuData));
3503 if (type_of_list == INFO_NUM_LIST && info_num_level > 1)//if info numbers,
3504 { FREE_MEMORY((void*)info_numbers[info_num_level-1], sizeof(T_MFW_CPHS_INFONUM_LIST));
3505 info_numbers[info_num_level-1] = NULL;
3506 }
3507 }
3508 FREE_MEMORY ((void *)data, sizeof (T_INFO_NUM_INFO));
3509
3510 }
3511 else
3512 {
3513 TRACE_EVENT ("InfoNum_destroy() called twice");
3514 }
3515 }
3516 }
3517
3518 /*******************************************************************************
3519
3520 $Function: info_num_win_cb
3521
3522 $Description: Window callback function for the info numbers window.
3523
3524 $Returns: none
3525
3526 $Arguments: w - mfw window handler
3527 e - mfw event
3528
3529 *******************************************************************************/
3530
3531 static int info_num_win_cb (MfwEvt e, MfwWin *w) /* yyy window event handler */
3532 {
3533 TRACE_EVENT ("info_num_win_cb()");
3534
3535 switch (e)
3536 {
3537 case MfwWinVisible: /* window is visible */
3538 break;
3539
3540 case MfwWinFocussed: /* input focus / selected */
3541 case MfwWinDelete: /* window will be deleted */
3542
3543 default:
3544 return MFW_EVENT_REJECTED;
3545 }
3546 return MFW_EVENT_CONSUMED;
3547 }
3548
3549
3550
3551 /*******************************************************************************
3552
3553 $Function: mmi_cphs_get_als_info
3554
3555 $Description: Returns the current Line enabled
3556
3557 $Returns: none
3558
3559 $Arguments:
3560
3561 *******************************************************************************/
3562 //x0pleela 23 May, 2006 DR: OMAPS00070657
3563 #ifdef FF_CPHS
3564 void mmi_cphs_get_als_info()
3565 {
3566 int nALS_line_data;
3567
3568 nALS_line_data= mfw_cphs_get_als_info();
3569 TRACE_EVENT_P1("mmi_cphs_get_als_info() : %d",nALS_line_data);
3570 switch (nALS_line_data)
3571 {
3572 case ALS_MOD_SPEECH:
3573 als_status.selectedLine = MFW_SERV_LINE1;
3574 break;
3575
3576 case ALS_MOD_AUX_SPEECH:
3577 als_status.selectedLine = MFW_SERV_LINE2;
3578 break;
3579 default:
3580 als_status.selectedLine = MFW_SERV_NotPresent;
3581 break;
3582 }
3583 }
3584
3585
3586 /*******************************************************************************
3587
3588 $Function: mmi_cphs_set_als_value
3589
3590 $Description: Set the Als flag based on the CSP data read from CPHS enabled SIM
3591
3592 $Returns: none
3593
3594 $Arguments:
3595
3596 *******************************************************************************/
3597 //x0pleela 29 May, 2006 DR: OMAPS00070657
3598
3599 void mmi_cphs_set_als_value( UBYTE als_val)
3600 {
3601 TRACE_FUNCTION("mmi_cphs_set_als_value()");
3602 Als_flag = als_val;
3603 }
3604
3605 /*******************************************************************************
3606
3607 $Function: mmi_cphs_get_als_value
3608
3609 $Description: Returns the Als flag value
3610
3611 $Returns: none
3612
3613 $Arguments:
3614
3615 *******************************************************************************/
3616 //x0pleela 29 May, 2006 DR: OMAPS00070657
3617
3618 UBYTE mmi_cphs_get_als_value( void )
3619 {
3620 TRACE_EVENT_P1("mmi_cphs_get_als_value() %d",Als_flag);
3621 return Als_flag;
3622 }
3623
3624 #ifdef FF_CPHS_REL4
3625 UBYTE mmi_cphs_get_msp_value( void )
3626 {
3627 TRACE_EVENT_P1("mmi_cphs_get_msp_value - MSP_flag - %d", MSP_flag);
3628 return MSP_flag;
3629 }
3630 #endif
3631 /*******************************************************************************
3632
3633 $Function: mmi_get_als_selectedLine
3634
3635 $Description: Returns the current Line enabled
3636
3637 $Returns: none
3638
3639 $Arguments:
3640
3641 *******************************************************************************/
3642 //x0pleela 30 May, 2006 DR: OMAPS00070657
3643 T_MFW_LINE_INDEX mmi_get_als_selectedLine( void)
3644 {
3645 return als_status.selectedLine;
3646 }
3647 #endif /* FF_CPHS */