comparison src/aci2/bmi/MmiCPHS.c @ 3:93999a60b835

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
1 /*******************************************************************************
2
3 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
31 Jun 14, 2005 REF: MMI-FIX-30439 x0018858
32 Description: The homezone/cityzone tags were not being displayed properly.
33 Solution: Modified to save the tags properly in caches and also made the
34 appropriate modifications to update the same properly during mobility.
35
36 Aug 16, 2004 REF: CRR 24323 Deepa M.D
37 Bug:Clenup of sprintf used for tracing
38 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX
39
40 Jun 23, 2004 REF: CRR MMI-SPR-13599 Rashmi C N(Sasken)
41 Solution: The CF state is maintained in flash. During bootup the CF icon in the idle screen
42 is displayed depending upon its state in the ffs
43
44
45 // May 31, 2004 REF: CRR 17291 xvilliva
46 // Bug: After power cycle the setting of the used line which have been made
47 // from the BMI is lost.
48 // Fix: 1.The global g_pin2 is defined here.
49 // 2. sAT_PlusCLCK() is called while locking and unlocking ALS.
50 // 3. ALSPresent() is modified to call tAT_PercentALS() & qAT_PercentALS().
51 // NOTE:- ALSPresent() was giving faulty status earlier.
52
53
54 25/01/02 Original Condat(UK) BMI version. (MC)
55
56 $End
57
58 *******************************************************************************/
59
60
61 /******************************************************************************
62
63 Include Files
64
65 *******************************************************************************/
66
67 /* includes */
68 #include <string.h>
69 #include <stdio.h>
70 #include <stdlib.h>
71
72 #if defined (NEW_FRAME)
73
74 #include "typedefs.h"
75 #include "vsi.h"
76 #include "pei.h"
77 #include "custom.h"
78 #include "gsm.h"
79
80 #else
81
82 #include "STDDEFS.H"
83 #include "custom.h"
84 #include "gsm.h"
85 #include "vsi.h"
86
87 #endif
88 #include "mfw_sys.h"
89
90 #include "cus_aci.h"
91
92 #include "mfw_mfw.h"
93 #include "mfw_win.h"
94 #include "mfw_kbd.h"
95 /* SPR#1428 - SH - New Editor changes */
96 #ifndef NEW_EDITOR
97 #include "mfw_edt.h"
98 #endif
99 #include "mfw_tim.h"
100 #include "mfw_phb.h"
101 #include "ksd.h"
102 #include "psa.h"
103 #include "mfw_sms.h"
104 #include "mfw_icn.h"
105 #include "mfw_mnu.h"
106 #include "mfw_lng.h"
107 #include "mfw_sat.h"
108 #include "mfw_kbd.h"
109 #include "mfw_nm.h"
110 #include "mfw_str.h"
111
112 #include "dspl.h"
113
114 #include "MmiMain.h"
115 #include "MmiDummy.h"
116 #include "MmiMmi.h"
117 #include "MmiDialogs.h"
118 #include "MmiLists.h"
119 #include "MmiDialogs.h"
120 #include "MmiMenu.h"
121 #include "MmiSoftKeys.h"
122 /* SPR#1428 - SH - New Editor changes */
123 #ifdef NEW_EDITOR
124 #include "ATBCommon.h"
125 #include "ATBDisplay.h"
126 #include "ATBEditor.h"
127 #include "AUIEditor.h"
128 #else
129 #include "MmiEditor.h"
130 #endif
131 #include "MmiBookShared.h"
132 #include "mmiSmsMenu.h"
133 #include "Mmiicons.h"
134 #include "mmiColours.h"
135
136 #include "MmiCPHS.h"
137 // Jun 23 2004 REF: CRR MMI-SPR-13599 Rashmi C N(Sasken)
138 #include "mfw_ffs.h"
139 /* SPR759 - SH */
140 #ifdef MMI_HOMEZONE_ENABLED
141 #include "MmiHomezone.h"
142 #endif
143
144
145
146
147 /******************************************************************************
148
149 Definitions
150
151 *******************************************************************************/
152 //#define CPHS_PROV_TEST /*Test to bypass the reading of the CPHS field from the SIM card*/
153 char g_pin2[MAX_PIN+1];//xvilliva SPR17291
154
155 typedef enum
156
157
158 {
159 INFO_NUM_LIST,
160 MAILBOX_LIST,
161 MAILBOX_LIST_CALL
162 }
163 T_MENU_TYPE;
164
165
166 static MfwMnuAttr InfoNum_menuAttrib =
167 {
168 &melody_menuArea,
169 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
170 -1, /* use default font */
171 NULL, /* with these items */
172 0, /* number of items */
173 COLOUR_LIST_XX, TxtNull, NULL, MNUATTRSPARE
174
175 };
176
177 typedef struct
178 {
179 /* administrative data */
180
181 T_MMI_CONTROL mmi_control;
182 T_MFW_HND win;
183 T_MFW_HND parent_win;
184 #ifdef NEW_EDITOR
185 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */
186 #else /* NEW_EDITOR */
187 T_EDITOR_DATA editor_data;
188 #endif /* NEW_EDITOR */
189
190 /* associated handlers */
191
192 T_MFW_HND kbd;
193 T_MFW_HND kbd_long;
194 T_MFW_HND menu;
195 T_MFW_HND menu_tim;
196 UBYTE status_of_timer; /* use for the keypadlock */
197
198 T_MFW_HND mailbox_win;
199 T_MFW_CPHS_ENTRY cphs_voicemail_num;
200 T_MFW_CPHS_VC_STAT* cphs_voicemail_status;
201 T_MFW_CPHS_STATUS cphs_status;
202 T_MFW_CPHS_OP_NAME* operator_name;
203
204 } T_MMI_CPHS_DATA;
205
206
207 typedef struct
208 {
209 T_MMI_CONTROL mmi_control;
210 T_MFW_HND numbers_win; /* MFW win handler */
211 T_MFW_HND parent;
212 T_MFW_HND melody_handler; /* MFW sms handler */
213 unsigned char local_status;
214 ListMenuData * menu_list_data;
215 } T_INFO_NUM_INFO;
216
217 #define E_INIT 1
218
219
220
221 #define CPHS_TELESERVICES_BYTE_VALUE 0x06
222 #define ALS_MASK 0x80
223
224 #define CPHS_INFONUMS_BYTE_VALUE 0xC0
225 #define INFONUM_MASK 0xFF
226
227
228 /******************************************************************************
229
230 Static Global variables
231
232 *******************************************************************************/
233
234 static T_MFW_CPHS_ENTRY cphs_voicemail_num;
235 static T_MFW_CPHS_INFONUM_ENTRY current_info_num;
236 static T_MFW_CPHS_VC_NUM cphs_voicemail_numbers;
237 static T_MFW_CPHS_VC_STAT* cphs_voicemail_status;
238 static T_MFW_CPHS_STATUS cphs_status = CPHS_NotPresent;
239 static T_MFW_CPHS_OP_NAME operator_name;
240 static T_MFW_CPHS_DV_STAT call_forwarding_status;
241 static T_MFW_CPHS_ALS_STATUS als_status;
242 static T_MFW_CPHS_CSP customer_service_profile;
243 static T_MFW_CPHS_INFONUM_LIST* info_numbers[4]= {NULL, NULL, NULL, NULL};
244
245 static UBYTE info_num_level;
246 static USHORT info_num_index;
247
248 static T_MENU_TYPE type_of_list = INFO_NUM_LIST;
249
250 /******************************************************************************
251
252 Function Prototypes
253
254 *******************************************************************************/
255 int InfoNumbers2(void); // RAVI
256
257 int show_cphs_mb_number(T_MFW_CPHS_ENTRY* mb_number);
258 static void mailbox_edit_cb( T_MFW_HND win, USHORT Identifier,UBYTE reason);
259 static int cphs_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
260 int cphs_mfw_cb(T_MFW_EVENT event, void* para);
261 void cphs_dialog_cb(T_MFW_HND win, USHORT e, SHORT identifier, void *parameter);
262 T_MFW_HND mmi_cphs_create(T_MFW_HND parent_window);
263 T_MFW_HND edit_mailbox_start(T_MFW_HND parent_window);
264
265 static T_MFW_HND buildInfoNumberMenu( MfwHnd parent_window);
266 void info_num_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
267 void InfonumList_cb(T_MFW_HND * Parent, ListMenuData * ListData);
268 static void InfoNum_destroy(MfwHnd own_window);
269 static int info_num_win_cb (MfwEvt e, MfwWin *w) ;
270 void info_num_display_cb(T_MFW_HND win, USHORT identifier, UBYTE reason);
271 EXTERN void cphs_support_check(void); // ADDED BY RAVI - 29-11-2005
272
273 /******************************************************************************
274
275 Public functions
276
277 *******************************************************************************/
278 /*******************************************************************************
279
280 $Function: mmi_cphs_init()
281
282 $Description: initiatialise cphs module
283
284 $Returns: mfw handle
285
286 $Arguments: none
287
288 *******************************************************************************/
289 T_MFW_HND mmi_cphs_init()
290 {
291 T_MFW_HND status;
292 cphs_init(); //initialise MFW CPHS module
293
294 status = cphs_create(NULL, 0xFFFF, cphs_mfw_cb); //create handler for MFW CPHS EVENTS
295
296 info_num_level = 0;
297 info_num_index = 1;
298 cphs_get_als_info(&als_status);
299 return status;
300 }
301
302 void mmi_cphs_refresh()
303 {
304 cphs_support_check(); //check if cphs supported
305 /*retrieval of other values set off by callback function cphs_mfw_cb
306 so when the CPHS status is retrieved, the operator name is then requested and
307 when it has returned, then the CSP is requested etc etec */
308
309 }
310 /*******************************************************************************
311
312 $Function: cphs_E_plus_ALS_supported
313
314 $Description: returns TRUE if SIM is from E-plus, FALSE otherwise
315
316 $Returns: status BOOL
317
318 $Arguments: none
319
320 *******************************************************************************/
321 BOOL cphs_E_plus_ALS_supported()
322 { char IMSI[17];
323 char MNC_MCC[6];
324 char E_plus_MNC_MCC[] = "26203";
325 int i=0;
326 T_ACI_RETURN result;
327 // char debug[40]; // RAVI
328
329 while ((result = qAT_PlusCIMI(CMD_SRC_LCL, IMSI)) != AT_CMPL && i < 5)
330 {
331 i++;
332 }
333
334 strncpy(MNC_MCC, IMSI, 5);
335 MNC_MCC[5] =0;//terminate string
336 TRACE_EVENT("E-plus IMSI?");
337 TRACE_EVENT(MNC_MCC);
338 if (!strncmp(E_plus_MNC_MCC, MNC_MCC, 5)) //if e-plus IMSI
339 {
340 return TRUE;
341
342 }
343 else
344 { TRACE_EVENT("Not e-plus IMSI");
345 return FALSE;
346 }
347
348 }
349 /*******************************************************************************
350
351 $Function: cphs_als_status
352
353 $Description: display which ALS line is enabled
354
355 $Returns: status int
356
357 $Arguments: menu, tag (not used)
358
359 *******************************************************************************/
360 int cphs_als_status(MfwMnu* m, MfwMnuItem* i)
361 { T_MFW_HND parent = mfwParent( mfw_header());
362 UBYTE line;
363 line = GetAlsLine();
364 #ifndef CPHS_PROV_TEST
365 if (CphsPresent() == TRUE || cphs_E_plus_ALS_supported())
366 #endif
367 {
368 if (als_status.selectedLine != MFW_SERV_NotPresent)
369 switch(line)
370 {
371 case (MFW_SERV_LINE1): ShowMessage(parent, TxtLine1, TxtActivated);break;
372 case (MFW_SERV_LINE2): ShowMessage(parent, TxtLine2, TxtActivated);break;
373 default: ShowMessage(parent, TxtReadError, TxtNull);break;
374 }
375 else
376 ShowMessage(parent, TxtReadError, TxtNull);
377 }
378 #ifndef CPHS_PROV_TEST
379 else
380 ShowMessage(parent, TxtNotSupported, TxtNull);
381 #else
382 cphs_support_check();
383 #endif
384
385 return MFW_EVENT_CONSUMED;
386 }
387
388 /*******************************************************************************
389
390 $Function: cphs_lock_als
391
392 $Description: Lock ALS Line Selection from menu
393
394 $Returns: status int
395
396 $Arguments: menu, tag (not used)
397
398 *******************************************************************************/
399 int cphs_lock_als(MfwMnu* m, MfwMnuItem* i)
400 {
401 T_MFW_HND parent = mfwParent( mfw_header());
402 T_MFW retVal;
403
404 TRACE_FUNCTION("cphs_lock_als");
405
406 #ifndef CPHS_PROV_TEST
407 if (!ALSPresent(NULL, NULL, NULL))
408 #endif
409 {
410 //xvilliva SPR17291
411 //We call sAT_PlusCLCK(), to update the value in FFS. This is the value used by
412 //ACI to estabilish a call on Line1 or Line2.
413 #ifndef FF_2TO1_PS
414 sAT_PlusCLCK(CMD_SRC_LCL,CLCK_FAC_Al,CLCK_MOD_Lock,g_pin2,
415 ((als_status.selectedLine == MFW_SERV_LINE1) ? CLASS_Vce : CLASS_AuxVce));//
416 #endif
417 retVal = cphs_set_als_status(MFW_LINE_LOCKED);
418 if (retVal == CPHS_OK)
419 {
420 als_status.status = MFW_LINE_LOCKED;
421 ShowMessage(parent, TxtAlsLocked, TxtNull);
422 }
423 }
424 #ifndef CPHS_PROV_TEST
425 else
426 ShowMessage(parent, TxtNotSupported, TxtNull);
427 #endif
428
429 return MFW_EVENT_CONSUMED;
430 }
431
432 /*******************************************************************************
433
434 $Function: cphs_unlock_als
435
436 $Description: Unlock ALS Line Selection from menu
437
438 $Returns: status int
439
440 $Arguments: menu, tag (not used)
441
442 *******************************************************************************/
443 int cphs_unlock_als(MfwMnu* m, MfwMnuItem* i)
444 {
445 T_MFW_HND parent = mfwParent( mfw_header());
446 T_MFW retVal;
447
448 TRACE_FUNCTION("cphs_unlock_als");
449
450 #ifndef CPHS_PROV_TEST
451 if (!ALSPresent(NULL, NULL, NULL))
452 #endif
453 {
454 //xvilliva SPR17291
455 //We call sAT_PlusCLCK(), to update the value in FFS. This is the value used by
456 //ACI to estabilish a call on Line1 or Line2.
457 #ifndef FF_2TO1_PS
458 sAT_PlusCLCK(CMD_SRC_LCL,CLCK_FAC_Al,CLCK_MOD_Unlock,g_pin2,((als_status.selectedLine == MFW_SERV_LINE1) ? CLASS_Vce : CLASS_AuxVce));//
459 #endif
460 retVal = cphs_set_als_status(MFW_LINE_UNLOCKED);
461 if (retVal == CPHS_OK)
462 {
463 als_status.status = MFW_LINE_UNLOCKED;
464 ShowMessage(parent, TxtAlsUnlocked, TxtNull);
465 }
466 }
467 #ifndef CPHS_PROV_TEST
468 else
469 ShowMessage(parent, TxtNotSupported, TxtNull);
470 #endif
471
472 return MFW_EVENT_CONSUMED;
473 }
474
475 /*******************************************************************************
476
477 $Function: cphs_line1_select
478
479 $Description: Enable ALS Line1 from menu
480
481 $Returns: status int
482
483 $Arguments: menu, tag (not used)
484
485 *******************************************************************************/
486 int cphs_line1_select(MfwMnu* m, MfwMnuItem* i)
487 {
488 T_MFW_HND parent = mfwParent( mfw_header());
489 #ifndef CPHS_PROV_TEST
490 if (!ALSPresent(NULL, NULL, NULL))
491 #endif
492 { cphs_select_line(MFW_SERV_LINE1);
493 cphs_get_divert_status();
494 }
495 #ifndef CPHS_PROV_TEST
496 else
497 ShowMessage(parent, TxtNotSupported, TxtNull);
498 #endif
499 return MFW_EVENT_CONSUMED;
500 }
501 /*******************************************************************************
502
503 $Function: cphs_line2_select
504
505 $Description: Enable ALS Line2 from menu
506
507 $Returns: status int
508
509 $Arguments: menu, tag (not used)
510
511 *******************************************************************************/
512 int cphs_line2_select(MfwMnu* m, MfwMnuItem* i)
513 { T_MFW_HND parent = mfwParent( mfw_header());
514
515 #ifndef CPHS_PROV_TEST
516 if (!ALSPresent(NULL, NULL, NULL))
517 #endif
518 { cphs_select_line(MFW_SERV_LINE2);
519 cphs_get_divert_status();
520 }
521 #ifndef CPHS_PROV_TEST
522 else
523 ShowMessage(parent, TxtNotSupported, TxtNull);
524 #endif
525 return MFW_EVENT_CONSUMED;
526 }
527 /*******************************************************************************
528
529 $Function: menu_cphs_call_mailbox_number
530
531 $Description: edit mailbox numbers from menu
532
533 $Returns: status int
534
535 $Arguments: menu, tag (not used)
536
537 *******************************************************************************/
538 int menu_cphs_call_mailbox_number(MfwMnu* m, MfwMnuItem* i)
539 { T_MFW_HND parent = mfwParent( mfw_header());
540 T_MFW_CPHS_INFO configuration;
541 type_of_list = MAILBOX_LIST_CALL;
542 cphs_config(&configuration);
543 /***************************Go-lite Optimization changes Start***********************/
544 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
545 TRACE_EVENT_P2( "CPHS? %d Mailbox config info: %d", configuration.mbNum, CphsPresent());
546 /***************************Go-lite Optimization changes end***********************/
547 if (CphsMailboxPresent()==TRUE )
548 cphs_get_mailbox();
549 else
550 M_callVoice(m, i);
551 return MFW_EVENT_CONSUMED;
552 }
553 /*******************************************************************************
554
555 $Function: menu_cphs_edit_mailbox_number
556
557 $Description: edit mailbox numbers from menu
558
559 $Returns: status int
560
561 $Arguments: menu, tag (not used)
562
563 *******************************************************************************/
564 int menu_cphs_edit_mailbox_number(MfwMnu* m, MfwMnuItem* i)
565 { T_MFW_HND parent = mfwParent( mfw_header());
566 T_MFW_CPHS_INFO configuration;
567
568 type_of_list = MAILBOX_LIST;
569
570 cphs_config(&configuration);
571 /***************************Go-lite Optimization changes Start***********************/
572 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
573 TRACE_EVENT_P2( "CPHS? %d Mailbox config info: %d", configuration.mbNum, CphsPresent());
574 /***************************Go-lite Optimization changes end***********************/
575 if (CphsMailboxPresent()==TRUE )
576 cphs_get_mailbox();
577 else
578 M_exeVoice(m, i);
579 return MFW_EVENT_CONSUMED;
580 }
581 /*******************************************************************************
582
583 $Function: InfoNumbers
584
585 $Description: displays information number list from CPHS
586
587 $Returns: MFW_EVENT_CONSUMED always
588
589 $Arguments: m, menu, i, item
590
591 *******************************************************************************/
592
593 int InfoNumbers( MfwMnu *m, MfwMnuItem *i )
594 {
595 T_MFW_HND win;
596 T_MFW_HND parent_win = mfw_parent(mfw_header());
597 T_MFW_CPHS_INFO config_info;
598
599 cphs_config(&config_info);
600 /***************************Go-lite Optimization changes Start***********************/
601 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
602 TRACE_EVENT_P1("Info Num config info: %d", config_info.iNum);
603 /***************************Go-lite Optimization changes end***********************/
604 if (CphsPresent() && config_info.iNum&0x03)
605 { if (info_numbers[0] != NULL&& info_numbers[0]->count != 0)
606 { type_of_list = INFO_NUM_LIST;
607 info_num_level = 1;
608 win = buildInfoNumberMenu(parent_win);
609
610 if (win NEQ NULL)
611 {
612 SEND_EVENT (win, E_INIT, 0, 0);
613 }
614 }
615 else
616 ShowMessage(parent_win, TxtEmptyList, TxtNull);
617 }
618 else
619 ShowMessage(parent_win, TxtNotSupported, TxtNull);
620
621 return MFW_EVENT_CONSUMED;
622 }
623
624
625 /*******************************************************************************
626
627 $Function: CphsRequestOperatorName()
628
629 $Description: returns operator name data structure from CPHS SIM data
630
631 $Returns: see above
632
633 $Arguments: none
634
635 *******************************************************************************/
636 T_MFW_CPHS_OP_NAME* CphsRequestOperatorName()
637 {
638 return &operator_name;
639 }
640
641 /*******************************************************************************
642
643 $Function: CphsPresent()
644
645 $Description: indicates whether CPHS sim or not
646
647 $Returns: TRUE if it is, FALSe if it isn't
648 $Arguments: none
649
650 *******************************************************************************/
651 UBYTE CphsPresent()
652 {
653
654 if (cphs_status == CPHS_OK)
655 return TRUE;
656 else
657 { if (cphs_status == CPHS_NotPresent)
658 return FALSE;
659 else /*MC 21/05/02, CONQ5999->6007 Helps diagnose initialisation probs*/
660 return CPHS_ERR;
661 }
662 }
663 /*******************************************************************************
664
665 $Function: CphsMailboxPresent
666
667 $Description: indicates whether a CPHS SIM which supports mailbox numbers
668
669 $Returns: TRUE if it is, FALSe if it isn't
670 $Arguments: none
671
672 *******************************************************************************/
673 USHORT CphsMailboxPresent( /*struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi*/ )
674 { T_MFW_CPHS_INFO config_info;
675
676 cphs_config(&config_info);
677
678 if (config_info.mbNum &0x03 && CphsPresent())
679 return /*0*/TRUE;
680 else
681 return /*1*/FALSE;
682
683 }
684 /*******************************************************************************
685
686 $Function: ALSPresent
687
688 $Description: indicates whether a CPHS SIM supports ALS by checking CSP
689
690 $Returns: 0 if it does, 1 if it doesn't
691 $Arguments: menu tag, menu attribute tag, menu item tag (none of them used,
692 this is merely the format for menu display/suppression functions)
693
694 *******************************************************************************/
695 USHORT ALSPresent( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi )
696 {
697 //xvilliva SPR17291 - The pre-existing code was returning ALS not supported
698 // even if it the SIM supported. Changed the code to call
699 // tAT_PercentALS() and qAT_PercentALS().
700
701 T_ACI_RETURN ACI_return = AT_FAIL ;
702 T_ACI_ALS_MOD ALSmode = (T_ACI_ALS_MOD)0; // RAVI
703
704 ACI_return = tAT_PercentALS( CMD_SRC_NONE, &ALSmode );
705 ACI_return = qAT_PercentALS( CMD_SRC_NONE, &ALSmode );
706
707 // ALSmode = 1;//xvilliva SPR17291 - IMP: Hardcoded for our SIMS - got to test on ALS sim.
708
709 return (!ALSmode);//returns 0 (if line1 or line2) returns 1 if not supported.
710 }
711 /*******************************************************************************
712
713 $Function: CphsALSUnlocked
714
715 $Description: Indicates whether a CPHS SIM's support of ALS has been locked by the User
716
717 $Returns: 0 if it hasn't, 1 if it has
718 $Arguments: menu tag, menu attribute tag, menu item tag (none of them used,
719 this is merely the format for menu display/suppression functions)
720
721 *******************************************************************************/
722 USHORT CphsALSUnlocked( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi )
723 {
724 USHORT retVal = CphsALSLocked(m, ma, mi);
725
726 if (retVal == 0)
727 retVal = 1;
728 else
729 retVal = 0;
730
731 return (retVal);
732 }
733 /*******************************************************************************
734
735 $Function: CphsALSUnlocked
736
737 $Description: Indicates whether a CPHS SIM's support of ALS has been locked by the User
738
739 $Returns: 0 if it has, 1 if it hasn't
740 $Arguments: menu tag, menu attribute tag, menu item tag (none of them used,
741 this is merely the format for menu display/suppression functions)
742
743 *******************************************************************************/
744 USHORT CphsALSLocked( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi )
745 {
746 USHORT retVal;
747
748 if (als_status.status == MFW_LINE_LOCKED)
749 retVal = 0;
750 else
751 retVal = 1;
752
753 return (retVal);
754 }
755 /*******************************************************************************
756
757 $Function: InfoNumbersPresent
758
759 $Description: indicates whether a CPHS SIM has Info Numbers by checking CSP
760
761 $Returns: 0 if it does, 1 if it doesn't
762 $Arguments: none
763
764 *******************************************************************************/
765 USHORT InfoNumbersPresent( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi )
766 { T_MFW_CPHS_INFO config_info;
767
768 int i;
769 cphs_config(&config_info);
770 /***************************Go-lite Optimization changes Start***********************/
771 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
772 TRACE_EVENT_P1("InfoNum config: %d", config_info.iNum);
773 /***************************Go-lite Optimization changes end***********************/
774 for(i=0; i< strlen((char*)customer_service_profile.csp); i+=2)
775 {
776 if (customer_service_profile.csp[i] ==CPHS_INFONUMS_BYTE_VALUE)
777 if (customer_service_profile.csp[(i+1)] & INFONUM_MASK)
778 return 0; //ALS is supported
779 }
780 return 1;
781 }
782 /*******************************************************************************
783
784 $Function: GetCphsVoicemailStatus
785
786 $Description: Asks MFW to check voicemail status on CPHS SIM
787 cphs_mfw_cb handles callback from this
788 $Returns: status of line passed as parameter
789 $Arguments: line
790
791 *******************************************************************************/
792 T_MFW_CFLAG_STATUS GetCphsVoicemailStatus(UBYTE line)
793 {
794 cphs_get_mailbox_status ();
795 TRACE_EVENT("Requesting voicemail status");
796
797 /*SPR 2653, removed unneccessary code*/
798 /*requesting the mailbox status will trigger an event from the MFW if
799 CPHS is supported and that event will cause a voicemail indication window if a
800 voicemail flag has been set in the SIM*/
801 return MFW_CFLAG_NotPresent;
802
803
804 }
805 /*******************************************************************************
806
807 $Function: GetCphsDivertStatus
808
809 $Description: get call forwarding status of specified line
810 cphs_mfw_cb handles callback from this
811 $Returns: status of line passed as parameter
812 $Arguments: line
813
814 *******************************************************************************/
815
816 T_MFW_CFLAG_STATUS GetCphsDivertStatus(UBYTE line)
817 {
818 switch (line)
819 {
820 case MFW_SERV_LINE1: return call_forwarding_status.line1; //break; // RAVI
821 case MFW_SERV_LINE2: return call_forwarding_status.line2; // break; // RAVI
822 case MFW_SERV_FAX: return call_forwarding_status.fax; // break; // RAVI
823 case MFW_SERV_DATA: return call_forwarding_status.data; // break; // RAVI
824 default: return MFW_CFLAG_NotPresent;
825 }
826 }
827 /*******************************************************************************
828
829 $Function: GetAlsLine
830 $Description: gets current als line
831 $Returns: current als line
832 $Arguments: line
833
834 *******************************************************************************/
835 UBYTE GetAlsLine()
836 {
837 return als_status.selectedLine;
838 }
839
840 /*******************************************************************************
841
842 $Function: ShowMessage
843 $Description: Displays screen with passed text ids
844 $Returns: nothing
845 $Arguments: parent window, 2 text ids
846
847 *******************************************************************************/
848 void ShowMessage(T_MFW_HND win, USHORT TextId1, USHORT TextId2)
849 {
850
851 T_DISPLAY_DATA Dialog;
852
853 /* Initialise the dialog control block with default information
854 */
855 dlg_initDisplayData_TextId( &Dialog, TxtNull, TxtNull, TextId1, TextId2 , COLOUR_STATUS);
856 dlg_initDisplayData_events( &Dialog, NULL, THREE_SECS, KEY_LEFT| KEY_RIGHT|KEY_CLEAR );
857
858 /* Show the dialog
859 */
860 info_dialog( win, &Dialog );
861 }
862
863
864
865 /******************************************************************************
866
867 Private functions
868
869 *******************************************************************************/
870
871 T_MFW_HND edit_mailbox_start(T_MFW_HND parent_window)
872 {
873 T_MFW_HND win = mmi_cphs_create(parent_window);
874 TRACE_FUNCTION("calc_start()");
875 if (win NEQ NULL)
876 {
877 SEND_EVENT(win, MAILBOX, NULL, NULL);
878
879 }
880
881 return win;
882 }
883
884
885
886
887
888 T_MFW_HND mmi_cphs_create(T_MFW_HND parent)
889 { T_MMI_CPHS_DATA * data = (T_MMI_CPHS_DATA *)ALLOC_MEMORY (sizeof (T_MMI_CPHS_DATA ));
890 T_MFW_WIN * mailbox_win;
891
892 if (data EQ NULL)
893 {
894 return NULL;
895 }
896
897 // Create window handler
898 data->mailbox_win = win_create (parent, 0, E_WIN_VISIBLE, (MfwCb)cphs_win_cb);
899 if (data->mailbox_win EQ NULL)
900 {
901
902 return NULL;
903 }
904 // connect the dialog data to the MFW-window
905 data->mmi_control.dialog = (T_DIALOG_FUNC)cphs_dialog_cb;
906 data->mmi_control.data = data;
907 mailbox_win = ((T_MFW_HDR *)data->mailbox_win)->data;
908 mailbox_win->user = (void *)data;
909 data->parent_win = parent;
910 data->win = mailbox_win;
911 return data->mailbox_win;
912
913 }
914
915 void mailbox_destroy(MfwHnd own_window)
916 {
917 T_MFW_WIN * win_data;
918 T_MMI_CPHS_DATA * data = NULL;
919
920 if (own_window)
921 {
922
923 win_data = ((T_MFW_HDR *)own_window)->data;
924 if (win_data != NULL) //PATCH TB
925 data = (T_MMI_CPHS_DATA *)win_data->user;
926
927 if (data)
928 {
929 TRACE_EVENT ("mailbox_destroy()");
930
931 win_delete (data->win);
932 // Free Memory
933 FREE_MEMORY ((void *)data, sizeof (T_MMI_CPHS_DATA));
934
935 }
936 else
937 {
938 TRACE_EVENT ("mailbox_destroy() called twice");
939 }
940 }
941 }
942
943 void cphs_dialog_cb(T_MFW_HND win, USHORT e, SHORT identifier, void *parameter)
944 { TRACE_EVENT("cphs_dialog_cb()");
945 switch(e)
946 { case (MAILBOX):
947 cphs_get_mailbox();break;
948 default: break;
949 }
950 }
951
952 static int cphs_win_cb (T_MFW_EVENT event, T_MFW_WIN * win)
953 {
954 T_MMI_CPHS_DATA * data = (T_MMI_CPHS_DATA *)win->user;
955
956 TRACE_FUNCTION ("cphs_win_cb()");
957
958 if(data EQ 0)
959 return 1;
960 switch (event)
961 {
962 case E_WIN_VISIBLE:
963 if (win->flags & E_WIN_VISIBLE)
964 {
965 /* Print the information dialog */
966 /* Clear Screen */
967 dspl_ClearAll();
968 }
969 default:
970 return 0;
971 }
972 return 1;
973 }
974 /*******************************************************************************
975
976 $Function: show_cphs_mb_numbers
977 $Description: Show the list of mailbox numbers
978 $Returns: nothing
979 $Arguments: none
980
981 *******************************************************************************/
982 void show_cphs_mb_numbers()
983 {
984 T_MFW_HND win;
985 T_MFW_HND parent_win= mfw_parent(mfw_header());
986
987 {
988 win = buildInfoNumberMenu(parent_win);
989
990 if (win NEQ NULL)
991 {
992 SEND_EVENT (win, E_INIT, 0, 0);
993 }
994 }
995 }
996
997 /*******************************************************************************
998
999 $Function: show_cphs_mb_number
1000 $Description: Show the passed mailbox number in editor
1001 $Returns: status int
1002 $Arguments: mailbox number entry
1003
1004 *******************************************************************************/
1005
1006 int show_cphs_mb_number(T_MFW_CPHS_ENTRY* mb_number)
1007 { T_MFW_HND parent_win = mfw_parent(mfw_header());
1008 #ifdef NEW_EDITOR
1009 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data*/
1010 #else
1011 T_EDITOR_DATA editor_data;
1012 #endif
1013 char temp_number[PHB_MAX_LEN];
1014
1015 memset(temp_number, 0, PHB_MAX_LEN);
1016
1017 //if it's an international number without a '+'
1018 if (mb_number->ton == MFW_TON_INTERNATIONAL && mb_number->number[0] != '+')
1019 { strcat(temp_number, "+"); //put a + in front of number
1020 strcat(temp_number, (char*)mb_number->number);
1021 strcpy((char*)mb_number->number, temp_number);
1022 }
1023
1024 /* SPR#1428 - SH - New Editor changes */
1025
1026 #ifdef NEW_EDITOR
1027 AUI_edit_SetDefault(&editor_data);
1028 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)mb_number->number, PHB_MAX_LEN-1);
1029 AUI_edit_SetMode(&editor_data, 0, ED_CURSOR_UNDERLINE);
1030 AUI_edit_SetDisplay(&editor_data, 0, COLOUR_EDITOR, EDITOR_FONT);
1031 AUI_edit_SetEvents(&editor_data, 0, TRUE, FOREVER, (T_AUI_EDIT_CB)mailbox_edit_cb);
1032 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtNull, NULL);
1033
1034 AUI_edit_Start(parent_win, &editor_data);
1035 #else /* NEW_EDITOR */
1036 editor_attr_init(&editor_data.editor_attr, 0, edtCurBar1, NULL, (char*)mb_number->number, PHB_MAX_LEN-1, COLOUR_EDITOR);
1037 editor_data_init(&editor_data, (T_EDIT_CB)mailbox_edit_cb, TxtSoftOK, TxtDelete, NULL, 1, DIGITS_MODE, FOREVER);
1038 editor_data.Identifier = 0;
1039 editor_data.hide = FALSE;
1040 editor_data.destroyEditor = TRUE;
1041 editor_data.TextString = NULL; /*MC SPR 1257, stops glitch in Chinese*/
1042
1043
1044 editor_start(parent_win,&editor_data); /* start the editor */
1045 #endif /* NEW_EDITOR */
1046 // ADDED BY RAVI - 29-11-2005
1047 #if (BOARD == 61)
1048 return 1;
1049 #endif
1050 // END RAVI
1051 }
1052
1053 /*******************************************************************************
1054
1055 $Function: mailbox_edit_cb
1056 $Description: callback for mailbox editor screen
1057 $Returns: nothing
1058 $Arguments: window, identifier, reason
1059
1060 *******************************************************************************/
1061 static void mailbox_edit_cb( T_MFW_HND win, USHORT Identifier,UBYTE reason)
1062 {
1063
1064 TRACE_FUNCTION("mailbox_edit_cb()");
1065 switch (reason )
1066 {
1067 case INFO_KCD_LEFT:
1068 {
1069 TRACE_EVENT((char*)cphs_voicemail_num.number);
1070 cphs_set_mailbox(&cphs_voicemail_num);
1071
1072 }
1073
1074 break;
1075
1076 default:
1077 {
1078 /* otherwise no action to be performed
1079 */
1080 break;
1081 }
1082 }
1083 }
1084 /*******************************************************************************
1085
1086 $Function: cphs_mfw_cb
1087 $Description: Callback handler for mfw_cphs events
1088 $Returns: status int
1089 $Arguments: event, parameter pointer
1090
1091 *******************************************************************************/
1092 int cphs_mfw_cb(T_MFW_EVENT event, void* para)
1093 { T_MFW_HND parent = mfwParent( mfw_header());
1094
1095 // T_MFW_CPHS_VC_NUM* number_list =(T_MFW_CPHS_VC_NUM* )para; // RAVI
1096
1097 // T_MFW_CPHS_PARA* parameter = (T_MFW_CPHS_PARA*)para; // RAVI
1098 // T_MFW_CPHS_STATUS temp; // RAVI
1099 switch(event)
1100 { case E_CPHS_IND:
1101 TRACE_EVENT("Getting cphs status");
1102 if(para != NULL)
1103 { cphs_status =(* (T_MFW_CPHS_STATUS*)para);
1104 if (cphs_status != CPHS_OK)
1105 {
1106 /***************************Go-lite Optimization changes Start***********************/
1107 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
1108 TRACE_EVENT_P1("cphs not supported, apparently%d", cphs_status);
1109 /***************************Go-lite Optimization changes end***********************/
1110 }
1111 cphs_operator_name();
1112 }
1113 break;
1114 case E_CPHS_OP_NAME:
1115 if(para != NULL)
1116 {
1117 memcpy(&operator_name, para, sizeof(T_MFW_CPHS_OP_NAME));
1118 TRACE_EVENT("operator name callback");
1119
1120
1121 if (operator_name.longName.data[0] == NULL)
1122 TRACE_EVENT("Blank long name");
1123
1124 if (operator_name.shortName.data[0] == NULL)
1125 TRACE_EVENT("Blank short name");
1126
1127 cphs_get_csp();
1128 }
1129 break;
1130 case E_CPHS_GET_VC_NUM:
1131 {
1132 if (para!= NULL)
1133 { memcpy(&cphs_voicemail_numbers, para, sizeof(T_MFW_CPHS_VC_NUM));
1134 /***************************Go-lite Optimization changes Start***********************/
1135 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
1136 TRACE_EVENT_P1("Voicemail No %s", cphs_voicemail_numbers.entries[0].number);
1137 /***************************Go-lite Optimization changes end***********************/
1138 show_cphs_mb_numbers();
1139 }
1140
1141 }
1142 break;
1143 case E_CPHS_SET_VC_NUM:
1144 { //result of writing mailbox number
1145 UBYTE write_result;
1146 if(para != NULL)
1147 { write_result = *(UBYTE*)para;
1148 if (write_result == MFW_SIMOP_WRITE_OK)
1149 ShowMessage(parent, TxtSaved, TxtNull);
1150 else
1151 ShowMessage(parent, TxtWriteError, TxtNull);//display "Write Error"
1152 }
1153 }
1154 break;
1155 case E_CPHS_GET_VC_STAT:
1156 {
1157 MfwHnd idle_win =idle_get_window();
1158 // UBYTE line; // RAVI
1159 if(para != NULL)
1160 { cphs_voicemail_status = (T_MFW_CPHS_VC_STAT*)para;
1161
1162 TRACE_EVENT("Getting voicemail status");
1163 if (cphs_voicemail_status->line1 == MFW_CFLAG_SET)
1164 {
1165 ShowMessage(idle_win, TxtVoicemail, TxtLine1);
1166
1167 /* SPR#1929 - DS - Set voicemail icon on idle screen. Port of 1960 */
1168 iconsSetState(iconIdVoice);
1169 }
1170
1171
1172 if (cphs_voicemail_status->line2 == MFW_CFLAG_SET)
1173 {
1174 ShowMessage(idle_win, TxtVoicemail, TxtLine2);
1175
1176 /* SPR#1929 - DS - Set voicemail icon on idle screen. Port of 1960 */
1177 iconsSetState(iconIdVoice);
1178 }
1179
1180 /* SPR#1929 - DS - Remove voicemail icon from idle screen if
1181 * there is no voicemail waiting on either line1/line2. Port of 1960.
1182 */
1183 if ( (cphs_voicemail_status->line1 != MFW_CFLAG_SET) &&
1184 (cphs_voicemail_status->line2 != MFW_CFLAG_SET) )
1185 {
1186 iconsDeleteState(iconIdVoice);
1187 }
1188
1189 }
1190
1191 }
1192 break;
1193 case E_CPHS_SET_VC_STAT:
1194
1195 { //result of resetting mailbox status
1196 // UBYTE write_result; // RAVI
1197
1198 TRACE_EVENT("Mailbox status set");
1199 //Update our copy of the mailbox status
1200 GetCphsVoicemailStatus(0);
1201 }
1202 break;
1203 case E_CPHS_GET_DV_STAT:
1204 {
1205 TRACE_EVENT("Getting divert status");
1206 if(para != NULL)
1207 memcpy(&call_forwarding_status, para, sizeof(T_MFW_CPHS_DV_STAT));
1208 {UBYTE line;
1209 //check for divert on active line
1210 line = GetAlsLine();
1211 //check if current outgoing line diverted
1212 if (line == MFW_SERV_LINE2)
1213 DivertStatus = GetCphsDivertStatus(MFW_SERV_LINE2);
1214 else//if (line == MFW_SERV_LINE1)
1215 DivertStatus = GetCphsDivertStatus(MFW_SERV_LINE1);
1216
1217 //set the call forwarding icon
1218 if (DivertStatus == MFW_CFLAG_SET)
1219 {
1220 iconsSetState(iconIdCallFor);
1221 // Jun 23, 2004 REF: CRR MMI-SPR-13599 Rashmi C N(Sasken)
1222 // Setting the Current state of CF in Flash
1223 FFS_flashData.CFState=TRUE;
1224 }
1225 //gid rid of call forwarding icon
1226 if (DivertStatus == MFW_CFLAG_NOTSet)
1227 {
1228 iconsDeleteState(iconIdCallFor);
1229 // Jun 23, 2004 REF: CRR MMI-SPR-13599 Rashmi C N(Sasken)
1230 // Setting the Current state of CF in Flash
1231 FFS_flashData.CFState=FALSE;
1232 }
1233 // Jun 23, 2004 REF: CRR MMI-SPR-13599 Rashmi C N(Sasken)
1234 // Writng the Current state of CF into ffs
1235 flash_write();
1236
1237 }
1238 }break;
1239 case E_CPHS_SET_DV_STAT:
1240 { //result of setting divert status
1241 // UBYTE write_result; // RAVI
1242
1243 TRACE_EVENT("Divert status set");
1244 cphs_get_divert_status(); //refresh divert status
1245
1246 }
1247 break;
1248 case E_CPHS_GET_ALS_STATUS:
1249 { if(para != NULL)
1250 memcpy(&als_status, para, sizeof(T_MFW_CPHS_ALS_STATUS));
1251 }
1252 break;
1253 case E_CPHS_SET_LINE:
1254 { //result of set ALS line
1255 UBYTE write_result;
1256 if(para != NULL)
1257 { write_result = *(UBYTE*)para;
1258 if (write_result == MFW_SIMOP_WRITE_OK)
1259 ShowMessage(parent, TxtChanged, TxtNull);
1260 if (write_result == MFW_SIMOP_WRITE_ERR)
1261 ShowMessage(parent, TxtWriteError, TxtNull);//display "Write Error"
1262 }
1263 cphs_get_als_info(&als_status);//refresh current line
1264 cphs_get_divert_status(); //refresh divert status
1265 }
1266 break;
1267 case E_CPHS_SET_ALS_STATUS:
1268 { //result of setting ALS status
1269 UBYTE write_result;
1270 if(para != NULL)
1271 { write_result = *(UBYTE*)para;
1272 if (write_result == MFW_SIMOP_WRITE_OK)
1273 ShowMessage(parent, TxtSaved, TxtNull);
1274 if (write_result == MFW_SIMOP_WRITE_ERR)
1275 ShowMessage(parent, TxtWriteError, TxtNull);//display "Write Error"
1276 }
1277 }
1278 break;
1279 case E_CPHS_GET_CSP:
1280 { if(para != NULL)
1281 { memcpy(&customer_service_profile, para, sizeof(T_MFW_CPHS_CSP));
1282 /***************************Go-lite Optimization changes Start***********************/
1283 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
1284 TRACE_EVENT_P7("CSP: %x,%x,%x,%x,%x,%x,%x", customer_service_profile.csp[0], customer_service_profile.csp[1],
1285 customer_service_profile.csp[2], customer_service_profile.csp[3], customer_service_profile.csp[4], customer_service_profile.csp[5],
1286 customer_service_profile.csp[6]);
1287 TRACE_EVENT_P3("%x,%x,%x", customer_service_profile.csp[7], customer_service_profile.csp[8], customer_service_profile.csp[9]);
1288 TRACE_EVENT_P7("CSP: %x,%x,%x,%x,%x,%x,%x", customer_service_profile.csp[10], customer_service_profile.csp[11],
1289 customer_service_profile.csp[12], customer_service_profile.csp[13], customer_service_profile.csp[14], customer_service_profile.csp[15],
1290 customer_service_profile.csp[16]);
1291 TRACE_EVENT_P3("%x,%x,%x", customer_service_profile.csp[17], customer_service_profile.csp[18], customer_service_profile.csp[19]);
1292 /***************************Go-lite Optimization changes end***********************/
1293 cphs_get_info_num(1, info_num_index);
1294 }
1295
1296 }break;
1297 case E_CPHS_GET_INFO_NUM:
1298 {
1299 if(para != NULL)
1300 {
1301 memcpy(&current_info_num, para, sizeof( T_MFW_CPHS_INFONUM_ENTRY));
1302
1303 TRACE_EVENT("Getting info number");
1304 if (current_info_num.result !=MFW_SIMOP_READ_ERR)
1305 { T_DISPLAY_DATA Dialog;
1306 TRACE_EVENT("Displaying num");
1307 /* Initialise the dialog control block with default information
1308 */
1309 dlg_initDisplayData_TextStr( &Dialog, TxtSoftCall, TxtSoftBack, (char*)current_info_num.alpha.data, (char*)current_info_num.number, COLOUR_STATUS);
1310 dlg_initDisplayData_events( &Dialog, (T_VOID_FUNC) info_num_display_cb, FOREVER, KEY_LEFT| KEY_RIGHT|KEY_CLEAR );
1311
1312 /* Show the dialog
1313 */
1314 info_dialog( parent, &Dialog );
1315 }
1316 }
1317 }
1318
1319 break;
1320 case E_CPHS_GET_INFO_LIST:
1321 {
1322 if (para == NULL)
1323 {
1324 TRACE_EVENT("Invalid info num list");
1325 }
1326 else
1327 { //populate next pointer
1328 //RAVI - 29-11-2005
1329 if ((info_numbers[info_num_level] = (T_MFW_CPHS_INFONUM_LIST*) ALLOC_MEMORY(sizeof(T_MFW_CPHS_INFONUM_LIST))))
1330 memcpy(info_numbers[info_num_level], para, sizeof(T_MFW_CPHS_INFONUM_LIST));
1331
1332
1333 TRACE_EVENT("Getting info numbers!!");
1334 if (info_numbers[info_num_level]->count != 0)
1335 {
1336 /***************************Go-lite Optimization changes Start***********************/
1337 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
1338 TRACE_EVENT_P1("Valid info num list, count:%d",info_numbers[info_num_level]->count);
1339 /***************************Go-lite Optimization changes end***********************/
1340 if (info_num_level)
1341 { info_num_level++;
1342 InfoNumbers2();
1343
1344 }
1345 }
1346 else
1347 info_numbers[info_num_level]=NULL;
1348 }
1349 }
1350 break;
1351 case E_CPHS_GET_SIM_FIELD:
1352 { T_MFW_CPHS_READ_SIM_ENTRY temp;
1353
1354 memcpy(&temp, para, sizeof(T_MFW_CPHS_READ_SIM_ENTRY));
1355 if (temp.data_len >0)
1356 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858
1357 //begin 30439
1358 //temp.exchange_data[temp.data_len-1] = 0;
1359 //end 30439
1360 /***************************Go-lite Optimization changes Start***********************/
1361 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
1362 TRACE_EVENT_P3("Sim Read, Field: %d (Record: %d) Errcode: %d",temp.requested_field, temp.record, temp.sim_result);
1363 /***************************Go-lite Optimization changes end***********************/
1364 /* SPR759 - SH - Read Sim for homezone, calls appropriate functions */
1365 #ifdef MMI_HOMEZONE_ENABLED
1366 if (temp.requested_field>=HZ_SIM_PARAMETERS
1367 && temp.requested_field < (HZ_SIM_CELL_CACHE+HZ_ZONES_MAX) )
1368 {
1369 homezoneReadSimCb(temp.requested_field, temp.record, temp.sim_result);
1370 }
1371 #endif
1372 }
1373 break;
1374
1375 case E_CPHS_SET_SIM_FIELD:
1376 {
1377 T_MFW_CPHS_READ_SIM_ENTRY temp;
1378
1379 memcpy(&temp, para, sizeof(T_MFW_CPHS_READ_SIM_ENTRY));
1380 if (temp.data_len >0)
1381 temp.exchange_data[temp.data_len-1] = 0;
1382 /***************************Go-lite Optimization changes Start***********************/
1383 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
1384 TRACE_EVENT_P2("Sim Write, Requested_field: %d Errcode: %d",temp.requested_field, temp.sim_result);
1385 /***************************Go-lite Optimization changes end***********************/
1386 /* SPR759 - SH - Read Sim for homezone, calls appropriate functions */
1387 #ifdef MMI_HOMEZONE_ENABLED
1388 if (temp.requested_field>=HZ_SIM_PARAMETERS
1389 && temp.requested_field < (HZ_SIM_CELL_CACHE+HZ_ZONES_MAX) )
1390 {
1391 homezoneWriteSimCb(temp.requested_field, temp.record, temp.sim_result);
1392 }
1393 #endif
1394 }
1395 break;
1396
1397 default: break;
1398 }
1399
1400
1401 return TRUE;
1402 }
1403
1404
1405
1406
1407
1408
1409
1410
1411 /*******************************************************************************
1412
1413 $Function: int InfoNumbers2( )
1414 $Description: Displays info number sub-menus
1415 $Returns: status int
1416 $Arguments: nothing
1417
1418 *******************************************************************************/
1419 //for sub-menus
1420 int InfoNumbers2( )
1421 {
1422 T_MFW_HND win;
1423 T_MFW_HND parent_win = mfw_parent(mfw_header());
1424
1425 TRACE_FUNCTION("InfoNumbers2");
1426
1427 if (info_numbers != NULL)
1428 { type_of_list = INFO_NUM_LIST;
1429 win = buildInfoNumberMenu(parent_win);
1430
1431 if (win NEQ NULL)
1432 {
1433 SEND_EVENT (win, E_INIT, 0, 0);
1434 }
1435 }
1436
1437 return MFW_EVENT_CONSUMED;
1438 }
1439 /*******************************************************************************
1440
1441 $Function: buildInfoNumberMenu
1442 $Description: Creates window for Information numbers
1443 $Returns: window created
1444 $Arguments: parent window
1445
1446 *******************************************************************************/
1447 static T_MFW_HND buildInfoNumberMenu( MfwHnd parent_window)
1448 {
1449 T_INFO_NUM_INFO * data = (T_INFO_NUM_INFO *)ALLOC_MEMORY (sizeof (T_INFO_NUM_INFO));
1450 T_MFW_WIN * win;
1451
1452
1453 /*
1454 * Create window handler
1455 */
1456
1457 data->numbers_win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)info_num_win_cb);
1458 if (data->numbers_win EQ NULL)
1459 {
1460 return NULL;
1461 }
1462
1463 TRACE_EVENT(">>>> Info num window created: " );
1464 /*
1465 * connect the dialog data to the MFW-window
1466 */
1467
1468 data->mmi_control.dialog = (T_DIALOG_FUNC)info_num_exec_cb;
1469 data->mmi_control.data = data;
1470 win = ((T_MFW_HDR *)data->numbers_win)->data;
1471 win->user = (void *)data;
1472 data->parent = parent_window;
1473 winShow(data->numbers_win);
1474 /*
1475 * return window handle
1476 */
1477
1478 return data->numbers_win;
1479 }
1480
1481 /*******************************************************************************
1482
1483 $Function: info_num_display_cb
1484
1485 $Description: Dialogue callback function of the information Numbers display window
1486
1487 $Returns: none
1488
1489 $Arguments: win - window handler, dialogue id, key pressed
1490
1491
1492 *******************************************************************************/
1493
1494 void info_num_display_cb(T_MFW_HND win, USHORT identifier, UBYTE reason)
1495 {
1496
1497 // char buf [40]; // RAVI
1498
1499 TRACE_FUNCTION ("info_num_display_cb");
1500
1501 switch (reason)
1502 {
1503 case INFO_KCD_LEFT: callNumber((UBYTE*)current_info_num.number);
1504 default: break; // RAVI - Deafault corrected to default.
1505
1506 }
1507 }
1508 /*******************************************************************************
1509
1510 $Function: info_num_exec_cb
1511
1512 $Description: Exec callback function of the information Numbers window
1513
1514 $Returns: none
1515
1516 $Arguments: win - window handler
1517 event - mfw event
1518 parameter - optional data.
1519
1520 *******************************************************************************/
1521 void info_num_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
1522 {
1523 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
1524 T_INFO_NUM_INFO * data = (T_INFO_NUM_INFO *)win_data->user;
1525 UBYTE i;
1526 UBYTE numberOfEntries;
1527 // ListWinInfo * mnu_data = (ListWinInfo *)parameter; // RAVI
1528 char* Mailboxes[4];
1529
1530 Mailboxes[0] = MmiRsrcGetText(TxtLine1);
1531 Mailboxes[1] =MmiRsrcGetText(TxtLine2);
1532 Mailboxes[2] = MmiRsrcGetText(TxtFax);
1533 Mailboxes[3] = MmiRsrcGetText(TxtData);
1534 TRACE_FUNCTION (">>>>> info_num_exec_cb()");
1535
1536 switch (event)
1537 {
1538 case E_INIT:
1539
1540 TRACE_EVENT(">>>> info_num_exec_cb() Event:E_INIT");
1541
1542 /* initialization of administrative data */
1543
1544
1545 data->menu_list_data = (ListMenuData *)ALLOC_MEMORY(sizeof(ListMenuData));
1546
1547 if(data->menu_list_data == 0)
1548 {
1549 TRACE_EVENT("Failed memory alloc 1 ");
1550 return;
1551 }
1552 if (type_of_list == MAILBOX_LIST || type_of_list == MAILBOX_LIST_CALL)
1553 { numberOfEntries = cphs_voicemail_numbers.count;
1554 if (numberOfEntries > 4)
1555 numberOfEntries = 4;
1556 }
1557 else
1558 numberOfEntries = info_numbers[info_num_level-1]->count;
1559
1560 data->menu_list_data->List = (T_MFW_MNU_ITEM *)ALLOC_MEMORY( 4 * sizeof(T_MFW_MNU_ITEM) );
1561
1562 if(data->menu_list_data->List == 0)
1563 {
1564 TRACE_EVENT("Failed memory alloc 2");
1565 return;
1566 }
1567
1568 for (i = 0; i < numberOfEntries ; i++)
1569 {
1570 mnuInitDataItem(&data->menu_list_data->List[i]);
1571 if (type_of_list == MAILBOX_LIST || type_of_list == MAILBOX_LIST_CALL)
1572 data->menu_list_data->List[i].str = (char *)cphs_voicemail_numbers.entries[i].alpha.data;
1573 else
1574 data->menu_list_data->List[i].str = (char *)info_numbers[info_num_level-1]->entry[i].alpha.data;
1575 data->menu_list_data->List[i].flagFunc = item_flag_none;
1576 }
1577
1578 data->menu_list_data->ListLength =numberOfEntries;
1579 data->menu_list_data->ListPosition = 1;
1580 data->menu_list_data->CursorPosition = 1;
1581 data->menu_list_data->SnapshotSize = numberOfEntries;
1582 data->menu_list_data->Font = 0;
1583 if (type_of_list == MAILBOX_LIST_CALL)
1584 data->menu_list_data->LeftSoftKey = TxtSoftCall;
1585 else
1586 data->menu_list_data->LeftSoftKey = TxtSoftSelect;
1587 data->menu_list_data->RightSoftKey = TxtSoftBack;
1588 data->menu_list_data->KeyEvents = KEY_ALL;
1589 data->menu_list_data->Reason = 0;
1590 data->menu_list_data->Strings = TRUE;
1591 data->menu_list_data->Attr = &InfoNum_menuAttrib;
1592 data->menu_list_data->autoDestroy = FALSE;
1593
1594
1595 /* Create the dynamic menu window */
1596 listDisplayListMenu(win, data->menu_list_data,(ListCbFunc)InfonumList_cb,0);
1597
1598 break;
1599
1600 default:
1601 break;
1602 }
1603 }
1604 /*******************************************************************************
1605
1606 $Function: InfonumList_cb
1607
1608 $Description: Callback function for the info num list.
1609
1610 $Returns: none
1611
1612 $Arguments: Parent - parent window.
1613 ListData - Menu item list
1614 *******************************************************************************/
1615
1616 void InfonumList_cb(T_MFW_HND * Parent, ListMenuData * ListData)
1617 {
1618 T_MFW_WIN * win_data = ((T_MFW_HDR *)Parent)->data;
1619 T_INFO_NUM_INFO * data = (T_INFO_NUM_INFO *)win_data->user;
1620 // char debug[40]; // RAVI
1621
1622 if ((ListData->Reason EQ LISTS_REASON_BACK) || (ListData->Reason EQ LISTS_REASON_CLEAR))
1623 {
1624
1625 listsDestroy(ListData->win);
1626 InfoNum_destroy(data->numbers_win);
1627 info_num_level--;
1628 }
1629 else if(ListData->Reason EQ LISTS_REASON_SELECT)
1630 {
1631 if (type_of_list == MAILBOX_LIST || type_of_list == MAILBOX_LIST_CALL) //get the correct voicemail num
1632 {
1633 if (type_of_list == MAILBOX_LIST)
1634 { /*If we're editing*/
1635 show_cphs_mb_number(&cphs_voicemail_numbers.entries[ListData->ListPosition]);
1636 memcpy(&cphs_voicemail_num, &cphs_voicemail_numbers.entries[ListData->ListPosition], sizeof(T_MFW_CPHS_ENTRY));
1637 }
1638 else
1639 { char temp_number[PHB_MAX_LEN];
1640
1641 memcpy(&cphs_voicemail_num, &cphs_voicemail_numbers.entries[ListData->ListPosition], sizeof(T_MFW_CPHS_ENTRY));
1642 memset(temp_number, 0, PHB_MAX_LEN);
1643
1644 /*If we're calling the number*/
1645 //if it's an international number without a '+'
1646 if (cphs_voicemail_num.ton == MFW_TON_INTERNATIONAL && cphs_voicemail_num.number[0] != '+')
1647 { strcat(temp_number, "+"); //put a + in front of number
1648 strcat(temp_number, (char*)cphs_voicemail_num.number);
1649 strcpy((char*)cphs_voicemail_num.number, temp_number);
1650 }
1651 callNumber(cphs_voicemail_num.number);
1652
1653 }
1654
1655
1656 }
1657 else
1658 {
1659 //get the number/directory
1660 info_num_index = info_numbers[info_num_level-1]->entry[ListData->ListPosition].index;
1661 /***************************Go-lite Optimization changes Start***********************/
1662 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
1663 TRACE_EVENT_P3("Index selected: %d, Level, %d, entryStat:%d",info_num_index, info_num_level,
1664 info_numbers[info_num_level-1]->entry[ListData->ListPosition].entryStat);
1665 /***************************Go-lite Optimization changes end***********************/
1666 if (info_numbers[info_num_level-1]->entry[ListData->ListPosition].entryStat & 0x80) //if bit 8 set
1667 { TRACE_EVENT("CPHS INFO:Should be number entry");
1668 if (info_num_level < 4)
1669 cphs_select_info_num(info_num_index);
1670 }
1671 else
1672 { if (info_num_level < 4)
1673 { TRACE_EVENT("CPHS INFO:Should be dir entry");
1674
1675 cphs_get_info_num(info_num_level+1, info_num_index+1);
1676 }
1677 }
1678
1679 }
1680
1681 }
1682
1683
1684 }
1685
1686 /*******************************************************************************
1687
1688 $Function: InfoNum_destroy
1689
1690 $Description: Destroy the info num window.
1691
1692 $Returns: none
1693
1694 $Arguments: own_window- current window
1695 *******************************************************************************/
1696
1697 static void InfoNum_destroy(MfwHnd own_window)
1698 {
1699 T_MFW_WIN * win_data;
1700 T_INFO_NUM_INFO * data;
1701 UBYTE numberOfEntries;
1702
1703 TRACE_FUNCTION ("InfoNum_destroy()");
1704
1705 if (own_window)
1706 {
1707 win_data = ((T_MFW_HDR *)own_window)->data;
1708 data = (T_INFO_NUM_INFO *)win_data->user;
1709
1710 if (data)
1711 {
1712 /*
1713 * Delete WIN handler
1714 */
1715 win_delete (data->numbers_win);
1716
1717 /*
1718 * Free Memory
1719 */
1720 if (type_of_list == MAILBOX_LIST)
1721 { numberOfEntries = cphs_voicemail_numbers.count;
1722 if (numberOfEntries > 4)
1723 numberOfEntries = 4;
1724 }
1725 else
1726 numberOfEntries =info_numbers[info_num_level-1]->count;
1727 if (data->menu_list_data != NULL)
1728 { //int i; // RAVI
1729 FREE_MEMORY ((void *)data->menu_list_data->List, numberOfEntries * sizeof (T_MFW_MNU_ITEM));
1730 FREE_MEMORY ((void *)data->menu_list_data, sizeof (ListMenuData));
1731 if (type_of_list == INFO_NUM_LIST && info_num_level > 1)//if info numbers,
1732 { FREE_MEMORY((void*)info_numbers[info_num_level-1], sizeof(T_MFW_CPHS_INFONUM_LIST));
1733 info_numbers[info_num_level-1] = NULL;
1734 }
1735 }
1736 FREE_MEMORY ((void *)data, sizeof (T_INFO_NUM_INFO));
1737
1738 }
1739 else
1740 {
1741 TRACE_EVENT ("InfoNum_destroy() called twice");
1742 }
1743 }
1744 }
1745
1746 /*******************************************************************************
1747
1748 $Function: info_num_win_cb
1749
1750 $Description: Window callback function for the info numbers window.
1751
1752 $Returns: none
1753
1754 $Arguments: w - mfw window handler
1755 e - mfw event
1756
1757 *******************************************************************************/
1758
1759 static int info_num_win_cb (MfwEvt e, MfwWin *w) /* yyy window event handler */
1760 {
1761 TRACE_EVENT ("info_num_win_cb()");
1762 switch (e)
1763 {
1764 case MfwWinVisible: /* window is visible */
1765 break;
1766 case MfwWinFocussed: /* input focus / selected */
1767 case MfwWinDelete: /* window will be deleted */
1768
1769 default:
1770 return MFW_EVENT_REJECTED;
1771 }
1772 return MFW_EVENT_CONSUMED;
1773 }
1774
1775
1776