comparison g23m/condat/ms/src/mfw/mfw_cphs.c @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
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 Jan 12, 2006 OMAPS00062632 x0018858
17 Description: The differnace in the type of the data passed to the function cphs_read_information()
18 is causing an incorrect value being received as the output.
19 Solution: The errcode being passed to the function has been modified to USHORT
20
21 Mar 30, 2005 REF: CRR 29986 xpradipg
22 Description: Optimisation 1: Removal of unused variables and dynamically
23 allocate/ deallocate mbndata
24 Solution: Static allocation of mbnData is replaced with dynamic allocation
25 and deallocation
26
27 Aug 16, 2004 REF: CRR 24323 Deepa M.D
28 Bug:Clenup of sprintf used for tracing
29 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX
30
31 */
32
33 #define ENTITY_MFW
34
35 #include <string.h>
36 #include <stdio.h>
37 #include <stdlib.h>
38 #include <limits.h>
39
40 #if defined (NEW_FRAME)
41
42 #include "typedefs.h"
43 #include "vsi.h"
44 #include "pei.h"
45 #include "custom.h"
46 #include "gsm.h"
47
48 #else
49
50 #include "STDDEFS.H"
51 #include "custom.h"
52 #include "gsm.h"
53 #include "vsi.h"
54
55 #endif
56
57 #include "mfw_mfw.h"
58 #include "mfw_sim.h"
59 #include "mfw_nm.h"
60 #include "mfw_simi.h"
61 #include "mfw_phb.h"
62 #include "mfw_phbi.h"
63 #include "mfw_cphs.h"
64 #include "mfw_cphsi.h"
65 #include "mfw_win.h"
66 #include "mfw_cm.h"
67 #include "mfw_ss.h"
68 #include "mfw_ffs.h"
69
70 #include "ksd.h"
71 #include "psa.h"
72
73 #ifdef SIM_TOOLKIT
74 #include "mfw_sat.h"
75 #endif
76
77 #if defined (FAX_AND_DATA)
78 #include "aci_fd.h"
79 #endif
80
81 #include "cmh.h"
82 #include "phb.h"
83 #include "cmh_phb.h"
84 #include "psa_sim.h"
85
86 #ifndef PCM_2_FFS
87 #include "pcm.h"
88 #include "mfw_ffs.h"
89 #endif
90
91
92 EXTERN MfwHdr * current_mfw_elem;
93 static int cphsCommand (U32 cmd, void *h); /* handle win commands */
94
95 /* event parameter define */
96 static T_MFW_CPHS_OP_NAME opName;
97 static T_MFW_CPHS_VC_NUM mbNum;
98 static T_MFW_CPHS_VC_STAT mbStatus;
99 static T_MFW_CPHS_DV_STAT dvStatus;
100 static T_MFW_CPHS_ALS_STATUS alsStatus;
101 static T_MFW_CPHS_CSP csProfile;
102 static T_MFW_CPHS_INFONUM_LIST numList;
103 static T_MFW_CPHS_INFONUM_ENTRY infoEntry;
104 // Mar 30, 2005 REF: CRR 29986 xpradipg
105 // the optimisation is placed under a flag, a pointer variable is defined
106 // instead of the static array, which is allocated and deallocated
107 #ifdef FF_MMI_OPTIM
108 #define MAX_MAIL_BOX_NUMBER 40
109 UBYTE *mbnData;
110 #else
111 static UBYTE mbnData[40]; // it should be allocated dynamically.
112 #endif
113 /* PATCH VO 22.01.01 */
114 static UBYTE mbsData[MFW_CPHS_MBS_SIZE]; // it should be allocated dynamically.
115 static UBYTE dvData[MFW_CPHS_CFF_SIZE]; // it should be allocated dynamically.
116 /* PATCH VO 22.01.01 end */
117 static T_MFW_CPHS_READ_SIM_ENTRY read_sim_entry;//MC
118 /* variable define */
119 static T_MFW_CPHS_STATUS cphsStatus;
120 static UBYTE cphsPhase;
121 static UBYTE cphsServTab[CPHS_SERVICE_TABLE];
122 static UBYTE maxRec;
123 /* PATCH JPS 16.01.01: store mailbox number entry */
124 static T_MFW_CPHS_ENTRY MbnEntry;
125 /* PATCH JPS 16.01.01 END */
126 static T_MFW_CPHS_ENTRY *vcEntry;
127 static UBYTE simStatus;
128 static UBYTE alsData;
129 static UBYTE idxLevel;
130 static UBYTE startIdx;
131 static UBYTE cphsUpdate = FALSE;
132 static UINT16 cphsPrevRead = 0;
133
134
135 //Added by Muthu Raja For PCM Reolacement
136
137 #ifdef PCM_2_FFS
138 #define PSPDF_MBN_ID "/PCM/MBN" /* Mailbox Numbers */
139 #endif
140
141 /*
142 +--------------------------------------------------------------------+
143 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
144 | STATE : code ROUTINE: cphs_init |
145 +--------------------------------------------------------------------+
146
147
148 PURPOSE : initialize for CPHS management
149
150 */
151
152 void cphs_init(void)
153 {
154 TRACE_FUNCTION("cphs_init()");
155
156 cphsStatus = CPHS_NotPresent;
157 simStatus = MFW_SIMOP_UNKNOWN;
158 mfwCommand[MfwTypCphs] = (MfwCb) cphsCommand;
159 }
160
161
162 /*
163 +--------------------------------------------------------------------+
164 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
165 | STATE : code ROUTINE: cphs_exit |
166 +--------------------------------------------------------------------+
167
168
169 PURPOSE :
170
171 */
172
173 void cphs_exit(void)
174 {
175 TRACE_FUNCTION ("cphs_exit()");
176 }
177
178
179 /*
180 +--------------------------------------------------------------------+
181 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
182 | STATE : code ROUTINE: cphs_create |
183 +--------------------------------------------------------------------+
184
185
186 PURPOSE : create event for CPHS management
187
188 */
189
190 MfwHnd cphs_create (MfwHnd hWin, MfwEvt event, MfwCb cbfunc)
191 {
192 MfwHdr *hdr;
193 T_MFW_CPHS *cphs_para;
194 MfwHdr *insert_status=0;
195
196 TRACE_FUNCTION("cphs_create()");
197
198 hdr = (MfwHdr *) mfwAlloc(sizeof(MfwHdr));
199 cphs_para = (T_MFW_CPHS *) mfwAlloc(sizeof(T_MFW_CPHS));
200
201 if (!hdr || !cphs_para)
202 {
203 TRACE_ERROR("ERROR: cphs_create() Mem Alloc Failed.");
204
205 if(hdr)
206 mfwFree((U8*)hdr,sizeof(MfwHdr));
207
208 if(cphs_para)
209 mfwFree((U8*)cphs_para,sizeof(T_MFW_CPHS));
210
211 return FALSE;
212 }
213
214 cphs_para->emask = event;
215 cphs_para->handler = cbfunc;
216
217 hdr->data = cphs_para; /* store parameter in node */
218 hdr->type = MfwTypCphs; /* type of event handler */
219
220 insert_status= mfwInsert((MfwHdr *) hWin,hdr);
221 if(!insert_status)
222 {
223 TRACE_ERROR("ERROR: cphs_create() Failed to Install Handler. ");
224 mfwFree((U8*)hdr,sizeof(MfwHdr));
225 mfwFree((U8*)cphs_para,sizeof(T_MFW_CPHS));
226 return 0;
227 }
228 return insert_status;
229 }
230
231 /*
232 +--------------------------------------------------------------------+
233 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
234 | STATE : code ROUTINE: cphs_delete |
235 +--------------------------------------------------------------------+
236
237
238 PURPOSE : delete a event for CPHS management
239
240 */
241
242 MfwRes cphs_delete (MfwHnd h)
243 {
244 TRACE_FUNCTION("cphs_delete()");
245
246 if (!h || !((MfwHdr *) h)->data)
247 return MfwResIllHnd;
248
249 if (!mfwRemove((MfwHdr *) h))
250 return MfwResIllHnd;
251
252 mfwFree(((MfwHdr *) h)->data,sizeof(T_MFW_CPHS));
253 mfwFree(h,sizeof(MfwHdr));
254
255 return MfwResOk;
256 }
257
258 /*
259 +--------------------------------------------------------------------+
260 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
261 | STATE : code ROUTINE : cphs_sign_exec |
262 +--------------------------------------------------------------------+
263
264 PURPOSE : dispatch CPHS management signal
265
266 */
267
268 static int cphs_sign_exec (MfwHdr *cur_elem, MfwEvt event,
269 T_MFW_CPHS_PARA * para)
270 {
271 TRACE_FUNCTION("cphs_sign_exec()");
272
273 while (cur_elem)
274 {
275 if (cur_elem->type == MfwTypCphs)
276 {
277 T_MFW_CPHS *cphs_data;
278
279 cphs_data = (T_MFW_CPHS *) cur_elem->data;
280 if (cphs_data->emask & event)
281 {
282 cphs_data->event = event;
283 switch (event)
284 {
285 case E_CPHS_IND:
286 memcpy(&cphs_data->para.stat, para, sizeof(T_MFW_CPHS_STATUS));
287 break;
288 case E_CPHS_OP_NAME:
289 memcpy(&cphs_data->para.oper_name, para, sizeof(T_MFW_CPHS_OP_NAME));
290 break;
291 case E_CPHS_GET_VC_NUM:
292 memcpy(&cphs_data->para.vc_entry, para, sizeof(T_MFW_CPHS_VC_NUM));
293 break;
294 case E_CPHS_SET_VC_NUM:
295 memcpy(&cphs_data->para.result, para, sizeof(UBYTE));
296 break;
297 case E_CPHS_GET_VC_STAT:
298 memcpy(&cphs_data->para.vc_status, para, sizeof(T_MFW_CPHS_VC_STAT));
299 break;
300 case E_CPHS_SET_VC_STAT:
301 memcpy(&cphs_data->para.result, para, sizeof(UBYTE));
302 break;
303 case E_CPHS_GET_DV_STAT:
304 memcpy(&cphs_data->para.dv_status, para, sizeof(T_MFW_CPHS_DV_STAT));
305 break;
306 case E_CPHS_SET_DV_STAT:
307 memcpy(&cphs_data->para.result, para, sizeof(UBYTE));
308 break;
309 case E_CPHS_GET_ALS_STATUS:
310 memcpy(&cphs_data->para.als_status, para, sizeof(T_MFW_CPHS_ALS_STATUS));
311 break;
312 case E_CPHS_SET_LINE:
313 memcpy(&cphs_data->para.result, para, sizeof(UBYTE));
314 break;
315 case E_CPHS_GET_CSP:
316 memcpy(&cphs_data->para.csp, para, sizeof(T_MFW_CPHS_CSP));
317 break;
318 case E_CPHS_GET_INFO_LIST:
319 memcpy(&cphs_data->para.num_list, para, sizeof(T_MFW_CPHS_INFONUM_LIST));
320 break;
321 case E_CPHS_GET_INFO_NUM:
322 memcpy(&cphs_data->para.info_entry, para, sizeof(T_MFW_CPHS_INFONUM_ENTRY));
323 break;
324 case E_CPHS_GET_SIM_FIELD://MC added for generic read function
325 memcpy(&cphs_data->para.read_sim_entry, para, sizeof(T_MFW_CPHS_READ_SIM_ENTRY));
326 break;
327 case E_CPHS_SET_SIM_FIELD://MC added for generic read function
328 memcpy(&cphs_data->para.read_sim_entry, para, sizeof(T_MFW_CPHS_READ_SIM_ENTRY));
329 break;
330
331
332 }
333 if (cphs_data->handler)
334 {
335 // store current mfw elem
336 current_mfw_elem = cur_elem;
337
338 if ((*(cphs_data->handler)) (cphs_data->event, (void *) &cphs_data->para))
339 return TRUE;
340 }
341 }
342 }
343 cur_elem = cur_elem->next;
344 }
345
346 return FALSE;
347 }
348
349 /*
350 +--------------------------------------------------------------------+
351 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
352 | STATE : code ROUTINE : cphs_signal |
353 +--------------------------------------------------------------------+
354
355 PURPOSE : Send a signal
356
357 */
358
359 static void cphs_signal (MfwEvt event, void *para)
360 {
361 /*MC, SPR 1389, we have to enable the display whenever
362 we send an event up to the MMI*/
363 UBYTE temp = dspl_Enable(0);
364
365 TRACE_FUNCTION("cphs_signal()");
366
367 if (mfwSignallingMethod EQ 0)
368 {
369 if (mfwFocus)
370 if (cphs_sign_exec(mfwFocus,event,para))
371 { dspl_Enable(temp);/*MC, SPR 1389*/
372 return;
373 }
374 if (mfwRoot)
375 cphs_sign_exec(mfwRoot,event,para);
376 }
377 else
378 {
379 MfwHdr * h = 0;
380
381 /*
382 * Focus set, then start here
383 */
384 if (mfwFocus)
385 h = mfwFocus;
386 /*
387 * Focus not set, then start root
388 */
389 if (!h)
390 h = mfwRoot;
391
392 /*
393 * No elements available, return
394 */
395
396 while (h)
397 {
398 /*
399 * Signal consumed, then return
400 */
401 if (cphs_sign_exec (h, event, para))
402 { dspl_Enable(temp);/*MC, SPR 1389*/
403 return;
404 }
405
406 /*
407 * All windows tried inclusive root
408 */
409 if (h == mfwRoot)
410 { dspl_Enable(temp);/*MC, SPR 1389*/
411 return;
412 }
413
414 /*
415 * get parent window
416 */
417 h = mfwParent(mfwParent(h));
418 if(h)
419 h = ((MfwWin * )(h->data))->elems;
420 }
421 cphs_sign_exec(mfwRoot,event,para);
422 }
423 dspl_Enable(temp);/*MC, SPR 1389*/
424 }
425
426 /*
427 +--------------------------------------------------------------------+
428 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
429 | STATE : code ROUTINE : cphs_support_check |
430 +--------------------------------------------------------------------+
431
432 PURPOSE : Check whether CPHS is supported.
433
434 */
435
436 void cphs_support_check (void)
437 {
438 TRACE_FUNCTION ("cphs_support_check()");
439
440 /* Read CPHS information filed (6F16 - 3 bytes) from SIM card */
441 if (!cphs_read_sim_dat(SIM_CPHS_CINF, NOT_PRESENT_8BIT, MFW_CPHS_INFO_SIZE))
442 {
443 /* Read failed */
444 /*MC-CONQUEST5999->6007, 20/05/2002, set status to ERR rather than NotPresent*/
445 cphsStatus = CPHS_ERR;
446 TRACE_EVENT("CPHS, error reading support indication");
447 cphs_signal(E_CPHS_IND, &cphsStatus);
448 }
449 }
450
451 /*
452 +--------------------------------------------------------------------+
453 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
454 | STATE : code ROUTINE : cphs_config |
455 +--------------------------------------------------------------------+
456
457 PURPOSE : Request the Configuration of CPHS fields
458
459 */
460
461 T_MFW cphs_config (T_MFW_CPHS_INFO *cphs_info)
462 {
463 TRACE_FUNCTION ("cphs_config()");
464
465 if (cphs_info NEQ NULL /* AND
466 cphsStatus EQ CPHS_OK */ )
467 {
468 cphs_info->phase = cphsPhase;
469 cphs_info->csp = cphs_ssc(MFW_CPHS_CSP, cphsServTab);
470 cphs_info->mbNum = cphs_ssc(MFW_CPHS_MB_NUMBER, cphsServTab);
471
472 if (cphsPhase EQ 1) /* phase 1 only */
473 cphs_info->sst = cphs_ssc(MFW_CPHS_SST, cphsServTab);
474 else /* not support */
475 cphs_info->sst = NO_ALLOCATED;
476
477 if (cphsPhase EQ 2) /* phase 2 only */
478 {
479 cphs_info->opNS = cphs_ssc(MFW_CHPS_NAME_SHORT, cphsServTab);
480 cphs_info->iNum = cphs_ssc(MFW_CHPS_INFO_NUMBERS, cphsServTab);
481 }
482 else /* not support */
483 {
484 cphs_info->opNS = NO_ALLOCATED;
485 cphs_info->iNum = NO_ALLOCATED;
486 }
487 }
488 return cphsStatus;
489 }
490
491 /*
492 +--------------------------------------------------------------------+
493 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
494 | STATE : code ROUTINE : cphs_operator_name |
495 +--------------------------------------------------------------------+
496
497 PURPOSE : Request the network operator name
498
499 */
500
501 T_MFW cphs_operator_name (void)
502 {
503 TRACE_FUNCTION ("cphs_operator_name()");
504
505 /* Check CPHS support status */
506 if (cphsStatus EQ CPHS_NotPresent)
507 return cphsStatus;
508
509 /* Read operator name sring */
510 if (!cphs_read_sim_dat(SIM_CPHS_ONSTR, NOT_PRESENT_8BIT, MFW_CPHS_ONS_SIZE))
511 {
512 /* Read operator name sring failed */
513 opName.longName.len = 0;
514
515 /* Read operator name shortform */
516 if ((cphsPhase NEQ 2) OR
517 (cphs_ssc(MFW_CHPS_NAME_SHORT, cphsServTab) NEQ ALLOCATED_AND_ACTIVATED) OR
518 !cphs_read_sim_dat(SIM_CPHS_ONSHF, NOT_PRESENT_8BIT, MFW_CPHS_ONSF_SIZE) )
519 {
520 /* Read operator name shortform failed.
521 Send event with empty info to MMI */
522 opName.shortName.len = 0;
523 cphs_signal(E_CPHS_OP_NAME, &opName);
524 }
525 }
526 return cphsStatus;
527 }
528
529 /*
530 +--------------------------------------------------------------------+
531 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
532 | STATE : code ROUTINE : cphs_get_mailbox |
533 +--------------------------------------------------------------------+
534
535 PURPOSE : Request the Mailbox Numbers
536
537 */
538
539 void cphs_get_mailbox (void)
540 {
541 TRACE_FUNCTION ("cphs_get_mailbox()");
542
543 mbNum.count = 0;
544
545 /* Check CPHS support status.
546 When CPHS is not support, read mailbox numbers from EEPROM */
547 if (cphsStatus EQ CPHS_NotPresent)
548 {
549 cphs_read_eeprom_mailbox();
550 return;
551 }
552
553 /* Check CPHS service table.
554 When CPHS is not support, read mailbox numbers from EEPROM */
555 if (cphs_ssc(MFW_CPHS_MB_NUMBER, cphsServTab) NEQ ALLOCATED_AND_ACTIVATED)
556 {
557 cphs_read_eeprom_mailbox();
558 return;
559 }
560
561 /* Read mailbox numbers from SIM.
562 When this reading failed, read mailbox numbers from EEPROM */
563 if (!cphs_read_sim_rcd(SIM_CPHS_MBXN, 1, 0)) /* read the first record */
564 cphs_read_eeprom_mailbox();
565 }
566
567 /*
568 +--------------------------------------------------------------------+
569 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
570 | STATE : code ROUTINE : cphs_set_mailbox |
571 +--------------------------------------------------------------------+
572
573 PURPOSE : Save the Mailbox Numbers
574
575 */
576
577 T_MFW cphs_set_mailbox (T_MFW_CPHS_ENTRY *entry)
578 {
579
580 TRACE_FUNCTION ("cphs_set_mailbox()");
581
582 if (entry NEQ NULL AND
583 strlen((char *)entry->number) NEQ 0 )
584 /* PATCH JPS 16.01.01: must copy the data and not only point on it!! */
585 {
586 memcpy((char *)&MbnEntry, (char *)entry, sizeof(T_MFW_CPHS_ENTRY));
587 //vcEntry = entry;
588 vcEntry = &MbnEntry; // VO ???
589 }
590 else
591 return CPHS_ERR;
592
593 if ((entry->index <= 0) OR
594 (entry->index > 4) )
595 return CPHS_ERR;
596
597 /* Check CPHS support status.
598 When CPHS is not support, write mailbox numbers to EEPROM */
599 if (cphsStatus EQ CPHS_NotPresent)
600 {
601 cphs_write_eeprom_mailbox(entry);
602 return CPHS_OK;
603 }
604
605 /* Check CPHS service table.
606 When CPHS is not support, write mailbox numbers to EEPROM */
607 if ( cphs_ssc(MFW_CPHS_MB_NUMBER, cphsServTab) NEQ ALLOCATED_AND_ACTIVATED)
608 {
609 cphs_write_eeprom_mailbox(entry);
610 return CPHS_OK;
611 }
612
613 /* Read first record to determine the data length,
614 When the reading failed, write mailbox numbers to EEPROM */
615 simStatus = MFW_SIMOP_WRITE_OK;
616 if (!cphs_read_sim_rcd(SIM_CPHS_MBXN, 1, 0))
617 {
618 simStatus = MFW_SIMOP_UNKNOWN;
619 cphs_write_eeprom_mailbox(entry);
620 }
621 return CPHS_OK;
622 }
623
624 /*
625 +-------------------------------------------------------------------------+
626 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
627 | STATE : code ROUTINE : cphs_get_mailbox_status |
628 +-------------------------------------------------------------------------+
629
630 PURPOSE : get the voice message waiting flag
631
632 */
633
634 T_MFW cphs_get_mailbox_status ()
635 {
636 TRACE_FUNCTION ("cphs_get_mailbox_status()");
637
638
639 /* Read voice message waiting flag.
640 When this reading failed, send event with "read error" parameter to MMI */
641 if (!cphs_read_sim_dat(SIM_CPHS_VMW, NOT_PRESENT_8BIT, MFW_CPHS_MBS_SIZE))
642 {
643 mbStatus.result = MFW_SIMOP_READ_ERR;
644 cphs_signal(E_CPHS_GET_VC_STAT, &mbStatus);
645 }
646 return cphsStatus;
647 }
648
649 /*
650 +-------------------------------------------------------------------------+
651 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
652 | STATE : code ROUTINE : cphs_set_mailbox_status |
653 +-------------------------------------------------------------------------+
654
655 PURPOSE : Save the voice message waiting flag
656
657 */
658
659 T_MFW cphs_set_mailbox_status (T_MFW_CFLAG_STATUS line1,
660 T_MFW_CFLAG_STATUS line2,
661 T_MFW_CFLAG_STATUS fax,
662 T_MFW_CFLAG_STATUS data)
663 {
664 UBYTE result;
665
666 TRACE_FUNCTION ("cphs_set_mailbox_status()");
667
668 /* Check CPHS support status. */
669 if (cphsStatus EQ CPHS_NotPresent)
670 {
671 TRACE_EVENT("cphsStatus is CPHS_NotPresent !");
672 return cphsStatus;
673 }
674
675 /* Write status in buffer */
676 if (line1 EQ MFW_CFLAG_SET OR
677 line1 EQ MFW_CFLAG_NOTSet )
678 { mbsData[0] &=0xF0; //zero the lower nibble
679 mbsData[0] |= line1&0x0F; /* low Nibble */
680 }
681 /*else
682 mbsData[0] = 0x0F;*/
683
684 if (line2 EQ MFW_CFLAG_SET OR
685 line2 EQ MFW_CFLAG_NOTSet )
686 { mbsData[0]&=0x0F;
687 mbsData[0] |= (line2 << 4)&0xF0;; /* high Nibble */
688 }
689
690 if (fax EQ MFW_CFLAG_SET OR
691 fax EQ MFW_CFLAG_NOTSet )
692 { mbsData[1] &= 0xF0; //zero the low nibble
693 mbsData[1] |= fax&0x0F; /* low Nibble */
694 }
695
696 if (data EQ MFW_CFLAG_SET OR
697 data EQ MFW_CFLAG_NOTSet )
698 { mbsData[1] &= 0x0F; //zero the high nibble
699 mbsData[1] |= (data << 4)&0xF0; /* high Nibble */
700 }
701
702 /* Read voice message waiting flag to determine the size */
703 simStatus = MFW_SIMOP_WRITE_OK;
704 if (!cphs_read_sim_dat(SIM_CPHS_VMW, NOT_PRESENT_8BIT, MFW_CPHS_MBS_SIZE))
705 {
706 result = MFW_SIMOP_WRITE_ERR;
707 cphs_signal(E_CPHS_SET_VC_STAT, &result);
708 }
709 /* PATCH VO 22.01.01 end */
710 return cphsStatus;
711 }
712
713 /*
714 +------------------------------------------------------------------------+
715 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
716 | STATE : code ROUTINE : cphs_get_divert_status |
717 +------------------------------------------------------------------------+
718
719 PURPOSE : Request the call forwarding flags
720
721 */
722
723 T_MFW cphs_get_divert_status ()
724 {
725 TRACE_FUNCTION ("cphs_get_divert_status()");
726
727
728 /* Read call forwarding flags.
729 When this reading failed, send event with "read error" parameter to MMI */
730 if (!cphs_read_sim_dat(SIM_CPHS_CFF, NOT_PRESENT_8BIT, MFW_CPHS_CFF_SIZE))
731 {
732 dvStatus.result = MFW_SIMOP_READ_ERR;
733 cphs_signal(E_CPHS_GET_DV_STAT, &dvStatus);
734 }
735 return cphsStatus;
736 }
737
738 /*
739 +-------------------------------------------------------------------------+
740 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
741 | STATE : code ROUTINE : cphs_set_divert_status |
742 +-------------------------------------------------------------------------+
743
744 PURPOSE : Save the call forwarding flag
745
746 */
747
748 T_MFW cphs_set_divert_status (T_MFW_CFLAG_STATUS line1,
749 T_MFW_CFLAG_STATUS line2,
750 T_MFW_CFLAG_STATUS fax,
751 T_MFW_CFLAG_STATUS data)
752 {
753 UBYTE result;
754
755 TRACE_FUNCTION ("cphs_set_divert_status()");
756
757
758 /* Write status in buffer */
759 if (line1 EQ MFW_CFLAG_SET OR
760 line1 EQ MFW_CFLAG_NOTSet )
761 { dvData[0]&= 0xF0; //zero the lower nibble
762 dvData[0] |= line1&0x0F; /* low Nibble */
763 }
764
765 if (line2 EQ MFW_CFLAG_SET OR
766 line2 EQ MFW_CFLAG_NOTSet )
767 { dvData[0]&= 0x0F;
768 dvData[0] |= (line2 << 4)&0xF0; /* high Nibble */
769 }
770
771 if (fax EQ MFW_CFLAG_SET OR
772 fax EQ MFW_CFLAG_NOTSet )
773 { dvData[1]&= 0xF0; //zero the lower nibble
774 dvData[1] |= fax&0x0F; /* low Nibble */
775 }
776
777
778 if (data EQ MFW_CFLAG_SET OR
779 data EQ MFW_CFLAG_NOTSet )
780 { dvData[1] &=0x0F;
781 dvData[1] |= (data << 4)&0xF0; /* high Nibble */
782 }
783
784 /* Read call forwarding flag to determine the size */
785 simStatus = MFW_SIMOP_WRITE_OK;
786 if (!cphs_read_sim_dat(SIM_CPHS_CFF, NOT_PRESENT_8BIT, MFW_CPHS_CFF_SIZE))
787 {
788 result = MFW_SIMOP_WRITE_ERR;
789 cphs_signal(E_CPHS_SET_DV_STAT, &result);
790 }
791 return cphsStatus;
792 }
793
794 /*
795 +---------------------------------------------------------------------+
796 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
797 | STATE : code ROUTINE : cphs_get_als_info |
798 +---------------------------------------------------------------------+
799
800 PURPOSE : Request the Status of Alternate Line Service information
801 (first read selected ALS line, dann status of this line).
802 When the field does not exist in SIM, read it from EEPROM.
803
804 */
805
806 void cphs_get_als_info (T_MFW_CPHS_ALS_STATUS *info)
807 {
808 TRACE_FUNCTION ("cphs_get_als_info()");
809
810 /* read alternate line service from EEPROM */
811 cphs_read_eeprom_als(info);
812
813 cphs_signal(E_CPHS_GET_ALS_STATUS, &alsStatus);
814 }
815
816 /*
817 +---------------------------------------------------------------------+
818 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
819 | STATE : code ROUTINE : cphs_select_line |
820 +---------------------------------------------------------------------+
821
822 PURPOSE : Select the current used line. When the field does not
823 exist in SIM, read it from EEPROM.
824
825 */
826
827 void cphs_select_line (T_MFW_LINE_INDEX line)
828 {
829 UBYTE result;
830 T_ACI_ALS_MOD alsMode;
831
832 TRACE_FUNCTION ("cphs_select_line()");
833
834 if (line NEQ MFW_SERV_LINE1 AND
835 line NEQ MFW_SERV_LINE2 )
836 {
837 result = MFW_SIMOP_WRITE_ERR;
838 cphs_signal(E_CPHS_SET_LINE, &result);
839 return;
840 }
841
842 alsData = (UBYTE) line;
843
844
845 /* write alternate line service in EEPROM */
846 cphs_write_eeprom_als(&result);
847
848 if (line EQ MFW_SERV_LINE1)
849 alsMode = ALS_MOD_SPEECH;
850 if (line EQ MFW_SERV_LINE2)
851 alsMode = ALS_MOD_AUX_SPEECH;
852 sAT_PercentALS(CMD_SRC_LCL, alsMode);
853
854 cphs_signal(E_CPHS_SET_LINE, &result);
855 }
856
857 /*
858 +---------------------------------------------------------------------+
859 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
860 | STATE : code ROUTINE : cphs_set_als_status |
861 +---------------------------------------------------------------------+
862
863 PURPOSE : Change the lock status of the line. When the field does
864 not exist in SIM, read it from EEPROM.
865
866 */
867
868 T_MFW cphs_set_als_status (T_MFW_LINE_STATUS status)
869 {
870 UBYTE result;
871 T_MFW_SIM_PIN_STATUS pinStatus;
872
873 TRACE_FUNCTION ("cphs_set_als_status()");
874
875 /* check PIN 2 requirement */
876 pinStatus.type = MFW_SIM_PIN2;
877 sim_pin_status(&pinStatus);
878 if (pinStatus.stat NEQ MFW_SIM_NO_PIN)
879 return MFW_SIM_PIN2_REQ;
880
881 /* check given parameter */
882 if (status NEQ MFW_LINE_LOCKED AND
883 status NEQ MFW_LINE_UNLOCKED )
884 {
885 result = MFW_SIMOP_WRITE_ERR;
886 cphs_signal(E_CPHS_SET_ALS_STATUS, &result);
887 return CPHS_ERR;
888 }
889
890 alsData = (UBYTE) status;
891
892 /* write lock status in EEPROM */
893 cphs_write_eeprom_alss(&result);
894 cphs_signal(E_CPHS_SET_LINE, &result);
895 return CPHS_OK;
896 }
897
898 /*
899 +---------------------------------------------------------------------+
900 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
901 | STATE : code ROUTINE : cphs_get_csp |
902 +---------------------------------------------------------------------+
903
904 PURPOSE : Request the customer service profile
905
906 */
907
908 T_MFW cphs_get_csp ()
909 {
910 UBYTE res;
911
912 TRACE_FUNCTION ("cphs_get_csp()");
913
914
915 /* check CPHS service table */
916 res = cphs_ssc(MFW_CPHS_CSP, cphsServTab);
917 if ( res NEQ ALLOCATED_AND_ACTIVATED)
918 return res;
919
920 /* Read customer service profile.
921 When this reading failed, send event with empty parameter array to MMI */
922 if (!cphs_read_sim_dat(SIM_CPHS_CSP, NOT_PRESENT_8BIT, MFW_CPHS_CSP_SIZE))
923 {
924 csProfile.result = MFW_SIMOP_READ_ERR;
925 memset(csProfile.csp, 0, sizeof(csProfile.csp));
926 cphs_signal(E_CPHS_GET_CSP, &csProfile);
927 }
928
929 return cphsStatus;
930 }
931
932 /*
933 +---------------------------------------------------------------------+
934 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
935 | STATE : code ROUTINE : cphs_get_info_num |
936 +---------------------------------------------------------------------+
937
938 PURPOSE : Request information numbers directory
939
940 */
941
942 T_MFW cphs_get_info_num (UBYTE level, UBYTE startIndex)
943 {
944 // UBYTE res; // RAVI
945 T_MFW_CPHS_INFO cf_info;
946
947 TRACE_FUNCTION ("cphs_get_info_num()");
948
949
950 if (level < 1 OR
951 startIndex < 1 )
952 return CPHS_ERR;
953 cphs_config(&cf_info);
954
955
956 /* Read customer service profile to check
957 whether information numbers are supported. */
958 numList.count = 0;
959 idxLevel = level;
960 startIdx = startIndex;
961 simStatus = MFW_SIMOP_READ_OK;
962 if (!cphs_read_sim_dat(SIM_CPHS_CSP, NOT_PRESENT_8BIT, MFW_CPHS_CSP_SIZE))
963 {
964 simStatus = MFW_SIMOP_UNKNOWN;
965 TRACE_EVENT("Can't read CSP for info nums");
966 return CPHS_NotPresent;
967 }
968
969 return cphsStatus;
970 }
971
972 /*
973 +----------------------------------------------------------------------+
974 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
975 | STATE : code ROUTINE : cphs_select_info_num |
976 +----------------------------------------------------------------------+
977
978 PURPOSE : read a information number entry
979
980 */
981
982 T_MFW cphs_select_info_num (UBYTE index)
983 {
984 TRACE_FUNCTION ("cphs_select_info_num()");
985
986
987 /* Read a information number entry.
988 When this reading failed, send event with "read error" parameter to MMI */
989 simStatus = MFW_SIMOP_READ_OK;
990 startIdx = index;
991
992 // By now we know if 6F19 or EA01 are present for reading info. num entries from
993 // So lets use this knowledge.
994
995 if (cphsPrevRead == SIM_CPHS_INFN)
996 {
997 if (!cphs_read_sim_rcd(SIM_CPHS_INFN, 1, 0))
998 {
999 infoEntry.result = MFW_SIMOP_READ_ERR;
1000 cphs_signal(E_CPHS_GET_INFO_NUM, &infoEntry);
1001 TRACE_EVENT("Error reading single info num");
1002 }
1003 else
1004 {
1005 cphsPrevRead = SIM_CPHS_INFN;
1006 }
1007 }
1008 else
1009 {
1010 if (cphsPrevRead == SIM_CPHS_INFN2)
1011 {
1012 if (!cphs_read_sim_rcd(SIM_CPHS_INFN2, 1, 0))
1013 {TRACE_EVENT("Error reading single info num 2");
1014 infoEntry.result = MFW_SIMOP_READ_ERR;
1015 cphs_signal(E_CPHS_GET_INFO_NUM, &infoEntry);
1016 }
1017 else
1018 {
1019 cphsPrevRead = SIM_CPHS_INFN2;
1020 }
1021 }
1022 }
1023 return cphsStatus;
1024 }
1025
1026 /*
1027 +-----------------------------------------------------------------------+
1028 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1029 | STATE : code ROUTINE : cphs_read_information |
1030 +-----------------------------------------------------------------------+
1031
1032 PURPOSE : Read CPHS information
1033
1034 */
1035 //x0018858 OMAPS00062632 The errcode type has been modified from SHORT to USHORT.
1036 void cphs_read_information(USHORT errCode, UBYTE *data, UBYTE dataLen)
1037 {
1038 UBYTE *ptr;
1039 /* PATCH VO 22.01.01: copy CPHS service table according to
1040 the actual length in the SIM card */
1041 UBYTE len;
1042 /* PATCH VO 22.01.01 END */
1043
1044 TRACE_FUNCTION ("cphs_read_information()");
1045
1046 ptr = data;
1047 /* PATCH VO 22.01.01: copy CPHS service table according to
1048 the actual length in the SIM card */
1049 len = dataLen;
1050 memset(cphsServTab, 0, sizeof(cphsServTab));
1051 /* PATCH VO 22.01.01 END */
1052 #ifdef FF_2TO1_PS
1053 if ( errCode NEQ CAUSE_SIM_NO_ERROR OR
1054 #else
1055 if ( errCode NEQ SIM_NO_ERROR OR
1056 #endif
1057 ptr EQ NULL OR
1058 dataLen <= 0) /* PATCH VO 22.01.01: not check a certain length */
1059 {
1060 cphs_signal(E_CPHS_IND, &cphsStatus);
1061 }
1062 else
1063 {
1064 cphsPhase = *ptr;
1065 len--;
1066 if (len > 0)
1067 {
1068 ptr++;
1069 memcpy (cphsServTab, ptr, MINIMUM(len, CPHS_SERVICE_TABLE));
1070 }
1071 /* PATCH VO 22.01.01 END */
1072 cphsStatus = CPHS_OK;
1073 TRACE_EVENT("CPHS supported");
1074 cphs_signal(E_CPHS_IND, &cphsStatus);
1075 }
1076 }
1077
1078 /*
1079 +-----------------------------------------------------------------------+
1080 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1081 | STATE : code ROUTINE : cphs_read_ons |
1082 +-----------------------------------------------------------------------+
1083
1084 PURPOSE : Read operator name short form
1085
1086 */
1087
1088 void cphs_read_ons(SHORT errCode, UBYTE *data, UBYTE dataLen)
1089 {
1090 UBYTE *ptr;
1091
1092 TRACE_FUNCTION ("cphs_read_ons()");
1093
1094 ptr = data;
1095 #ifdef FF_2TO1_PS
1096 if ( errCode NEQ CAUSE_SIM_NO_ERROR OR
1097 #else
1098 if ( errCode NEQ SIM_NO_ERROR OR
1099 #endif
1100 ptr EQ NULL OR
1101 // dataLen < MFW_CPHS_ONS_SIZE )
1102 dataLen <= 0 ) /* PATCH VO 22.01.01: not check a certain length */
1103 {
1104 opName.longName.len = 0;
1105 }
1106 else
1107 {
1108 cmhPHB_getMfwTagNt(ptr, (UBYTE)MINIMUM(LONG_NAME, dataLen),
1109 opName.longName.data, &opName.longName.len);
1110 opName.longName.dcs = MFW_DCS_SIM;
1111
1112 /* Read operator name shortform */
1113 if ((cphsPhase NEQ 2) OR
1114 (cphs_ssc(MFW_CHPS_NAME_SHORT, cphsServTab) NEQ ALLOCATED_AND_ACTIVATED) OR
1115 !cphs_read_sim_dat(SIM_CPHS_ONSHF, NOT_PRESENT_8BIT, MFW_CPHS_ONSF_SIZE) )
1116 {
1117 opName.shortName.len = 0;
1118 if (opName.longName.len != 0)
1119 TRACE_EVENT("Got a long name!!!");
1120 cphs_signal(E_CPHS_OP_NAME, &opName);
1121 }
1122 }
1123 }
1124
1125 /*
1126 +-----------------------------------------------------------------------+
1127 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1128 | STATE : code ROUTINE : cphs_read_onsf |
1129 +-----------------------------------------------------------------------+
1130
1131 PURPOSE : Read operator name short form
1132
1133 */
1134
1135 void cphs_read_onsf(SHORT errCode, UBYTE *data, UBYTE dataLen)
1136 {
1137 UBYTE *ptr;
1138
1139 TRACE_FUNCTION ("cphs_read_onsf()");
1140
1141 ptr = data;
1142 #ifdef FF_2TO1_PS
1143 if ( errCode NEQ CAUSE_SIM_NO_ERROR OR
1144 #else
1145 if ( errCode NEQ SIM_NO_ERROR OR
1146 #endif
1147 ptr EQ NULL OR
1148 dataLen < MFW_CPHS_ONSF_SIZE )
1149 {
1150 opName.shortName.len = 0;
1151 }
1152 else
1153 {
1154 cmhPHB_getMfwTagNt(ptr, MFW_CPHS_ONSF_SIZE,
1155 opName.shortName.data, &opName.shortName.len);
1156 opName.shortName.dcs = MFW_DCS_SIM;
1157 TRACE_EVENT("Got a short Name");
1158 }
1159
1160 cphs_signal(E_CPHS_OP_NAME, &opName);
1161 }
1162
1163 /*
1164 +-----------------------------------------------------------------------+
1165 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1166 | STATE : code ROUTINE : cphs_read_mbn |
1167 +-----------------------------------------------------------------------+
1168
1169 PURPOSE : Read mailbox numbers
1170
1171 */
1172
1173 void cphs_read_mbn(SHORT table_id)
1174 {
1175 UBYTE* pData; /* points to data buffer */
1176 UBYTE alphaLen;
1177 UBYTE dataLen;
1178 UBYTE recNr;
1179 T_ACI_TOA type;
1180
1181 TRACE_FUNCTION ("cphs_read_mbn()");
1182
1183 pData = simShrdPrm.atb[table_id].exchData;
1184 dataLen = simShrdPrm.atb[table_id].dataLen;
1185 recNr = simShrdPrm.atb[table_id].recNr;
1186
1187 #ifdef FF_2TO1_PS
1188 if ( simShrdPrm.atb[table_id].errCode NEQ CAUSE_SIM_NO_ERROR OR
1189 #else
1190 if ( simShrdPrm.atb[table_id].errCode NEQ SIM_NO_ERROR OR
1191 #endif
1192 pData EQ NULL OR
1193 dataLen < MFW_CPHS_MIN_MBN_SIZE )
1194 {
1195 if (recNr <= 1)
1196 {
1197 cphs_read_eeprom_mailbox();
1198 return;
1199 }
1200 else
1201 cphs_signal(E_CPHS_GET_VC_NUM, &mbNum);
1202 }
1203 else /* no read error */
1204 {
1205 if (recNr EQ 1)
1206 {
1207 maxRec = simShrdPrm.atb[table_id].recMax;
1208 }
1209 alphaLen = dataLen - MFW_CPHS_MIN_MBN_SIZE;
1210
1211 /* Copy/encode data */
1212 if (*(pData + alphaLen + 2) NEQ 0xFF)
1213 {
1214 mbNum.entries[mbNum.count].index = recNr;
1215 cmhPHB_getMfwTagNt(pData, alphaLen,
1216 mbNum.entries[mbNum.count].alpha.data,
1217 &mbNum.entries[mbNum.count].alpha.len);
1218 pData += alphaLen;
1219
1220 cmhPHB_getAdrStr ( (CHAR *)mbNum.entries[mbNum.count].number,
1221 PHB_MAX_LEN - 1,
1222 pData + 2,
1223 *pData );
1224
1225 cmhPHB_toaDmrg ( *( pData + 1 ), &type );
1226 mbNum.entries[mbNum.count].ton = phb_cvtTon(type.ton);
1227 mbNum.entries[mbNum.count].npi = phb_cvtNpi(type.npi);
1228 pData += 12;
1229
1230 if ( *pData NEQ 0xFF )
1231 {
1232 /* read bearer capability EF */
1233 /* return; */
1234 }
1235 mbNum.count++;
1236 }
1237 recNr++;
1238 if (recNr > maxRec)
1239 { TRACE_EVENT("got CPHS MAilbox nos");
1240 cphs_signal(E_CPHS_GET_VC_NUM, &mbNum);
1241 }
1242 else
1243 {
1244 /* Read the next entry */
1245 if (!cphs_read_sim_rcd(SIM_CPHS_MBXN, recNr, dataLen))
1246 cphs_signal(E_CPHS_GET_VC_NUM, &mbNum);
1247 }
1248 }
1249 }
1250
1251 /*
1252 +-----------------------------------------------------------------------+
1253 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1254 | STATE : code ROUTINE : cphs_read_mbs |
1255 +-----------------------------------------------------------------------+
1256
1257 PURPOSE : Read voice message waiting flag
1258
1259 */
1260
1261 void cphs_read_mbs(SHORT errCode, UBYTE *data, UBYTE dataLen)
1262 {
1263 UBYTE *ptr;
1264 int i; /* PATCH VO 22.01.01 */
1265
1266 TRACE_FUNCTION ("cphs_read_mbs()");
1267
1268 ptr = data;
1269 #ifdef FF_2TO1_PS
1270 if ( errCode NEQ CAUSE_SIM_NO_ERROR OR
1271 #else
1272 if ( errCode NEQ SIM_NO_ERROR OR
1273 #endif
1274 ptr EQ NULL OR
1275 dataLen <= 0 ) /* PATCH VO 22.01.01: not check a certain length */
1276 {
1277 mbStatus.result = MFW_SIMOP_READ_ERR;
1278 }
1279 else
1280 {
1281 memset(&mbStatus, MFW_CFLAG_NotPresent, sizeof(mbStatus));
1282 mbStatus.result = MFW_SIMOP_READ_OK;
1283 for (i=0; i<dataLen; i++)
1284 {
1285 switch (i)
1286 {
1287 case 0:
1288 mbStatus.line1 = (T_MFW_CFLAG_STATUS)ptr[i] & 0x0F;
1289 mbStatus.line2 = (T_MFW_CFLAG_STATUS)( ptr[i] >> 4 ) & 0x0F;
1290 break;
1291 case 1:
1292 mbStatus.fax = (T_MFW_CFLAG_STATUS)ptr[i] & 0x0F;
1293 mbStatus.data = (T_MFW_CFLAG_STATUS)( ptr[i] >> 4 ) & 0x0F;
1294 break;
1295 default:
1296 break;
1297 }
1298 }
1299 /* PATCH VO 22.01.01 END */
1300 }
1301 TRACE_EVENT("Reading Mailboxes");
1302 cphs_signal(E_CPHS_GET_VC_STAT, &mbStatus);
1303 }
1304
1305 /*
1306 +-----------------------------------------------------------------------+
1307 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1308 | STATE : code ROUTINE : cphs_read_cff |
1309 +-----------------------------------------------------------------------+
1310
1311 PURPOSE : Read call forwarding flag
1312
1313 */
1314
1315 void cphs_read_cff(SHORT errCode, UBYTE *data, UBYTE dataLen)
1316 {
1317 UBYTE *ptr;
1318 int i; /* PATCH VO 22.01.01 */
1319
1320 TRACE_FUNCTION ("cphs_read_cff()");
1321
1322 ptr = data;
1323 #ifdef FF_2TO1_PS
1324 if ( errCode NEQ CAUSE_SIM_NO_ERROR OR
1325 #else
1326 if ( errCode NEQ SIM_NO_ERROR OR
1327 #endif
1328 ptr EQ NULL OR
1329 dataLen <= 0 ) /* PATCH VO 22.01.01: not check a certain length */
1330 {
1331 dvStatus.result = MFW_SIMOP_READ_ERR;
1332 }
1333 else
1334 {
1335 memset(&dvStatus, MFW_CFLAG_NotPresent, sizeof(dvStatus));
1336 dvStatus.result = MFW_SIMOP_READ_OK;
1337 for (i=0; i<dataLen; i++)
1338 {
1339 switch (i)
1340 {
1341 case 0:
1342 dvStatus.line1 = (T_MFW_CFLAG_STATUS)ptr[i] & 0x0F;
1343 dvStatus.line2 = (T_MFW_CFLAG_STATUS)( ptr[i] >> 4 ) & 0x0F;
1344 break;
1345 case 1:
1346 dvStatus.fax = (T_MFW_CFLAG_STATUS)ptr[i] & 0x0F;
1347 dvStatus.data = (T_MFW_CFLAG_STATUS)( ptr[i] >> 4 ) & 0x0F;
1348 break;
1349 default:
1350 break;
1351 }
1352 }
1353 /* PATCH VO 22.01.01 END */
1354 }
1355 TRACE_EVENT("CPHS valid call forwrading status");
1356 cphs_signal(E_CPHS_GET_DV_STAT, &dvStatus);
1357 }
1358
1359 /*
1360 +-----------------------------------------------------------------------+
1361 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1362 | STATE : code ROUTINE : cphs_read_als |
1363 +-----------------------------------------------------------------------+
1364
1365 PURPOSE : Read alternate line service
1366
1367 */
1368
1369 void cphs_read_als(SHORT errCode, UBYTE *data, UBYTE dataLen)
1370 {
1371
1372 TRACE_FUNCTION ("cphs_read_als()");
1373 }
1374
1375 /*
1376 +-----------------------------------------------------------------------+
1377 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1378 | STATE : code ROUTINE : cphs_read_alss |
1379 +-----------------------------------------------------------------------+
1380
1381 PURPOSE : Read alternate line service status
1382
1383 */
1384
1385 void cphs_read_alss(SHORT errCode, UBYTE *data, UBYTE dataLen)
1386 {
1387
1388 TRACE_FUNCTION ("cphs_read_alss()");
1389
1390 }
1391
1392 /*
1393 +-----------------------------------------------------------------------+
1394 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1395 | STATE : code ROUTINE : cphs_read_csp |
1396 +-----------------------------------------------------------------------+
1397
1398 PURPOSE : Read customer service profile
1399
1400 */
1401
1402 void cphs_read_csp(SHORT errCode, UBYTE *data, UBYTE dataLen)
1403 {
1404 UBYTE *ptr;
1405 UBYTE flag;
1406 int i;
1407
1408 TRACE_FUNCTION ("cphs_read_csp()");
1409
1410 ptr = data;
1411 #ifdef FF_2TO1_PS
1412 if ( errCode NEQ CAUSE_SIM_NO_ERROR OR
1413 #else
1414 if ( errCode NEQ SIM_NO_ERROR OR
1415 #endif
1416 ptr EQ NULL OR
1417 dataLen <= 0 ) /* PATCH VO 22.01.01: not check a certain length */
1418 {
1419 if (simStatus EQ MFW_SIMOP_READ_OK) /* Used for read information numbers */
1420 {
1421 simStatus = MFW_SIMOP_UNKNOWN;
1422 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
1423 }
1424 else
1425 {
1426 csProfile.result = MFW_SIMOP_READ_ERR;
1427 memset(csProfile.csp, 0, sizeof(csProfile.csp));
1428 cphs_signal(E_CPHS_GET_CSP, &csProfile);
1429 }
1430 }
1431 else
1432 {
1433 if (simStatus EQ MFW_SIMOP_READ_OK) /* Used for read information numbers */
1434 {
1435 simStatus = MFW_SIMOP_UNKNOWN;
1436
1437 /* check the service group code */
1438 flag = 0;
1439 for (i = 0; i < dataLen; i += 2) /* PATCH VO 22.01.01: use the actual length in the SIM card */
1440 {
1441 if (ptr[i] EQ 0xD5 AND ptr[i+1] EQ 0xFF)
1442 flag = 1;
1443 }
1444 if (!flag)
1445 {
1446 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
1447 return;
1448 }
1449
1450 /* Read the first information numbers record */
1451 if (!cphs_read_sim_rcd(SIM_CPHS_INFN, 1, 0))
1452 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
1453 else
1454 cphsPrevRead = SIM_CPHS_INFN;
1455 }
1456 else
1457 {
1458 csProfile.result = MFW_SIMOP_READ_OK;
1459 TRACE_EVENT("CPHS valis CSP");
1460 memcpy(csProfile.csp, ptr, sizeof(csProfile.csp));
1461 cphs_signal(E_CPHS_GET_CSP, &csProfile);
1462 }
1463 }
1464 }
1465
1466 /*
1467 +------------------------------------------------------------------------+
1468 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1469 | STATE : code ROUTINE : cphs_req_info_num_read |
1470 +------------------------------------------------------------------------+
1471
1472 PURPOSE : Read customer service profile
1473
1474 */
1475
1476 void cphs_req_info_num_read(UBYTE rcd_num, UBYTE dataLen)
1477 {
1478 TRACE_FUNCTION ("cphs_req_info_num_read()");
1479
1480 if (rcd_num > maxRec)
1481 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
1482 else
1483 {
1484 if (cphsPrevRead == SIM_CPHS_INFN)
1485 {
1486 if (!cphs_read_sim_rcd(SIM_CPHS_INFN, rcd_num, dataLen))
1487 {
1488 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
1489 }
1490 else
1491 {
1492 cphsPrevRead = SIM_CPHS_INFN;
1493 }
1494 }
1495 else
1496 {
1497 if (cphsPrevRead == SIM_CPHS_INFN2)
1498 {
1499 if (!cphs_read_sim_rcd(SIM_CPHS_INFN2, rcd_num, dataLen))
1500 {
1501 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
1502 }
1503 else
1504 {
1505 cphsPrevRead = SIM_CPHS_INFN2;
1506 }
1507 }
1508 }
1509 }
1510 }
1511
1512 /*
1513 +--------------------------------------------------------------------------+
1514 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1515 | STATE : code ROUTINE : cphs_read_first_info_num |
1516 +--------------------------------------------------------------------------+
1517
1518 PURPOSE : Read first record of information numbers
1519
1520 */
1521
1522 void cphs_read_first_info_num(SHORT table_id)
1523 {
1524 UBYTE dataLen;
1525
1526 TRACE_FUNCTION ("cphs_read_first_info_num()");
1527
1528 #ifdef FF_2TO1_PS
1529 if ( simShrdPrm.atb[table_id].errCode NEQ CAUSE_SIM_NO_ERROR ) /* VO patch 040501 - remove dataLen and pData check */
1530 #else
1531 if ( simShrdPrm.atb[table_id].errCode NEQ SIM_NO_ERROR ) /* VO patch 040501 - remove dataLen and pData check */
1532 #endif
1533 {
1534 if (simStatus EQ MFW_SIMOP_READ_OK) /* Read entry of information numbers */
1535 {
1536 simStatus = MFW_SIMOP_UNKNOWN;
1537 infoEntry.result = MFW_SIMOP_READ_ERR;
1538 cphs_signal(E_CPHS_GET_INFO_NUM, &infoEntry);
1539 }
1540 else
1541 {// if we are here then its possible the read of 7F20 6F19 failed.
1542
1543 if (cphsPrevRead == SIM_CPHS_INFN)
1544 {
1545 if (!cphs_read_sim_rcd(SIM_CPHS_INFN2, 1, 0))
1546 {
1547 infoEntry.result = MFW_SIMOP_READ_ERR;
1548 cphs_signal(E_CPHS_GET_INFO_LIST, &infoEntry);
1549 }
1550 else
1551 {
1552 cphsPrevRead = SIM_CPHS_INFN2;
1553 }
1554 }
1555 else
1556 {
1557 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
1558 }
1559 }
1560 }
1561 else
1562 {
1563 maxRec = simShrdPrm.atb[table_id].recMax;
1564 dataLen = simShrdPrm.atb[table_id].dataLen;
1565
1566 if (simStatus EQ MFW_SIMOP_READ_OK) /* Read entry of information numbers */
1567 {
1568 /* VO patch 040501 - add dataLen check: if (patch) else ... */
1569 if (dataLen < MFW_CPHS_MIN_INS_SIZE )
1570 {
1571 simStatus = MFW_SIMOP_UNKNOWN;
1572 infoEntry.result = MFW_SIMOP_READ_ERR;
1573 cphs_signal(E_CPHS_GET_INFO_NUM, &infoEntry);
1574 }
1575 else
1576 cphs_req_info_num_read(startIdx, dataLen);
1577 }
1578 else /* Read list of information numbers */
1579 {
1580 /* VO patch 040501 - add dataLen check: if (patch) else ... */
1581 if (dataLen < MFW_CPHS_MIN_INS_SIZE )
1582 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
1583 else
1584 {
1585 if (idxLevel EQ 1) /* read this entry */
1586 cphs_read_info_num(table_id);
1587 else /* read the startIndex record */
1588 cphs_req_info_num_read(startIdx, dataLen);
1589 }
1590 }
1591 }
1592 }
1593
1594 /*
1595 +---------------------------------------------------------------------+
1596 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1597 | STATE : code ROUTINE : cphs_read_info_num |
1598 +---------------------------------------------------------------------+
1599
1600 PURPOSE : Read first record of information numbers
1601
1602 */
1603
1604 void cphs_read_info_num(SHORT table_id)
1605 {
1606 UBYTE* pData; /* points to data buffer */
1607 UBYTE dataLen;
1608 UBYTE alphaLen;
1609 UBYTE recNr;
1610 T_ACI_TOA type;
1611
1612 TRACE_FUNCTION ("cphs_read_info_num()");
1613
1614 pData = simShrdPrm.atb[table_id].exchData;
1615 dataLen = simShrdPrm.atb[table_id].dataLen;
1616 recNr = simShrdPrm.atb[table_id].recNr;
1617
1618 #ifdef FF_2TO1_PS
1619 if ( simShrdPrm.atb[table_id].errCode NEQ CAUSE_SIM_NO_ERROR OR
1620 #else
1621 if ( simShrdPrm.atb[table_id].errCode NEQ SIM_NO_ERROR OR
1622 #endif
1623 pData EQ NULL OR
1624 dataLen < MFW_CPHS_MIN_INS_SIZE )
1625 {
1626 if (simStatus EQ MFW_SIMOP_READ_OK) /* Read entry of information numbers */
1627 {
1628 simStatus = MFW_SIMOP_UNKNOWN;
1629 infoEntry.result = MFW_SIMOP_READ_ERR;
1630 cphs_signal(E_CPHS_GET_INFO_NUM, &infoEntry);
1631 }
1632 else
1633 {// if we are here then its possible the read of 7F20 6F19 failed.
1634 // so we must try reading 7F10 EA01 instead.
1635
1636 if (cphsPrevRead == SIM_CPHS_INFN2)
1637 {
1638 if (!cphs_read_sim_rcd(SIM_CPHS_INFN2, 1, 0))
1639 {
1640 infoEntry.result = MFW_SIMOP_READ_ERR;
1641 cphs_signal(E_CPHS_GET_INFO_LIST, &infoEntry);
1642 }
1643 else
1644 {
1645 cphsPrevRead = SIM_CPHS_INFN2;
1646 }
1647 }
1648 else
1649 {
1650 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
1651 }
1652 }
1653 cphs_signal(E_CPHS_GET_INFO_LIST, &numList); // correct ??? VO
1654 }
1655 else
1656 {
1657 if (simStatus EQ MFW_SIMOP_READ_OK)
1658 {
1659 /* Read entry of information numbers */
1660 alphaLen = *pData;
1661 if (alphaLen)
1662 {
1663 /* copy/encode entry */
1664 infoEntry.index = recNr;
1665 infoEntry.entryStat = *(pData + 1);
1666
1667 cmhPHB_getMfwTagNt(pData + 2, alphaLen,
1668 infoEntry.alpha.data, &infoEntry.alpha.len);
1669
1670 pData += alphaLen + 2;
1671
1672 if (*pData NEQ 0xFF)
1673 {
1674 cmhPHB_getAdrStr ( (CHAR *)infoEntry.number,
1675 3, /* length of number */
1676 pData + 2,
1677 *pData );
1678 cmhPHB_toaDmrg ( *( pData + 1 ), &type );
1679 infoEntry.ton = phb_cvtTon(type.ton);
1680 infoEntry.npi = phb_cvtNpi(type.npi);
1681 infoEntry.entryStat = infoEntry.entryStat | 0x80;
1682 }
1683 else
1684 {
1685 infoEntry.number[0] = '\0';
1686 infoEntry.ton = MFW_TON_UNKNOWN;
1687 infoEntry.npi = MFW_NPI_UNKNOWN;
1688 }
1689 }
1690 infoEntry.result = MFW_SIMOP_READ_OK;
1691 cphs_signal(E_CPHS_GET_INFO_NUM, &infoEntry);
1692 return;
1693 }
1694 else if ((*(pData + 1) & 0x0F) < idxLevel)
1695 {
1696 /* The index level is out the wished index level. */
1697 cphs_signal(E_CPHS_GET_INFO_LIST, &numList);
1698 }
1699 else if ((*(pData + 1) & 0x0F) > idxLevel)
1700 {
1701 /* This is not wished index level. Read the next */
1702 recNr++;
1703 cphs_req_info_num_read(recNr, dataLen);
1704 }
1705 else
1706 {
1707 /* This is the wished index level. Read it. */
1708 alphaLen = *pData;
1709 if (alphaLen) /* check alpha length */
1710 {
1711 /* copy/encode this entry in list */
1712 numList.level = idxLevel;
1713 numList.entry[numList.count].index = recNr;
1714 numList.entry[numList.count].entryStat = *(pData + 1) & 0x7F; /* set bit 8 to 0 */
1715
1716 cmhPHB_getMfwTagNt(pData + 2, alphaLen,
1717 numList.entry[numList.count].alpha.data,
1718 &numList.entry[numList.count].alpha.len);
1719
1720 pData += alphaLen + 2;
1721
1722 if (*pData NEQ 0xFF)
1723 {
1724 numList.entry[numList.count].entryStat = numList.entry[numList.count].entryStat | 0x80;
1725 }
1726 numList.count++;
1727 }
1728 recNr++;
1729 /* Read the next record */
1730 cphs_req_info_num_read(recNr, dataLen);
1731 }
1732 }
1733 }
1734
1735 /*
1736 +--------------------------------------------------------------------------+
1737 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1738 | STATE : code ROUTINE : cphs_read_eeprom_mailbox |
1739 +--------------------------------------------------------------------------+
1740
1741 PURPOSE : Read mailbox number from EEPROM
1742
1743 */
1744
1745 void cphs_read_eeprom_mailbox(void)
1746 {
1747 U8 version;
1748 #ifdef PCM_2_FFS
1749 T_PSPDF_MBN mbn;
1750 #else
1751 EF_MBN mbn;
1752 #endif
1753
1754 T_ACI_TOA numTp;
1755 int i;
1756 USHORT max_rcd;
1757
1758 for (i=0; i<MAX_CPHS_ENTRY; i++)
1759 {
1760 #ifdef PCM_2_FFS
1761 if (ffs_ReadRecord((UBYTE *)PSPDF_MBN_ID, (UBYTE *)&mbn,
1762 sizeof( T_PSPDF_MBN ), (USHORT)(i+1), 1 ) == sizeof( T_PSPDF_MBN ) )
1763
1764 #else
1765 if (pcm_ReadRecord((UBYTE *)EF_MBN_ID,
1766 (USHORT)(i+1),
1767 SIZE_EF_MBN,
1768 (UBYTE *)&mbn,
1769 &version,
1770 &max_rcd) == PCM_OK)
1771 #endif
1772
1773 {
1774 if (mbn.len)
1775 {
1776 mbNum.entries[mbNum.count].index = i+1;
1777 cmhPHB_getAdrStr ( (char *)mbNum.entries[mbNum.count].number,
1778 PHB_MAX_LEN - 1, mbn.mbNum, mbn.len );
1779 cmhPHB_getMfwTagNt ( mbn.alphId, 10,
1780 mbNum.entries[mbNum.count].alpha.data,
1781 &mbNum.entries[mbNum.count].alpha.len );
1782 cmhPHB_toaDmrg ( mbn.numTp, &numTp );
1783 mbNum.entries[mbNum.count].ton = phb_cvtTon(numTp.ton);
1784 mbNum.entries[mbNum.count].npi = phb_cvtNpi(numTp.npi);
1785 mbNum.entries[mbNum.count].service = i;
1786 mbNum.count++;
1787 }
1788 }
1789 }
1790 cphs_signal(E_CPHS_GET_VC_NUM, &mbNum);
1791 }
1792
1793 /*
1794 +---------------------------------------------------------------------------+
1795 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1796 | STATE : code ROUTINE : cphs_write_eeprom_mailbox |
1797 +---------------------------------------------------------------------------+
1798
1799 PURPOSE : Write mailbox number in EEPROM
1800
1801 */
1802
1803 void cphs_write_eeprom_mailbox(T_MFW_CPHS_ENTRY *entry)
1804 {
1805 T_ACI_PB_TEXT text;
1806 UBYTE len;
1807 //EF_MBN mbn;
1808 T_ACI_TOA type;
1809 UBYTE *pNumber;
1810 UBYTE result;
1811 UBYTE outLen;
1812
1813 len = MINIMUM ( MAX_PCM_MAILBOX_LEN, entry->alpha.len);
1814 text.len = len;
1815 memcpy(text.data, entry->alpha.data, len);
1816 text.cs = CS_Sim;
1817 cmhPHB_getMfwTagSim ( &text, FFS_flashData.mbn_AlphId, &outLen, MAX_PCM_MAILBOX_LEN );
1818
1819 if ( entry->number[0] EQ '+')
1820 {
1821 type.ton = TON_International;
1822 pNumber = &entry->number[1];
1823 }
1824 else
1825 {
1826 type.ton = entry->ton;
1827 pNumber = &entry->number[0];
1828 }
1829 type.npi = entry->npi;
1830 //MC- switching from PCM to FFS
1831 cmhPHB_toaMrg ( &type, /*&mbn.numTp*/&FFS_flashData.mbn_numTp );
1832
1833 cmhPHB_getAdrBcd ((UBYTE*) FFS_flashData.mbn_Num/*mbn.mbNum*/, /*&mbn.len*/&FFS_flashData.mbn_len,
1834 MAX_PCM_MAILBOX_LEN, (CHAR *)pNumber );
1835 FFS_flashData.mbn_len/*mbn.len*/++;
1836
1837 if (flash_write() == EFFS_OK)
1838
1839 result = MFW_SIMOP_WRITE_OK;
1840 else
1841 result = MFW_SIMOP_WRITE_ERR;
1842 cphs_signal(E_CPHS_SET_VC_NUM, &result);
1843 }
1844
1845 /*
1846 +-----------------------------------------------------------------------+
1847 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1848 | STATE : code ROUTINE : cphs_read_eeprom_als |
1849 +-----------------------------------------------------------------------+
1850
1851 PURPOSE : Read alternate line service information from EEPROM
1852
1853 */
1854
1855 void cphs_read_eeprom_als(T_MFW_CPHS_ALS_STATUS *info)
1856 {
1857 #ifdef PCM_2_FFS
1858 T_PSPDF_ALS alsInfo;
1859 #else
1860 EF_ALS alsInfo;
1861 #endif
1862
1863 // UBYTE version; // RAVI
1864
1865 TRACE_FUNCTION ("cphs_read_eeprom_als()");
1866 alsInfo.selLine = FFS_flashData.als_selLine;
1867 alsInfo.statLine = FFS_flashData.als_statLine;
1868 {
1869 switch (alsInfo.selLine)
1870 {
1871 case MFW_SERV_LINE1:
1872 alsStatus.selectedLine = MFW_SERV_LINE1;
1873 break;
1874 case MFW_SERV_LINE2:
1875 alsStatus.selectedLine = MFW_SERV_LINE2;
1876 break;
1877 default:
1878 alsStatus.selectedLine = MFW_SERV_LINE2;
1879 break;
1880 }
1881
1882 switch (alsInfo.statLine)
1883 {
1884 case MFW_LINE_LOCKED:
1885 alsStatus.status = MFW_LINE_LOCKED;
1886 break;
1887 case MFW_LINE_UNLOCKED:
1888 alsStatus.status = MFW_LINE_UNLOCKED;
1889 break;
1890 default:
1891 alsStatus.status = MFW_LINE_UNLOCKED;
1892 break;
1893 }
1894 }
1895
1896 info->selectedLine = alsStatus.selectedLine;
1897 info->status = alsStatus.status;
1898
1899 }
1900
1901 /*
1902 +-----------------------------------------------------------------------+
1903 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1904 | STATE : code ROUTINE : cphs_write_eeprom_als |
1905 +-----------------------------------------------------------------------+
1906
1907 PURPOSE : Write selected alternate line in EEPROM
1908
1909 */
1910
1911 void cphs_write_eeprom_als(UBYTE *res)
1912 {
1913 #ifdef PCM_2_FFS
1914 T_PSPDF_ALS alsInfo;
1915 #else
1916 EF_ALS alsInfo;
1917 #endif
1918
1919
1920 TRACE_FUNCTION ("cphs_write_eeprom_als()");
1921 {
1922 if (alsStatus.status EQ MFW_LINE_LOCKED)
1923 *res = MFW_SIMOP_WRITE_ERR;
1924
1925 alsStatus.selectedLine = (T_MFW_LINE_INDEX)alsData;
1926
1927 FFS_flashData.als_selLine = alsData;
1928 if (flash_write() == EFFS_OK)
1929
1930 *res = MFW_SIMOP_WRITE_OK;
1931 else
1932 *res = MFW_SIMOP_WRITE_ERR;
1933 }
1934 }
1935
1936 /*
1937 +-----------------------------------------------------------------------+
1938 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
1939 | STATE : code ROUTINE : cphs_write_eeprom_alss|
1940 +-----------------------------------------------------------------------+
1941
1942 PURPOSE : Write line lock status in EEPROM
1943
1944 */
1945
1946 void cphs_write_eeprom_alss(UBYTE *res)
1947 {
1948 #ifndef PCM_2_FFS
1949 EF_ALS alsInfo;
1950 #endif
1951
1952
1953 TRACE_FUNCTION ("cphs_write_eeprom_als()");
1954 {
1955 alsStatus.status = (T_MFW_LINE_STATUS)alsData;
1956 FFS_flashData.als_statLine = alsData;
1957
1958 if (flash_write() == EFFS_OK)
1959 *res = MFW_SIMOP_WRITE_OK;
1960 else
1961 *res = MFW_SIMOP_WRITE_ERR;
1962 }
1963 }
1964
1965 /*
1966 +----------------------------------------------------------------------+
1967 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
1968 | STATE : code ROUTINE: cphs_read_sim_dat |
1969 +----------------------------------------------------------------------+
1970
1971
1972 PURPOSE : Request to read SIM card.
1973
1974 */
1975
1976 BOOL cphs_read_sim_dat(USHORT data_id, UBYTE len, UBYTE max_length)
1977 {
1978 T_ACI_RETURN res;
1979
1980 TRACE_FUNCTION ("cphs_read_sim_dat()");
1981
1982 #ifdef FF_2TO1_PS
1983 res = cmhSIM_ReadTranspEF ( CMD_SRC_NONE,
1984 AT_CMD_NONE,
1985 FALSE, /* SCT: dummy only (path info valid flag) */
1986 NULL, /* SCT: dummy only (path info)*/
1987 data_id,
1988 0,
1989 max_length,
1990 NULL,
1991 cphs_read_sim_dat_cb);
1992 #else
1993 res = cmhSIM_ReadTranspEF ( CMD_SRC_NONE,
1994 AT_CMD_NONE,
1995 data_id,
1996 0,
1997 max_length,
1998 NULL,
1999 cphs_read_sim_dat_cb);
2000 #endif
2001 if (res NEQ AT_EXCT)
2002 return FALSE;
2003
2004 return TRUE;
2005 }
2006
2007 /*
2008 +----------------------------------------------------------------------+
2009 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2010 | STATE : code ROUTINE: cphs_read_sim_dat_cb |
2011 +----------------------------------------------------------------------+
2012
2013
2014 PURPOSE : Call back for SIM read.
2015
2016 */
2017
2018 void cphs_read_sim_dat_cb(SHORT table_id)
2019 {
2020 UBYTE dataLen;
2021 UBYTE result;
2022 TRACE_FUNCTION ("cphs_read_sim_dat_cb()");
2023 /***************************Go-lite Optimization changes Start***********************/
2024 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
2025 TRACE_EVENT_P1("SIM Error code!!!%d",simShrdPrm.atb[table_id].errCode);
2026 /***************************Go-lite Optimization changes end***********************/
2027 switch (simShrdPrm.atb[table_id].reqDataFld)
2028 {
2029 case SIM_CPHS_CINF: /* CPHS information */
2030 if (!cphsUpdate)
2031 cphs_read_information(simShrdPrm.atb[table_id].errCode,
2032 simShrdPrm.atb[table_id].exchData,
2033 simShrdPrm.atb[table_id].dataLen);
2034 #ifdef SIM_TOOLKIT
2035 else
2036 cphs_update_info_cnf(simShrdPrm.atb[table_id].errCode,
2037 simShrdPrm.atb[table_id].exchData,
2038 simShrdPrm.atb[table_id].dataLen);
2039 #endif
2040 break;
2041
2042 case SIM_CPHS_ONSTR: /* operator name string */
2043 cphs_read_ons(simShrdPrm.atb[table_id].errCode,
2044 simShrdPrm.atb[table_id].exchData,
2045 simShrdPrm.atb[table_id].dataLen);
2046 break;
2047
2048 case SIM_CPHS_ONSHF: /* operator name short form */
2049 cphs_read_onsf(simShrdPrm.atb[table_id].errCode,
2050 simShrdPrm.atb[table_id].exchData,
2051 simShrdPrm.atb[table_id].dataLen);
2052 break;
2053
2054 case SIM_CPHS_VMW: /* voice message waiting flag */
2055 /* PATCH VO 22.01.01 */
2056 if (simStatus EQ MFW_SIMOP_WRITE_OK)
2057 {
2058 /* Determine the size of this field, and write the data.
2059 When the writing is not possible, write this voice
2060 message waiting flag in EEPROM. */
2061 simStatus = MFW_SIMOP_UNKNOWN;
2062 #ifdef FF_2TO1_PS
2063 if ( simShrdPrm.atb[table_id].errCode EQ CAUSE_SIM_NO_ERROR )
2064 #else
2065 if ( simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR )
2066 #endif
2067 {
2068 dataLen = simShrdPrm.atb[table_id].dataLen;
2069 /* Write voice message waiting flag.
2070 When this writing failed, send event with "write error" parameter to MMI */
2071 if (!cphs_write_sim_dat(SIM_CPHS_VMW, mbsData, dataLen))
2072 {
2073 result = MFW_SIMOP_WRITE_ERR;
2074 cphs_signal(E_CPHS_SET_VC_STAT, &result);
2075 }
2076 }
2077 else
2078 {
2079 result = MFW_SIMOP_WRITE_ERR;
2080 cphs_signal(E_CPHS_SET_VC_STAT, &result);
2081 }
2082 }
2083 else
2084 /* PATCH VO 22.01.01 end */
2085 cphs_read_mbs (simShrdPrm.atb[table_id].errCode,
2086 simShrdPrm.atb[table_id].exchData,
2087 simShrdPrm.atb[table_id].dataLen);
2088 break;
2089
2090 case SIM_CPHS_CFF: /* call forwarding flag */
2091 /* PATCH VO 22.01.01 */
2092 if (simStatus EQ MFW_SIMOP_WRITE_OK)
2093 {
2094 /* Determine the size of this field, and write the data.
2095 When the writing is not possible, write this voice
2096 message waiting flag in EEPROM. */
2097 simStatus = MFW_SIMOP_UNKNOWN;
2098 #ifdef FF_2TO1_PS
2099 if ( simShrdPrm.atb[table_id].errCode EQ CAUSE_SIM_NO_ERROR )
2100 #else
2101 if ( simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR )
2102 #endif
2103 {
2104 dataLen = simShrdPrm.atb[table_id].dataLen;
2105 /* Write call forwarding flag.
2106 When this writing failed, send event with "write error" parameter to MMI */
2107 if (!cphs_write_sim_dat(SIM_CPHS_CFF, dvData, dataLen))
2108 {
2109 result = MFW_SIMOP_WRITE_ERR;
2110 cphs_signal(E_CPHS_SET_DV_STAT, &result);
2111 }
2112 }
2113 else
2114 {
2115 result = MFW_SIMOP_WRITE_ERR;
2116 cphs_signal(E_CPHS_SET_VC_STAT, &result);
2117 }
2118 }
2119 else
2120 /* PATCH VO 22.01.01 end */
2121 cphs_read_cff (simShrdPrm.atb[table_id].errCode,
2122 simShrdPrm.atb[table_id].exchData,
2123 simShrdPrm.atb[table_id].dataLen);
2124 break;
2125
2126
2127 case SIM_CPHS_CSP: /* customer service profile */
2128 cphs_read_csp (simShrdPrm.atb[table_id].errCode,
2129 simShrdPrm.atb[table_id].exchData,
2130 simShrdPrm.atb[table_id].dataLen);
2131 break;
2132
2133 default:
2134 break;
2135 }
2136 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;
2137 }
2138
2139 /*
2140 +----------------------------------------------------------------------+
2141 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2142 | STATE : code ROUTINE: cphs_write_sim_dat |
2143 +----------------------------------------------------------------------+
2144
2145
2146 PURPOSE : Request to write SIM card.
2147
2148 */
2149
2150 BOOL cphs_write_sim_dat(USHORT data_id, UBYTE *data, UBYTE length)
2151 {
2152 T_ACI_RETURN res;
2153
2154 TRACE_FUNCTION ("cphs_write_sim_dat()");
2155
2156 #ifdef FF_2TO1_PS
2157 res = cmhSIM_WriteTranspEF (CMD_SRC_NONE,
2158 AT_CMD_NONE,
2159 FALSE, /* SCT: dummy only (path info valid flag) */
2160 NULL, /* SCT: dummy only (path info) */
2161 data_id,
2162 0,
2163 length,
2164 data,
2165 cphs_write_sim_dat_cb);
2166 #else
2167 res = cmhSIM_WriteTranspEF (CMD_SRC_NONE,
2168 AT_CMD_NONE,
2169 data_id,
2170 0,
2171 length,
2172 data,
2173 cphs_write_sim_dat_cb);
2174 #endif
2175
2176 if (res NEQ AT_EXCT)
2177 return FALSE;
2178
2179 return TRUE;
2180 }
2181
2182 /*
2183 +----------------------------------------------------------------------+
2184 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2185 | STATE : code ROUTINE: cphs_write_sim_dat_cb |
2186 +----------------------------------------------------------------------+
2187
2188
2189 PURPOSE : callback of SIM card writing.
2190
2191 */
2192
2193 void cphs_write_sim_dat_cb(SHORT table_id)
2194 {
2195 UBYTE result;
2196 TRACE_FUNCTION ("sim_write_sim_dat_cb()");
2197 /***************************Go-lite Optimization changes Start***********************/
2198 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
2199 TRACE_EVENT_P1("SIM Error code!!!%d", simShrdPrm.atb[table_id].errCode);
2200 /***************************Go-lite Optimization changes end***********************/
2201 switch (simShrdPrm.atb[table_id].reqDataFld)
2202 {
2203 case SIM_CPHS_VMW: /* voice message waiting flag */
2204 #ifdef FF_2TO1_PS
2205 if ( simShrdPrm.atb[table_id].errCode EQ CAUSE_SIM_NO_ERROR )
2206 #else
2207 if ( simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR )
2208 #endif
2209 {
2210 result = MFW_SIMOP_WRITE_OK;
2211 cphs_signal(E_CPHS_SET_VC_STAT, &result);
2212 }
2213 else
2214 {
2215 result = MFW_SIMOP_WRITE_ERR;
2216 cphs_signal(E_CPHS_SET_VC_STAT, &result);
2217 }
2218 break;
2219
2220 case SIM_CPHS_CFF: /* call forwarding flag */
2221 #ifdef FF_2TO1_PS
2222 if ( simShrdPrm.atb[table_id].errCode EQ CAUSE_SIM_NO_ERROR )
2223 #else
2224 if ( simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR )
2225 #endif
2226 {
2227 result = MFW_SIMOP_WRITE_OK;
2228 cphs_signal(E_CPHS_SET_DV_STAT, &result);
2229 }
2230 else
2231 {
2232 result = MFW_SIMOP_WRITE_ERR;
2233 cphs_signal(E_CPHS_SET_DV_STAT, &result);
2234 }
2235 break;
2236
2237 default:
2238 break;
2239 }
2240 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;
2241 }
2242
2243 /*
2244 +----------------------------------------------------------------------+
2245 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2246 | STATE : code ROUTINE: cphs_read_sim_rcd |
2247 +----------------------------------------------------------------------+
2248
2249
2250 PURPOSE : Request to read SIM card.
2251
2252 */
2253
2254 BOOL cphs_read_sim_rcd(USHORT data_id, UBYTE rcd_num, UBYTE len)
2255 {
2256 T_ACI_RETURN res;
2257 UBYTE dataLen;
2258
2259 TRACE_FUNCTION ("cphs_read_sim_rcd()");
2260
2261 if (rcd_num EQ 1)
2262 dataLen = UCHAR_MAX;
2263 else
2264 dataLen = len;
2265
2266 #ifdef FF_2TO1_PS
2267 res = cmhSIM_ReadRecordEF ( CMD_SRC_NONE,
2268 AT_CMD_NONE,
2269 TRUE, /* SCT: dummy only (path info valid flag) */
2270 NULL, /* SCT: dummy only (path info) */
2271 data_id,
2272 rcd_num,
2273 dataLen,
2274 NULL,
2275 cphs_read_sim_rcd_cb);
2276 #else
2277 res = cmhSIM_ReadRecordEF ( CMD_SRC_NONE,
2278 AT_CMD_NONE,
2279 data_id,
2280 rcd_num,
2281 dataLen,
2282 NULL,
2283 cphs_read_sim_rcd_cb);
2284 #endif
2285
2286 if (res NEQ AT_EXCT)
2287 return FALSE;
2288
2289 return TRUE;
2290 }
2291
2292 /*
2293 +----------------------------------------------------------------------+
2294 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2295 | STATE : code ROUTINE: cphs_read_sim_rcd_cb |
2296 +----------------------------------------------------------------------+
2297
2298
2299 PURPOSE : Request to read SIM card.
2300
2301 */
2302
2303 void cphs_read_sim_rcd_cb (SHORT table_id)
2304 {
2305 UBYTE dataLen;
2306 TRACE_FUNCTION ("cphs_read_sim_rcd_cb()");
2307 /***************************Go-lite Optimization changes Start***********************/
2308 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
2309 TRACE_EVENT_P1("SIM Error code!!!%d", simShrdPrm.atb[table_id].errCode);
2310 /***************************Go-lite Optimization changes end***********************/
2311 switch (simShrdPrm.atb[table_id].reqDataFld)
2312 {
2313 case SIM_CPHS_MBXN: /* mailbox numbers */
2314 if (simStatus EQ MFW_SIMOP_WRITE_OK)
2315 {
2316 /* Determine the size of record, and write a new record.
2317 When the writing is not possible, write this mailbox
2318 number in EEPROM. */
2319 simStatus = MFW_SIMOP_UNKNOWN;
2320 #ifdef FF_2TO1_PS
2321 if ( simShrdPrm.atb[table_id].errCode EQ CAUSE_SIM_NO_ERROR )
2322 #else
2323 if ( simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR )
2324 #endif
2325 {
2326 dataLen = simShrdPrm.atb[table_id].dataLen;
2327 /* allocate mbnData (sizeof(dataLen)) */
2328 // Mar 30, 2005 REF: CRR 29986 xpradipg
2329 // the dynamic allocation is done here, if the write fails it is deallocated
2330 // else if success it is deallocated in the callback
2331 #ifdef FF_MMI_OPTIM
2332 mbnData = (UBYTE*)mfwAlloc(MAX_MAIL_BOX_NUMBER);
2333 if(mbnData != NULL)
2334 {
2335 #endif
2336 cphs_build_mbn_data(mbnData, dataLen);
2337 if (!cphs_write_sim_rcd(SIM_CPHS_MBXN, vcEntry->index,
2338 mbnData, dataLen))
2339 {
2340 cphs_write_eeprom_mailbox(vcEntry);
2341 #ifdef FF_MMI_OPTIM
2342 mfwFree(mbnData,MAX_MAIL_BOX_NUMBER);
2343 #endif
2344 }
2345 #ifdef FF_MMI_OPTIM
2346 }
2347 #endif
2348 }
2349 else
2350 cphs_write_eeprom_mailbox(vcEntry);
2351 }
2352 else
2353 cphs_read_mbn(table_id);
2354 break;
2355
2356 case SIM_CPHS_INFN: /* information numbers */
2357 if (simShrdPrm.atb[table_id].recNr EQ 1)
2358 {
2359 /* VO patch 150501 */
2360 if ((startIdx EQ 1) AND (simStatus EQ MFW_SIMOP_READ_OK))
2361 cphs_read_info_num(table_id);
2362 else
2363 /* VO patch 150501 end */
2364 cphs_read_first_info_num(table_id);
2365 }
2366 else
2367 cphs_read_info_num(table_id);
2368 break;
2369
2370 case SIM_CPHS_INFN2: /* information numbers 2 - 7F10 'EA01' selected if SIM_CPHS_INFN '6F19' isn't there*/
2371 if (simShrdPrm.atb[table_id].recNr EQ 1)
2372 {
2373 /* VO patch 150501 */
2374 if ((startIdx EQ 1) AND (simStatus EQ MFW_SIMOP_READ_OK))
2375 cphs_read_info_num(table_id);
2376 else
2377 /* VO patch end */
2378 cphs_read_first_info_num(table_id);
2379 }
2380 else
2381 cphs_read_info_num(table_id);
2382 break;
2383
2384 default:
2385 break;
2386 }
2387 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;
2388 }
2389
2390 /*
2391 +----------------------------------------------------------------------+
2392 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2393 | STATE : code ROUTINE: cphs_write_sim_rcd |
2394 +----------------------------------------------------------------------+
2395
2396
2397 PURPOSE : Request to write SIM card.
2398
2399 */
2400
2401 BOOL cphs_write_sim_rcd(USHORT data_id, UBYTE rcd_num,
2402 UBYTE *data, UBYTE dataLen)
2403 {
2404 T_ACI_RETURN res;
2405
2406 TRACE_FUNCTION ("cphs_read_sim_rcd()");
2407
2408 #ifdef FF_2TO1_PS
2409 res = cmhSIM_WriteRecordEF (CMD_SRC_NONE,
2410 AT_CMD_NONE,
2411 TRUE, /* SCT: dummy only (path info valid flag) */
2412 NULL, /* SCT: dummy only (path info) */
2413 data_id,
2414 rcd_num,
2415 dataLen,
2416 data,
2417 cphs_write_sim_rcd_cb);
2418 #else
2419 res = cmhSIM_WriteRecordEF (CMD_SRC_NONE,
2420 AT_CMD_NONE,
2421 data_id,
2422 rcd_num,
2423 dataLen,
2424 data,
2425 cphs_write_sim_rcd_cb);
2426 #endif
2427
2428 if (res NEQ AT_EXCT)
2429 return FALSE;
2430
2431 return TRUE;
2432 }
2433
2434 /*
2435 +----------------------------------------------------------------------+
2436 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2437 | STATE : code ROUTINE: cphs_write_sim_rcd_cb |
2438 +----------------------------------------------------------------------+
2439
2440
2441 PURPOSE : callback of SIM card writing.
2442
2443 */
2444
2445 void cphs_write_sim_rcd_cb (SHORT table_id)
2446 {
2447 UBYTE result;
2448 TRACE_FUNCTION ("cphs_write_sim_rcd_cb()");
2449 /***************************Go-lite Optimization changes Start***********************/
2450 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
2451 TRACE_EVENT_P1("SIM Error code!!!%d", simShrdPrm.atb[table_id].errCode);
2452 /***************************Go-lite Optimization changes end***********************/
2453 switch (simShrdPrm.atb[table_id].reqDataFld)
2454 {
2455 case SIM_CPHS_MBXN: /* mailbox numbers */
2456 #ifdef FF_2TO1_PS
2457 if ( simShrdPrm.atb[table_id].errCode EQ CAUSE_SIM_NO_ERROR )
2458 #else
2459 if ( simShrdPrm.atb[table_id].errCode EQ SIM_NO_ERROR )
2460 #endif
2461 {
2462 result = MFW_SIMOP_WRITE_OK;
2463 cphs_signal(E_CPHS_SET_VC_NUM, &result);
2464 }
2465 else
2466 {
2467 cphs_write_eeprom_mailbox(vcEntry);
2468 }
2469 // Mar 30, 2005 REF: CRR 29986 xpradipg
2470 // mbnData is deallocated, on successfull write operation
2471 #ifdef FF_MMI_OPTIM
2472 if(mbnData)
2473 mfwFree(mbnData,MAX_MAIL_BOX_NUMBER);
2474 #endif
2475 break;
2476
2477 default:
2478 break;
2479 }
2480 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;
2481 }
2482
2483 /*
2484 +----------------------------------------------------------------------+
2485 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2486 | STATE : code ROUTINE: cphs_build_mbn_data |
2487 +----------------------------------------------------------------------+
2488
2489
2490 PURPOSE : Build mailbox number data in SIM format.
2491
2492 */
2493
2494 void cphs_build_mbn_data(UBYTE *data, UBYTE len)
2495 {
2496 UBYTE alphaLen;
2497 UBYTE numLen;
2498 UBYTE *pNumber;
2499 UBYTE i, j;
2500
2501 TRACE_FUNCTION ("cphs_build_mbn_data()");
2502
2503 memset(data, MFW_INVALID_SIM_DATA, len);
2504
2505 /* alpha data */
2506 if (len <= MFW_CPHS_MIN_MBN_SIZE)
2507 alphaLen = 0;
2508 else
2509 alphaLen = len - MFW_CPHS_MIN_MBN_SIZE;
2510 i = MINIMUM (alphaLen, vcEntry->alpha.len);
2511
2512 for ( j = 0; j < i; j++ )
2513 data[j] = vcEntry->alpha.data[j];
2514
2515 data += alphaLen;
2516
2517 /* number data and TON/NPI data */
2518 if ( vcEntry->number[0] EQ '+' )
2519 {
2520 vcEntry->ton = TON_International;
2521 pNumber = &vcEntry->number[1];
2522 }
2523 else
2524 pNumber = &vcEntry->number[0];
2525
2526 cmhPHB_getAdrBcd ( data + 2, &numLen,
2527 PHB_MAX_LEN, (CHAR *)pNumber );
2528 *data = numLen + 1;
2529 *(data + 1) = ((( vcEntry -> ton << 4 ) & 0xF0 ) + ( vcEntry -> npi & 0x0F )) | 0x80;
2530
2531 data += 12;
2532
2533 /* capability/configuration identifier data and EXT identifier data */
2534 *data = 0xFF;
2535 *(data + 1) = 0xFF;
2536 }
2537
2538 /*
2539 +----------------------------------------------------------------------+
2540 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2541 | STATE : code ROUTINE: cphs_ssc |
2542 +----------------------------------------------------------------------+
2543
2544
2545 PURPOSE : Check CPHS service status.
2546
2547 */
2548
2549 UBYTE cphs_ssc (UBYTE nr, UBYTE * serv_table)
2550 {
2551 UBYTE value;
2552
2553 TRACE_FUNCTION ("cphs_ssc()");
2554
2555 serv_table = serv_table + (nr-1)/4;
2556 value = * serv_table;
2557
2558 value = value >> (((nr-1) & 3) * 2);
2559 value = value & 3;
2560
2561 return value;
2562 }
2563
2564 /*
2565 +--------------------------------------------------------------------+
2566 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
2567 | STATE : code ROUTINE : cphsCommand |
2568 +--------------------------------------------------------------------+
2569
2570 PURPOSE : handle mfw windows command
2571
2572 */
2573
2574 static int cphsCommand (U32 cmd, void *h)
2575 {
2576 switch (cmd)
2577 {
2578 case MfwCmdDelete: /* delete me */
2579 if (!h)
2580 return 0;
2581 cphs_delete(h);
2582 return 1;
2583 default:
2584 break;
2585 }
2586
2587 return 0;
2588 }
2589
2590 #ifdef SIM_TOOLKIT
2591 /*
2592 +---------------------------------------------------------------------+
2593 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
2594 | STATE : code ROUTINE : cphs_sat_file_update |
2595 +---------------------------------------------------------------------+
2596
2597 PURPOSE : SIM file change indication
2598
2599 */
2600
2601 void cphs_sat_file_update(USHORT dataId)
2602 {
2603 TRACE_FUNCTION("cphs_sat_file_update()");
2604
2605 cphsUpdate = TRUE;
2606 switch (dataId)
2607 {
2608 case SIM_CPHS_CINF:
2609 if (!cphs_read_sim_dat(SIM_CPHS_CINF, NOT_PRESENT_8BIT, MFW_CPHS_INFO_SIZE))
2610 {
2611 satUpdateFiles(TRUE, SIM_CPHS_CINF);
2612 }
2613 break;
2614 default:
2615 break;
2616 }
2617 }
2618 #endif
2619
2620 #ifdef SIM_TOOLKIT
2621 /*
2622 +---------------------------------------------------------------------+
2623 | PROJECT : MMI-Framework (8417) MODULE : MFW_CPHS |
2624 | STATE : code ROUTINE : cphs_update_info_cnf |
2625 +---------------------------------------------------------------------+
2626
2627 PURPOSE : call back for SIM file read
2628
2629 */
2630
2631 void cphs_update_info_cnf (SHORT errCode, UBYTE *data, UBYTE dataLen)
2632 {
2633 UBYTE *ptr;
2634
2635 TRACE_FUNCTION ("cphs_update_info_cnf()");
2636
2637 cphsUpdate = FALSE; /* reset flag */
2638 ptr = data;
2639 #ifdef FF_2TO1_PS
2640 if ( errCode NEQ CAUSE_SIM_NO_ERROR OR
2641 #else
2642 if ( errCode NEQ SIM_NO_ERROR OR
2643 #endif
2644 ptr EQ NULL OR
2645 dataLen < MFW_CPHS_INFO_SIZE)
2646 {
2647 satUpdateFiles(TRUE, SIM_CPHS_CINF);
2648 }
2649 else
2650 {
2651 cphsPhase = *ptr;
2652 ptr++;
2653 memcpy (cphsServTab, ptr, CPHS_SERVICE_TABLE*sizeof(UBYTE));
2654 cphsStatus = CPHS_OK;
2655 satUpdateFiles ( TRUE, SIM_CPHS_CINF );
2656 }
2657 }
2658 #endif
2659 /*
2660 +----------------------------------------------------------------------+
2661 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2662 | STATE : code ROUTINE: Read_Sim |
2663 +----------------------------------------------------------------------+
2664
2665
2666 PURPOSE : Request to read SIM card.
2667
2668 */
2669
2670 BOOL Read_Sim(USHORT dat_id, USHORT offset, UBYTE max_len, UBYTE *exDat)
2671 {
2672 T_ACI_RETURN res;
2673
2674 TRACE_FUNCTION ("Read_Sim()");
2675
2676 #ifdef FF_2TO1_PS
2677 res = cmhSIM_ReadTranspEF ( CMD_SRC_NONE,
2678 AT_CMD_NONE,
2679 FALSE, /* SCT: dummy only (path info valid flag) */
2680 NULL, /* SCT: dummy only (path info) */
2681 dat_id,
2682 offset,
2683 max_len,
2684 exDat,
2685 cphs_read_sim_default_cb);
2686 #else
2687 res = cmhSIM_ReadTranspEF ( CMD_SRC_NONE,
2688 AT_CMD_NONE,
2689 dat_id,
2690 offset,
2691 max_len,
2692 exDat,
2693 cphs_read_sim_default_cb);
2694 #endif
2695 if (res NEQ AT_EXCT)
2696 return FALSE;
2697
2698 return TRUE;
2699 }
2700
2701
2702 /*
2703 +----------------------------------------------------------------------+
2704 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2705 | STATE : code ROUTINE: Read_Sim_Record |
2706 +----------------------------------------------------------------------+
2707
2708
2709 PURPOSE : Request to read record from SIM card.
2710
2711 */
2712
2713 BOOL Read_Sim_Record(USHORT dat_id, USHORT record, UBYTE len, UBYTE *exDat)
2714 {
2715 T_ACI_RETURN res;
2716 UBYTE dataLen;
2717
2718 TRACE_FUNCTION ("Read_Sim_Record()");
2719
2720 #ifdef FF_2TO1_PS
2721 res = cmhSIM_ReadRecordEF ( CMD_SRC_NONE,
2722 AT_CMD_NONE,
2723 TRUE, /* SCT: dummy only (path info valid flag) */
2724 NULL, /* SCT: dummy only (path info) */
2725 dat_id,
2726 record,
2727 dataLen,
2728 exDat,
2729 cphs_read_sim_default_cb);
2730 #else
2731 res = cmhSIM_ReadRecordEF ( CMD_SRC_NONE,
2732 AT_CMD_NONE,
2733 dat_id,
2734 record,
2735 dataLen,
2736 exDat,
2737 cphs_read_sim_default_cb);
2738 #endif
2739 if (res NEQ AT_EXCT)
2740 return FALSE;
2741
2742 return TRUE;
2743 }
2744
2745
2746 /*
2747 +----------------------------------------------------------------------+
2748 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2749 | STATE : code ROUTINE: Write_Sim |
2750 +----------------------------------------------------------------------+
2751
2752
2753 PURPOSE : Request to write SIM card.
2754
2755 */
2756
2757 BOOL Write_Sim(USHORT dat_id, UBYTE len, UBYTE *exDat)
2758 {
2759 T_ACI_RETURN res;
2760
2761 TRACE_FUNCTION ("Write_Sim()");
2762
2763 #ifdef FF_2TO1_PS
2764 res = cmhSIM_WriteTranspEF (CMD_SRC_NONE,
2765 AT_CMD_NONE,
2766 FALSE, /* SCT: dummy only (path info valid flag) */
2767 NULL, /* SCT: dummy only (path info) */
2768 dat_id,
2769 0,
2770 len,
2771 exDat,
2772 cphs_write_sim_default_cb);
2773 #else
2774 res = cmhSIM_WriteTranspEF (CMD_SRC_NONE,
2775 AT_CMD_NONE,
2776 dat_id,
2777 0,
2778 len,
2779 exDat,
2780 cphs_write_sim_default_cb);
2781 #endif
2782
2783 if (res NEQ AT_EXCT)
2784 return FALSE;
2785
2786 return TRUE;
2787 }
2788
2789
2790 /*
2791 +----------------------------------------------------------------------+
2792 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2793 | STATE : code ROUTINE: Write_Sim_Record |
2794 +----------------------------------------------------------------------+
2795
2796
2797 PURPOSE : Request to write record to SIM card.
2798
2799 */
2800
2801 BOOL Write_Sim_Record(USHORT dat_id, USHORT record, UBYTE len, UBYTE *exDat)
2802 {
2803 T_ACI_RETURN res;
2804
2805 TRACE_FUNCTION ("Write_Sim()");
2806
2807 #ifdef FF_2TO1_PS
2808 res = cmhSIM_WriteRecordEF (CMD_SRC_NONE,
2809 AT_CMD_NONE,
2810 TRUE, /* SCT: dummy only (path info valid flag) */
2811 NULL, /* SCT: dummy only (path info) */
2812 dat_id,
2813 record,
2814 len,
2815 exDat,
2816 cphs_write_sim_default_cb);
2817 #else
2818 res = cmhSIM_WriteRecordEF (CMD_SRC_NONE,
2819 AT_CMD_NONE,
2820 dat_id,
2821 record,
2822 len,
2823 exDat,
2824 cphs_write_sim_default_cb);
2825 #endif
2826
2827 if (res NEQ AT_EXCT)
2828 return FALSE;
2829
2830 return TRUE;
2831 }
2832
2833 /*
2834 +----------------------------------------------------------------------+
2835 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2836 | STATE : code ROUTINE: cphs_read_default_cb |
2837 +----------------------------------------------------------------------+
2838
2839
2840 PURPOSE : Sends event to MMI
2841
2842 */
2843 void cphs_read_sim_default_cb(SHORT table_id)
2844 {
2845
2846 read_sim_entry.requested_field = simShrdPrm.atb[table_id].reqDataFld;
2847 read_sim_entry.exchange_data = simShrdPrm.atb[table_id].exchData;
2848 read_sim_entry.sim_result = simShrdPrm.atb[table_id].errCode;
2849 read_sim_entry.data_len = simShrdPrm.atb[table_id].dataLen;
2850 read_sim_entry.record = simShrdPrm.atb[table_id].recNr;
2851 #ifdef FF_2TO1_PS
2852 if (read_sim_entry.sim_result != CAUSE_SIM_NO_ERROR)
2853 #else
2854 if (read_sim_entry.sim_result != SIM_NO_ERROR)
2855 #endif
2856 { read_sim_entry.exchange_data = NULL;
2857 read_sim_entry.data_len = 0;
2858 }
2859
2860 cphs_signal(E_CPHS_GET_SIM_FIELD, &read_sim_entry);
2861 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;
2862 }
2863
2864
2865 /*
2866 +----------------------------------------------------------------------+
2867 | PROJECT: MMI-Framework (8417) MODULE: MFW_CPHS |
2868 | STATE : code ROUTINE: cphs_read_default_cb |
2869 +----------------------------------------------------------------------+
2870
2871
2872 PURPOSE : Sends event to MMI
2873
2874 */
2875 void cphs_write_sim_default_cb(SHORT table_id)
2876 {
2877
2878 read_sim_entry.requested_field = simShrdPrm.atb[table_id].reqDataFld;
2879 read_sim_entry.exchange_data = simShrdPrm.atb[table_id].exchData;
2880 read_sim_entry.sim_result = simShrdPrm.atb[table_id].errCode;
2881 read_sim_entry.data_len = simShrdPrm.atb[table_id].dataLen;
2882 #ifdef FF_2TO1_PS
2883 if (read_sim_entry.sim_result != CAUSE_SIM_NO_ERROR)
2884 #else
2885 if (read_sim_entry.sim_result != SIM_NO_ERROR)
2886 #endif
2887 { read_sim_entry.exchange_data = NULL;
2888 read_sim_entry.data_len = 0;
2889 }
2890
2891 cphs_signal(E_CPHS_SET_SIM_FIELD, &read_sim_entry);
2892 simShrdPrm.atb[table_id].ntryUsdFlg = FALSE;
2893 }