comparison src/g23m-aci/aci/cmh_phbf.c @ 162:53929b40109c

src/g23m-aci: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 11 Oct 2016 02:02:43 +0000
parents
children
comparison
equal deleted inserted replaced
161:4557e2a9c18e 162:53929b40109c
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : CMH_PHBF
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This module defines the functions used by the command
18 | handler for the phonebook management.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef CMH_PHBF_C
23 #define CMH_PHBF_C
24 #endif
25
26 #include "aci_all.h"
27 /*==== INCLUDES ===================================================*/
28 #include "aci_cmh.h"
29 #include "ati_cmd.h"
30 #include "aci_cmd.h"
31
32 #ifdef FAX_AND_DATA
33 #include "aci_fd.h"
34 #endif /* of #ifdef FAX_AND_DATA */
35
36 #include "aci.h"
37 #include "psa.h"
38 #include "phb.h"
39 #include "cmh.h"
40 #include "cmh_phb.h"
41
42 /*==== CONSTANTS ==================================================*/
43
44 #define PHB_CMH_INVALID_TAG_ENTRY 0xFF /* fill up a tag */
45 #define PHB_CMH_INVALID_BCD_ENTRY 0xF /* fill up a BCD number */
46
47 #define PHB_CMH_YEAR_INVLD (255) /* invalid year */
48 #define PHB_CMH_MONTH_INVLD (255) /* invalid month */
49 #define PHB_CMH_DAY_INVLD (255) /* invalid day */
50 #define PHB_CMH_HOUR_INVLD (255) /* invalid hour */
51 #define PHB_CMH_MINUTE_INVLD (255) /* invalid minute */
52 #define PHB_CMH_SECOND_INVLD (255) /* invalid second */
53
54 /*==== TYPES ======================================================*/
55 /* Implements Measure 108, 109 */
56 /*
57 * Here we are having two SIM Phonebook as in our code we have two,
58 * one is FFS based that has been defined in phb_sim.h
59 * And the other one is RAM based has been defined in phb.h
60 */
61
62 /*
63 * Conversion Array that convert the type of phonebook used by
64 * phonebook management to the type of phonebook used by ACI.
65 */
66 #ifdef TI_PS_FFS_PHB
67 /*
68 * FFS based SIM phonebook
69 */
70 const T_ACI_PB_STOR cmhPHB_cvtPhbPsaType[]=
71 {
72 PB_STOR_Ed, /* ECC */
73 PB_STOR_Ad, /* ADN */
74 PB_STOR_Fd, /* FDN */
75 PB_STOR_Bd, /* BDN */
76 PB_STOR_Ld, /* LDN */
77 PB_STOR_Lr, /* LRN */
78 PB_STOR_Sd, /* SDN */
79 PB_STOR_Lm, /* LMN */
80 PB_STOR_Ud, /* UPN */
81 PB_STOR_NotPresent, /* ME */
82 PB_STOR_NotPresent, /* ADN_ME */
83 PB_STOR_NotPresent, /* MAX_PHONEBOOK */
84 };
85 #else
86 /*
87 * Old RAM based SIM phonebook.
88 */
89 const T_ACI_PB_STOR cmhPHB_cvtPhbPsaType[]=
90 {
91 PB_STOR_Ed, /* ECC */
92 PB_STOR_Ad, /* ADN */
93 PB_STOR_Fd, /* FDN */
94 PB_STOR_Bd, /* BDN */
95 PB_STOR_Ld, /* LDN */
96 PB_STOR_Lr, /* LRN */
97 PB_STOR_Sd, /* SDN */
98 PB_STOR_Lm, /* LMN */
99 PB_STOR_NotPresent, /* ADN_FDN */
100 PB_STOR_Ud, /* UPN */
101 PB_STOR_NotPresent /* MAX_PHONEBOOK */
102 };
103 #endif /* TI_PS_FFS_PHB */
104
105 /*
106 * Conversion Array that convert the type of phonebook used by
107 * used by ACI to the type of phonebook used by phonebook management.
108 */
109 const T_PHB_TYPE cmhPHB_cvtPBType[]=
110 {
111 FDN, /* PB_STOR_Fd */
112 LDN, /* PB_STOR_Ld */
113 ECC, /* PB_STOR_Ed */
114 ADN, /* PB_STOR_Ad */
115 BDN, /* PB_STOR_Bd */
116 LRN, /* PB_STOR_Lr */
117 SDN, /* PB_STOR_Sd */
118 LMN, /* PB_STOR_Lm */
119 #ifdef TI_PS_FFS_PHB
120 INVALID_PHB, /* PB_STOR_Af , Not supported anymore */
121 #else
122 UNUSED_INDEX,
123 #endif
124 UPN /* PB_STOR_Ud */
125 };
126
127 /*==== EXPORT =====================================================*/
128
129 /*==== VARIABLES ==================================================*/
130
131 /*==== FUNCTIONS ==================================================*/
132 /*
133 +-------------------------------------------------------------------+
134 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBF |
135 | STATE : code ROUTINE : cmhPHB_rplcIntnl |
136 +-------------------------------------------------------------------+
137
138 PURPOSE :
139 */
140 GLOBAL BOOL cmhPHB_rplcIntnl ( CHAR* inNumber,
141 CHAR* outNumber,
142 UBYTE inCnt )
143 {
144 USHORT inIdx = 0;
145 USHORT outIdx = 0;
146 UBYTE actCnt = 0;
147 BOOL international = FALSE;
148
149 while ( inNumber[inIdx] NEQ '\0' )
150 {
151 /*
152 *---------------------------------------------------------------
153 * international indicator "+"
154 *---------------------------------------------------------------
155 */
156 if ( inNumber[inIdx] EQ '+' AND
157 inNumber[inIdx-1] EQ '*' )
158 {
159 if ( actCnt EQ inCnt OR inCnt EQ 0xFF )
160 {
161 international = TRUE;
162 }
163 else
164 {
165 outNumber[outIdx++] = inNumber[inIdx];
166 }
167 }
168 /* PATCH LE 12.05.00
169 * 00 is used in china as national number
170 * checked against competitor phone
171 * now ACI has the same behaviour
172 */
173 /*
174 *---------------------------------------------------------------
175 * international indicator "00"
176 *---------------------------------------------------------------
177 */
178 /* else if ( inNumber[inIdx+1] EQ '0' AND
179 inNumber[inIdx] EQ '0' AND
180 inNumber[inIdx-1] EQ '*' )
181 {
182 if ( actCnt EQ inCnt OR inCnt EQ 0xFF )
183 {
184 international = TRUE;
185 inIdx++;
186 }
187 else
188 {
189 outNumber[outIdx++] = inNumber[inIdx++];
190 outNumber[outIdx++] = inNumber[inIdx];
191 }
192 } */
193 /* END PATCH LE 12.05.00 */
194 /*
195 *---------------------------------------------------------------
196 * national indicator
197 *---------------------------------------------------------------
198 */
199 else
200 {
201 if ( inNumber[inIdx] EQ '*' )
202 {
203 actCnt++;
204 }
205
206 outNumber[outIdx++] = inNumber[inIdx];
207 }
208
209 inIdx++;
210 }
211
212 outNumber[outIdx] = '\0';
213
214 return international;
215 }
216
217 /*
218 +-------------------------------------------------------------------+
219 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBF |
220 | STATE : code ROUTINE : cmhPHB_cvtPhbType |
221 +-------------------------------------------------------------------+
222
223 PURPOSE : This function is used to convert the type of phonebook
224 used by ACI to the type of phonebook used by phonebook
225 management.
226 */
227 GLOBAL BOOL cmhPHB_cvtPhbType ( T_ACI_PB_STOR inMem, T_PHB_TYPE* outMem )
228 {
229 /* Implements Measure 108, 109 */
230 if ( (inMem <= PB_STOR_Ud) AND (inMem NEQ PB_STOR_Af)
231 AND (inMem > PB_STOR_NotPresent) )
232 {
233 *outMem = ( T_PHB_TYPE ) cmhPHB_cvtPBType[inMem];
234 return ( TRUE );
235 }
236 else
237 {
238 return ( FALSE );
239 }
240 }
241
242
243 /*
244 +--------------------------------------------------------------------+
245 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBF |
246 | STATE : code ROUTINE : cmhPHB_toaMrg |
247 +--------------------------------------------------------------------+
248
249 PURPOSE : This function is used to build the type of address octet
250 from T_ACI_TOA structure.
251 */
252 GLOBAL void cmhPHB_toaMrg ( T_ACI_TOA* type, UBYTE* octet )
253 {
254 *octet = ( ( ( type -> ton << 4 ) & 0xF0 ) + ( type -> npi & 0x0F ) ) | 0x80;
255 }
256
257 /*
258 +--------------------------------------------------------------------+
259 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBF |
260 | STATE : code ROUTINE : cmhPHB_toaDmrg |
261 +--------------------------------------------------------------------+
262
263 PURPOSE : This function is used to build the T_ACI_TOA structure
264 from the type of address octet.
265 */
266 GLOBAL void cmhPHB_toaDmrg ( UBYTE octet, T_ACI_TOA* type )
267 {
268 if ( octet EQ 0xFF )
269 {
270 type -> ton = TON_NotPresent;
271 type -> npi = NPI_NotPresent;
272 }
273 else
274 {
275 type -> ton = (T_ACI_TOA_TON)(( octet & 0x70 ) >> 4);
276 type -> npi = (T_ACI_TOA_NPI)(octet & 0x0F);
277 }
278 }
279
280 /*
281 +--------------------------------------------------------------------+
282 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBF |
283 | STATE : code ROUTINE : cmhPHB_getAdrStr |
284 +--------------------------------------------------------------------+
285
286 PURPOSE : This function is used to convert the phone number
287 in BCD to the phone number as a string.
288
289 BCD Note: Two digits are stored in one byte.
290
291 +-------+-------+-------+-------+
292 BCD: | 1 - 0 | 3 - 2 | F - 4 | F - F |
293 +-------+-------+-------+-------+
294
295 STRING: "01234"
296
297 */
298 GLOBAL CHAR cmhPHB_convertBCD2char( UBYTE bcd )
299 {
300 switch ( bcd )
301 {
302 case 0:
303 case 1:
304 case 2:
305 case 3:
306 case 4:
307 case 5:
308 case 6:
309 case 7:
310 case 8:
311 case 9:
312 return (bcd + '0');
313
314 case 0x0a:
315 return ('*');
316
317 case 0x0b:
318 return ('#');
319
320 case 0x0c:
321 return (PHB_DIAL_PAUSE); /* 'P' */
322
323 case 0x0d:
324 return (PHB_WILD_CRD); /* '?' */
325
326 case 0x0e:
327 return (PHB_EXP_DIGIT); /* 'E' */
328
329 default:
330 return ('\0');
331 }
332 }
333
334 GLOBAL UBYTE cmhPHB_getAdrStr ( CHAR* pStr,
335 UBYTE maxIdx,
336 const UBYTE* pBcd,
337 UBYTE numDigits )
338 {
339 BOOL highNibble = FALSE;
340
341 UBYTE bcdIdx = 0;
342 UBYTE strIdx = 0;
343
344 UBYTE bcd;
345 char digit;
346 BOOL ignore_next = FALSE;
347
348 while ( bcdIdx < numDigits AND strIdx < maxIdx )
349 {
350 if ( highNibble )
351 {
352 bcd = ( pBcd[bcdIdx] & 0xF0 ) >> 4;
353 bcdIdx++;
354 }
355 else
356 {
357 bcd = pBcd[bcdIdx] & 0x0F;
358 }
359
360 highNibble = ! highNibble;
361
362 if(bcd EQ PHB_CMH_INVALID_BCD_ENTRY)
363 {
364 break;
365 }
366
367 digit = cmhPHB_convertBCD2char( bcd );
368 if (ignore_next EQ TRUE)
369 {
370 ; /* skip the digit following on an extension flag since we do not support it */
371 ignore_next = FALSE; /* reset flag */
372 }
373 else if (digit EQ PHB_EXP_DIGIT)
374 {
375 ignore_next = TRUE; /* we currently do not support Expansion Digit so skip next digit */
376 }
377 else
378 {
379 pStr[strIdx++] = cmhPHB_convertBCD2char( bcd ); /* normal and supported digit */
380 }
381
382 }
383
384 pStr[strIdx] = '\0';
385 return ( strIdx );
386 }
387
388 /*
389 +--------------------------------------------------------------------+
390 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBF |
391 | STATE : code ROUTINE : cmhPHB_getAdrBcd |
392 +--------------------------------------------------------------------+
393
394 PURPOSE : This function is used to convert the phone number
395 as a string to the phone number in BCD.
396
397 STRING: "01234"
398
399 BCD Note: Two digits are stored in one byte.
400
401 +-------+-------+-------+-------+
402 BCD: | 1 - 0 | 3 - 2 | F - 4 | F - F |
403 +-------+-------+-------+-------+
404 */
405 GLOBAL void cmhPHB_getAdrBcd ( UBYTE* pBcd,
406 UBYTE* pNumDigits,
407 UBYTE maxDigits,
408 CHAR* pStr )
409 {
410 BOOL highNibble = FALSE;
411
412 UBYTE bcdIdx = 0;
413 UBYTE strIdx;
414 SHORT restLen;
415
416 UBYTE bcd;
417
418 for(strIdx = 0; bcdIdx < maxDigits AND pStr[strIdx] NEQ '\0'; strIdx++)
419 {
420 switch ( pStr[strIdx] )
421 {
422 case '0':
423 case '1':
424 case '2':
425 case '3':
426 case '4':
427 case '5':
428 case '6':
429 case '7':
430 case '8':
431 case '9':
432 bcd = pStr[strIdx] - '0';
433 break;
434
435 case '*':
436 bcd = 0x0a;
437 break;
438
439 case '#':
440 bcd = 0x0b;
441 break;
442
443 case 'w':
444 case 'p':
445 case 'W':
446 case 'P':
447 bcd = 0x0c;
448 break;
449
450 case '?':
451 bcd = 0x0d;
452 break;
453
454 case 'E':
455 bcd = 0x0e;
456 break;
457
458 default:
459 continue;
460 }
461
462 if ( highNibble )
463 {
464 pBcd[bcdIdx] += ( bcd << 4 );
465 bcdIdx++;
466 }
467 else
468
469 pBcd[bcdIdx] = bcd;
470
471 highNibble = ! highNibble;
472 }
473
474 /*
475 *-----------------------------------------------------------------
476 * The last byte of the phone number is filled up with 'F' if
477 * necessary
478 *-----------------------------------------------------------------
479 */
480 if ( highNibble )
481 {
482 pBcd[bcdIdx] += ( PHB_CMH_INVALID_BCD_ENTRY << 4 );
483 bcdIdx++;
484 }
485
486 *pNumDigits = bcdIdx;
487
488 /*
489 *-----------------------------------------------------------------
490 * The rest of the phone number is filled up with 'FF'
491 *-----------------------------------------------------------------
492 */
493 restLen = maxDigits - bcdIdx;
494 if ( restLen > 0 )
495 memset ( &pBcd[bcdIdx],
496 (PHB_CMH_INVALID_BCD_ENTRY << 4) + PHB_CMH_INVALID_BCD_ENTRY,
497 restLen );
498 }
499
500 /*
501 +--------------------------------------------------------------------+
502 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBF |
503 | STATE : code ROUTINE : cmhPHB_cpyRecEntr |
504 +--------------------------------------------------------------------+
505
506 PURPOSE : This function is used to copy the relevant data from the
507 T_PHB_RECORD structure to the T_ACI_PB_ENTR structure.
508 */
509 GLOBAL void cmhPHB_cpyRecEntr ( T_ACI_PB_ENTR* entry,
510 #ifdef TI_PS_FFS_PHB
511 T_PHB_TYPE book,
512 #endif
513 const T_PHB_RECORD* record )
514 {
515 #ifdef TI_PS_FFS_PHB
516 entry -> index = record->phy_recno;
517 #else
518 entry -> index = ( SHORT ) record -> index;
519 #endif
520
521 cmhPHB_getAdrStr ( entry -> number,
522 MAX_PHB_NUM_LEN - 1,
523 record -> number,
524 record -> len );
525
526 cmhPHB_toaDmrg ( record -> ton_npi, &entry -> type );
527
528 cmhPHB_getMfwTagNt ( record -> tag, record -> tag_len,
529 entry -> text.data, &entry -> text.len );
530
531 entry -> text.cs = CS_Sim;
532
533 /* Implements Measure 108, 109 */
534 #ifdef TI_PS_FFS_PHB
535 if ( (book >= INVALID_PHB) AND (book <= MAX_PHONEBOOK) )
536 {
537 entry -> book = ( T_ACI_PB_STOR ) cmhPHB_cvtPhbPsaType[book];
538 }
539 #else
540 if ( record -> book <= MAX_PHONEBOOK )
541 {
542 entry -> book = ( T_ACI_PB_STOR ) cmhPHB_cvtPhbPsaType[record -> book];
543 }
544 #endif /* TI_PS_FFS_PHB */
545
546 cmhPHB_cpyPhbDateTime ( record, &entry -> dateTime );
547 }
548
549 /*
550 +--------------------------------------------------------------------+
551 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBF |
552 | STATE : code ROUTINE : cmhPHB_invldEntr |
553 +--------------------------------------------------------------------+
554
555 PURPOSE : This function is used to invalidate the elements of
556 a T_ACI_PB_ENTR structure.
557 */
558 GLOBAL void cmhPHB_invldEntr ( T_ACI_PB_ENTR* entry )
559 {
560 entry -> index = ACI_NumParmNotPresent;
561 entry -> number[0] = '\0';
562 entry -> type.ton = TON_Unknown;
563 entry -> type.npi = NPI_IsdnTelephony;
564 entry -> text.len = 0;
565 entry -> book = PB_STOR_NotPresent;
566
567 cmhPHB_invldCmhDateTime ( &entry -> dateTime);
568 }
569
570 /*
571 +--------------------------------------------------------------------+
572 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBF |
573 | STATE : code ROUTINE : cmhPHB_getTagNt |
574 +--------------------------------------------------------------------+
575
576 PURPOSE : This function converts the actual tag in the format used
577 when storing it on the SIM into a null terminated string.
578 */
579 GLOBAL void cmhPHB_getTagNt ( UBYTE* inTag,
580 UBYTE maxInLen,
581 CHAR* outTag,
582 UBYTE maxOutLen )
583 {
584 UBYTE i = 0;
585
586 while ( i < maxOutLen - 1 AND i < maxInLen AND
587 inTag[i] NEQ PHB_CMH_INVALID_TAG_ENTRY )
588 {
589 /*
590 *-----------------------------------------------------------------
591 * Convert from default GSM to internal GSM alphabet
592 *-----------------------------------------------------------------
593 */
594 outTag[i] = ( CHAR ) inTag[i] | 0x80;
595 i++;
596 }
597
598 outTag[i] = '\0';
599 }
600
601 /*
602 +--------------------------------------------------------------------+
603 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBF |
604 | STATE : code ROUTINE : cmhPHB_getMfwTagNt |
605 +--------------------------------------------------------------------+
606
607 PURPOSE : This function copy the actual tag .
608 */
609 GLOBAL void cmhPHB_getMfwTagNt ( const UBYTE* inTag,
610 UBYTE maxInLen,
611 UBYTE* outTag,
612 UBYTE* maxOutLen )
613 {
614 UBYTE len;
615
616 if(maxInLen EQ 0)
617 {
618 memset(outTag, 0, MAX_ALPHA_LEN); /* we need to set out tag to 0 to prevent to be recognized by UCS2 decoder */
619 *maxOutLen = 0;
620 return;
621 }
622
623 len = pb_get_entry_len(inTag, maxInLen);
624
625 if (len >= MAX_ALPHA_LEN)
626 {
627 len = MAX_ALPHA_LEN;
628 }
629
630 memcpy(outTag, inTag, len);
631 *maxOutLen = len;
632 }
633
634 /*
635 +--------------------------------------------------------------------+
636 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBF |
637 | STATE : code ROUTINE : cmhPHB_getTagSim |
638 +--------------------------------------------------------------------+
639
640 PURPOSE : This function converts the actual tag as a null
641 terminated string in the format used when storing it on
642 the SIM.
643 */
644 GLOBAL void cmhPHB_getTagSim ( T_ACI_PB_TEXT *inTag,
645 UBYTE *outTag,
646 UBYTE maxOutLen )
647 {
648 UBYTE inLen = inTag->len;
649 UBYTE i = MINIMUM ( maxOutLen, inLen);
650 SHORT restLen = maxOutLen - inLen;
651 UBYTE j;
652
653 /*
654 *-----------------------------------------------------------------
655 * Convert from internal GSM to default GSM alphabet
656 *-----------------------------------------------------------------
657 */
658 for ( j = 0; j < i; j++ )
659 outTag[j] = inTag->data[j] & 0x7F;
660
661 if ( restLen > 0 )
662 memset ( &outTag[i], PHB_CMH_INVALID_TAG_ENTRY, restLen);
663 }
664
665 /*
666 +--------------------------------------------------------------------+
667 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBF |
668 | STATE : code ROUTINE : cmhPHB_getMfwTagSim |
669 +--------------------------------------------------------------------+
670
671 PURPOSE : This function converts the actual tag string in the
672 format used when storing it on the SIM.
673 */
674 GLOBAL void cmhPHB_getMfwTagSim ( T_ACI_PB_TEXT* inTag,
675 UBYTE* outTag,
676 UBYTE* outTagLen,
677 UBYTE maxOutLen )
678 {
679 UBYTE i = MINIMUM ( maxOutLen, inTag->len);
680 SHORT restLen = maxOutLen - inTag->len;
681 UBYTE j;
682
683 /*
684 *-----------------------------------------------------------------
685 * Convert from internal GSM to default GSM alphabet
686 *-----------------------------------------------------------------
687 */
688 for ( j = 0; j < i; j++ )
689 outTag[j] = inTag->data[j];
690
691 *outTagLen = i;
692
693 if ( restLen > 0 )
694 memset ( &outTag[i], PHB_CMH_INVALID_TAG_ENTRY, restLen);
695 }
696
697 /*
698 +-------------------------------------------------------------------+
699 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBF |
700 | STATE : code ROUTINE : cmhPHB_invldPhbDateTime |
701 +-------------------------------------------------------------------+
702
703 PURPOSE : This function is used to invalidate the date and time
704 of a phonebook entry.
705 */
706 GLOBAL void cmhPHB_invldPhbDateTime ( T_PHB_RECORD* record )
707 {
708 #ifdef TI_PS_FFS_PHB
709 record->v_time = FALSE;
710
711 /* Backward compatibility. Setting v_time to FALSE would be sufficient */
712 record->time.year = PHB_CMH_YEAR_INVLD;
713 record->time.month = PHB_CMH_MONTH_INVLD;
714 record->time.day = PHB_CMH_DAY_INVLD;
715 record->time.hour = PHB_CMH_HOUR_INVLD;
716 record->time.minute = PHB_CMH_MINUTE_INVLD;
717 record->time.second = PHB_CMH_SECOND_INVLD;
718 #else
719 record -> year = PHB_CMH_YEAR_INVLD;
720 record -> month = PHB_CMH_MONTH_INVLD;
721 record -> day = PHB_CMH_DAY_INVLD;
722 record -> hour = PHB_CMH_HOUR_INVLD;
723 record -> minute = PHB_CMH_MINUTE_INVLD;
724 record -> second = PHB_CMH_SECOND_INVLD;
725 #endif
726 }
727
728 /*
729 +-------------------------------------------------------------------+
730 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBF |
731 | STATE : code ROUTINE : cmhPHB_invldCmhDateTime |
732 +-------------------------------------------------------------------+
733
734 PURPOSE : This function is used to invalidate the date and time
735 of a phonebook entry.
736 */
737 GLOBAL void cmhPHB_invldCmhDateTime ( T_ACI_VP_ABS* dateTime )
738 {
739 dateTime -> year [0] = PHB_CMH_INVALID_BCD_ENTRY;
740 dateTime -> year [1] = PHB_CMH_INVALID_BCD_ENTRY;
741 dateTime -> month [0] = PHB_CMH_INVALID_BCD_ENTRY;
742 dateTime -> month [1] = PHB_CMH_INVALID_BCD_ENTRY;
743 dateTime -> day [0] = PHB_CMH_INVALID_BCD_ENTRY;
744 dateTime -> day [1] = PHB_CMH_INVALID_BCD_ENTRY;
745 dateTime -> hour [0] = PHB_CMH_INVALID_BCD_ENTRY;
746 dateTime -> hour [1] = PHB_CMH_INVALID_BCD_ENTRY;
747 dateTime -> minute[0] = PHB_CMH_INVALID_BCD_ENTRY;
748 dateTime -> minute[1] = PHB_CMH_INVALID_BCD_ENTRY;
749 dateTime -> second[0] = PHB_CMH_INVALID_BCD_ENTRY;
750 dateTime -> second[1] = PHB_CMH_INVALID_BCD_ENTRY;
751 }
752
753 /*
754 +-------------------------------------------------------------------+
755 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBF |
756 | STATE : code ROUTINE : cmhPHB_cpyCmhDateTime |
757 +-------------------------------------------------------------------+
758
759 PURPOSE : This function is used to convert the date and time used
760 within the command handler to the format used in the
761 phonebook management.
762 */
763 GLOBAL void cmhPHB_cpyCmhDateTime ( const T_ACI_VP_ABS* dateTime,
764 T_PHB_RECORD* record )
765 {
766 #ifdef TI_PS_FFS_PHB
767 record->time.year = (UBYTE)(dateTime -> year [0] << 4) +
768 dateTime -> year [1];
769 record->time.month = (UBYTE)(dateTime -> month [0] << 4) +
770 dateTime -> month [1];
771 record->time.day = (UBYTE)(dateTime -> day [0] << 4) +
772 dateTime -> day [1];
773 record->time.hour = (UBYTE)(dateTime -> hour [0] << 4) +
774 dateTime -> hour [1];
775 record->time.minute = (UBYTE)(dateTime -> minute[0] << 4) +
776 dateTime -> minute[1];
777 record->time.second = (UBYTE)(dateTime -> second[0] << 4) +
778 dateTime -> second[1];
779 record->v_time = (record->time.year NEQ 0xff);
780 #else
781 record -> year = (UBYTE)(dateTime -> year [0] << 4) +
782 dateTime -> year [1];
783 record -> month = (UBYTE)(dateTime -> month [0] << 4) +
784 dateTime -> month [1];
785 record -> day = (UBYTE)(dateTime -> day [0] << 4) +
786 dateTime -> day [1];
787 record -> hour = (UBYTE)(dateTime -> hour [0] << 4) +
788 dateTime -> hour [1];
789 record -> minute = (UBYTE)(dateTime -> minute[0] << 4) +
790 dateTime -> minute[1];
791 record -> second = (UBYTE)(dateTime -> second[0] << 4) +
792 dateTime -> second[1];
793 #endif
794 }
795
796 /*
797 +-------------------------------------------------------------------+
798 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBF |
799 | STATE : code ROUTINE : cmhPHB_cpyPhbDateTime |
800 +-------------------------------------------------------------------+
801
802 PURPOSE : This function is used to convert the date and time used
803 within the phonebook management to the format used in
804 the command handler.
805 */
806 GLOBAL void cmhPHB_cpyPhbDateTime ( const T_PHB_RECORD* record,
807 T_ACI_VP_ABS* dateTime )
808 {
809 #ifdef TI_PS_FFS_PHB
810 dateTime -> year [0] = ( record->time.year ) >> 4;
811 dateTime -> year [1] = record->time.year & 0x0F;
812 dateTime -> month [0] = ( record->time.month ) >> 4;
813 dateTime -> month [1] = record->time.month & 0x0F;
814 dateTime -> day [0] = ( record->time.day ) >> 4;
815 dateTime -> day [1] = record->time.day & 0x0F;
816 dateTime -> hour [0] = ( record->time.hour ) >> 4;
817 dateTime -> hour [1] = record->time.hour & 0x0F;
818 dateTime -> minute[0] = ( record->time.minute ) >> 4;
819 dateTime -> minute[1] = record->time.minute & 0x0F;
820 dateTime -> second[0] = ( record->time.second ) >> 4;
821 dateTime -> second[1] = record->time.second & 0x0F;
822 #else
823 dateTime -> year [0] = ( record -> year ) >> 4;
824 dateTime -> year [1] = record -> year & 0x0F;
825 dateTime -> month [0] = ( record -> month ) >> 4;
826 dateTime -> month [1] = record -> month & 0x0F;
827 dateTime -> day [0] = ( record -> day ) >> 4;
828 dateTime -> day [1] = record -> day & 0x0F;
829 dateTime -> hour [0] = ( record -> hour ) >> 4;
830 dateTime -> hour [1] = record -> hour & 0x0F;
831 dateTime -> minute[0] = ( record -> minute ) >> 4;
832 dateTime -> minute[1] = record -> minute & 0x0F;
833 dateTime -> second[0] = ( record -> second ) >> 4;
834 dateTime -> second[1] = record -> second & 0x0F;
835 #endif
836 }
837
838 /*==== EOF ========================================================*/
839