comparison src/ui/mfw/mfw_cphs.c @ 3:67bfe9f274f6

src/ui: import of src/ui3 from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:33:10 +0000
parents
children 92abb46dc1ba
comparison
equal deleted inserted replaced
2:3a14ee9a9843 3:67bfe9f274f6
1 /*
2 +--------------------------------------------------------------------+
3 | PROJECT: MMI-Framework (8417) $Workfile:: mfw_cphs.c $|
4 | $Author:: VO $Revision:: 1 $|
5 | CREATED: 14.7.00 $Modtime:: $|
6 | STATE : code |
7 +--------------------------------------------------------------------+
8
9 MODULE : MFW_CPHS
10
11 PURPOSE : This modul contains CPHS management functions.
12
13
14 $History:: mfw_cphs.c $
15
16 June 27,2007 OMAPS00134788 x0066814(Geetha)
17 Description: EXT1 record not appende to CHPHS Voice Mail Number (6F17) though referenced
18 Solution: Added a function to read the EXT1 records for mailbox number.
19 Added a condition in cphs_read_mbn() to check whether EXT1 is present.
20
21 Nov 27, 2006 OMAPS00098359 a0393213(R.Prabakar)
22 Description: CPHS 4.2 : Call Divert doesn't work properly for Line 2
23
24 Oct 30 2006, OMAPS00098881 x0039928(sumanth)
25 Removal of power variant
26
27 May 30, 2006 REF:OMAPS00079650 a0393213 (R.Prabakar)
28 Description : CPHS Call Forwarding feature implementation
29
30 May 30, 2006 DR: OMAPS00070657 x0pleela
31 Description: CPHS feature on Locosto-Lite
32 Solution: For ALS feature,
33 a) Added the definition for the new function "mfw_cphs_get_als_info()"
34
35 May 18, 2006 DR: OMAPS00070657 x0pleela
36 Description: CPHS feature on Locosto-Lite
37 Solution: For VMWI feature,
38 a) A new function "sendCPWIEvt" is defined to set the voice mail indication
39 if there are any voice mails
40
41 Jan 12, 2006 OMAPS00062632 x0018858
42 Description: The differnace in the type of the data passed to the function cphs_read_information()
43 is causing an incorrect value being received as the output.
44 Solution: The errcode being passed to the function has been modified to USHORT
45
46 Mar 30, 2005 REF: CRR 29986 xpradipg
47 Description: Optimisation 1: Removal of unused variables and dynamically
48 allocate/ deallocate mbndata
49 Solution: Static allocation of mbnData is replaced with dynamic allocation
50 and deallocation
51
52 Aug 16, 2004 REF: CRR 24323 Deepa M.D
53 Bug:Clenup of sprintf used for tracing
54 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX
55
56 */
57
58 #define ENTITY_MFW
59
60 #include <string.h>
61 #include <stdio.h>
62 #include <stdlib.h>
63 #include <limits.h>
64
65 #if defined (NEW_FRAME)
66
67 #include "typedefs.h"
68 #include "vsi.h"
69 #include "pei.h"
70 #include "custom.h"
71 #include "gsm.h"
72
73 #else
74
75 #include "STDDEFS.H"
76 #include "custom.h"
77 #include "gsm.h"
78 #include "vsi.h"
79
80 #endif
81
82 #include "mfw_mfw.h"
83 #include "mfw_sim.h"
84 #include "mfw_nm.h"
85 #include "mfw_simi.h"
86 #include "mfw_phb.h"
87 #include "mfw_phbi.h"
88 #include "mfw_cphs.h"
89 #include "mfw_cphsi.h"
90 #include "mfw_win.h"
91 #include "mfw_cm.h"
92 #include "mfw_ss.h"
93 #include "mfw_ffs.h"
94
95 #include "ksd.h"
96 #include "psa.h"
97
98 #ifdef SIM_TOOLKIT
99 #include "mfw_sat.h"
100 #endif
101
102 #if defined (FAX_AND_DATA)
103 #include "aci_fd.h"
104 #endif
105
106 #include "cmh.h"
107 #include "phb.h"
108 #include "cmh_phb.h"
109 #include "psa_sim.h"
110
111 #ifndef PCM_2_FFS
112 #include "pcm.h"
113 #include "mfw_ffs.h"
114 #endif
115
116 //x0pleela 11 june, 2006 DR: OMAPS00079692
117 //Including this header to get the ACI's VC Status and update MFW VC staus variable
118 #ifdef FF_CPHS
119 #include "Cphs.h"
120 #endif
121
122 EXTERN MfwHdr * current_mfw_elem;
123 static int cphsCommand (U32 cmd, void *h); /* handle win commands */
124
125 /* event parameter define */
126 static T_MFW_CPHS_OP_NAME opName;
127 static T_MFW_CPHS_VC_NUM mbNum;
128 static T_MFW_CPHS_VC_STAT mbStatus;
129 static T_MFW_CPHS_DV_STAT dvStatus;
130 static T_MFW_CPHS_ALS_STATUS alsStatus;
131 static T_MFW_CPHS_CSP csProfile;
132 static T_MFW_CPHS_INFONUM_LIST numList;
133 static T_MFW_CPHS_INFONUM_ENTRY infoEntry;
134 #ifdef FF_CPHS_REL4
135 static T_MFW_CPHS_MSP_INFO mspinfo;
136 T_MFW_CPHS_REL4_MWIS mwis_stat[4];
137 #endif
138 // Mar 30, 2005 REF: CRR 29986 xpradipg
139 // the optimisation is placed under a flag, a pointer variable is defined
140 // instead of the static array, which is allocated and deallocated
141 #ifdef FF_MMI_OPTIM
142 //x0pleela 14 June, 2006 DR: OMAPS00080549
143 //changed the size of the Mail box number to avoid SIM write operation to overwrite other memory locations
144 #ifdef FF_CPHS
145 #if defined ( TI_PS_FFS_PHB) || defined(PHONEBOOK_EXTENSION)
146 #define MAX_MAIL_BOX_NUMBER 120
147 #else//TI_PS_FFS_PHB OR PHONEBOOK_EXTENSION
148 #define MAX_MAIL_BOX_NUMBER 120
149 #endif//TI_PS_FFS_PHB OR PHONEBOOK_EXTENSION
150 #else //FF_CPHS
151 #define MAX_MAIL_BOX_NUMBER 120
152 #endif //FF_CPHS
153 UBYTE *mbnData;
154 #else //FF_MMI_OPTIM
155 //x0pleela 14 June, 2006 DR: OMAPS00080549
156 #ifdef FF_CPHS
157 #if defined ( TI_PS_FFS_PHB) || defined(PHONEBOOK_EXTENSION)
158 static UBYTE mbnData[120]; // it should be allocated dynamically.
159 #else//TI_PS_FFS_PHB OR PHONEBOOK_EXTENSION
160 static UBYTE mbnData[120]; // it should be allocated dynamically.
161 #endif//TI_PS_FFS_PHB OR PHONEBOOK_EXTENSION
162 #else //FF_CPHS
163 static UBYTE mbnData[120]; // it should be allocated dynamically.
164 #endif //FF_CPHS
165 #endif //FF_MMI_OPTIM
166
167 /* PATCH VO 22.01.01 */
168 static UBYTE mbsData[MFW_CPHS_MBS_SIZE]; // it should be allocated dynamically.
169 static UBYTE dvData[MFW_CPHS_CFF_SIZE]; // it should be allocated dynamically.
170 /* PATCH VO 22.01.01 end */
171 static T_MFW_CPHS_READ_SIM_ENTRY read_sim_entry;//MC
172 /* variable define */
173 static T_MFW_CPHS_STATUS cphsStatus;
174 static UBYTE cphsPhase;
175 static UBYTE cphsServTab[CPHS_SERVICE_TABLE];
176 static UBYTE maxRec;
177 /* PATCH JPS 16.01.01: store mailbox number entry */
178 static T_MFW_CPHS_ENTRY MbnEntry;
179 /* PATCH JPS 16.01.01 END */
180 static T_MFW_CPHS_ENTRY *vcEntry;
181 static UBYTE simStatus;
182 static UBYTE alsData;
183 static UBYTE idxLevel;
184 static UBYTE startIdx;
185 static UBYTE cphsUpdate = FALSE;
186 static UINT16 cphsPrevRead = 0;
187 /*June 27,2007 OMAPS00134788 x0066814(Geetha)*/
188 static UBYTE curr_recNr;
189 static void cphs_read_ext1(SHORT table_id);
190 //Added by Muthu Raja For PCM Reolacement
191
192 #ifdef PCM_2_FFS
193 #define PSPDF_MBN_ID "/PCM/MBN" /* Mailbox Numbers */
194 #endif
195
196 static UBYTE ubCphsMbExtRecNo = 0;
197 static SHORT sFreeRec = 0;
198 static UBYTE ubCurrExtRcWrite = 0;
199 static UBYTE ubFlushRecords = 0;
200 static UBYTE ubExtRecData[200];
201 static UBYTE flush_data[13];
202
203
204 /* FreeCalypso change: remove unbounded FFS filler */
205 #if 0
206
207 void FFS_log_message(char *LogMsg,...);
208 #define TRACE_FUNCTION FFS_log_message
209 #define TRACE_FUNCTION_P1 FFS_log_message
210 #define TRACE_EVENT FFS_log_message
211 #define TRACE_EVENT_P1 FFS_log_message
212 #define TRACE_EVENT_P2 FFS_log_message
213 #define TRACE_EVENT_P3 FFS_log_message
214 #define TRACE_EVENT_P4 FFS_log_message
215
216 void FFS_log_message(char *LogMsg,...)
217 {
218 fd_t fd= -1;
219 char log_ffs_buf[256];
220 va_list varpars;
221 va_start (varpars, LogMsg);
222 vsprintf(log_ffs_buf,LogMsg,varpars);
223 va_end (varpars);
224 fd = ffs_open((const char*)"/ffslog", FFS_O_APPEND | FFS_O_WRONLY );
225 if(fd < 0)
226 fd=ffs_open((const char*)"/ffslog", FFS_O_CREATE |FFS_O_WRONLY );
227 if(fd > 0)
228 {
229 strcat(log_ffs_buf, "\n");
230 ffs_write(fd, log_ffs_buf, strlen(log_ffs_buf));
231 ffs_close(fd);
232 }
233 }
234
235 #endif
236
237
238 /*
239 +--------------------------------------------------------------------+
240 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
241 | STATE : code ROUTINE: cphs_init |
242 +--------------------------------------------------------------------+
243
244
245 PURPOSE : initialize for CPHS management
246
247 */
248
249 void cphs_init(void)
250 {
251 TRACE_FUNCTION("cphs_init()");
252
253 cphsStatus = CPHS_NotPresent;
254 simStatus = MFW_SIMOP_UNKNOWN;
255 mfwCommand[MfwTypCphs] = (MfwCb) cphsCommand;
256 }
257
258
259 /*
260 +--------------------------------------------------------------------+
261 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
262 | STATE : code ROUTINE: cphs_exit |
263 +--------------------------------------------------------------------+
264
265
266 PURPOSE :
267
268 */
269
270 void cphs_exit(void)
271 {
272 TRACE_FUNCTION ("cphs_exit()");
273 }
274
275
276 /*
277 +--------------------------------------------------------------------+
278 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
279 | STATE : code ROUTINE: cphs_create |
280 +--------------------------------------------------------------------+
281
282
283 PURPOSE : create event for CPHS management
284
285 */
286
287 MfwHnd cphs_create (MfwHnd hWin, MfwEvt event, MfwCb cbfunc)
288 {
289 MfwHdr *hdr;
290 T_MFW_CPHS *cphs_para;
291 MfwHdr *insert_status=0;
292
293 TRACE_FUNCTION("cphs_create()");
294
295 hdr = (MfwHdr *) mfwAlloc(sizeof(MfwHdr));
296 cphs_para = (T_MFW_CPHS *) mfwAlloc(sizeof(T_MFW_CPHS));
297
298 if (!hdr || !cphs_para)
299 {
300 TRACE_ERROR("ERROR: cphs_create() Mem Alloc Failed.");
301
302 if(hdr)
303 mfwFree((U8*)hdr,sizeof(MfwHdr));
304
305 if(cphs_para)
306 mfwFree((U8*)cphs_para,sizeof(T_MFW_CPHS));
307
308 return FALSE;
309 }
310
311 cphs_para->emask = event;
312 cphs_para->handler = cbfunc;
313
314 hdr->data = cphs_para; /* store parameter in node */
315 hdr->type = MfwTypCphs; /* type of event handler */
316
317 insert_status= mfwInsert((MfwHdr *) hWin,hdr);
318 if(!insert_status)
319 {
320 TRACE_ERROR("ERROR: cphs_create() Failed to Install Handler. ");
321 mfwFree((U8*)hdr,sizeof(MfwHdr));
322 mfwFree((U8*)cphs_para,sizeof(T_MFW_CPHS));
323 return 0;
324 }
325 return insert_status;
326 }
327
328 /*
329 +--------------------------------------------------------------------+
330 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
331 | STATE : code ROUTINE: cphs_delete |
332 +--------------------------------------------------------------------+
333
334
335 PURPOSE : delete a event for CPHS management
336
337 */
338
339 MfwRes cphs_delete (MfwHnd h)
340 {
341 TRACE_FUNCTION("cphs_delete()");
342
343 if (!h || !((MfwHdr *) h)->data)
344 return MfwResIllHnd;
345
346 if (!mfwRemove((MfwHdr *) h))
347 return MfwResIllHnd;
348
349 mfwFree(((MfwHdr *) h)->data,sizeof(T_MFW_CPHS));
350 mfwFree(h,sizeof(MfwHdr));
351
352 return MfwResOk;
353 }
354
355 /*
356 +--------------------------------------------------------------------+
357 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
358 | STATE : code ROUTINE : cphs_sign_exec |
359 +--------------------------------------------------------------------+
360
361 PURPOSE : dispatch CPHS management signal
362
363 */
364
365 static int cphs_sign_exec (MfwHdr *cur_elem, MfwEvt event,
366 T_MFW_CPHS_PARA * para)
367 {
368 TRACE_FUNCTION("cphs_sign_exec()");
369
370 while (cur_elem)
371 {
372 if (cur_elem->type == MfwTypCphs)
373 {
374 T_MFW_CPHS *cphs_data;
375
376 cphs_data = (T_MFW_CPHS *) cur_elem->data;
377 if (cphs_data->emask & event)
378 {
379 cphs_data->event = event;
380 TRACE_EVENT_P1("cphs_sign_exec():event=%d",event);
381 switch (event)
382 {
383 case E_CPHS_IND:
384 memcpy(&cphs_data->para.stat, para, sizeof(T_MFW_CPHS_STATUS));
385 break;
386 case E_CPHS_OP_NAME:
387 memcpy(&cphs_data->para.oper_name, para, sizeof(T_MFW_CPHS_OP_NAME));
388 break;
389 case E_CPHS_GET_VC_NUM:
390 memcpy(&cphs_data->para.vc_entry, para, sizeof(T_MFW_CPHS_VC_NUM));
391 break;
392 case E_CPHS_SET_VC_NUM:
393 memcpy(&cphs_data->para.result, para, sizeof(UBYTE));
394 break;
395 case E_CPHS_GET_VC_STAT:
396 memcpy(&cphs_data->para.vc_status, para, sizeof(T_MFW_CPHS_VC_STAT));
397 break;
398 case E_CPHS_SET_VC_STAT:
399 memcpy(&cphs_data->para.result, para, sizeof(UBYTE));
400 break;
401 case E_CPHS_GET_DV_STAT:
402 memcpy(&cphs_data->para.dv_status, para, sizeof(T_MFW_CPHS_DV_STAT));
403 break;
404 case E_CPHS_SET_DV_STAT:
405 memcpy(&cphs_data->para.result, para, sizeof(UBYTE));
406 break;
407 case E_CPHS_GET_ALS_STATUS:
408 memcpy(&cphs_data->para.als_status, para, sizeof(T_MFW_CPHS_ALS_STATUS));
409 break;
410 case E_CPHS_SET_LINE:
411 memcpy(&cphs_data->para.result, para, sizeof(UBYTE));
412 break;
413 case E_CPHS_GET_CSP:
414 memcpy(&cphs_data->para.csp, para, sizeof(T_MFW_CPHS_CSP));
415 break;
416 case E_CPHS_GET_INFO_LIST:
417 memcpy(&cphs_data->para.num_list, para, sizeof(T_MFW_CPHS_INFONUM_LIST));
418 break;
419 case E_CPHS_GET_INFO_NUM:
420 memcpy(&cphs_data->para.info_entry, para, sizeof(T_MFW_CPHS_INFONUM_ENTRY));
421 break;
422 case E_CPHS_GET_SIM_FIELD://MC added for generic read function
423 memcpy(&cphs_data->para.read_sim_entry, para, sizeof(T_MFW_CPHS_READ_SIM_ENTRY));
424 break;
425 case E_CPHS_SET_SIM_FIELD://MC added for generic read function
426 memcpy(&cphs_data->para.read_sim_entry, para, sizeof(T_MFW_CPHS_READ_SIM_ENTRY));
427 break;
428
429
430 }
431 if (cphs_data->handler)
432 {
433 // store current mfw elem
434 current_mfw_elem = cur_elem;
435
436 if ((*(cphs_data->handler)) (cphs_data->event, (void *) &cphs_data->para))
437 return TRUE;
438 }
439 }
440 }
441 cur_elem = cur_elem->next;
442 }
443
444 return FALSE;
445 }
446
447 /*
448 +--------------------------------------------------------------------+
449 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
450 | STATE : code ROUTINE : cphs_signal |
451 +--------------------------------------------------------------------+
452
453 PURPOSE : Send a signal
454
455 */
456
457 static void cphs_signal (MfwEvt event, void *para)
458 {
459 /*MC, SPR 1389, we have to enable the display whenever
460 we send an event up to the MMI*/
461
462 UBYTE temp=0;
463 #ifndef FF_POWER_MANAGEMENT
464 temp = dspl_Enable(0);
465 #else
466 /*OMAPS00098881 (removing power variant) a0393213(Prabakar)
467 display is enabled only when lcd refresh is needed*/
468 if(FFS_flashData.refresh == 1)
469 temp = dspl_Enable(0);
470 #endif
471
472 TRACE_FUNCTION("cphs_signal()");
473
474 if (mfwSignallingMethod EQ 0)
475 {
476 if (mfwFocus)
477 if (cphs_sign_exec(mfwFocus,event,para))
478 {
479 #ifndef FF_POWER_MANAGEMENT
480 dspl_Enable(temp);/*MC, SPR 1389*/
481 #else
482 /*OMAPS00098881 (removing power variant) a0393213(Prabakar)
483 display is enabled only when lcd refresh is needed*/
484 if(FFS_flashData.refresh == 1)
485 dspl_Enable(temp);/*MC, SPR 1389*/
486 #endif
487 return;
488 }
489 if (mfwRoot)
490 cphs_sign_exec(mfwRoot,event,para);
491 }
492 else
493 {
494 MfwHdr * h = 0;
495
496 /*
497 * Focus set, then start here
498 */
499 if (mfwFocus)
500 h = mfwFocus;
501 /*
502 * Focus not set, then start root
503 */
504 if (!h)
505 h = mfwRoot;
506
507 /*
508 * No elements available, return
509 */
510
511 while (h)
512 {
513 /*
514 * Signal consumed, then return
515 */
516 if (cphs_sign_exec (h, event, para))
517 {
518 #ifndef FF_POWER_MANAGEMENT
519 dspl_Enable(temp);/*MC, SPR 1389*/
520 #else
521 /*OMAPS00098881 (removing power variant) a0393213(Prabakar)
522 display is enabled only when lcd refresh is needed*/
523 if(FFS_flashData.refresh == 1)
524 dspl_Enable(temp);/*MC, SPR 1389*/
525 #endif
526 return;
527 }
528
529 /*
530 * All windows tried inclusive root
531 */
532 if (h == mfwRoot)
533 {
534 #ifndef FF_POWER_MANAGEMENT
535 dspl_Enable(temp);/*MC, SPR 1389*/
536 #else
537 /*OMAPS00098881 (removing power variant) a0393213(Prabakar)
538 display is enabled only when lcd refresh is needed*/
539 if(FFS_flashData.refresh == 1)
540 dspl_Enable(temp);/*MC, SPR 1389*/
541 #endif
542 return;
543 }
544
545 /*
546 * get parent window
547 */
548 h = mfwParent(mfwParent(h));
549 if(h)
550 h = ((MfwWin * )(h->data))->elems;
551 }
552 cphs_sign_exec(mfwRoot,event,para);
553 }
554 // Power Management
555 #ifndef FF_POWER_MANAGEMENT
556 dspl_Enable(temp);/*MC, SPR 1389*/
557 #else
558 /*OMAPS00098881 (removing power variant) a0393213(Prabakar)
559 display is enabled only when lcd refresh is needed*/
560 if(FFS_flashData.refresh == 1)
561 dspl_Enable(temp);/*MC, SPR 1389*/
562 #endif
563 }
564
565 /*
566 +--------------------------------------------------------------------+
567 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
568 | STATE : code ROUTINE: sendCPWIEvt |
569 +--------------------------------------------------------------------+
570
571
572 PURPOSE :this function sends the E_CPHS_GET_VC_STAT event if there is any voice mail
573 MMI doesn't read from the SIM, but will set the vc Status based on the input from ACI
574
575 */
576 //18 May, 2006 DR: OMAPS00070657 x0pleela
577 #ifdef FF_CPHS
578 void sendCPWIEvt( UBYTE flag_set, USHORT line )
579 {
580 T_MFW_CPHS_VC_STAT vc_stat;
581 TRACE_FUNCTION("sendCPWIEvt()");
582 //11/06/2006
583
584 vc_stat.line1 = MFW_CFLAG_NotPresent;
585 vc_stat.line2 = MFW_CFLAG_NotPresent;
586 vc_stat.data = MFW_CFLAG_NotPresent;
587 vc_stat.fax = MFW_CFLAG_NotPresent;
588
589 switch( line )
590 {
591 case CPHS_LINE1:
592 if( flag_set )
593 vc_stat.line1 = MFW_CFLAG_SET;
594 else
595 vc_stat.line1 = MFW_CFLAG_NOTSet;
596 break;
597
598 case CPHS_LINE2:
599 if( flag_set )
600 vc_stat.line2 = MFW_CFLAG_SET;
601 else
602 vc_stat.line2 = MFW_CFLAG_NOTSet;
603 break;
604
605 case CPHS_LINE_DATA:
606 if( flag_set )
607 vc_stat.data = MFW_CFLAG_SET;
608 else
609 vc_stat.data = MFW_CFLAG_NOTSet;
610 break;
611
612 case CPHS_LINE_FAX:
613 if( flag_set )
614 vc_stat.fax = MFW_CFLAG_SET;
615 else
616 vc_stat.fax = MFW_CFLAG_NOTSet;
617 break;
618
619 default:
620 vc_stat.line1 = MFW_CFLAG_NotPresent;
621 vc_stat.line2 = MFW_CFLAG_NotPresent;
622 vc_stat.data = MFW_CFLAG_NotPresent;
623 vc_stat.fax = MFW_CFLAG_NotPresent;
624 break;
625
626 }
627
628 cphs_signal(E_CPHS_GET_VC_STAT,(void*)&vc_stat);
629 }
630 #endif
631
632 /*
633 +--------------------------------------------------------------------+
634 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
635 | STATE : code ROUTINE: sendCFISEvt |
636 +--------------------------------------------------------------------+
637
638
639 PURPOSE :this function is used to signal CFIS event
640 */
641
642 #ifdef FF_CPHS_REL4
643 void sendCPHSSignal( UBYTE event, void* para)
644 {
645 TRACE_FUNCTION("sendCPHSSignal()");
646 cphs_signal(event,para);
647 }
648 #endif
649 /*
650 +--------------------------------------------------------------------+
651 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
652 | STATE : code ROUTINE : cphs_support_check |
653 +--------------------------------------------------------------------+
654
655 PURPOSE : Check whether CPHS is supported.
656
657 */
658
659 void cphs_support_check (void)
660 {
661 TRACE_FUNCTION ("cphs_support_check()");
662
663 /* Read CPHS information filed (6F16 - 3 bytes) from SIM card */
664 if (!cphs_read_sim_dat(SIM_CPHS_CINF, NOT_PRESENT_8BIT, MFW_CPHS_INFO_SIZE))
665 {
666 /* Read failed */
667 /*MC-CONQUEST5999->6007, 20/05/2002, set status to ERR rather than NotPresent*/
668 cphsStatus = CPHS_ERR;
669 TRACE_EVENT("CPHS, error reading support indication");
670 cphs_signal(E_CPHS_IND, &cphsStatus);
671 }
672 }
673
674 /*
675 +--------------------------------------------------------------------+
676 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
677 | STATE : code ROUTINE : cphs_config |
678 +--------------------------------------------------------------------+
679
680 PURPOSE : Request the Configuration of CPHS fields
681
682 */
683
684 T_MFW cphs_config (T_MFW_CPHS_INFO *cphs_info)
685 {
686 TRACE_FUNCTION ("cphs_config()");
687
688 if (cphs_info NEQ NULL /* AND
689 cphsStatus EQ MFW_CPHS_OK */ )
690 {
691 cphs_info->phase = cphsPhase;
692 cphs_info->csp = cphs_ssc(MFW_CPHS_CSP, cphsServTab);
693 cphs_info->mbNum = cphs_ssc(MFW_CPHS_MB_NUMBER, cphsServTab);
694
695 if (cphsPhase EQ 1) /* phase 1 only */
696 cphs_info->sst = cphs_ssc(MFW_CPHS_SST, cphsServTab);
697 else /* not support */
698 cphs_info->sst = NO_ALLOCATED;
699
700 if (cphsPhase EQ 2) /* phase 2 only */
701 {
702 cphs_info->opNS = cphs_ssc(MFW_CHPS_NAME_SHORT, cphsServTab);
703 cphs_info->iNum = cphs_ssc(MFW_CHPS_INFO_NUMBERS, cphsServTab);
704 }
705 else /* not support */
706 {
707 cphs_info->opNS = NO_ALLOCATED;
708 cphs_info->iNum = NO_ALLOCATED;
709 }
710 }
711 return cphsStatus;
712 }
713
714 /*
715 +--------------------------------------------------------------------+
716 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
717 | STATE : code ROUTINE : cphs_operator_name |
718 +--------------------------------------------------------------------+
719
720 PURPOSE : Request the network operator name
721
722 */
723
724 T_MFW cphs_operator_name (void)
725 {
726 TRACE_FUNCTION ("cphs_operator_name()");
727
728 /* Check CPHS support status */
729 if (cphsStatus EQ CPHS_NotPresent)
730 return cphsStatus;
731
732 /* Read operator name sring */
733 if (!cphs_read_sim_dat(SIM_CPHS_ONSTR, NOT_PRESENT_8BIT, MFW_CPHS_ONS_SIZE))
734 {
735 /* Read operator name sring failed */
736 opName.longName.len = 0;
737
738 /* Read operator name shortform */
739 if ((cphsPhase NEQ 2) OR
740 (cphs_ssc(MFW_CHPS_NAME_SHORT, cphsServTab) NEQ ALLOCATED_AND_ACTIVATED) OR
741 !cphs_read_sim_dat(SIM_CPHS_ONSHF, NOT_PRESENT_8BIT, MFW_CPHS_ONSF_SIZE) )
742 {
743 /* Read operator name shortform failed.
744 Send event with empty info to MMI */
745 opName.shortName.len = 0;
746 cphs_signal(E_CPHS_OP_NAME, &opName);
747 }
748 }
749 return cphsStatus;
750 }
751
752 /*
753 +--------------------------------------------------------------------+
754 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
755 | STATE : code ROUTINE : cphs_get_mailbox |
756 +--------------------------------------------------------------------+
757
758 PURPOSE : Request the Mailbox Numbers
759
760 */
761
762 void cphs_get_mailbox (void)
763 {
764 TRACE_FUNCTION ("cphs_get_mailbox()");
765
766 mbNum.count = 0;
767
768 /* Check CPHS support status.
769 When CPHS is not support, read mailbox numbers from EEPROM */
770 if (cphsStatus EQ CPHS_NotPresent)
771 {
772 cphs_read_eeprom_mailbox();
773 return;
774 }
775
776 /* Check CPHS service table.
777 When CPHS is not support, read mailbox numbers from EEPROM */
778 if (cphs_ssc(MFW_CPHS_MB_NUMBER, cphsServTab) NEQ ALLOCATED_AND_ACTIVATED)
779 {
780 cphs_read_eeprom_mailbox();
781 return;
782 }
783 /* Read mailbox numbers from SIM.
784 When this reading failed, read mailbox numbers from EEPROM */
785 if (!cphs_read_sim_rcd(SIM_CPHS_MBXN, 1, 0)) /* read the first record */
786 cphs_read_eeprom_mailbox();
787 }
788
789 static UBYTE cphs_write_sim_voicemail_rcd(void)
790 {
791 BOOL bSavePossible = FALSE;
792 UBYTE result = MFW_SIMOP_WRITE_OK;
793
794 TRACE_FUNCTION("cphs_write_sim_voicemail_rcd");
795
796 /* allocate mbnData (sizeof(dataLen)) */
797 // Mar 30, 2005 REF: CRR 29986 xpradipg
798 // the dynamic allocation is done here, if the write fails it is deallocated
799 // else if success it is deallocated in the callback
800 #ifdef FF_MMI_OPTIM
801 mbnData = (UBYTE*)mfwAlloc(200);
802 if(mbnData != NULL)
803 {
804 #endif
805 ubCphsMbExtRecNo = 0;
806 sFreeRec = 0;
807 ubCurrExtRcWrite = 0;
808 ubFlushRecords = 0;
809
810 bSavePossible = cphs_build_mbn_data(mbnData, vcEntry->datalen);
811
812 /**************************************************************************************/
813 /**************************************************************************************/
814 /* Check if enough EXT1 Records are available for storing the current number; If not, show Write Error */
815 if ( bSavePossible == FALSE )
816 {
817 result = MFW_SIMOP_WRITE_ERR;
818
819 TRACE_FUNCTION("cphs_write_sim_voicemail_rcd: notenuf EXT1recs");
820 cphs_signal(E_CPHS_SET_VC_NUM, &result);
821
822 // Mar 30, 2005 REF: CRR 29986 xpradipg
823 // mbnData is deallocated, on failure of write operation
824 #ifdef FF_MMI_OPTIM
825 if(mbnData)
826 mfwFree(mbnData,200);
827 #endif
828
829 return 0;
830 }
831 /**************************************************************************************/
832 /**************************************************************************************/
833
834 if (!cphs_write_sim_rcd(SIM_CPHS_MBXN, vcEntry->index,
835 mbnData, vcEntry->datalen))
836 {
837 cphs_write_eeprom_mailbox(vcEntry);
838 }
839 #ifdef FF_MMI_OPTIM
840 }
841 #endif
842
843 return 1;
844 }
845
846 /*
847 +--------------------------------------------------------------------+
848 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
849 | STATE : code ROUTINE : cphs_set_mailbox |
850 +--------------------------------------------------------------------+
851
852 PURPOSE : Save the Mailbox Numbers
853
854 */
855
856 T_MFW cphs_set_mailbox (T_MFW_CPHS_ENTRY *entry)
857 {
858
859 TRACE_FUNCTION ("cphs_set_mailbox()");
860
861 TRACE_EVENT_P1("no: %s", entry->number);
862
863 if (entry NEQ NULL AND
864 strlen((char *)entry->number) NEQ 0 )
865 /* PATCH JPS 16.01.01: must copy the data and not only point on it!! */
866 {
867 memcpy((char *)&MbnEntry, (char *)entry, sizeof(T_MFW_CPHS_ENTRY));
868 //vcEntry = entry;
869 vcEntry = &MbnEntry; // VO ???
870
871 }
872 else
873 return CPHS_ERR;
874
875 if ((entry->index <= 0) OR
876 (entry->index > 4) )
877 return CPHS_ERR;
878
879 /* Check CPHS support status.
880 When CPHS is not support, write mailbox numbers to EEPROM */
881 if (cphsStatus EQ CPHS_NotPresent)
882 {
883 cphs_write_eeprom_mailbox(entry);
884 //x0pleela 11 June, 2006 DR:OMAPS00079692
885 //changed from CPHS_OK to MFW_CPHS_OK
886 return MFW_CPHS_OK;
887 }
888
889 /* Check CPHS service table.
890 When CPHS is not support, write mailbox numbers to EEPROM */
891 if ( cphs_ssc(MFW_CPHS_MB_NUMBER, cphsServTab) NEQ ALLOCATED_AND_ACTIVATED)
892 {
893 cphs_write_eeprom_mailbox(entry);
894 //x0pleela 11 June, 2006 DR:OMAPS00079692
895 //changed from CPHS_OK to MFW_CPHS_OK
896 return MFW_CPHS_OK;
897 }
898
899 /* Read first record to determine the data length,
900 When the reading failed, write mailbox numbers to EEPROM */
901 // simStatus = MFW_SIMOP_WRITE_OK;
902 if (!cphs_write_sim_voicemail_rcd())
903 {
904 return CPHS_ERR;
905 }
906
907 //x0pleela 11 June, 2006 DR:OMAPS00079692
908 //changed from CPHS_OK to MFW_CPHS_OK
909 return MFW_CPHS_OK;
910 }
911
912 /*
913 +-------------------------------------------------------------------------+
914 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
915 | STATE : code ROUTINE : cphs_get_mailbox_status |
916 +-------------------------------------------------------------------------+
917
918 PURPOSE : get the voice message waiting flag
919
920 */
921
922 T_MFW cphs_get_mailbox_status ()
923 {
924 TRACE_FUNCTION ("cphs_get_mailbox_status()");
925
926
927 /* Read voice message waiting flag.
928 When this reading failed, send event with "read error" parameter to MMI */
929 if (!cphs_read_sim_dat(SIM_CPHS_VMW, NOT_PRESENT_8BIT, MFW_CPHS_MBS_SIZE))
930 {
931 mbStatus.result = MFW_SIMOP_READ_ERR;
932 cphs_signal(E_CPHS_GET_VC_STAT, &mbStatus);
933 }
934 return cphsStatus;
935 }
936 /*
937 +-------------------------------------------------------------------------+
938 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
939 | STATE : code ROUTINE : cphs_rel4_get_mailbox_status |
940 +-------------------------------------------------------------------------+
941
942 PURPOSE : get the voice message waiting flag
943
944 */
945 #ifdef FF_CPHS_REL4
946 void cphs_rel4_get_mailbox_status()
947 {
948 TRACE_FUNCTION("cphs_rel4_get_mailbox_status");
949 qAT_PercentMWIS(CMD_SRC_LCL,0xFF);/*mspId is set to FF to get MWIS for all profiles*/
950 }
951
952 T_MFW_CPHS_REL4_MWIS* get_mwis_stat(int profile)
953 {
954 return &mwis_stat[profile -1];
955 }
956 #endif
957 /*
958 +-------------------------------------------------------------------------+
959 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
960 | STATE : code ROUTINE : cphs_set_mailbox_status |
961 +-------------------------------------------------------------------------+
962
963 PURPOSE : Save the voice message waiting flag
964
965 */
966
967 T_MFW cphs_set_mailbox_status (T_MFW_CFLAG_STATUS line1,
968 T_MFW_CFLAG_STATUS line2,
969 T_MFW_CFLAG_STATUS fax,
970 T_MFW_CFLAG_STATUS data)
971 {
972 UBYTE result;
973
974 TRACE_FUNCTION ("cphs_set_mailbox_status()");
975
976 /* Check CPHS support status. */
977 if (cphsStatus EQ CPHS_NotPresent)
978 {
979 TRACE_EVENT("cphsStatus is CPHS_NotPresent !");
980 return cphsStatus;
981 }
982
983 /* Write status in buffer */
984 if (line1 EQ MFW_CFLAG_SET OR
985 line1 EQ MFW_CFLAG_NOTSet )
986 { mbsData[0] &=0xF0; //zero the lower nibble
987 mbsData[0] |= line1&0x0F; /* low Nibble */
988 }
989 /*else
990 mbsData[0] = 0x0F;*/
991
992 if (line2 EQ MFW_CFLAG_SET OR
993 line2 EQ MFW_CFLAG_NOTSet )
994 { mbsData[0]&=0x0F;
995 mbsData[0] |= (line2 << 4)&0xF0;; /* high Nibble */
996 }
997
998 if (fax EQ MFW_CFLAG_SET OR
999 fax EQ MFW_CFLAG_NOTSet )
1000 { mbsData[1] &= 0xF0; //zero the low nibble
1001 mbsData[1] |= fax&0x0F; /* low Nibble */
1002 }
1003
1004 if (data EQ MFW_CFLAG_SET OR
1005 data EQ MFW_CFLAG_NOTSet )
1006 { mbsData[1] &= 0x0F; //zero the high nibble
1007 mbsData[1] |= (data << 4)&0xF0; /* high Nibble */
1008 }
1009
1010 /* Read voice message waiting flag to determine the size */
1011 simStatus = MFW_SIMOP_WRITE_OK;
1012 if (!cphs_read_sim_dat(SIM_CPHS_VMW, NOT_PRESENT_8BIT, MFW_CPHS_MBS_SIZE))
1013 {
1014 result = MFW_SIMOP_WRITE_ERR;
1015 cphs_signal(E_CPHS_SET_VC_STAT, &result);
1016 }
1017 /* PATCH VO 22.01.01 end */
1018 return cphsStatus;
1019 }
1020
1021 /*
1022 +------------------------------------------------------------------------+
1023 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1024 | STATE : code ROUTINE : cphs_get_divert_status |
1025 +------------------------------------------------------------------------+
1026
1027 PURPOSE : Request the call forwarding flags
1028
1029 */
1030
1031 T_MFW cphs_get_divert_status ()
1032 {
1033 TRACE_FUNCTION ("cphs_get_divert_status()");
1034
1035
1036 /* Read call forwarding flags.
1037 When this reading failed, send event with "read error" parameter to MMI */
1038 /*a0393213 cphs rel4 - when EF(CFIS) is present call sAT_PercentCFIS to get CFIS*/
1039 #ifdef FF_CPHS_REL4
1040 if(sim_serv_table_check((UBYTE)SRV_No_55) != ALLOCATED_AND_ACTIVATED )
1041 {
1042 #endif
1043
1044 if (!cphs_read_sim_dat(SIM_CPHS_CFF, NOT_PRESENT_8BIT, MFW_CPHS_CFF_SIZE))
1045 {
1046 dvStatus.result = MFW_SIMOP_READ_ERR;
1047 cphs_signal(E_CPHS_GET_DV_STAT, &dvStatus);
1048 }
1049 #ifdef FF_CPHS_REL4
1050 }
1051 else
1052 {
1053 UBYTE mspId=mfw_cphs_get_reg_profile();
1054 TRACE_EVENT_P1("msp id %d", mspId);
1055 /*needs clarification regarding third and fourth parameters*/
1056 sAT_PercentCFIS(CMD_SRC_LCL, CFIS_MOD_Read, mspId , mspId, 0, NULL, NULL, 0);
1057 }
1058 #endif
1059 return cphsStatus;
1060 }
1061
1062 /*
1063 +-------------------------------------------------------------------------+
1064 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1065 | STATE : code ROUTINE : cphs_set_divert_status |
1066 +-------------------------------------------------------------------------+
1067
1068 PURPOSE : Save the call forwarding flag
1069
1070 */
1071
1072 T_MFW cphs_set_divert_status (T_MFW_CFLAG_STATUS line1,
1073 T_MFW_CFLAG_STATUS line2,
1074 T_MFW_CFLAG_STATUS fax,
1075 T_MFW_CFLAG_STATUS data)
1076 {
1077 UBYTE result;
1078
1079 TRACE_EVENT_P4 ("cphs_set_divert_status() %d %d %d %d",line1,line2,fax,data);
1080
1081
1082 /* Write status in buffer */
1083 if (line1 EQ MFW_CFLAG_SET OR
1084 line1 EQ MFW_CFLAG_NOTSet )
1085 { dvData[0]&= 0xF0; //zero the lower nibble
1086 dvData[0] |= line1&0x0F; /* low Nibble */
1087 }
1088
1089 if (line2 EQ MFW_CFLAG_SET OR
1090 line2 EQ MFW_CFLAG_NOTSet )
1091 { dvData[0]&= 0x0F;
1092 dvData[0] |= (line2 << 4)&0xF0; /* high Nibble */
1093 }
1094
1095 if (fax EQ MFW_CFLAG_SET OR
1096 fax EQ MFW_CFLAG_NOTSet )
1097 { dvData[1]&= 0xF0; //zero the lower nibble
1098 dvData[1] |= fax&0x0F; /* low Nibble */
1099 }
1100
1101
1102 if (data EQ MFW_CFLAG_SET OR
1103 data EQ MFW_CFLAG_NOTSet )
1104 { dvData[1] &=0x0F;
1105 dvData[1] |= (data << 4)&0xF0; /* high Nibble */
1106 }
1107
1108 /* Read call forwarding flag to determine the size */
1109 simStatus = MFW_SIMOP_WRITE_OK;
1110 if (!cphs_read_sim_dat(SIM_CPHS_CFF, NOT_PRESENT_8BIT, MFW_CPHS_CFF_SIZE))
1111 {
1112 TRACE_EVENT("cphs_set_divert_status:cphs_read_sim_dat failed");
1113 result = MFW_SIMOP_WRITE_ERR;
1114 cphs_signal(E_CPHS_SET_DV_STAT, &result);
1115 }
1116 return cphsStatus;
1117 }
1118
1119
1120 /*
1121 +-------------------------------------------------------------------------+
1122 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1123 | STATE : code ROUTINE : cphs_rel4_set_divert_status |
1124 +-------------------------------------------------------------------------+
1125
1126 PURPOSE : Save the call forwarding flag into SIM by calling sAT_PercentCFIS
1127 PARAMETERS: voice - call forward status for voice
1128 fax - call forward status for fax
1129 data - call forward status for data
1130
1131 */
1132 #ifdef FF_CPHS_REL4
1133 T_MFW cphs_rel4_set_divert_status(T_MFW_CFLAG_STATUS voice, T_MFW_CFLAG_STATUS fax,
1134 T_MFW_CFLAG_STATUS data, char number[PHB_MAX_LEN])
1135 {
1136 UBYTE mspId=mfw_cphs_get_reg_profile();
1137 UBYTE cfuStat=0x00;
1138
1139 TRACE_FUNCTION("cphs_rel4_set_divert_status");
1140 TRACE_EVENT_P4("voice - %d, fax - %d, data - %d, number - %s", voice, fax, data, number);
1141 TRACE_EVENT_P1("msp id %d",mspId);
1142
1143 cfuStat= cfuStat | (voice == MFW_CFLAG_SET) | ((fax==MFW_CFLAG_SET)<<1) | ((data==MFW_CFLAG_SET)<<2);
1144
1145 /*check third, fourth, sixth, seventh and eight parameters, number convert to 10 digit, TOA - psaSAT_getTonNpi is a local fn in ACI*/
1146 sAT_PercentCFIS( CMD_SRC_LCL,
1147 CFIS_MOD_Write,
1148 mspId,
1149 mspId,
1150 cfuStat,
1151 number,
1152 NULL,
1153 0xFF);
1154 return cphsStatus;
1155
1156
1157 }
1158 #endif
1159
1160
1161
1162 /*
1163 +---------------------------------------------------------------------+
1164 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1165 | STATE : code ROUTINE : cphs_get_als_info |
1166 +---------------------------------------------------------------------+
1167
1168 PURPOSE : Request the Status of Alternate Line Service information
1169 (first read selected ALS line, dann status of this line).
1170 When the field does not exist in SIM, read it from EEPROM.
1171
1172 */
1173
1174 void cphs_get_als_info (T_MFW_CPHS_ALS_STATUS *info)
1175 {
1176 TRACE_FUNCTION ("cphs_get_als_info()");
1177
1178 /* read alternate line service from EEPROM */
1179 cphs_read_eeprom_als(info);
1180
1181 cphs_signal(E_CPHS_GET_ALS_STATUS, &alsStatus);
1182 }
1183
1184 /*
1185 +---------------------------------------------------------------------+
1186 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1187 | STATE : code ROUTINE : cphs_select_line |
1188 +---------------------------------------------------------------------+
1189
1190 PURPOSE : Select the current used line. When the field does not
1191 exist in SIM, read it from EEPROM.
1192
1193 */
1194
1195 void cphs_select_line (T_MFW_LINE_INDEX line)
1196 {
1197 UBYTE result;
1198 T_ACI_ALS_MOD alsMode=ALS_MOD_NOTPRESENT;
1199
1200 TRACE_EVENT_P1 ("cphs_select_line() %d",line);
1201
1202 if (line NEQ MFW_SERV_LINE1 AND
1203 line NEQ MFW_SERV_LINE2 )
1204 {
1205 result = MFW_SIMOP_WRITE_ERR;
1206 cphs_signal(E_CPHS_SET_LINE, &result);
1207 return;
1208 }
1209
1210 alsData = (UBYTE) line;
1211
1212
1213 /* write alternate line service in EEPROM */
1214 cphs_write_eeprom_als(&result);
1215
1216 if (line EQ MFW_SERV_LINE1)
1217 alsMode = ALS_MOD_SPEECH;
1218 if (line EQ MFW_SERV_LINE2)
1219 alsMode = ALS_MOD_AUX_SPEECH;
1220 sAT_PercentALS(CMD_SRC_LCL, alsMode);
1221
1222 cphs_signal(E_CPHS_SET_LINE, &result);
1223 }
1224
1225 /*
1226 +---------------------------------------------------------------------+
1227 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1228 | STATE : code ROUTINE : cphs_set_als_status |
1229 +---------------------------------------------------------------------+
1230
1231 PURPOSE : Change the lock status of the line. When the field does
1232 not exist in SIM, read it from EEPROM.
1233
1234 */
1235
1236 T_MFW cphs_set_als_status (T_MFW_LINE_STATUS status)
1237 {
1238 UBYTE result;
1239 T_MFW_SIM_PIN_STATUS pinStatus;
1240
1241 TRACE_FUNCTION ("cphs_set_als_status()");
1242
1243 /* check PIN 2 requirement */
1244 pinStatus.type = MFW_SIM_PIN2;
1245 sim_pin_status(&pinStatus);
1246 if (pinStatus.stat NEQ MFW_SIM_NO_PIN)
1247 return MFW_SIM_PIN2_REQ;
1248
1249 /* check given parameter */
1250 if (status NEQ MFW_LINE_LOCKED AND
1251 status NEQ MFW_LINE_UNLOCKED )
1252 {
1253 result = MFW_SIMOP_WRITE_ERR;
1254 cphs_signal(E_CPHS_SET_ALS_STATUS, &result);
1255 return CPHS_ERR;
1256 }
1257
1258 alsData = (UBYTE) status;
1259
1260 /* write lock status in EEPROM */
1261 cphs_write_eeprom_alss(&result);
1262 cphs_signal(E_CPHS_SET_LINE, &result);
1263 //x0pleela 11 June, 2006 DR:OMAPS00079692
1264 //changed from CPHS_OK to MFW_CPHS_OK
1265 return MFW_CPHS_OK;
1266 }
1267
1268 /*
1269 +---------------------------------------------------------------------+
1270 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1271 | STATE : code ROUTINE : cphs_get_csp |
1272 +---------------------------------------------------------------------+
1273
1274 PURPOSE : Request the customer service profile
1275
1276 */
1277
1278 T_MFW cphs_get_csp ()
1279 {
1280 UBYTE res;
1281
1282 TRACE_FUNCTION ("cphs_get_csp()");
1283
1284
1285 /* check CPHS service table */
1286 res = cphs_ssc(MFW_CPHS_CSP, cphsServTab);
1287 if ( res NEQ ALLOCATED_AND_ACTIVATED)
1288 return res;
1289
1290 /* Read customer service profile.
1291 When this reading failed, send event with empty parameter array to MMI */
1292 if (!cphs_read_sim_dat(SIM_CPHS_CSP, NOT_PRESENT_8BIT, MFW_CPHS_CSP_SIZE))
1293 {
1294 csProfile.result = MFW_SIMOP_READ_ERR;
1295 memset(csProfile.csp, 0, sizeof(csProfile.csp));
1296 cphs_signal(E_CPHS_GET_CSP, &csProfile);
1297 }
1298
1299 return cphsStatus;
1300 }
1301
1302 /*
1303 +---------------------------------------------------------------------+
1304 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1305 | STATE : code ROUTINE : cphs_get_info_num |
1306 +---------------------------------------------------------------------+
1307
1308 PURPOSE : Request information numbers directory
1309
1310 */
1311
1312 T_MFW cphs_get_info_num (UBYTE level, UBYTE startIndex)
1313 {
1314 // UBYTE res; // RAVI
1315 T_MFW_CPHS_INFO cf_info;
1316
1317 TRACE_FUNCTION ("cphs_get_info_num()");
1318
1319
1320 if (level < 1 OR
1321 startIndex < 1 )
1322 return CPHS_ERR;
1323 cphs_config(&cf_info);
1324
1325
1326 /* Read customer service profile to check
1327 whether information numbers are supported. */
1328 numList.count = 0;
1329 idxLevel = level;
1330 startIdx = startIndex;
1331 simStatus = MFW_SIMOP_READ_OK;
1332 if (!cphs_read_sim_dat(SIM_CPHS_CSP, NOT_PRESENT_8BIT, MFW_CPHS_CSP_SIZE))
1333 {
1334 simStatus = MFW_SIMOP_UNKNOWN;
1335 TRACE_EVENT("Can't read CSP for info nums");
1336 return CPHS_NotPresent;
1337 }
1338
1339 return cphsStatus;
1340 }
1341
1342 /*
1343 +----------------------------------------------------------------------+
1344 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1345 | STATE : code ROUTINE : cphs_select_info_num |
1346 +----------------------------------------------------------------------+
1347
1348 PURPOSE : read a information number entry
1349
1350 */
1351
1352 T_MFW cphs_select_info_num (UBYTE index)
1353 {
1354 TRACE_FUNCTION ("cphs_select_info_num()");
1355
1356
1357 /* Read a information number entry.
1358 When this reading failed, send event with "read error" parameter to MMI */
1359 simStatus = MFW_SIMOP_READ_OK;
1360 startIdx = index;
1361
1362 // By now we know if 6F19 or EA01 are present for reading info. num entries from
1363 // So lets use this knowledge.
1364
1365 if (cphsPrevRead == SIM_CPHS_INFN)
1366 {
1367 if (!cphs_read_sim_rcd(SIM_CPHS_INFN, 1, 0))
1368 {
1369 infoEntry.result = MFW_SIMOP_READ_ERR;
1370 cphs_signal(E_CPHS_GET_INFO_NUM, &infoEntry);
1371 TRACE_EVENT("Error reading single info num");
1372 }
1373 else
1374 {
1375 cphsPrevRead = SIM_CPHS_INFN;
1376 }
1377 }
1378 else
1379 {
1380 if (cphsPrevRead == SIM_CPHS_INFN2)
1381 {
1382 if (!cphs_read_sim_rcd(SIM_CPHS_INFN2, 1, 0))
1383 {TRACE_EVENT("Error reading single info num 2");
1384 infoEntry.result = MFW_SIMOP_READ_ERR;
1385 cphs_signal(E_CPHS_GET_INFO_NUM, &infoEntry);
1386 }
1387 else
1388 {
1389 cphsPrevRead = SIM_CPHS_INFN2;
1390 }
1391 }
1392 }
1393 return cphsStatus;
1394 }
1395
1396 /*
1397 +-----------------------------------------------------------------------+
1398 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1399 | STATE : code ROUTINE : cphs_read_information |
1400 +-----------------------------------------------------------------------+
1401
1402 PURPOSE : Read CPHS information
1403
1404 */
1405 //x0018858 OMAPS00062632 The errcode type has been modified from SHORT to USHORT.
1406 void cphs_read_information(USHORT errCode, UBYTE *data, UBYTE dataLen)
1407 {
1408 UBYTE *ptr;
1409 /* PATCH VO 22.01.01: copy CPHS service table according to
1410 the actual length in the SIM card */
1411 UBYTE len;
1412 /* PATCH VO 22.01.01 END */
1413
1414 TRACE_FUNCTION ("cphs_read_information()");
1415
1416 ptr = data;
1417 /* PATCH VO 22.01.01: copy CPHS service table according to
1418 the actual length in the SIM card */
1419 len = dataLen;
1420 memset(cphsServTab, 0, sizeof(cphsServTab));
1421 /* PATCH VO 22.01.01 END */
1422 #ifdef FF_2TO1_PS
1423 if ( errCode NEQ CAUSE_SIM_NO_ERROR OR
1424 #else
1425 if ( errCode NEQ SIM_NO_ERROR OR
1426 #endif
1427 ptr EQ NULL OR
1428 dataLen <= 0) /* PATCH VO 22.01.01: not check a certain length */
1429 {
1430 cphs_signal(E_CPHS_IND, &cphsStatus);
1431 }
1432 else
1433 {
1434 cphsPhase = *ptr;
1435 len--;
1436 if (len > 0)
1437 {
1438 ptr++;
1439 memcpy (cphsServTab, ptr, MINIMUM(len, CPHS_SERVICE_TABLE));
1440 }
1441 /* PATCH VO 22.01.01 END */
1442 //x0pleela 11 June, 2006 DR:OMAPS00079692
1443 //changed from CPHS_OK to MFW_CPHS_OK
1444 cphsStatus = MFW_CPHS_OK;
1445 TRACE_EVENT("CPHS supported");
1446 cphs_signal(E_CPHS_IND, &cphsStatus);
1447 }
1448 }
1449
1450 /*
1451 +-----------------------------------------------------------------------+
1452 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1453 | STATE : code ROUTINE : cphs_read_ons |
1454 +-----------------------------------------------------------------------+
1455
1456 PURPOSE : Read operator name short form
1457
1458 */
1459 void cphs_read_ons(USHORT errCode, UBYTE *data, UBYTE dataLen)
1460 {
1461 UBYTE *ptr;
1462
1463 TRACE_FUNCTION ("cphs_read_ons()");
1464
1465 ptr = data;
1466 #ifdef FF_2TO1_PS
1467 if ( errCode NEQ CAUSE_SIM_NO_ERROR OR
1468 #else
1469 if ( errCode NEQ SIM_NO_ERROR OR
1470 #endif
1471 ptr EQ NULL OR
1472 // dataLen < MFW_CPHS_ONS_SIZE )
1473 dataLen <= 0 ) /* PATCH VO 22.01.01: not check a certain length */
1474 {
1475 opName.longName.len = 0;
1476 }
1477 else
1478 {
1479 cmhPHB_getMfwTagNt(ptr, (UBYTE)MINIMUM(LONG_NAME, dataLen),
1480 opName.longName.data, &opName.longName.len);
1481 opName.longName.dcs = MFW_DCS_SIM;
1482
1483 /* Read operator name shortform */
1484 if ((cphsPhase NEQ 2) OR
1485 (cphs_ssc(MFW_CHPS_NAME_SHORT, cphsServTab) NEQ ALLOCATED_AND_ACTIVATED) OR
1486 !cphs_read_sim_dat(SIM_CPHS_ONSHF, NOT_PRESENT_8BIT, MFW_CPHS_ONSF_SIZE) )
1487 {
1488 opName.shortName.len = 0;
1489 if (opName.longName.len != 0)
1490 TRACE_EVENT("Got a long name!!!");
1491 cphs_signal(E_CPHS_OP_NAME, &opName);
1492 }
1493 }
1494 }
1495
1496 /*
1497 +-----------------------------------------------------------------------+
1498 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1499 | STATE : code ROUTINE : cphs_read_onsf |
1500 +-----------------------------------------------------------------------+
1501
1502 PURPOSE : Read operator name short form
1503
1504 */
1505 void cphs_read_onsf(USHORT errCode, UBYTE *data, UBYTE dataLen)
1506 {
1507 UBYTE *ptr;
1508
1509 TRACE_FUNCTION ("cphs_read_onsf()");
1510
1511 ptr = data;
1512 #ifdef FF_2TO1_PS
1513 if ( errCode NEQ CAUSE_SIM_NO_ERROR OR
1514 #else
1515 if ( errCode NEQ SIM_NO_ERROR OR
1516 #endif
1517 ptr EQ NULL OR
1518 dataLen < MFW_CPHS_ONSF_SIZE )
1519 {
1520 opName.shortName.len = 0;
1521 }
1522 else
1523 {
1524 cmhPHB_getMfwTagNt(ptr, MFW_CPHS_ONSF_SIZE,
1525 opName.shortName.data, &opName.shortName.len);
1526 opName.shortName.dcs = MFW_DCS_SIM;
1527 TRACE_EVENT("Got a short Name");
1528 }
1529
1530 cphs_signal(E_CPHS_OP_NAME, &opName);
1531 }
1532
1533 /*
1534 +-----------------------------------------------------------------------+
1535 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1536 | STATE : code ROUTINE : cphs_read_mbn |
1537 +-----------------------------------------------------------------------+
1538
1539 PURPOSE : Read mailbox numbers
1540
1541 */
1542
1543 void cphs_read_mbn(SHORT table_id)
1544 {
1545 UBYTE* pData; /* points to data buffer */
1546 UBYTE alphaLen;
1547 UBYTE dataLen;
1548 T_ACI_TOA type;
1549
1550 TRACE_FUNCTION ("cphs_read_mbn()");
1551
1552 pData = simShrdPrm.atb[table_id].exchData;
1553 dataLen = simShrdPrm.atb[table_id].dataLen;
1554 /*June 27,2007 OMAPS00134788 x0066814(Geetha)*/
1555 curr_recNr = simShrdPrm.atb[table_id].recNr;
1556
1557 TRACE_EVENT_P1("curr_recNr: %d", curr_recNr);
1558
1559 TRACE_EVENT_P1("dataLen: %d", dataLen);
1560
1561 #ifdef FF_2TO1_PS
1562 if ( simShrdPrm.atb[table_id].errCode NEQ CAUSE_SIM_NO_ERROR OR
1563 #else
1564 if ( simShrdPrm.atb[table_id].errCode NEQ SIM_NO_ERROR OR
1565 #endif
1566 pData EQ NULL OR
1567 dataLen < MFW_CPHS_MIN_MBN_SIZE )
1568 {
1569 /*June 27,2007 OMAPS00134788 x0066814(Geetha)*/
1570 if (curr_recNr <= 1)
1571 {
1572 cphs_read_eeprom_mailbox();
1573 return;
1574 }
1575 else
1576 {
1577 cphs_signal(E_CPHS_GET_VC_NUM, &mbNum);
1578 }
1579 }
1580 else /* no read error */
1581 {
1582 /*June 27,2007 OMAPS00134788 x0066814(Geetha)*/
1583 if (curr_recNr EQ 1)
1584 {
1585 maxRec = simShrdPrm.atb[table_id].recMax;
1586 }
1587
1588 if ( dataLen >= MFW_CPHS_MIN_MBN_SIZE )
1589 {
1590 alphaLen = dataLen - MFW_CPHS_MIN_MBN_SIZE;
1591 }
1592 else
1593 {
1594 alphaLen = 0;
1595 }
1596
1597 /* Copy/encode data */
1598 if ( ( *(pData + alphaLen) > 0 ) /* If Length of the contents is > 0 */
1599 &&
1600 ( *(pData + alphaLen) <= 11 )
1601 )
1602 {
1603 /*June 27,2007 OMAPS00134788 x0066814(Geetha)*/
1604 mbNum.entries[mbNum.count].index = curr_recNr;
1605
1606 mbNum.entries[mbNum.count].datalen = dataLen;
1607
1608 TRACE_EVENT_P1("mbNum.count: %d", mbNum.count);
1609
1610 TRACE_EVENT_P1("mbNum.entries[mbNum.count].index: %d", mbNum.entries[mbNum.count].index);
1611
1612 cmhPHB_getMfwTagNt(pData, alphaLen,
1613 mbNum.entries[mbNum.count].alpha.data,
1614 &mbNum.entries[mbNum.count].alpha.len);
1615 pData += alphaLen;
1616
1617 if ( *(pData) > 1 )
1618 {
1619 cmhPHB_getAdrStr ( (CHAR *)mbNum.entries[mbNum.count].number,
1620 PHB_MAX_LEN - 1,
1621 pData + 2,
1622 *pData );
1623 }
1624 else
1625 {
1626 memset ( (void *)mbNum.entries[mbNum.count].number, 0, PHB_MAX_LEN );
1627 }
1628
1629 cmhPHB_toaDmrg ( *( pData + 1 ), &type );
1630 mbNum.entries[mbNum.count].ton = phb_cvtTon(type.ton);
1631 mbNum.entries[mbNum.count].npi = phb_cvtNpi(type.npi);
1632
1633 mbNum.entries[mbNum.count].ext_rec_number = 0;
1634
1635 TRACE_EVENT_P1("dataLen: %d", dataLen);
1636
1637 TRACE_EVENT_P1("alphaLen: %d", alphaLen);
1638
1639 TRACE_EVENT_P2("cphs_read_mbn: idx, ext_rec_number: %d, %d", mbNum.count, mbNum.entries[mbNum.count].ext_rec_number);
1640
1641 pData += 12;
1642
1643 if ( *pData NEQ 0xFF )
1644 {
1645 /* read bearer capability EF */
1646 /* return; */
1647 }
1648
1649 /*June 27,2007 OMAPS00134788 x0066814(Geetha)*/
1650 pData += 1;
1651
1652 if ( *pData NEQ 0xFF )
1653 {
1654 /*Read EXT1 EF */
1655 UBYTE rcd_no;
1656 rcd_no= *pData;
1657 mbNum.entries[mbNum.count].ext_rec_idx[mbNum.entries[mbNum.count].ext_rec_number] = rcd_no;
1658
1659 if(!cphs_read_sim_rcd(SIM_EXT1,rcd_no,UCHAR_MAX))
1660 {
1661 /*Append the extension data to mailbox number*/
1662 TRACE_FUNCTION("EXTENSION RECORD PRESENT");
1663 }
1664 else
1665 {
1666 /*EXT1 record is being read. Wait the corr callback.*/
1667 return;
1668 }
1669 }
1670
1671 mbNum.count++;
1672
1673 }
1674
1675 curr_recNr++;
1676 if (curr_recNr > maxRec)
1677 {
1678 TRACE_EVENT("got CPHS MAilbox nos");
1679 cphs_signal(E_CPHS_GET_VC_NUM, &mbNum);
1680 }
1681 else
1682 {
1683 /* Read the next entry */
1684 if (!cphs_read_sim_rcd(SIM_CPHS_MBXN, curr_recNr, UCHAR_MAX))
1685 {
1686 cphs_signal(E_CPHS_GET_VC_NUM, &mbNum);
1687 }
1688 }
1689 }
1690 }
1691
1692 /*
1693 +-----------------------------------------------------------------------+
1694 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1695 | STATE : code ROUTINE : cphs_read_ext1 |
1696 +-----------------------------------------------------------------------+
1697
1698 PURPOSE : Read EXT1 record for mailbox numbers
1699
1700 */
1701 /*June 27,2007 OMAPS00134788 x0066814(Geetha)*/
1702 void cphs_read_ext1(SHORT table_id)
1703 {
1704 UBYTE* pData; /* points to data buffer */
1705 UBYTE alphaLen;
1706 UBYTE dataLen;
1707 UBYTE recNr;
1708 UBYTE ext_rec_no;
1709 T_ACI_TOA type;
1710 UBYTE ext1num[PHB_MAX_LEN];
1711
1712 TRACE_FUNCTION ("cphs_read_ext1()");
1713
1714 pData = simShrdPrm.atb[table_id].exchData;
1715 dataLen = simShrdPrm.atb[table_id].dataLen;
1716 recNr = simShrdPrm.atb[table_id].recNr;
1717
1718 if ( *pData EQ 0x02 ) //implies that the EF conatins additional data
1719 {
1720
1721 /*Extract ext data*/
1722 if(*(pData+1) NEQ 0xFF)
1723 {
1724 alphaLen=*(pData+1);
1725 cmhPHB_getAdrStr ( (CHAR *)ext1num,
1726 PHB_MAX_LEN - 1,
1727 pData + 2,
1728 *(pData+1) );
1729
1730 strncat( (CHAR *)mbNum.entries[mbNum.count].number, (CHAR *)ext1num,
1731 strlen((CHAR *)ext1num) );
1732
1733 mbNum.entries[mbNum.count].ext_rec_number++;
1734
1735 TRACE_EVENT_P2("cphs_read_ext1: idx, ext_rec_number: %d, %d", mbNum.count, mbNum.entries[mbNum.count].ext_rec_number);
1736
1737 if ( *(pData + 12) == 0xFF )
1738 {
1739 //return control to mbn
1740 curr_recNr++;
1741
1742 mbNum.count++;
1743
1744 if (curr_recNr > maxRec)
1745 {
1746 TRACE_EVENT("got CPHS MAilbox nos-2");
1747 cphs_signal(E_CPHS_GET_VC_NUM, &mbNum);
1748 }
1749 else
1750 {
1751 if(!cphs_read_sim_rcd(SIM_CPHS_MBXN, curr_recNr, UCHAR_MAX))
1752 {
1753 TRACE_FUNCTION("Control Back to mbn-1");
1754 return;
1755 }
1756 }
1757 }
1758 else
1759 {
1760 ext_rec_no = *(pData + 12);
1761
1762 mbNum.entries[mbNum.count].ext_rec_idx[mbNum.entries[mbNum.count].ext_rec_number] = ext_rec_no;
1763
1764 if(!cphs_read_sim_rcd(SIM_EXT1,ext_rec_no,UCHAR_MAX))
1765 {
1766 /*Append the extension data to mailbox number*/
1767 TRACE_FUNCTION( " MORE EXTENSION RECORDS PRESENT -But read Error");
1768
1769 curr_recNr++;
1770
1771 mbNum.count++;
1772
1773 if(!cphs_read_sim_rcd(SIM_CPHS_MBXN, curr_recNr, UCHAR_MAX))
1774 {
1775 TRACE_FUNCTION("Control Back to mbn-2");
1776 return;
1777 }
1778 }
1779 }
1780 }
1781 }
1782 else
1783 ;
1784
1785 return;
1786 }
1787
1788 /*
1789 +-----------------------------------------------------------------------+
1790 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1791 | STATE : code ROUTINE : cphs_rel4_get_mailbox_id |
1792 +-----------------------------------------------------------------------+
1793
1794 PURPOSE : Get mailbox identifiers for the registered profile
1795
1796 */
1797 #ifdef FF_CPHS_REL4
1798 void cphs_rel4_get_mailbox_id()
1799 {
1800 UBYTE mspId=mfw_cphs_get_reg_profile();
1801 TRACE_FUNCTION("cphs_rel4_get_mailbox_id");
1802 /*get Mailbox Identifiers for the registered profile*/
1803 qAT_PercentMBI(CMD_SRC_LCL,mspId);
1804 }
1805 /*
1806 +-----------------------------------------------------------------------+
1807 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1808 | STATE : code ROUTINE : cphs_rel4_get_mailbox_no |
1809 +-----------------------------------------------------------------------+
1810
1811 PURPOSE : Get mailbox number from the given index
1812
1813 */
1814 void cphs_rel4_get_mailbox_no(UBYTE index)
1815 {
1816 TRACE_FUNCTION("cphs_rel4_get_mailbox_no");
1817 /*get mailbox number for the supplied index - the call is asynchronous*/
1818 qAT_PercentMBDN(CMD_SRC_LCL,index);
1819 }
1820
1821 /*******************************************************************************
1822
1823 $Function: is_message_waiting
1824 $Description: returns true if any message (in any profile) is waiting
1825
1826 *******************************************************************************/
1827
1828 BOOL is_message_waiting(void)
1829 {
1830 TRACE_FUNCTION("is_message_waiting");
1831 if(mwis_stat[0].mwisStat&0x0F || mwis_stat[1].mwisStat&0x0F ||
1832 mwis_stat[2].mwisStat&0x0F || mwis_stat[3].mwisStat&0x0F)
1833 return TRUE;
1834 else
1835 return FALSE;
1836 }
1837
1838
1839 #endif
1840
1841 /*
1842 +-----------------------------------------------------------------------+
1843 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1844 | STATE : code ROUTINE : cphs_read_mbs |
1845 +-----------------------------------------------------------------------+
1846
1847 PURPOSE : Read voice message waiting flag
1848
1849 */
1850 void cphs_read_mbs(USHORT errCode, UBYTE *data, UBYTE dataLen)
1851 {
1852 UBYTE *ptr;
1853 int i; /* PATCH VO 22.01.01 */
1854
1855 TRACE_FUNCTION ("cphs_read_mbs()");
1856
1857 ptr = data;
1858 #ifdef FF_2TO1_PS
1859 if ( errCode NEQ CAUSE_SIM_NO_ERROR OR
1860 #else
1861 if ( errCode NEQ SIM_NO_ERROR OR
1862 #endif
1863 ptr EQ NULL OR
1864 dataLen <= 0 ) /* PATCH VO 22.01.01: not check a certain length */
1865 {
1866 mbStatus.result = MFW_SIMOP_READ_ERR;
1867 }
1868 else
1869 {
1870 memset(&mbStatus, MFW_CFLAG_NotPresent, sizeof(mbStatus));
1871
1872 //x0pleela, 07 June, 2006 DVT: OMAPS00079692
1873 //Copy SIM data into mbsData to initialise mbsData with the SIM data instead of zeros
1874 memcpy( mbsData, ptr, dataLen );
1875
1876 mbStatus.result = MFW_SIMOP_READ_OK;
1877
1878 for (i=0; i<dataLen; i++)
1879 {
1880 switch (i)
1881 {
1882 case 0:
1883 mbStatus.line1 = (T_MFW_CFLAG_STATUS)(ptr[i] & 0x0F); /*a0393213 compiler warnings removal - extra parenthesis added*/
1884 mbStatus.line2 = (T_MFW_CFLAG_STATUS)(( ptr[i] >> 4 ) & 0x0F);
1885 break;
1886 case 1:
1887 mbStatus.fax = (T_MFW_CFLAG_STATUS)(ptr[i] & 0x0F);
1888 mbStatus.data = (T_MFW_CFLAG_STATUS)(( ptr[i] >> 4 ) & 0x0F);
1889 break;
1890 default:
1891 break;
1892 }
1893 }
1894 /* PATCH VO 22.01.01 END */
1895 }
1896 TRACE_EVENT("Reading Mailboxes");
1897 cphs_signal(E_CPHS_GET_VC_STAT, &mbStatus);
1898 }
1899
1900
1901
1902
1903
1904 /*
1905 +-----------------------------------------------------------------------+
1906 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1907 | STATE : code ROUTINE : cphs_read_cff |
1908 +-----------------------------------------------------------------------+
1909
1910 PURPOSE : Read call forwarding flag
1911
1912 */
1913 void cphs_read_cff(USHORT errCode, UBYTE *data, UBYTE dataLen)
1914 {
1915 UBYTE *ptr;
1916 int i; /* PATCH VO 22.01.01 */
1917
1918 TRACE_FUNCTION ("cphs_read_cff()");
1919
1920 ptr = data;
1921 #ifdef FF_2TO1_PS
1922 if ( errCode NEQ CAUSE_SIM_NO_ERROR OR
1923 #else
1924 if ( errCode NEQ SIM_NO_ERROR OR
1925 #endif
1926 ptr EQ NULL OR
1927 dataLen <= 0 ) /* PATCH VO 22.01.01: not check a certain length */
1928 {
1929 dvStatus.result = MFW_SIMOP_READ_ERR;
1930 }
1931 else
1932 {
1933 memset(&dvStatus, MFW_CFLAG_NotPresent, sizeof(dvStatus));
1934 /* May 30, 2006 REF:OMAPS00079650 a0393213 (R.Prabakar)
1935 Description : CPHS Call Forwarding feature implementation
1936 Solution : As part of this implementation, dvData is made to be consistent with the data
1937 read from SIM*/
1938 memcpy(&dvData, ptr,dataLen);
1939 dvStatus.result = MFW_SIMOP_READ_OK;
1940 for (i=0; i<dataLen; i++)
1941 {
1942 switch (i)
1943 {
1944 case 0:
1945 dvStatus.line1 = (T_MFW_CFLAG_STATUS)(ptr[i] & 0x0F); /*a0393213 compiler warnings removal - extra parenthesis added*/
1946 dvStatus.line2 = (T_MFW_CFLAG_STATUS)(( ptr[i] >> 4 ) & 0x0F);
1947 break;
1948 case 1:
1949 dvStatus.fax = (T_MFW_CFLAG_STATUS)(ptr[i] & 0x0F);
1950 dvStatus.data = (T_MFW_CFLAG_STATUS)(( ptr[i] >> 4 ) & 0x0F);
1951 break;
1952 default:
1953 break;
1954 }
1955 }
1956 /* PATCH VO 22.01.01 END */
1957 }
1958 TRACE_EVENT("CPHS valid call forwrading status");
1959 cphs_signal(E_CPHS_GET_DV_STAT, &dvStatus);
1960 }
1961
1962 /*
1963 +-----------------------------------------------------------------------+
1964 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1965 | STATE : code ROUTINE : cphs_read_als |
1966 +-----------------------------------------------------------------------+
1967
1968 PURPOSE : Read alternate line service
1969
1970 */
1971 void cphs_read_als(USHORT errCode, UBYTE *data, UBYTE dataLen)
1972 {
1973
1974 TRACE_FUNCTION ("cphs_read_als()");
1975 }
1976
1977 /*
1978 +-----------------------------------------------------------------------+
1979 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1980 | STATE : code ROUTINE : cphs_read_alss |
1981 +-----------------------------------------------------------------------+
1982
1983 PURPOSE : Read alternate line service status
1984
1985 */
1986 void cphs_read_alss(USHORT errCode, UBYTE *data, UBYTE dataLen)
1987 {
1988
1989 TRACE_FUNCTION ("cphs_read_alss()");
1990
1991 }
1992
1993 /*
1994 +-----------------------------------------------------------------------+
1995 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1996 | STATE : code ROUTINE : cphs_read_csp |
1997 +-----------------------------------------------------------------------+
1998
1999 PURPOSE : Read customer service profile
2000
2001 */
2002 void cphs_read_csp(USHORT errCode, UBYTE *data, UBYTE dataLen)
2003 {
2004 UBYTE *ptr;
2005 UBYTE flag;
2006 int i;
2007
2008 TRACE_FUNCTION ("cphs_read_csp()");
2009
2010 ptr = data;
2011 #ifdef FF_2TO1_PS
2012 if ( errCode NEQ CAUSE_SIM_NO_ERROR OR
2013 #else
2014 if ( errCode NEQ SIM_NO_ERROR OR
2015 #endif
2016 ptr EQ NULL OR
2017 dataLen <= 0 ) /* PATCH VO 22.01.01: not check a certain length */
2018 {
2019 if (simStatus EQ MFW_SIMOP_READ_OK) /* Used for read information numbers */
2020 {
2021 simStatus = MFW_SIMOP_UNKNOWN;
2022 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
2023 }
2024 else
2025 {
2026 csProfile.result = MFW_SIMOP_READ_ERR;
2027 memset(csProfile.csp, 0, sizeof(csProfile.csp));
2028 cphs_signal(E_CPHS_GET_CSP, &csProfile);
2029 }
2030 }
2031 else
2032 {
2033 if (simStatus EQ MFW_SIMOP_READ_OK) /* Used for read information numbers */
2034 {
2035 simStatus = MFW_SIMOP_UNKNOWN;
2036
2037 /* check the service group code */
2038 flag = 0;
2039 for (i = 0; i < dataLen; i += 2) /* PATCH VO 22.01.01: use the actual length in the SIM card */
2040 {
2041 if (ptr[i] EQ 0xD5 AND ptr[i+1] EQ 0xFF)
2042 flag = 1;
2043 }
2044 if (!flag)
2045 {
2046 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
2047 return;
2048 }
2049
2050 /* Read the first information numbers record */
2051 if (!cphs_read_sim_rcd(SIM_CPHS_INFN, 1, 0))
2052 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
2053 else
2054 cphsPrevRead = SIM_CPHS_INFN;
2055 }
2056 else
2057 {
2058 csProfile.result = MFW_SIMOP_READ_OK;
2059 TRACE_EVENT("CPHS valis CSP");
2060 memcpy(csProfile.csp, ptr, sizeof(csProfile.csp));
2061 cphs_signal(E_CPHS_GET_CSP, &csProfile);
2062 }
2063 }
2064 }
2065
2066 /*
2067 +------------------------------------------------------------------------+
2068 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
2069 | STATE : code ROUTINE : cphs_req_info_num_read |
2070 +------------------------------------------------------------------------+
2071
2072 PURPOSE : Read customer service profile
2073
2074 */
2075
2076 void cphs_req_info_num_read(UBYTE rcd_num, UBYTE dataLen)
2077 {
2078 TRACE_FUNCTION ("cphs_req_info_num_read()");
2079
2080 if (rcd_num > maxRec)
2081 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
2082 else
2083 {
2084 if (cphsPrevRead == SIM_CPHS_INFN)
2085 {
2086 if (!cphs_read_sim_rcd(SIM_CPHS_INFN, rcd_num, dataLen))
2087 {
2088 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
2089 }
2090 else
2091 {
2092 cphsPrevRead = SIM_CPHS_INFN;
2093 }
2094 }
2095 else
2096 {
2097 if (cphsPrevRead == SIM_CPHS_INFN2)
2098 {
2099 if (!cphs_read_sim_rcd(SIM_CPHS_INFN2, rcd_num, dataLen))
2100 {
2101 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
2102 }
2103 else
2104 {
2105 cphsPrevRead = SIM_CPHS_INFN2;
2106 }
2107 }
2108 }
2109 }
2110 }
2111
2112 /*
2113 +--------------------------------------------------------------------------+
2114 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
2115 | STATE : code ROUTINE : cphs_read_first_info_num |
2116 +--------------------------------------------------------------------------+
2117
2118 PURPOSE : Read first record of information numbers
2119
2120 */
2121
2122 void cphs_read_first_info_num(SHORT table_id)
2123 {
2124 UBYTE dataLen;
2125
2126 TRACE_FUNCTION ("cphs_read_first_info_num()");
2127
2128 #ifdef FF_2TO1_PS
2129 if ( simShrdPrm.atb[table_id].errCode NEQ CAUSE_SIM_NO_ERROR ) /* VO patch 040501 - remove dataLen and pData check */
2130 #else
2131 if ( simShrdPrm.atb[table_id].errCode NEQ SIM_NO_ERROR ) /* VO patch 040501 - remove dataLen and pData check */
2132 #endif
2133 {
2134 if (simStatus EQ MFW_SIMOP_READ_OK) /* Read entry of information numbers */
2135 {
2136 simStatus = MFW_SIMOP_UNKNOWN;
2137 infoEntry.result = MFW_SIMOP_READ_ERR;
2138 cphs_signal(E_CPHS_GET_INFO_NUM, &infoEntry);
2139 }
2140 else
2141 {// if we are here then its possible the read of 7F20 6F19 failed.
2142
2143 if (cphsPrevRead == SIM_CPHS_INFN)
2144 {
2145 if (!cphs_read_sim_rcd(SIM_CPHS_INFN2, 1, 0))
2146 {
2147 infoEntry.result = MFW_SIMOP_READ_ERR;
2148 cphs_signal(E_CPHS_GET_INFO_LIST, &infoEntry);
2149 }
2150 else
2151 {
2152 cphsPrevRead = SIM_CPHS_INFN2;
2153 }
2154 }
2155 else
2156 {
2157 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
2158 }
2159 }
2160 }
2161 else
2162 {
2163 maxRec = simShrdPrm.atb[table_id].recMax;
2164 dataLen = simShrdPrm.atb[table_id].dataLen;
2165
2166 if (simStatus EQ MFW_SIMOP_READ_OK) /* Read entry of information numbers */
2167 {
2168 /* VO patch 040501 - add dataLen check: if (patch) else ... */
2169 if (dataLen < MFW_CPHS_MIN_INS_SIZE )
2170 {
2171 simStatus = MFW_SIMOP_UNKNOWN;
2172 infoEntry.result = MFW_SIMOP_READ_ERR;
2173 cphs_signal(E_CPHS_GET_INFO_NUM, &infoEntry);
2174 }
2175 else
2176 cphs_req_info_num_read(startIdx, dataLen);
2177 }
2178 else /* Read list of information numbers */
2179 {
2180 /* VO patch 040501 - add dataLen check: if (patch) else ... */
2181 if (dataLen < MFW_CPHS_MIN_INS_SIZE )
2182 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
2183 else
2184 {
2185 if (idxLevel EQ 1) /* read this entry */
2186 cphs_read_info_num(table_id);
2187 else /* read the startIndex record */
2188 cphs_req_info_num_read(startIdx, dataLen);
2189 }
2190 }
2191 }
2192 }
2193
2194 /*
2195 +---------------------------------------------------------------------+
2196 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
2197 | STATE : code ROUTINE : cphs_read_info_num |
2198 +---------------------------------------------------------------------+
2199
2200 PURPOSE : Read first record of information numbers
2201
2202 */
2203
2204 void cphs_read_info_num(SHORT table_id)
2205 {
2206 UBYTE* pData; /* points to data buffer */
2207 UBYTE dataLen;
2208 UBYTE alphaLen;
2209 UBYTE recNr;
2210 T_ACI_TOA type;
2211
2212 TRACE_FUNCTION ("cphs_read_info_num()");
2213
2214 pData = simShrdPrm.atb[table_id].exchData;
2215 dataLen = simShrdPrm.atb[table_id].dataLen;
2216 recNr = simShrdPrm.atb[table_id].recNr;
2217
2218 #ifdef FF_2TO1_PS
2219 if ( simShrdPrm.atb[table_id].errCode NEQ CAUSE_SIM_NO_ERROR OR
2220 #else
2221 if ( simShrdPrm.atb[table_id].errCode NEQ SIM_NO_ERROR OR
2222 #endif
2223 pData EQ NULL OR
2224 dataLen < MFW_CPHS_MIN_INS_SIZE )
2225 {
2226 if (simStatus EQ MFW_SIMOP_READ_OK) /* Read entry of information numbers */
2227 {
2228 simStatus = MFW_SIMOP_UNKNOWN;
2229 infoEntry.result = MFW_SIMOP_READ_ERR;
2230 cphs_signal(E_CPHS_GET_INFO_NUM, &infoEntry);
2231 }
2232 else
2233 {// if we are here then its possible the read of 7F20 6F19 failed.
2234 // so we must try reading 7F10 EA01 instead.
2235
2236 if (cphsPrevRead == SIM_CPHS_INFN2)
2237 {
2238 if (!cphs_read_sim_rcd(SIM_CPHS_INFN2, 1, 0))
2239 {
2240 infoEntry.result = MFW_SIMOP_READ_ERR;
2241 cphs_signal(E_CPHS_GET_INFO_LIST, &infoEntry);
2242 }
2243 else
2244 {
2245 cphsPrevRead = SIM_CPHS_INFN2;
2246 }
2247 }
2248 else
2249 {
2250 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
2251 }
2252 }
2253 cphs_signal(E_CPHS_GET_INFO_LIST, &numList); // correct ??? VO
2254 }
2255 else
2256 {
2257 if (simStatus EQ MFW_SIMOP_READ_OK)
2258 {
2259 /* Read entry of information numbers */
2260 alphaLen = *pData;
2261 if (alphaLen)
2262 {
2263 /* copy/encode entry */
2264 infoEntry.index = recNr;
2265 infoEntry.entryStat = *(pData + 1);
2266
2267 cmhPHB_getMfwTagNt(pData + 2, alphaLen,
2268 infoEntry.alpha.data, &infoEntry.alpha.len);
2269
2270 pData += alphaLen + 2;
2271
2272 if (*pData NEQ 0xFF)
2273 {
2274 cmhPHB_getAdrStr ( (CHAR *)infoEntry.number,
2275 3, /* length of number */
2276 pData + 2,
2277 *pData );
2278 cmhPHB_toaDmrg ( *( pData + 1 ), &type );
2279 infoEntry.ton = phb_cvtTon(type.ton);
2280 infoEntry.npi = phb_cvtNpi(type.npi);
2281 infoEntry.entryStat = infoEntry.entryStat | 0x80;
2282 }
2283 else
2284 {
2285 infoEntry.number[0] = '\0';
2286 infoEntry.ton = MFW_TON_UNKNOWN;
2287 infoEntry.npi = MFW_NPI_UNKNOWN;
2288 }
2289 }
2290 infoEntry.result = MFW_SIMOP_READ_OK;
2291 cphs_signal(E_CPHS_GET_INFO_NUM, &infoEntry);
2292 return;
2293 }
2294 else if ((*(pData + 1) & 0x0F) < idxLevel)
2295 {
2296 /* The index level is out the wished index level. */
2297 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
2298 }
2299 else if ((*(pData + 1) & 0x0F) > idxLevel)
2300 {
2301 /* This is not wished index level. Read the next */
2302 recNr++;
2303 cphs_req_info_num_read(recNr, dataLen);
2304 }
2305 else
2306 {
2307 /* This is the wished index level. Read it. */
2308 alphaLen = *pData;
2309 if (alphaLen) /* check alpha length */
2310 {
2311 /* copy/encode this entry in list */
2312 numList.level = idxLevel;
2313 numList.entry[numList.count].index = recNr;
2314 numList.entry[numList.count].entryStat = *(pData + 1) & 0x7F; /* set bit 8 to 0 */
2315
2316 cmhPHB_getMfwTagNt(pData + 2, alphaLen,
2317 numList.entry[numList.count].alpha.data,
2318 &numList.entry[numList.count].alpha.len);
2319
2320 pData += alphaLen + 2;
2321
2322 if (*pData NEQ 0xFF)
2323 {
2324 numList.entry[numList.count].entryStat = numList.entry[numList.count].entryStat | 0x80;
2325 }
2326 numList.count++;
2327 }
2328 recNr++;
2329 /* Read the next record */
2330 cphs_req_info_num_read(recNr, dataLen);
2331 }
2332 }
2333 }
2334
2335 /*
2336 +--------------------------------------------------------------------------+
2337 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
2338 | STATE : code ROUTINE : cphs_read_eeprom_mailbox |
2339 +--------------------------------------------------------------------------+
2340
2341 PURPOSE : Read mailbox number from EEPROM
2342
2343 */
2344
2345 void cphs_read_eeprom_mailbox(void)
2346 {
2347 U8 version;
2348 #ifdef PCM_2_FFS
2349 T_PSPDF_MBN mbn;
2350 #else
2351 EF_MBN mbn;
2352 #endif
2353
2354 T_ACI_TOA numTp;
2355 int i;
2356 USHORT max_rcd;
2357
2358 for (i=0; i<MAX_CPHS_ENTRY; i++)
2359 {
2360 #ifdef PCM_2_FFS
2361 if (ffs_ReadRecord((UBYTE *)PSPDF_MBN_ID, (UBYTE *)&mbn,
2362 sizeof( T_PSPDF_MBN ), (USHORT)(i+1), 1 ) == sizeof( T_PSPDF_MBN ) )
2363
2364 #else
2365 if (pcm_ReadRecord((UBYTE *)EF_MBN_ID,
2366 (USHORT)(i+1),
2367 SIZE_EF_MBN,
2368 (UBYTE *)&mbn,
2369 &version,
2370 &max_rcd) == PCM_OK)
2371 #endif
2372
2373 {
2374 if (mbn.len)
2375 {
2376 mbNum.entries[mbNum.count].index = i+1;
2377 cmhPHB_getAdrStr ( (char *)mbNum.entries[mbNum.count].number,
2378 PHB_MAX_LEN - 1, mbn.mbNum, mbn.len );
2379 cmhPHB_getMfwTagNt ( mbn.alphId, 10,
2380 mbNum.entries[mbNum.count].alpha.data,
2381 &mbNum.entries[mbNum.count].alpha.len );
2382 cmhPHB_toaDmrg ( mbn.numTp, &numTp );
2383 mbNum.entries[mbNum.count].ton = phb_cvtTon(numTp.ton);
2384 mbNum.entries[mbNum.count].npi = phb_cvtNpi(numTp.npi);
2385 mbNum.entries[mbNum.count].service = i;
2386 mbNum.count++;
2387 }
2388 }
2389 }
2390 cphs_signal(E_CPHS_GET_VC_NUM, &mbNum);
2391 }
2392
2393 /*
2394 +---------------------------------------------------------------------------+
2395 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
2396 | STATE : code ROUTINE : cphs_write_eeprom_mailbox |
2397 +---------------------------------------------------------------------------+
2398
2399 PURPOSE : Write mailbox number in EEPROM
2400
2401 */
2402
2403 void cphs_write_eeprom_mailbox(T_MFW_CPHS_ENTRY *entry)
2404 {
2405 T_ACI_PB_TEXT text;
2406 UBYTE len;
2407 //EF_MBN mbn;
2408 T_ACI_TOA type;
2409 UBYTE *pNumber;
2410 UBYTE result;
2411 UBYTE outLen;
2412
2413 len = MINIMUM ( MAX_PCM_MAILBOX_LEN, entry->alpha.len);
2414 text.len = len;
2415 memcpy(text.data, entry->alpha.data, len);
2416 text.cs = CS_Sim;
2417 cmhPHB_getMfwTagSim ( &text, FFS_flashData.mbn_AlphId, &outLen, MAX_PCM_MAILBOX_LEN );
2418
2419 if ( entry->number[0] EQ '+')
2420 {
2421 type.ton = TON_International;
2422 pNumber = &entry->number[1];
2423 }
2424 else
2425 {
2426 type.ton = (T_ACI_TOA_TON)entry->ton;/*a0393213 warnings removal-explicit typecasting done*/
2427 pNumber = &entry->number[0];
2428 }
2429 type.npi = (T_ACI_TOA_NPI)entry->npi;/*a0393213 warnings removal-explicit typecasting done*/
2430 //MC- switching from PCM to FFS
2431 cmhPHB_toaMrg ( &type, /*&mbn.numTp*/&FFS_flashData.mbn_numTp );
2432
2433 cmhPHB_getAdrBcd ((UBYTE*) FFS_flashData.mbn_Num/*mbn.mbNum*/, /*&mbn.len*/&FFS_flashData.mbn_len,
2434 MAX_PCM_MAILBOX_LEN, (CHAR *)pNumber );
2435 FFS_flashData.mbn_len/*mbn.len*/++;
2436
2437 if (flash_write() == EFFS_OK)
2438
2439 result = MFW_SIMOP_WRITE_OK;
2440 else
2441 result = MFW_SIMOP_WRITE_ERR;
2442 cphs_signal(E_CPHS_SET_VC_NUM, &result);
2443 }
2444
2445 /*
2446 +-----------------------------------------------------------------------+
2447 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
2448 | STATE : code ROUTINE : cphs_read_eeprom_als |
2449 +-----------------------------------------------------------------------+
2450
2451 PURPOSE : Read alternate line service information from EEPROM
2452
2453 */
2454
2455 void cphs_read_eeprom_als(T_MFW_CPHS_ALS_STATUS *info)
2456 {
2457 #ifdef PCM_2_FFS
2458 T_PSPDF_ALS alsInfo;
2459 #else
2460 EF_ALS alsInfo;
2461 #endif
2462
2463 // UBYTE version; // RAVI
2464
2465 TRACE_FUNCTION ("cphs_read_eeprom_als()");
2466 alsInfo.selLine = FFS_flashData.als_selLine;
2467 alsInfo.statLine = FFS_flashData.als_statLine;
2468 {
2469 switch (alsInfo.selLine)
2470 {
2471 case MFW_SERV_LINE1:
2472 alsStatus.selectedLine = MFW_SERV_LINE1;
2473 break;
2474 case MFW_SERV_LINE2:
2475 alsStatus.selectedLine = MFW_SERV_LINE2;
2476 break;
2477 default:
2478 alsStatus.selectedLine = MFW_SERV_LINE2;
2479 break;
2480 }
2481
2482 switch (alsInfo.statLine)
2483 {
2484 case MFW_LINE_LOCKED:
2485 alsStatus.status = MFW_LINE_LOCKED;
2486 break;
2487 case MFW_LINE_UNLOCKED:
2488 alsStatus.status = MFW_LINE_UNLOCKED;
2489 break;
2490 default:
2491 alsStatus.status = MFW_LINE_UNLOCKED;
2492 break;
2493 }
2494 }
2495
2496 info->selectedLine = alsStatus.selectedLine;
2497 info->status = alsStatus.status;
2498
2499 }
2500
2501 /*
2502 +-----------------------------------------------------------------------+
2503 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
2504 | STATE : code ROUTINE : cphs_write_eeprom_als |
2505 +-----------------------------------------------------------------------+
2506
2507 PURPOSE : Write selected alternate line in EEPROM
2508
2509 */
2510
2511 void cphs_write_eeprom_als(UBYTE *res)
2512 {
2513
2514
2515
2516
2517 /*a0393213 compiler warnings removal - variable alsinfo deleted*/
2518
2519
2520 TRACE_FUNCTION ("cphs_write_eeprom_als()");
2521 {
2522 if (alsStatus.status EQ MFW_LINE_LOCKED)
2523 *res = MFW_SIMOP_WRITE_ERR;
2524
2525 alsStatus.selectedLine = (T_MFW_LINE_INDEX)alsData;
2526
2527 FFS_flashData.als_selLine = alsData;
2528 if (flash_write() == EFFS_OK)
2529 *res = MFW_SIMOP_WRITE_OK;
2530 else
2531 *res = MFW_SIMOP_WRITE_ERR;
2532 }
2533 }
2534
2535 /*
2536 +-----------------------------------------------------------------------+
2537 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
2538 | STATE : code ROUTINE : cphs_write_eeprom_alss|
2539 +-----------------------------------------------------------------------+
2540
2541 PURPOSE : Write line lock status in EEPROM
2542
2543 */
2544
2545 void cphs_write_eeprom_alss(UBYTE *res)
2546 {
2547
2548
2549 /*a0393213 compiler warnings removal - variable alsinfo removed*/
2550
2551
2552 TRACE_FUNCTION ("cphs_write_eeprom_als()");
2553 {
2554 alsStatus.status = (T_MFW_LINE_STATUS)alsData;
2555 FFS_flashData.als_statLine = alsData;
2556
2557 if (flash_write() == EFFS_OK)
2558 *res = MFW_SIMOP_WRITE_OK;
2559 else
2560 *res = MFW_SIMOP_WRITE_ERR;
2561 }
2562 }
2563
2564 /*
2565 +----------------------------------------------------------------------+
2566 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2567 | STATE : code ROUTINE: cphs_read_sim_dat |
2568 +----------------------------------------------------------------------+
2569
2570
2571 PURPOSE : Request to read SIM card.
2572
2573 */
2574
2575 BOOL cphs_read_sim_dat(USHORT data_id, UBYTE len, UBYTE max_length)
2576 {
2577 T_ACI_RETURN res;
2578
2579 TRACE_FUNCTION ("cphs_read_sim_dat()");
2580
2581 #ifdef FF_2TO1_PS
2582 res = cmhSIM_ReadTranspEF ( CMD_SRC_NONE,
2583 AT_CMD_NONE,
2584 FALSE, /* SCT: dummy only (path info valid flag) */
2585 NULL, /* SCT: dummy only (path info)*/
2586 data_id,
2587 0,
2588 max_length,
2589 NULL,
2590 cphs_read_sim_dat_cb);
2591 #else
2592 res = cmhSIM_ReadTranspEF ( CMD_SRC_NONE,
2593 AT_CMD_NONE,
2594 FALSE, /* SCT: dummy only (path info valid flag) */
2595 NULL, /* SCT: dummy only (path info)*/
2596 data_id,
2597 0,
2598 max_length,
2599 NULL,
2600 cphs_read_sim_dat_cb);
2601 #endif
2602 if (res NEQ AT_EXCT)
2603 return FALSE;
2604 return TRUE;
2605 }
2606
2607 /*
2608 +----------------------------------------------------------------------+
2609 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2610 | STATE : code ROUTINE: cphs_read_sim_dat_cb |
2611 +----------------------------------------------------------------------+
2612
2613
2614 PURPOSE : Call back for SIM read.
2615
2616 */
2617
2618 void cphs_read_sim_dat_cb(SHORT table_id)
2619 {
2620 UBYTE dataLen;
2621 UBYTE result;
2622 TRACE_FUNCTION ("cphs_read_sim_dat_cb()");
2623 /***************************Go-lite Optimization changes Start***********************/
2624 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
2625 TRACE_EVENT_P1("SIM Error code!!!%d",simShrdPrm.atb[table_id].errCode);
2626 /***************************Go-lite Optimization changes end***********************/
2627 switch (simShrdPrm.atb[table_id].reqDataFld)
2628 {
2629 case SIM_CPHS_CINF: /* CPHS information */
2630 if (!cphsUpdate)
2631 cphs_read_information(simShrdPrm.atb[table_id].errCode,
2632 simShrdPrm.atb[table_id].exchData,
2633 simShrdPrm.atb[table_id].dataLen);
2634 #ifdef SIM_TOOLKIT
2635 else
2636 cphs_update_info_cnf(simShrdPrm.atb[table_id].errCode,
2637 simShrdPrm.atb[table_id].exchData,
2638 simShrdPrm.atb[table_id].dataLen);
2639 #endif
2640 break;
2641
2642 case SIM_CPHS_ONSTR: /* operator name string */
2643 cphs_read_ons(simShrdPrm.atb[table_id].errCode,
2644 simShrdPrm.atb[table_id].exchData,
2645 simShrdPrm.atb[table_id].dataLen);
2646 break;
2647
2648 case SIM_CPHS_ONSHF: /* operator name short form */
2649 cphs_read_onsf(simShrdPrm.atb[table_id].errCode,
2650 simShrdPrm.atb[table_id].exchData,
2651 simShrdPrm.atb[table_id].dataLen);
2652 break;
2653
2654 case SIM_CPHS_VMW: /* voice message waiting flag */
2655 /* PATCH VO 22.01.01 */
2656 if (simStatus EQ MFW_SIMOP_WRITE_OK)
2657 {
2658 /* Determine the size of this field, and write the data.
2659 When the writing is not possible, write this voice
2660 message waiting flag in EEPROM. */
2661 simStatus = MFW_SIMOP_UNKNOWN;
2662 #ifdef FF_2TO1_PS
2663 if ( simShrdPrm.atb[table_id].errCode EQ CAUSE_SIM_NO_ERROR )
2664 #else
2665 if ( simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR )
2666 #endif
2667 {
2668 dataLen = simShrdPrm.atb[table_id].dataLen;
2669 /* Write voice message waiting flag.
2670 When this writing failed, send event with "write error" parameter to MMI */
2671 if (!cphs_write_sim_dat(SIM_CPHS_VMW, mbsData, dataLen))
2672 {
2673 result = MFW_SIMOP_WRITE_ERR;
2674 cphs_signal(E_CPHS_SET_VC_STAT, &result);
2675 }
2676 }
2677 else
2678 {
2679 result = MFW_SIMOP_WRITE_ERR;
2680 cphs_signal(E_CPHS_SET_VC_STAT, &result);
2681 }
2682 }
2683 else
2684 /* PATCH VO 22.01.01 end */
2685 cphs_read_mbs (simShrdPrm.atb[table_id].errCode,
2686 simShrdPrm.atb[table_id].exchData,
2687 simShrdPrm.atb[table_id].dataLen);
2688 break;
2689
2690 case SIM_CPHS_CFF: /* call forwarding flag */
2691 /* PATCH VO 22.01.01 */
2692 if (simStatus EQ MFW_SIMOP_WRITE_OK)
2693 {
2694 /* Determine the size of this field, and write the data.
2695 When the writing is not possible, write this call forward flag in EEPROM*/
2696 simStatus = MFW_SIMOP_UNKNOWN;
2697 #ifdef FF_2TO1_PS
2698 if ( simShrdPrm.atb[table_id].errCode EQ CAUSE_SIM_NO_ERROR )
2699 #else
2700 if ( simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR )
2701 #endif
2702 {
2703 dataLen = simShrdPrm.atb[table_id].dataLen;
2704 /* Write call forwarding flag.
2705 When this writing failed, send event with "write error" parameter to MMI */
2706 TRACE_EVENT_P2("cphs_read_sim_dat_cb():%x %x",dvData[0],dvData[1]);
2707 if (!cphs_write_sim_dat(SIM_CPHS_CFF, dvData, dataLen))
2708 {
2709 result = MFW_SIMOP_WRITE_ERR;
2710 cphs_signal(E_CPHS_SET_DV_STAT, &result);
2711 }
2712 }
2713 else
2714 {
2715 result = MFW_SIMOP_WRITE_ERR;
2716 /*May 30, 2006 REF:OMAPS00079650 a0393213 (R.Prabakar)
2717 Description : CPHS Call Forwarding feature implementation
2718 Solution : As part of the implementation, a typographical error is corrected.
2719 E_CPHS_SET_VC_STAT was changed to E_CPHS_SET_DV_STAT*/
2720 cphs_signal(E_CPHS_SET_DV_STAT, &result);
2721 }
2722 }
2723 else
2724 /* PATCH VO 22.01.01 end */
2725 cphs_read_cff (simShrdPrm.atb[table_id].errCode,
2726 simShrdPrm.atb[table_id].exchData,
2727 simShrdPrm.atb[table_id].dataLen);
2728 break;
2729
2730
2731 case SIM_CPHS_CSP: /* customer service profile */
2732 cphs_read_csp (simShrdPrm.atb[table_id].errCode,
2733 simShrdPrm.atb[table_id].exchData,
2734 simShrdPrm.atb[table_id].dataLen);
2735 break;
2736
2737 default:
2738 break;
2739 }
2740 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;
2741 }
2742
2743 /*
2744 +----------------------------------------------------------------------+
2745 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2746 | STATE : code ROUTINE: cphs_write_sim_dat |
2747 +----------------------------------------------------------------------+
2748
2749
2750 PURPOSE : Request to write SIM card.
2751
2752 */
2753
2754 BOOL cphs_write_sim_dat(USHORT data_id, UBYTE *data, UBYTE length)
2755 {
2756 T_ACI_RETURN res;
2757
2758 TRACE_FUNCTION ("cphs_write_sim_dat()");
2759
2760 #ifdef FF_2TO1_PS
2761 res = cmhSIM_WriteTranspEF (CMD_SRC_NONE,
2762 AT_CMD_NONE,
2763 FALSE, /* SCT: dummy only (path info valid flag) */
2764 NULL, /* SCT: dummy only (path info) */
2765 data_id,
2766 0,
2767 length,
2768 data,
2769 cphs_write_sim_dat_cb);
2770 #else
2771 res = cmhSIM_WriteTranspEF (CMD_SRC_NONE,
2772 AT_CMD_NONE,
2773 FALSE, /* SCT: dummy only (path info valid flag) */
2774 NULL, /* SCT: dummy only (path info) */
2775 data_id,
2776 0,
2777 length,
2778 data,
2779 cphs_write_sim_dat_cb);
2780 #endif
2781
2782 if (res NEQ AT_EXCT)
2783 return FALSE;
2784
2785 return TRUE;
2786 }
2787
2788 /*
2789 +----------------------------------------------------------------------+
2790 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2791 | STATE : code ROUTINE: cphs_write_sim_dat_cb |
2792 +----------------------------------------------------------------------+
2793
2794
2795 PURPOSE : callback of SIM card writing.
2796
2797 */
2798
2799 void cphs_write_sim_dat_cb(SHORT table_id)
2800 {
2801 UBYTE result;
2802 TRACE_FUNCTION ("sim_write_sim_dat_cb()");
2803 /***************************Go-lite Optimization changes Start***********************/
2804 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
2805 TRACE_EVENT_P1("SIM Error code!!!%d", simShrdPrm.atb[table_id].errCode);
2806 /***************************Go-lite Optimization changes end***********************/
2807 switch (simShrdPrm.atb[table_id].reqDataFld)
2808 {
2809 case SIM_CPHS_VMW: /* voice message waiting flag */
2810 #ifdef FF_2TO1_PS
2811 if ( simShrdPrm.atb[table_id].errCode EQ CAUSE_SIM_NO_ERROR )
2812 #else
2813 if ( simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR )
2814 #endif
2815 {
2816 result = MFW_SIMOP_WRITE_OK;
2817 cphs_signal(E_CPHS_SET_VC_STAT, &result);
2818 }
2819 else
2820 {
2821 result = MFW_SIMOP_WRITE_ERR;
2822 cphs_signal(E_CPHS_SET_VC_STAT, &result);
2823 }
2824 break;
2825
2826 case SIM_CPHS_CFF: /* call forwarding flag */
2827 #ifdef FF_2TO1_PS
2828 if ( simShrdPrm.atb[table_id].errCode EQ CAUSE_SIM_NO_ERROR )
2829 #else
2830 if ( simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR )
2831 #endif
2832 {
2833 result = MFW_SIMOP_WRITE_OK;
2834 cphs_signal(E_CPHS_SET_DV_STAT, &result);
2835 }
2836 else
2837 {
2838 result = MFW_SIMOP_WRITE_ERR;
2839 cphs_signal(E_CPHS_SET_DV_STAT, &result);
2840 }
2841 break;
2842
2843 default:
2844 break;
2845 }
2846 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;
2847 }
2848
2849 /*
2850 +----------------------------------------------------------------------+
2851 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2852 | STATE : code ROUTINE: cphs_read_sim_rcd |
2853 +----------------------------------------------------------------------+
2854
2855
2856 PURPOSE : Request to read SIM card.
2857
2858 */
2859
2860 BOOL cphs_read_sim_rcd(USHORT data_id, UBYTE rcd_num, UBYTE len)
2861 {
2862 T_ACI_RETURN res;
2863 UBYTE dataLen;
2864
2865 TRACE_FUNCTION ("cphs_read_sim_rcd()");
2866 TRACE_EVENT_P1("rec num to be read: %d", rcd_num);
2867
2868 if (rcd_num EQ 1)
2869 dataLen = UCHAR_MAX;
2870 else
2871 dataLen = len;
2872
2873 #ifdef FF_2TO1_PS
2874 res = cmhSIM_ReadRecordEF ( CMD_SRC_NONE,
2875 AT_CMD_NONE,
2876 TRUE, /* SCT: dummy only (path info valid flag) */
2877 NULL, /* SCT: dummy only (path info) */
2878 data_id,
2879 rcd_num,
2880 dataLen,
2881 NULL,
2882 cphs_read_sim_rcd_cb);
2883 #else
2884 res = cmhSIM_ReadRecordEF ( CMD_SRC_NONE,
2885 AT_CMD_NONE,
2886 FALSE, /* SCT: dummy only (path info valid flag) */
2887 NULL, /* SCT: dummy only (path info) */
2888 data_id,
2889 rcd_num,
2890 dataLen,
2891 NULL,
2892 cphs_read_sim_rcd_cb);
2893 #endif
2894
2895 if (res NEQ AT_EXCT)
2896 return FALSE;
2897
2898 return TRUE;
2899 }
2900
2901 /*
2902 +----------------------------------------------------------------------+
2903 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2904 | STATE : code ROUTINE: cphs_read_sim_rcd_cb |
2905 +----------------------------------------------------------------------+
2906
2907
2908 PURPOSE : Request to read SIM card.
2909
2910 */
2911
2912 void cphs_read_sim_rcd_cb (SHORT table_id)
2913 {
2914 UBYTE dataLen;
2915 TRACE_FUNCTION ("cphs_read_sim_rcd_cb()");
2916 /***************************Go-lite Optimization changes Start***********************/
2917 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
2918 TRACE_EVENT_P1("SIM Error code!!!%d", simShrdPrm.atb[table_id].errCode);
2919
2920
2921 TRACE_EVENT_P1("tableid: %d", table_id);
2922 /***************************Go-lite Optimization changes end***********************/
2923 switch (simShrdPrm.atb[table_id].reqDataFld)
2924 {
2925 case SIM_CPHS_MBXN: /* mailbox numbers */
2926 if (simStatus EQ MFW_SIMOP_WRITE_OK)
2927 {
2928 /* Determine the size of record, and write a new record.
2929 When the writing is not possible, write this mailbox
2930 number in EEPROM. */
2931 simStatus = MFW_SIMOP_UNKNOWN;
2932 #ifdef FF_2TO1_PS
2933 if ( simShrdPrm.atb[table_id].errCode EQ CAUSE_SIM_NO_ERROR )
2934 #else
2935 if ( simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR )
2936 #endif
2937 {
2938 dataLen = simShrdPrm.atb[table_id].dataLen;
2939 /* allocate mbnData (sizeof(dataLen)) */
2940 // Mar 30, 2005 REF: CRR 29986 xpradipg
2941 // the dynamic allocation is done here, if the write fails it is deallocated
2942 // else if success it is deallocated in the callback
2943 #ifdef FF_MMI_OPTIM
2944 mbnData = (UBYTE*)mfwAlloc(200);
2945 if(mbnData != NULL)
2946 {
2947 #endif
2948 ubCphsMbExtRecNo = 0;
2949
2950 cphs_build_mbn_data(mbnData, dataLen);
2951
2952 if (!cphs_write_sim_rcd(SIM_CPHS_MBXN, vcEntry->index,
2953 mbnData, dataLen))
2954 {
2955 cphs_write_eeprom_mailbox(vcEntry);
2956 }
2957 #ifdef FF_MMI_OPTIM
2958 }
2959 #endif
2960 }
2961 else
2962 cphs_write_eeprom_mailbox(vcEntry);
2963 }
2964 else
2965 cphs_read_mbn(table_id);
2966 break;
2967
2968 case SIM_CPHS_INFN: /* information numbers */
2969 if (simShrdPrm.atb[table_id].recNr EQ 1)
2970 {
2971 /* VO patch 150501 */
2972 if ((startIdx EQ 1) AND (simStatus EQ MFW_SIMOP_READ_OK))
2973 cphs_read_info_num(table_id);
2974 else
2975 /* VO patch 150501 end */
2976 cphs_read_first_info_num(table_id);
2977 }
2978 else
2979 cphs_read_info_num(table_id);
2980 break;
2981
2982 case SIM_CPHS_INFN2: /* information numbers 2 - 7F10 'EA01' selected if SIM_CPHS_INFN '6F19' isn't there*/
2983 if (simShrdPrm.atb[table_id].recNr EQ 1)
2984 {
2985 /* VO patch 150501 */
2986 if ((startIdx EQ 1) AND (simStatus EQ MFW_SIMOP_READ_OK))
2987 cphs_read_info_num(table_id);
2988 else
2989 /* VO patch end */
2990 cphs_read_first_info_num(table_id);
2991 }
2992 else
2993 cphs_read_info_num(table_id);
2994 break;
2995 /*June 27,2007 OMAPS00134788 x0066814(Geetha)*/
2996 case SIM_EXT1:
2997
2998 cphs_read_ext1(table_id);
2999
3000
3001
3002 break;
3003
3004 default:
3005 break;
3006 }
3007 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;
3008 }
3009
3010
3011 /*
3012 +----------------------------------------------------------------------+
3013 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
3014 | STATE : code ROUTINE: cphs_write_sim_rcd |
3015 +----------------------------------------------------------------------+
3016
3017
3018 PURPOSE : Request to write SIM card.
3019
3020 */
3021
3022 BOOL cphs_write_sim_rcd(USHORT data_id, UBYTE rcd_num,
3023 UBYTE *data, UBYTE dataLen)
3024 {
3025 T_ACI_RETURN res;
3026
3027 TRACE_FUNCTION ("cphs_read_sim_rcd()");
3028
3029 #ifdef FF_2TO1_PS
3030 res = cmhSIM_WriteRecordEF (CMD_SRC_NONE,
3031 AT_CMD_NONE,
3032 TRUE, /* SCT: dummy only (path info valid flag) */
3033 NULL, /* SCT: dummy only (path info) */
3034 data_id,
3035 rcd_num,
3036 dataLen,
3037 data,
3038 cphs_write_sim_rcd_cb);
3039 #else
3040 res = cmhSIM_WriteRecordEF (CMD_SRC_NONE,
3041 AT_CMD_NONE,
3042 FALSE, /* SCT: dummy only (path info valid flag) */
3043 NULL, /* SCT: dummy only (path info) */
3044 data_id,
3045 rcd_num,
3046 dataLen,
3047 data,
3048 cphs_write_sim_rcd_cb);
3049 #endif
3050
3051 if (res NEQ AT_EXCT)
3052 return FALSE;
3053
3054 return TRUE;
3055 }
3056
3057 /*
3058 +----------------------------------------------------------------------+
3059 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
3060 | STATE : code ROUTINE: cphs_build_ext1 |
3061 +----------------------------------------------------------------------+
3062
3063
3064 PURPOSE : Frame the data as per the EXT1 record structure
3065
3066 */
3067 UBYTE *temp_data = NULL;
3068
3069
3070 UBYTE cphs_build_ext1(UBYTE *pData)
3071
3072 {
3073 UBYTE count = 0;
3074 UBYTE ext1num[PHB_MAX_LEN];
3075 UBYTE indx = 0;
3076 SHORT rec_no_to_write = 0;
3077 UBYTE numLen;
3078 UBYTE *pNumber;
3079 UBYTE i, j;
3080 unsigned int length_no = 0;
3081 UBYTE byteno = 0;
3082
3083 TRACE_FUNCTION ( "cphs_build_ext1()" );
3084
3085 memset( pData, MFW_INVALID_SIM_DATA, 13);
3086
3087
3088 *pData = 0x02; //implies that the EF contains additional data
3089 temp_data = pData;
3090
3091 /* number data and TON/NPI data */
3092 if ( vcEntry->number[0] EQ '+' )
3093 {
3094 vcEntry->ton = TON_International;
3095 pNumber = &vcEntry->number[1];
3096 }
3097 else
3098 pNumber = &vcEntry->number[0];
3099
3100
3101 cmhPHB_getAdrBcd ( ext1num, &numLen,
3102 PHB_MAX_LEN - 1, (CHAR *) (pNumber));
3103
3104 for(i=0; i < strlen((CHAR *)pNumber); i++)
3105 {
3106 TRACE_EVENT_P2("pNumber[%d] : %c", i,pNumber[i]);
3107 }
3108
3109
3110 length_no = numLen; //strlen( (CHAR *)pNumber );
3111 byteno = numLen; //( length_no / 2 ) + ( length_no % 2 );
3112
3113 indx = ( (ubCurrExtRcWrite + 1) * 10 );
3114
3115 TRACE_EVENT_P1("length_no: %d", length_no);
3116 TRACE_EVENT_P1("indx: %d", indx);
3117
3118 if ( ( byteno - indx ) > 10 )
3119 {
3120 count = 10;
3121 }
3122 else
3123 {
3124 count = ( byteno - indx );
3125 }
3126
3127 TRACE_EVENT_P1("count: %d", count);
3128
3129 if ( count != 0 )
3130 {
3131 memcpy ( (void *)(pData + 2), (void *)&(ext1num[indx]),
3132 ( count ) );
3133 }
3134
3135 for(i=0; i < count; i++)
3136 {
3137 TRACE_EVENT_P2("pData + 2 + %d : %x", i, *(pData + 2+i));
3138 }
3139
3140
3141 *(pData+1) = ( count );
3142
3143 pData += 12;
3144
3145 mbNum.entries[vcEntry->list_index].ext_rec_idx[ubCurrExtRcWrite] = sFreeRec;
3146
3147 TRACE_EVENT_P1("ubCurrExtRcWrite: %d", ubCurrExtRcWrite);
3148
3149 TRACE_EVENT_P1("mbNum...ext_rec_idx[ubCurrExtRcWrite]: %d", mbNum.entries[vcEntry->list_index].ext_rec_idx[ubCurrExtRcWrite]);
3150
3151 ubCurrExtRcWrite++;
3152
3153 if ( ubCphsMbExtRecNo <= ubCurrExtRcWrite )
3154 {
3155 if ( ( sFreeRec <= 0 ) || ( sFreeRec == 0xFF ) )
3156 {
3157 TRACE_FUNCTION ("cphs_build_ext1() : ubCphsMbExtRecNo <= ubCurrExtRcWrite; no free rec");
3158 *(pData) = 0xFF;
3159 return FALSE;
3160 }
3161
3162 rec_no_to_write = sFreeRec;
3163
3164 *(pData) = 0xFF;
3165 }
3166 else
3167 {
3168 rec_no_to_write = sFreeRec;
3169
3170 sFreeRec = 0;
3171
3172 if ( mbNum.entries[vcEntry->list_index].ext_rec_number > ubCurrExtRcWrite )
3173 {
3174
3175 TRACE_FUNCTION("ext rec taken from within");
3176 sFreeRec = mbNum.entries[vcEntry->list_index].ext_rec_idx[ubCurrExtRcWrite];
3177 }
3178 else
3179 {
3180
3181 TRACE_FUNCTION("ext rec taken from cmh");
3182 #ifdef TI_PS_FFS_PHB
3183 sFreeRec = cmh_Query_free_ext_record();
3184 #endif
3185 }
3186
3187 TRACE_EVENT_P1("sFreeRec : %d", sFreeRec);
3188
3189 if ( ( sFreeRec <= 0 ) || ( sFreeRec == 0xFF ) )
3190 {
3191 TRACE_FUNCTION ("cphs_build_ext1() : No free records available");
3192 *(pData) = 0xFF;
3193 }
3194 else
3195 {
3196 *(pData) = 0x00;
3197 *(pData) = sFreeRec;
3198 TRACE_FUNCTION("cmh_PHB_update_ext_record to be");
3199 #ifdef TI_PS_FFS_PHB
3200 cmh_PHB_update_ext_record(sFreeRec,TRUE);
3201 #endif
3202 }
3203
3204 mbNum.entries[vcEntry->list_index].ext_rec_idx[ubCurrExtRcWrite] = *(pData);
3205 }
3206
3207 TRACE_EVENT_P1("rec_no_to_write : %d", rec_no_to_write);
3208 cphs_write_sim_rcd(SIM_EXT1, rec_no_to_write, temp_data, 13);
3209
3210 return TRUE;
3211 }
3212
3213 static UBYTE mfw_cphs_vm_write_cb_ext(void)
3214 {
3215 UBYTE ret_internal = 0;
3216 UBYTE result;
3217
3218 TRACE_FUNCTION("mfw_cphs_vm_write_cb_ext");
3219
3220 TRACE_EVENT_P1("ubCphsMbExtRecNo : %d", ubCphsMbExtRecNo);
3221 TRACE_EVENT_P1("ubCurrExtRcWrite : %d", ubCurrExtRcWrite);
3222 TRACE_EVENT_P2("idx, ext_rec_number : %d, %d", vcEntry->list_index, mbNum.entries[vcEntry->list_index].ext_rec_number);
3223
3224 if ( ( ubCphsMbExtRecNo == 0 ) || ( ubCphsMbExtRecNo <= ubCurrExtRcWrite ) )
3225 {
3226
3227 TRACE_FUNCTION("inside if!");
3228
3229 /* Flush any EXT Records, if any */
3230 if ( mbNum.entries[vcEntry->list_index].ext_rec_number > ubCphsMbExtRecNo )
3231 {
3232
3233
3234 TRACE_FUNCTION("flush needed!--");
3235
3236 if ( ubFlushRecords == 0 )
3237 {
3238 ubFlushRecords = 1;
3239 }
3240
3241 TRACE_EVENT_P1("ubFlushRecords : %d", ubFlushRecords);
3242 TRACE_EVENT_P1("i : %d", (ubCphsMbExtRecNo + ubFlushRecords - 1));
3243 TRACE_EVENT_P1("ext_rec_idx[i] : %d", mbNum.entries[vcEntry->list_index].ext_rec_idx[ubCphsMbExtRecNo + ubFlushRecords - 1]);
3244
3245 memset ( (void *)&flush_data[0], 0xFF, 13 );
3246 #ifdef TI_PS_FFS_PHB
3247 cmh_PHB_update_ext_record(mbNum.entries[vcEntry->list_index].ext_rec_idx[ubCphsMbExtRecNo + ubFlushRecords - 1],
3248 FALSE);
3249 #endif
3250 cphs_write_sim_rcd(SIM_EXT1,
3251 mbNum.entries[vcEntry->list_index].ext_rec_idx[ubCphsMbExtRecNo + ubFlushRecords - 1],
3252 flush_data, 13);
3253
3254 mbNum.entries[vcEntry->list_index].ext_rec_idx[ubCphsMbExtRecNo + ubFlushRecords - 1] = 0xFF;
3255 mbNum.entries[vcEntry->list_index].ext_rec_number--;
3256 ubFlushRecords++;
3257 return 1;
3258 }
3259
3260 ubFlushRecords = 0;
3261
3262 result = MFW_SIMOP_WRITE_OK;
3263
3264
3265 TRACE_FUNCTION("mfw_cphs_vm_write_cb_ext: write OK");
3266 cphs_signal(E_CPHS_SET_VC_NUM, &result);
3267
3268 // Mar 30, 2005 REF: CRR 29986 xpradipg
3269 // mbnData is deallocated, on successfull write operation
3270 #ifdef FF_MMI_OPTIM
3271 if(mbnData)
3272 mfwFree(mbnData,200);
3273 #endif
3274
3275 return 0;
3276
3277 }
3278 else
3279 {
3280 ret_internal = cphs_build_ext1(ubExtRecData);
3281 if ( ret_internal == FALSE )
3282 {
3283 TRACE_FUNCTION("mfw_cphs_vm_write_cb_ext: cphs_build_ext1 returns FALSE");
3284
3285 result = MFW_SIMOP_WRITE_OK;
3286
3287 cphs_signal(E_CPHS_SET_VC_NUM, &result);
3288
3289 // Mar 30, 2005 REF: CRR 29986 xpradipg
3290 // mbnData is deallocated, on successfull write operation
3291 #ifdef FF_MMI_OPTIM
3292 if(mbnData)
3293 mfwFree(mbnData,200);
3294 #endif
3295
3296 return 0;
3297 }
3298 }
3299
3300 return 1;
3301 }
3302
3303 /*
3304 +----------------------------------------------------------------------+
3305 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
3306 | STATE : code ROUTINE: cphs_write_sim_rcd_cb |
3307 +----------------------------------------------------------------------+
3308
3309
3310 PURPOSE : callback of SIM card writing.
3311
3312 */
3313
3314 void cphs_write_sim_rcd_cb (SHORT table_id)
3315 {
3316 UBYTE result;
3317 UBYTE *data_write;
3318 UBYTE dataLen = 0;
3319 UBYTE ret_internal = 0;
3320
3321 TRACE_FUNCTION ("cphs_write_sim_rcd_cb()");
3322 /***************************Go-lite Optimization changes Start***********************/
3323 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
3324 TRACE_EVENT_P1("SIM Error code!!!%d", simShrdPrm.atb[table_id].errCode);
3325 /***************************Go-lite Optimization changes end***********************/
3326 switch (simShrdPrm.atb[table_id].reqDataFld)
3327 {
3328 case SIM_CPHS_MBXN: /* mailbox numbers */
3329
3330 #ifdef FF_2TO1_PS
3331 if ( simShrdPrm.atb[table_id].errCode EQ CAUSE_SIM_NO_ERROR )
3332 #else
3333 if ( simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR )
3334 #endif
3335 {
3336 result = MFW_SIMOP_WRITE_OK;
3337
3338 ret_internal = mfw_cphs_vm_write_cb_ext();
3339 if ( ret_internal == 1 )
3340 {
3341 return;
3342 }
3343 }
3344 else
3345 {
3346 cphs_write_eeprom_mailbox(vcEntry);
3347 }
3348
3349 break;
3350
3351 case SIM_EXT1: /* mailbox ext numbers */
3352
3353 #ifdef FF_2TO1_PS
3354 if ( simShrdPrm.atb[table_id].errCode EQ CAUSE_SIM_NO_ERROR )
3355 #else
3356 if ( simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR )
3357 #endif
3358 {
3359 result = MFW_SIMOP_WRITE_OK;
3360
3361 ret_internal = mfw_cphs_vm_write_cb_ext();
3362 if ( ret_internal == 1 )
3363 {
3364 return;
3365 }
3366 }
3367 else
3368 {
3369 cphs_write_eeprom_mailbox(vcEntry);
3370 }
3371
3372 break;
3373
3374
3375 default:
3376 break;
3377 }
3378
3379 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;
3380 }
3381
3382 /*
3383 +----------------------------------------------------------------------+
3384 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
3385 | STATE : code ROUTINE: cphs_build_mbn_data |
3386 +----------------------------------------------------------------------+
3387
3388
3389 PURPOSE : Build mailbox number data in SIM format.
3390
3391 */
3392
3393 BOOL cphs_build_mbn_data(UBYTE *data, UBYTE len)
3394 {
3395 UBYTE alphaLen;
3396 UBYTE numLen;
3397 UBYTE *pNumber;
3398 UBYTE i, j;
3399 unsigned int length_no = 0;
3400 UBYTE byteno = 0;
3401
3402 TRACE_FUNCTION ("cphs_build_mbn_data()");
3403
3404 memset(data, MFW_INVALID_SIM_DATA, len);
3405
3406 /* alpha data */
3407 if (len <= MFW_CPHS_MIN_MBN_SIZE)
3408 alphaLen = 0;
3409 else
3410 alphaLen = len - MFW_CPHS_MIN_MBN_SIZE;
3411 i = MINIMUM (alphaLen, vcEntry->alpha.len);
3412
3413 for ( j = 0; j < i; j++ )
3414 data[j] = vcEntry->alpha.data[j];
3415
3416 data += alphaLen;
3417
3418 /* number data and TON/NPI data */
3419 if ( vcEntry->number[0] EQ '+' )
3420 {
3421 vcEntry->ton = TON_International;
3422 pNumber = &vcEntry->number[1];
3423 }
3424 else
3425 pNumber = &vcEntry->number[0];
3426
3427 for(i=0; i < strlen((CHAR *)pNumber); i++)
3428 {
3429 TRACE_EVENT_P2("pNumber[%d] : %c", i,pNumber[i]);
3430 }
3431
3432 cmhPHB_getAdrBcd ( data + 2, &numLen,
3433 PHB_MAX_LEN - 1, (CHAR *)pNumber );
3434
3435 for(i=0; i < numLen; i++)
3436 {
3437 TRACE_EVENT_P2("data + 2 + %d : %x", i, *(data + 2+i));
3438 }
3439
3440 if ( numLen < 11 )
3441 {
3442 *data = numLen + 1;
3443 }
3444 else
3445 {
3446 *data = 11;
3447 }
3448
3449
3450 *(data + 1) = ((( vcEntry -> ton << 4 ) & 0xF0 ) + ( vcEntry -> npi & 0x0F )) | 0x80;
3451
3452 data += 12;
3453
3454 length_no = numLen;
3455 byteno = length_no; // ( length_no / 2 ) + ( length_no % 2 );
3456
3457 if ( byteno > 10 )
3458 {
3459 ubCphsMbExtRecNo = ( byteno / 10 ) - ( ( byteno % 10 ) == 0 ? 1 : 0 );
3460 }
3461
3462 TRACE_EVENT_P1("length_no : %d", length_no);
3463 TRACE_EVENT_P1("byteno : %d", byteno);
3464 TRACE_EVENT_P1("ubCphsMbExtRecNo : %d", ubCphsMbExtRecNo);
3465 TRACE_EVENT_P1("vcEntry->index : %d", vcEntry->index);
3466 TRACE_EVENT_P1("vcEntry->list_index : %d", vcEntry->list_index);
3467 TRACE_EVENT_P1("dataLen : %d", len);
3468 TRACE_EVENT_P1("ext_rec_number : %d", mbNum.entries[vcEntry->list_index].ext_rec_number);
3469
3470
3471 /**************************************************************************************/
3472 /**************************************************************************************/
3473
3474 /* Check if enough EXT1 Records are available for storing the current number; If not, return FALSE */
3475
3476 if ( ( ubCphsMbExtRecNo > 0 ) &&
3477 ( mbNum.entries[vcEntry->list_index].ext_rec_number < ubCphsMbExtRecNo ) )
3478 {
3479 for ( i = mbNum.entries[vcEntry->list_index].ext_rec_number; i < ubCphsMbExtRecNo; i++ )
3480 {
3481 sFreeRec = 0;
3482 #ifdef TI_PS_FFS_PHB
3483 sFreeRec = cmh_Query_free_ext_record();
3484 #endif
3485 if ( ( sFreeRec <= 0 ) || ( sFreeRec == 0xFF ) )
3486 {
3487 sFreeRec = 0;
3488 TRACE_FUNCTION("Not enuf ext1 recs available, hence show writeerror");
3489 return FALSE;
3490 }
3491 }
3492
3493 sFreeRec = 0;
3494 }
3495
3496 /**************************************************************************************/
3497 /**************************************************************************************/
3498
3499
3500 /* capability/configuration identifier data and EXT identifier data */
3501 *data = 0xFF;
3502
3503 if ( ubCphsMbExtRecNo == 0 )
3504 {
3505 *(data + 1) = 0xFF;
3506 }
3507 else
3508 {
3509 sFreeRec = 0;
3510 ubCurrExtRcWrite = 0;
3511
3512 if ( mbNum.entries[vcEntry->list_index].ext_rec_number > ubCurrExtRcWrite )
3513 {
3514 TRACE_FUNCTION("ext rec taken from within");
3515 sFreeRec = mbNum.entries[vcEntry->list_index].ext_rec_idx[ubCurrExtRcWrite];
3516 }
3517 else
3518 {
3519 TRACE_FUNCTION("ext rec taken from cmh");
3520 #ifdef TI_PS_FFS_PHB
3521 sFreeRec = cmh_Query_free_ext_record();
3522 #endif
3523 }
3524
3525 TRACE_EVENT_P1("sFreeRec: %d", sFreeRec);
3526
3527 if ( ( sFreeRec <= 0 ) || ( sFreeRec == 0xFF ) )
3528 {
3529 TRACE_FUNCTION ("cphs_build_mbn_data() : No free records available");
3530 *(data + 1) = 0xFF;
3531 mbNum.entries[vcEntry->list_index].ext_rec_idx[ubCurrExtRcWrite] = 0xFF;
3532 }
3533 else
3534 {
3535 *(data + 1) = 0x00;
3536 *(data + 1) = sFreeRec;
3537 TRACE_FUNCTION("cmh_PHB_update_ext_record to be");
3538 #ifdef TI_PS_FFS_PHB
3539 cmh_PHB_update_ext_record(sFreeRec,TRUE);
3540 #endif
3541 TRACE_EVENT_P1(" *(data + 1) : %d", *(data + 1) );
3542 }
3543
3544 mbNum.entries[vcEntry->list_index].ext_rec_idx[ubCurrExtRcWrite] = *(data + 1);
3545 }
3546
3547 return TRUE;
3548 }
3549
3550 /*
3551 +----------------------------------------------------------------------+
3552 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
3553 | STATE : code ROUTINE: cphs_ssc |
3554 +----------------------------------------------------------------------+
3555
3556
3557 PURPOSE : Check CPHS service status.
3558
3559 */
3560
3561 UBYTE cphs_ssc (UBYTE nr, UBYTE * serv_table)
3562 {
3563 UBYTE value;
3564
3565 TRACE_FUNCTION ("cphs_ssc()");
3566
3567 serv_table = serv_table + (nr-1)/4;
3568 value = * serv_table;
3569
3570 value = value >> (((nr-1) & 3) * 2);
3571 value = value & 3;
3572
3573 return value;
3574 }
3575
3576 /*
3577 +--------------------------------------------------------------------+
3578 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
3579 | STATE : code ROUTINE : cphsCommand |
3580 +--------------------------------------------------------------------+
3581
3582 PURPOSE : handle mfw windows command
3583
3584 */
3585
3586 static int cphsCommand (U32 cmd, void *h)
3587 {
3588 switch (cmd)
3589 {
3590 case MfwCmdDelete: /* delete me */
3591 if (!h)
3592 return 0;
3593 cphs_delete(h);
3594 return 1;
3595 default:
3596 break;
3597 }
3598
3599 return 0;
3600 }
3601
3602 #ifdef SIM_TOOLKIT
3603 /*
3604 +---------------------------------------------------------------------+
3605 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
3606 | STATE : code ROUTINE : cphs_sat_file_update |
3607 +---------------------------------------------------------------------+
3608
3609 PURPOSE : SIM file change indication
3610
3611 */
3612
3613 void cphs_sat_file_update(USHORT dataId)
3614 {
3615 TRACE_FUNCTION("cphs_sat_file_update()");
3616
3617 cphsUpdate = TRUE;
3618 switch (dataId)
3619 {
3620 case SIM_CPHS_CINF:
3621 if (!cphs_read_sim_dat(SIM_CPHS_CINF, NOT_PRESENT_8BIT, MFW_CPHS_INFO_SIZE))
3622 {
3623 satUpdateFiles(TRUE, SIM_CPHS_CINF);
3624 }
3625 break;
3626 default:
3627 break;
3628 }
3629 }
3630 #endif
3631
3632 #ifdef SIM_TOOLKIT
3633 /*
3634 +---------------------------------------------------------------------+
3635 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
3636 | STATE : code ROUTINE : cphs_update_info_cnf |
3637 +---------------------------------------------------------------------+
3638
3639 PURPOSE : call back for SIM file read
3640
3641 */
3642 void cphs_update_info_cnf (USHORT errCode, UBYTE *data, UBYTE dataLen)
3643 {
3644 UBYTE *ptr;
3645
3646 TRACE_FUNCTION ("cphs_update_info_cnf()");
3647
3648 cphsUpdate = FALSE; /* reset flag */
3649 ptr = data;
3650 #ifdef FF_2TO1_PS
3651 if ( errCode NEQ CAUSE_SIM_NO_ERROR OR
3652 #else
3653 if ( errCode NEQ SIM_NO_ERROR OR
3654 #endif
3655 ptr EQ NULL OR
3656 dataLen < MFW_CPHS_INFO_SIZE)
3657 {
3658 satUpdateFiles(TRUE, SIM_CPHS_CINF);
3659 }
3660 else
3661 {
3662 cphsPhase = *ptr;
3663 ptr++;
3664 memcpy (cphsServTab, ptr, CPHS_SERVICE_TABLE*sizeof(UBYTE));
3665 //x0pleela 11 June, 2006 DR:OMAPS00079692
3666 //changed from CPHS_OK to MFW_CPHS_OK
3667 cphsStatus = MFW_CPHS_OK;
3668 satUpdateFiles ( TRUE, SIM_CPHS_CINF );
3669 }
3670 }
3671 #endif
3672 /*
3673 +----------------------------------------------------------------------+
3674 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
3675 | STATE : code ROUTINE: Read_Sim |
3676 +----------------------------------------------------------------------+
3677
3678
3679 PURPOSE : Request to read SIM card.
3680
3681 */
3682
3683 BOOL Read_Sim(USHORT dat_id, USHORT offset, UBYTE max_len, UBYTE *exDat)
3684 {
3685 T_ACI_RETURN res;
3686 /*
3687 * x0047685 Added path_info to support R99 SIM Interface changes.
3688 */
3689 T_path_info tmp_path;
3690
3691 TRACE_FUNCTION ("Read_Sim()");
3692
3693 tmp_path.df_level1 = SIM_DF_VI;
3694 tmp_path.v_df_level2 = FALSE;
3695
3696 #ifdef FF_2TO1_PS
3697 res = cmhSIM_ReadTranspEF ( CMD_SRC_NONE,
3698 AT_CMD_NONE,
3699 FALSE, /* SCT: dummy only (path info valid flag) */
3700 NULL, /* SCT: dummy only (path info) */
3701 dat_id,
3702 offset,
3703 max_len,
3704 exDat,
3705 cphs_read_sim_default_cb);
3706 #else
3707 res = cmhSIM_ReadTranspEF ( CMD_SRC_NONE,
3708 AT_CMD_NONE,
3709 TRUE, /* SCT: dummy only (path info valid flag) */
3710 &tmp_path, /* SCT: dummy only (path info) */
3711 dat_id,
3712 offset,
3713 max_len,
3714 exDat,
3715 cphs_read_sim_default_cb);
3716 #endif
3717
3718 if (res NEQ AT_EXCT)
3719 return FALSE;
3720
3721 return TRUE;
3722 }
3723
3724
3725 /*
3726 +----------------------------------------------------------------------+
3727 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
3728 | STATE : code ROUTINE: Read_Sim_Record |
3729 +----------------------------------------------------------------------+
3730
3731
3732 PURPOSE : Request to read record from SIM card.
3733
3734 */
3735
3736 BOOL Read_Sim_Record(USHORT dat_id, USHORT record, UBYTE len, UBYTE *exDat)
3737 {
3738 T_ACI_RETURN res;
3739 UBYTE dataLen;
3740 /*
3741 * x0047685 Added path_info to support R99 SIM Interface changes.
3742 */
3743 T_path_info tmp_path;
3744
3745 if (record EQ 1)
3746 dataLen = UCHAR_MAX;
3747 else
3748 dataLen = len;
3749
3750 TRACE_FUNCTION ("Read_Sim_Record()");
3751
3752 tmp_path.df_level1 = SIM_DF_VI;
3753 tmp_path.v_df_level2 = FALSE;
3754
3755 #ifdef FF_2TO1_PS
3756 res = cmhSIM_ReadRecordEF ( CMD_SRC_NONE,
3757 AT_CMD_NONE,
3758 FALSE, /* SCT: dummy only (path info valid flag) */
3759 NULL, /* SCT: dummy only (path info) */
3760 dat_id,
3761 record,
3762 dataLen,
3763 exDat,
3764 cphs_read_sim_default_cb);
3765 #else
3766 res = cmhSIM_ReadRecordEF ( CMD_SRC_NONE,
3767 AT_CMD_NONE,
3768 TRUE, /* SCT: dummy only (path info valid flag) */
3769 &tmp_path, /* SCT: dummy only (path info) */
3770 dat_id,
3771 record,
3772 dataLen,
3773 exDat,
3774 cphs_read_sim_default_cb);
3775 #endif
3776 if (res NEQ AT_EXCT)
3777 return FALSE;
3778
3779 return TRUE;
3780 }
3781
3782 /*
3783 +----------------------------------------------------------------------+
3784 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
3785 | STATE : code ROUTINE: Write_Sim |
3786 +----------------------------------------------------------------------+
3787 PURPOSE : Request to write SIM card.
3788 */
3789
3790 BOOL Write_Sim(USHORT dat_id, UBYTE len, UBYTE *exDat)
3791 {
3792 T_ACI_RETURN res;
3793
3794 TRACE_FUNCTION ("Write_Sim()");
3795
3796 #ifdef FF_2TO1_PS
3797 res = cmhSIM_WriteTranspEF (CMD_SRC_NONE,
3798 AT_CMD_NONE,
3799 FALSE, /* SCT: dummy only (path info valid flag) */
3800 NULL, /* SCT: dummy only (path info) */
3801 dat_id,
3802 0,
3803 len,
3804 exDat,
3805 cphs_write_sim_default_cb);
3806 #else
3807 res = cmhSIM_WriteTranspEF (CMD_SRC_NONE,
3808 AT_CMD_NONE,
3809 FALSE, /* SCT: dummy only (path info valid flag) */
3810 NULL, /* SCT: dummy only (path info) */
3811 dat_id,
3812 0,
3813 len,
3814 exDat,
3815 cphs_write_sim_default_cb);
3816 #endif
3817
3818 if (res NEQ AT_EXCT)
3819 return FALSE;
3820
3821 return TRUE;
3822 }
3823
3824
3825 /*
3826 +----------------------------------------------------------------------+
3827 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
3828 | STATE : code ROUTINE: Write_Sim_Record |
3829 +----------------------------------------------------------------------+
3830
3831
3832 PURPOSE : Request to write record to SIM card.
3833
3834 */
3835
3836 BOOL Write_Sim_Record(USHORT dat_id, USHORT record, UBYTE len, UBYTE *exDat)
3837 {
3838 T_ACI_RETURN res;
3839 /*
3840 * x0047685 Added path_info to support R99 SIM Interface changes.
3841 */
3842 T_path_info tmp_path;
3843
3844 TRACE_FUNCTION ("Write_Sim()");
3845
3846 tmp_path.df_level1 = SIM_DF_VI;
3847 tmp_path.v_df_level2 = FALSE;
3848
3849 #ifdef FF_2TO1_PS
3850 res = cmhSIM_WriteRecordEF (CMD_SRC_NONE,
3851 AT_CMD_NONE,
3852 FALSE, /* SCT: dummy only (path info valid flag) */
3853 NULL, /* SCT: dummy only (path info) */
3854 dat_id,
3855 record,
3856 len,
3857 exDat,
3858 cphs_write_sim_default_cb);
3859 #else
3860 res = cmhSIM_WriteRecordEF (CMD_SRC_NONE,
3861 AT_CMD_NONE,
3862 TRUE, /* SCT: dummy only (path info valid flag) */
3863 &tmp_path, /* SCT: dummy only (path info) */
3864 dat_id,
3865 record,
3866 len,
3867 exDat,
3868 cphs_write_sim_default_cb);
3869 #endif
3870
3871 if (res NEQ AT_EXCT)
3872 return FALSE;
3873
3874 return TRUE;
3875 }
3876
3877 /*
3878 +----------------------------------------------------------------------+
3879 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
3880 | STATE : code ROUTINE: cphs_read_default_cb |
3881 +----------------------------------------------------------------------+
3882
3883
3884 PURPOSE : Sends event to MMI
3885
3886 */
3887 void cphs_read_sim_default_cb(SHORT table_id)
3888 {
3889
3890 read_sim_entry.requested_field = simShrdPrm.atb[table_id].reqDataFld;
3891 read_sim_entry.exchange_data = simShrdPrm.atb[table_id].exchData;
3892 read_sim_entry.sim_result = simShrdPrm.atb[table_id].errCode;
3893 read_sim_entry.data_len = simShrdPrm.atb[table_id].dataLen;
3894 read_sim_entry.record = simShrdPrm.atb[table_id].recNr;
3895 #ifdef FF_2TO1_PS
3896 if (read_sim_entry.sim_result != CAUSE_SIM_NO_ERROR)
3897 #else
3898 if (read_sim_entry.sim_result != SIM_NO_ERROR)
3899 #endif
3900 { read_sim_entry.exchange_data = NULL;
3901 read_sim_entry.data_len = 0;
3902 }
3903
3904 cphs_signal(E_CPHS_GET_SIM_FIELD, &read_sim_entry);
3905 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;
3906 }
3907
3908
3909 /*
3910 +----------------------------------------------------------------------+
3911 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
3912 | STATE : code ROUTINE: cphs_read_default_cb |
3913 +----------------------------------------------------------------------+
3914
3915
3916 PURPOSE : Sends event to MMI
3917
3918 */
3919 void cphs_write_sim_default_cb(SHORT table_id)
3920 {
3921
3922 read_sim_entry.requested_field = simShrdPrm.atb[table_id].reqDataFld;
3923 read_sim_entry.exchange_data = simShrdPrm.atb[table_id].exchData;
3924 read_sim_entry.sim_result = simShrdPrm.atb[table_id].errCode;
3925 read_sim_entry.data_len = simShrdPrm.atb[table_id].dataLen;
3926 #ifdef FF_2TO1_PS
3927 if (read_sim_entry.sim_result != CAUSE_SIM_NO_ERROR)
3928 #else
3929 if (read_sim_entry.sim_result != SIM_NO_ERROR)
3930 #endif
3931 { read_sim_entry.exchange_data = NULL;
3932 read_sim_entry.data_len = 0;
3933 }
3934
3935 cphs_signal(E_CPHS_SET_SIM_FIELD, &read_sim_entry);
3936 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;
3937 }
3938
3939 #ifdef FF_CPHS_REL4
3940
3941 UBYTE mfw_cphs_get_reg_profile(void)
3942 {
3943 TRACE_FUNCTION("mfw_cphs_get_reg_profile");
3944 TRACE_EVENT_P1(" Get registered profile - %d", mspinfo.registered_profile);
3945 return mspinfo.registered_profile;
3946 }
3947
3948 UBYTE mfw_cphs_get_default_profile(void)
3949 {
3950 TRACE_FUNCTION("mfw_cphs_get_default_profile");
3951 TRACE_EVENT_P1(" Get default profile - %d", mspinfo.default_profile);
3952 return mspinfo.default_profile;
3953 }
3954
3955 void mfw_cphs_set_reg_profile(UBYTE profile_id)
3956 {
3957 TRACE_FUNCTION("mfw_cphs_set_reg_profile");
3958 TRACE_EVENT_P1(" Set registered profile - %d", profile_id);
3959 mspinfo.registered_profile = profile_id;
3960 }
3961
3962 void mfw_cphs_set_default_profile(UBYTE profile_id)
3963 {
3964 TRACE_FUNCTION("mfw_cphs_set_default_profile");
3965 TRACE_EVENT_P1(" Set default profile - %d", profile_id);
3966 mspinfo.default_profile = profile_id;
3967 }
3968
3969 T_MFW_CPHS_MSP_INFO* mfw_cphs_get_msp(void)
3970 {
3971 TRACE_FUNCTION("mfw_cphs_get_msp");
3972 TRACE_EVENT_P3("msp count - %d, def profile - %d, reg profile - %d ",mspinfo.count, mspinfo.default_profile, mspinfo.registered_profile);
3973
3974 return &mspinfo;
3975 }
3976
3977 UBYTE mfw_cphs_get_no_profile(void)
3978 {
3979 TRACE_FUNCTION("mfw_cphs_get_no_profile");
3980 return mspinfo.count;
3981 }
3982
3983
3984 /*
3985 +----------------------------------------------------------------------+
3986 | PROJECT: MMI-Framework MODULE: MFW_CPHS |
3987 | STATE : code ROUTINE: mfw_cphs_get_msp_info |
3988 +----------------------------------------------------------------------+
3989
3990
3991 PURPOSE : query for MSP
3992
3993 */
3994 void mfw_cphs_get_msp_info(void)
3995 {
3996 TRACE_FUNCTION("mfw_cphs_get_msp_info()");
3997 qAT_PlusCNUM(CMD_SRC_LCL, 0);
3998
3999 }
4000
4001 /*
4002 +----------------------------------------------------------------------+
4003 | PROJECT: MMI-Framework MODULE: MFW_CPHS |
4004 | STATE : code ROUTINE: check_msp_rec |
4005 +----------------------------------------------------------------------+
4006
4007
4008 PURPOSE : check for valid records in sim
4009
4010 */
4011 int check_msp_rec(T_ACI_CNUM_MSISDN *msisdn, int i)
4012 {
4013 TRACE_FUNCTION("check_msp_rec()");
4014 if(msisdn->vldFlag == TRUE)
4015 {
4016 strcpy(mspinfo.profile[i].alpha, msisdn->alpha);
4017 strcpy(mspinfo.profile[i].number, msisdn->number);
4018 TRACE_EVENT_P1("profile alpha %s",mspinfo.profile[i].alpha);
4019 TRACE_EVENT_P1("profile number %s",mspinfo.profile[i].number);
4020 return TRUE;
4021 }
4022 return FALSE;
4023 }
4024
4025 /*
4026 +----------------------------------------------------------------------+
4027 | PROJECT: MMI-Framework MODULE: MFW_CPHS |
4028 | STATE : code ROUTINE: send_msp_signal |
4029 +----------------------------------------------------------------------+
4030
4031
4032 PURPOSE : send event to MMI
4033
4034 */
4035 void send_msp_signal(UBYTE count)
4036 {
4037 TRACE_EVENT_P1("msp profile count %d", count);
4038 mspinfo.count = count;
4039 cphs_signal(E_CPHS_MSP_IND, &mspinfo);
4040 }
4041
4042 #endif
4043 /*
4044 +----------------------------------------------------------------------+
4045 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
4046 | STATE : code ROUTINE: mfw_cphs_get_als_info |
4047 +----------------------------------------------------------------------+
4048 PURPOSE : Returns the current active line
4049 */
4050
4051 //x0pleela 25 May, 2006 DR: OMAPS00070657
4052 #ifdef FF_CPHS
4053 T_MFW mfw_cphs_get_als_info(void)
4054 {
4055 T_ACI_ALS_MOD ALSmode = ALS_MOD_NOTPRESENT; /*a0393213 compiler warnings removal - 0 changed to ALS_MOD_NOTPRESENT*/
4056 TRACE_FUNCTION("mfw_cphs_get_als_info");
4057
4058 if( qAT_PercentALS( CMD_SRC_LCL, &ALSmode )!= AT_CMPL )
4059 return ALS_MOD_NOTPRESENT;
4060 else
4061 return ALSmode;
4062 }
4063 #endif
4064