4 * Copyright (c) 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Kyeongchul Kim <kyeongchul.kim@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
22 /* standard header files*/
32 #include <linux/stat.h>
40 #include "TapiCommon.h"
41 #include "TelUtility.h"
42 #include "TapiEvent.h"
44 #define SIM_APPLICATION_ID 10
45 #define _TAPI_DEBUG_ON_SCREEN_
46 #define TEST_DEBUG(frmt, args...) \
47 {do { fprintf(stderr, "[SIM Test][%s:%04d] "frmt "\n", __func__,__LINE__, ##args); } while (FALSE); }
59 //extern int EvtDeliveryHandle ;
63 static unsigned int* SIM_subscription_id;
65 void sim_async_event_callback(TelTapiEvent_t* sim_event);
76 int strlen2(register const char * s) {
83 int _fgets(register char * digit, int n) {
85 if (!fgets(digit, n, stdin)) {
88 if (*(digit + (n = strlen2(digit) - 1)) ^ '\n') {
90 while (getchar() ^ '\n')
101 TelSimPbFileType_t __InputStorageType() {
102 TelSimPbFileType_t storage_type = 0;
104 int iStorageType = 0;
107 TEST_DEBUG(" storage types are below : ");
108 TEST_DEBUG(" 2 - Emergency numbers ");
109 TEST_DEBUG(" 3 - Fixed dialing numbers ");
110 TEST_DEBUG(" 4- Last dialled numbers ");
111 TEST_DEBUG(" 8 - Own numbers ");
112 TEST_DEBUG(" 10 - 2G SIM numbers ");
113 TEST_DEBUG(" 11 - Service dialing numbers ");
114 TEST_DEBUG(" 12 - 3G SIM numbers ");
115 TEST_DEBUG(" 15 - Additional string numbers ");
116 TEST_DEBUG(" 16 - Grouping text string ");
118 TEST_DEBUG("Please input storage type: ");
119 scanf("%d%c", &iStorageType, &dummy);
121 switch (iStorageType) {
123 storage_type = TAPI_SIM_PB_EN;
128 storage_type = TAPI_SIM_PB_FDN;
133 storage_type = TAPI_SIM_PB_LDN;
138 storage_type = TAPI_SIM_PB_MSISDN;
143 storage_type = TAPI_SIM_PB_ADN;
148 storage_type = TAPI_SIM_PB_SDN;
153 storage_type = TAPI_SIM_PB_3GSIM;
158 storage_type = TAPI_SIM_PB_AAS;
163 storage_type = TAPI_SIM_PB_GAS;
168 storage_type = TAPI_SIM_PB_UNKNOWNN;
176 void __PrintStorageType(TelSimPbFileType_t tSimPbFileType) {
177 switch (tSimPbFileType) {
178 case TAPI_SIM_PB_EN: {
179 TEST_DEBUG("TAPI_SIM_PB_EN [0x%x]", tSimPbFileType);
183 case TAPI_SIM_PB_FDN: {
184 TEST_DEBUG("TAPI_SIM_PB_FDN [0x%x]", tSimPbFileType);
188 case TAPI_SIM_PB_LDN: {
189 TEST_DEBUG("TAPI_SIM_PB_LDN [0x%x]", tSimPbFileType);
193 case TAPI_SIM_PB_MSISDN: {
194 TEST_DEBUG("TAPI_SIM_PB_MSISDN [0x%x]", tSimPbFileType);
198 case TAPI_SIM_PB_ADN: {
199 TEST_DEBUG("TAPI_SIM_PB_ADN [0x%x]", tSimPbFileType);
203 case TAPI_SIM_PB_SDN: {
204 TEST_DEBUG("TAPI_SIM_PB_SDN [0x%x]", tSimPbFileType);
208 case TAPI_SIM_PB_3GSIM: {
209 TEST_DEBUG("TAPI_SIM_PB_3GSIM [0x%x]", tSimPbFileType);
213 case TAPI_SIM_PB_AAS: {
214 TEST_DEBUG("TAPI_SIM_PB_AAS [0x%x]", tSimPbFileType);
218 case TAPI_SIM_PB_GAS: {
219 TEST_DEBUG("TAPI_SIM_PB_GAS [0x%x]", tSimPbFileType);
224 TEST_DEBUG("Undefined Storage Type returnted [0x%x]", tSimPbFileType);
230 void __PrintPbFiledType(TelSimPb3GFileType_t tSimPb3GFileType) {
231 switch (tSimPb3GFileType) {
232 case TAPI_PB_3G_NAME: {
233 TEST_DEBUG("PB Type: TAPI_PB_3G_NAME [0x%x]", tSimPb3GFileType);
237 case TAPI_PB_3G_NUMBER: {
238 TEST_DEBUG("PB Type: TAPI_PB_3G_NUMBER [0x%x]", tSimPb3GFileType);
241 case TAPI_PB_3G_ANR: {
242 TEST_DEBUG("PB Type: TAPI_PB_3G_ANR [0x%x]", tSimPb3GFileType);
245 case TAPI_PB_3G_EMAIL: {
246 TEST_DEBUG("PB Type: TAPI_PB_3G_EMAIL [0x%x]", tSimPb3GFileType);
249 case TAPI_PB_3G_SNE: {
250 TEST_DEBUG("PB Type: TAPI_PB_3G_SNE [0x%x]", tSimPb3GFileType);
253 case TAPI_PB_3G_GRP: {
254 TEST_DEBUG("PB Type: TAPI_PB_3G_GRP [0x%x]", tSimPb3GFileType);
257 case TAPI_PB_3G_PBC: {
258 TEST_DEBUG("PB Type: TAPI_PB_3G_PBC [0x%x]", tSimPb3GFileType);
261 case TAPI_PB_3G_ANRA: {
262 TEST_DEBUG("PB Type: TAPI_PB_3G_ANRA [0x%x]", tSimPb3GFileType);
265 case TAPI_PB_3G_ANRB: {
266 TEST_DEBUG("PB Type: TAPI_PB_3G_ANRB [0x%x]", tSimPb3GFileType);
270 TEST_DEBUG("PB Type: Undefined PB 3G File Type [0x%x]", tSimPb3GFileType);
276 void __PrintLockType(TelSimLockType_t tSimLockType)
280 case TAPI_SIM_LOCK_READY:
281 TEST_DEBUG("Lock Type: TAPI_SIM_LOCK_READY [0x%x]", tSimLockType);
283 case TAPI_SIM_LOCK_PS:
284 TEST_DEBUG("Lock Type: TAPI_SIM_LOCK_PS (Phone-Sim Lock) [0x%x]", tSimLockType);
286 case TAPI_SIM_LOCK_PF:
287 TEST_DEBUG("Lock Type: TAPI_SIM_LOCK_PF (Phone first SIM) [0x%x]", tSimLockType);
289 case TAPI_SIM_LOCK_SC:
290 TEST_DEBUG("Lock Type: TAPI_SIM_LOCK_SC (PIN, PIN2, PUK, PUK2 Lock) [0x%x]", tSimLockType);
292 case TAPI_SIM_LOCK_FD:
293 TEST_DEBUG("Lock Type: TAPI_SIM_LOCK_FD (FDN) [0x%x]", tSimLockType);
295 case TAPI_SIM_LOCK_PN:
296 TEST_DEBUG("Lock Type: TAPI_SIM_LOCK_PN (Network Personalization) [0x%x]", tSimLockType);
298 case TAPI_SIM_LOCK_PU:
299 TEST_DEBUG("Lock Type: TAPI_SIM_LOCK_PU (Network Subset Personalization) [0x%x]", tSimLockType);
301 case TAPI_SIM_LOCK_PP:
302 TEST_DEBUG("Lock Type: TAPI_SIM_LOCK_PP (Service Provider Personalization) [0x%x]", tSimLockType);
304 case TAPI_SIM_LOCK_PC:
305 TEST_DEBUG("Lock Type: TAPI_SIM_LOCK_PC (Corporate Personalization) [0x%x]", tSimLockType);
307 case TAPI_SIM_LOCK_SC2:
308 TEST_DEBUG("Lock Type: TAPI_SIM_LOCK_SC2 (PIN2 Lock) [0x%x]", tSimLockType);
310 case TAPI_SIM_LOCK_SCPUK2:
311 TEST_DEBUG("Lock Type: TAPI_SIM_LOCK_SCPUK2 (PIN2 Unblocking Key) [0x%x]", tSimLockType);
313 case TAPI_SIM_LOCK_ACL:
314 TEST_DEBUG("Lock Type: TAPI_SIM_LOCK_ACL (ACL Lock) [0x%x]", tSimLockType);
316 case TAPI_SIM_NO_SIM:
317 TEST_DEBUG("Lock Type: TAPI_SIM_NO_SIM [0x%x]", tSimLockType);
319 case TAPI_SIM_UNAVAIL:
320 TEST_DEBUG("Lock Type: TAPI_SIM_UNAVAIL [0x%x]", tSimLockType);
322 case TAPI_SIM_INIT_COMPLETE:
323 TEST_DEBUG("Lock Type: TAPI_SIM_INIT_COMPLETE [0x%x]", tSimLockType);
325 case TAPI_SIM_PB_INIT_COMPLETE:
326 TEST_DEBUG("Lock Type: TAPI_SIM_PB_INIT_COMPLETE [0x%x]", tSimLockType);
329 TEST_DEBUG("Lock Type: Undefined Lcok Type [0x%x]", tSimLockType);
333 void __PrintLockKey(TelSimLockKey_t tSimLockKey)
337 case TAPI_SIM_LOCK_KEY_NOT_NEED:
338 TEST_DEBUG(" Lock Key: TAPI_SIM_LOCK_KEY_NOT_NEED [0x%x]", tSimLockKey);
340 case TAPI_SIM_LOCK_KEY_PIN:
341 TEST_DEBUG(" Lock Key: TAPI_SIM_LOCK_KEY_PIN [0x%x]", tSimLockKey);
343 case TAPI_SIM_LOCK_KEY_PUK:
344 TEST_DEBUG(" Lock Key: TAPI_SIM_LOCK_KEY_PUK [0x%x]", tSimLockKey);
346 case TAPI_SIM_LOCK_KEY_PIN2:
347 TEST_DEBUG(" Lock Key: TAPI_SIM_LOCK_KEY_PIN2 [0x%x]", tSimLockKey);
349 case TAPI_SIM_LOCK_KEY_PUK2:
350 TEST_DEBUG(" Lock Key: TAPI_SIM_LOCK_KEY_PUK2 [0x%x]", tSimLockKey);
352 case TAPI_SIM_LOCK_PERM_BLOCKED:
353 TEST_DEBUG(" Lock Key: TAPI_SIM_LOCK_PERM_BLOCKED [0x%x]", tSimLockKey);
355 case TAPI_SIM_LOCK_DISABLE:
356 TEST_DEBUG(" Lock Key: TAPI_SIM_LOCK_DISABLE [0x%x]", tSimLockKey);
358 case TAPI_SIM_LOCK_KEY_SIMLOCK:
359 TEST_DEBUG(" Lock Key: TAPI_SIM_LOCK_KEY_SIMLOCK [0x%x]", tSimLockKey);
362 TEST_DEBUG(" Lock Key: Undefined Lock key [0x%x]", tSimLockKey);
367 void __PrintCardStatus(char* str, TelSimCardStatus_t tSimCardStatus) {
368 switch (tSimCardStatus) {
369 case TAPI_SIM_STATUS_CARD_ERROR:
370 TEST_DEBUG("[%s]TAPI_SIM_STATUS_CARD_ERROR [0x%x]", str, tSimCardStatus)
373 case TAPI_SIM_STATUS_CARD_NOT_PRESENT:
374 TEST_DEBUG("[%s]TAPI_SIM_STATUS_CARD_NOT_PRESENT [0x%x]", str, tSimCardStatus)
377 case TAPI_SIM_STATUS_SIM_INITIALIZING:
378 TEST_DEBUG("[%s]TAPI_SIM_STATUS_SIM_INITIALIZING [0x%x]", str, tSimCardStatus)
381 case TAPI_SIM_STATUS_SIM_INIT_COMPLETED:
382 TEST_DEBUG("[%s]TAPI_SIM_STATUS_SIM_INIT_COMPLETED [0x%x]", str, tSimCardStatus)
385 case TAPI_SIM_STATUS_SIM_PIN_REQUIRED:
386 TEST_DEBUG("[%s]TAPI_SIM_STATUS_SIM_PIN_REQUIRED [0x%x]", str, tSimCardStatus)
389 case TAPI_SIM_STATUS_SIM_PUK_REQUIRED:
390 TEST_DEBUG("[%s]TAPI_SIM_STATUS_SIM_PUK_REQUIRED [0x%x]", str, tSimCardStatus)
393 case TAPI_SIM_STATUS_CARD_BLOCKED:
394 TEST_DEBUG("[%s]TAPI_SIM_STATUS_CARD_BLOCKED [0x%x]", str, tSimCardStatus)
397 case TAPI_SIM_STATUS_SIM_NCK_REQUIRED:
398 TEST_DEBUG("[%s]TAPI_SIM_STATUS_SIM_NCK_REQUIRED [0x%x]", str, tSimCardStatus)
401 case TAPI_SIM_STATUS_SIM_NSCK_REQUIRED:
402 TEST_DEBUG("[%s]TAPI_SIM_STATUS_SIM_NSCK_REQUIRED [0x%x]", str, tSimCardStatus)
405 case TAPI_SIM_STATUS_SIM_SPCK_REQUIRED:
406 TEST_DEBUG("[%s]TAPI_SIM_STATUS_SIM_SPCK_REQUIRED [0x%x]", str, tSimCardStatus)
409 case TAPI_SIM_STATUS_SIM_CCK_REQUIRED:
410 TEST_DEBUG("[%s]TAPI_SIM_STATUS_SIM_CCK_REQUIRED [0x%x]", str, tSimCardStatus)
413 case TAPI_SIM_STATUS_CARD_REMOVED:
414 TEST_DEBUG("[%s]TAPI_SIM_STATUS_CARD_REMOVED [0x%x]", str, tSimCardStatus)
417 case TAPI_SIM_STATUS_SIM_LOCK_REQUIRED:
418 TEST_DEBUG("[%s]TAPI_SIM_STATUS_SIM_LOCK_REQUIRED [0x%x]", str, tSimCardStatus)
422 TEST_DEBUG("[%s]Undefined Card Status [0x%x]", str, tSimCardStatus)
427 void __PrintPinStatus(char* str, TelSimPinStatus_t tSimPinStatus) {
428 switch (tSimPinStatus) {
429 case TAPI_SIM_PIN_STATUS_DISABLED:
430 TEST_DEBUG("%sTAPI_SIM_PIN_STATUS_DISABLED [0x%x]", str, tSimPinStatus)
433 case TAPI_SIM_PIN_STATUS_ENABLED:
434 TEST_DEBUG("%sTAPI_SIM_PIN_STATUS_ENABLED [0x%x]", str, tSimPinStatus)
437 case TAPI_SIM_PIN_STATUS_BLOCKED:
438 TEST_DEBUG("%sTAPI_SIM_PIN_STATUS_BLOCKED [0x%x]", str, tSimPinStatus)
441 case TAPI_SIM_PIN_STATUS_PUK_BLOCKED:
442 TEST_DEBUG("%sTAPI_SIM_PIN_STATUS_PUK_BLOCKED [0x%x]", str, tSimPinStatus)
445 case TAPI_SIM_PIN_STATUS_UNKNOWN:
446 TEST_DEBUG("%sTAPI_SIM_PIN_STATUS_UNKNOWN [0x%x]", str, tSimPinStatus)
450 TEST_DEBUG("%sUndefined Pin Status [0x%x]", str, tSimPinStatus)
457 void __PrintCardType(char* str, TelSimCardType_t tSimCardType) {
458 switch (tSimCardType) {
459 case TAPI_SIM_CARD_TYPE_UNKNOWN:
460 TEST_DEBUG("%sTAPI_SIM_CARD_TYPE_UNKNOWN [0x%x]", str, tSimCardType)
463 case TAPI_SIM_CARD_TYPE_GSM:
464 TEST_DEBUG("%sTAPI_SIM_CARD_TYPE_GSM [0x%x]", str, tSimCardType)
467 case TAPI_SIM_CARD_TYPE_USIM:
468 TEST_DEBUG("%sTAPI_SIM_CARD_TYPE_USIM [0x%x]", str, tSimCardType)
472 TEST_DEBUG("%sUndefined Card Type [0x%x]", str, tSimCardType)
477 void __PrintECCSvcInfo(TelSimEccEmergencyServiceInfo_t tSimECCSvcInfo) {
478 switch (tSimECCSvcInfo) {
479 case TAPI_SIM_ECC_ESC_POLICE:
480 TEST_DEBUG("TAPI_SIM_ECC_ESC_POLICE [0x%x]", tSimECCSvcInfo)
483 case TAPI_SIM_ECC_ESC_AMBULANCE:
484 TEST_DEBUG("TAPI_SIM_ECC_ESC_AMBULANCE [0x%x]", tSimECCSvcInfo)
487 case TAPI_SIM_ECC_ESC_FIREBRIGADE:
488 TEST_DEBUG("TAPI_SIM_ECC_ESC_FIREBRIGADE [0x%x]", tSimECCSvcInfo)
491 case TAPI_SIM_ECC_ESC_MARAINEGUARD:
492 TEST_DEBUG("TAPI_SIM_ECC_ESC_MARAINEGUARD [0x%x]", tSimECCSvcInfo)
495 case TAPI_SIM_ECC_ESC_MOUTAINRESCUE:
496 TEST_DEBUG("TAPI_SIM_ECC_ESC_MOUTAINRESCUE [0x%x]", tSimECCSvcInfo)
499 case TAPI_SIM_ECC_ESC_SPARE:
500 TEST_DEBUG("TAPI_SIM_ECC_ESC_SPARE [0x%x]", tSimECCSvcInfo)
504 TEST_DEBUG("Undefined ECC Sercie Info [0x%x]", tSimECCSvcInfo)
509 void __PrintUSTData(unsigned long UstLen, unsigned short UstData[]) {
511 fprintf(stderr, "UST Data: ");
512 for (i = 0; i < UstLen; i++) {
513 fprintf(stderr, "0x%x ", UstData[i]);
515 fprintf(stderr, "\n");
519 void __PrintUSimSvcTable(TelUSimServiceTable_t tUSimSVCTable)
521 TEST_DEBUG("-------- UST Table -------- (1: On, 0:Off)");
522 TEST_DEBUG("Local Phonebook [%d] ", tUSimSVCTable.bLocalPhoneBook);
523 TEST_DEBUG("FDN [%d] ", tUSimSVCTable.bFdn);
524 TEST_DEBUG("EXT2 [%d] ", tUSimSVCTable.bExtension2);
525 TEST_DEBUG("SDN [%d] ", tUSimSVCTable.bSdn);
526 TEST_DEBUG("EXT3 [%d] ", tUSimSVCTable.bExtension3);
527 TEST_DEBUG("BDN [%d] ", tUSimSVCTable.bBdn);
528 TEST_DEBUG("EXT4 [%d] ", tUSimSVCTable.bExtension4);
529 TEST_DEBUG("OUT Going Call Info. [%d] ", tUSimSVCTable.bOCIOCT);
530 TEST_DEBUG("Call control [%d] ", tUSimSVCTable.bUsimCallControl);
531 TEST_DEBUG("Added more Table as you need");
532 TEST_DEBUG("---------------------------");
535 void __PrintSimSvcTable(TelSimServiceTable_t tSimSVCTable)
537 TEST_DEBUG("-------- UST Table --------");
538 TEST_DEBUG("FDN [%d] ", tSimSVCTable.bFdn);
539 TEST_DEBUG("EXT2 [%d] ", tSimSVCTable.bExtension2);
540 TEST_DEBUG("SDN [%d] ", tSimSVCTable.bSdn);
541 TEST_DEBUG("EXT3 [%d] ", tSimSVCTable.bExtension3);
542 TEST_DEBUG("BDN [%d] ", tSimSVCTable.bBdn);
543 TEST_DEBUG("EXT4 [%d] ", tSimSVCTable.bExtension4);
544 TEST_DEBUG("PIN1 Disable func. [%d] ", tSimSVCTable.bPIN1DisableFunction );
545 TEST_DEBUG("Adn [%d] ", tSimSVCTable.bAdn);
546 TEST_DEBUG("Added more Table as you need");
547 TEST_DEBUG("---------------------------");
551 void __PrintSSTData(unsigned long SstLen, unsigned short SstData[]) {
553 TEST_DEBUG("SST Data: ");
554 for (i = 0; i < SstLen; i++) {
555 fprintf(stderr, "0x%x ", SstData[i]);
559 void __PrintLangInfo(char *str, TelSimLanguagePreferenceCode_t tSimLP) {
561 case TAPI_SIM_LP_GERMAN:
562 TEST_DEBUG("%s TAPI_SIM_LP_GERMAN", str)
566 case TAPI_SIM_LP_ENGLISH:
567 TEST_DEBUG("%s TAPI_SIM_LP_ENGLISH", str)
571 case TAPI_SIM_LP_ITALIAN:
572 TEST_DEBUG("%s TAPI_SIM_LP_ITALIAN", str)
576 case TAPI_SIM_LP_FRENCH:
577 TEST_DEBUG("%s TAPI_SIM_LP_FRENCH", str)
581 case TAPI_SIM_LP_SPANISH:
582 TEST_DEBUG("%s TAPI_SIM_LP_SPANISH", str)
586 case TAPI_SIM_LP_DUTCH:
587 TEST_DEBUG("%s TAPI_SIM_LP_DUTCH", str)
591 case TAPI_SIM_LP_SWEDISH:
592 TEST_DEBUG("%s TAPI_SIM_LP_SWEDISH", str)
596 case TAPI_SIM_LP_DANISH:
597 TEST_DEBUG("%s TAPI_SIM_LP_DANISH", str)
601 case TAPI_SIM_LP_PORTUGUESE:
602 TEST_DEBUG("%s TAPI_SIM_LP_PORTUGUESE", str)
606 case TAPI_SIM_LP_FINNISH:
607 TEST_DEBUG("%s TAPI_SIM_LP_FINNISH", str)
611 case TAPI_SIM_LP_NORWEGIAN:
612 TEST_DEBUG("%s TAPI_SIM_LP_NORWEGIAN", str)
616 case TAPI_SIM_LP_GREEK:
617 TEST_DEBUG("%s TAPI_SIM_LP_GREEK", str)
621 case TAPI_SIM_LP_TURKISH:
622 TEST_DEBUG("%s TAPI_SIM_LP_TURKISH", str)
626 case TAPI_SIM_LP_HUNGARIAN:
627 TEST_DEBUG("%s TAPI_SIM_LP_HUNGARIAN", str)
631 case TAPI_SIM_LP_POLISH:
632 TEST_DEBUG("%s TAPI_SIM_LP_POLISH", str)
636 case TAPI_SIM_LP_KOREAN:
637 TEST_DEBUG("%s TAPI_SIM_LP_KOREAN", str)
641 case TAPI_SIM_LP_CHINESE:
642 TEST_DEBUG("%s TAPI_SIM_LP_CHINESE", str)
646 case TAPI_SIM_LP_RUSSIAN:
647 TEST_DEBUG("%s TAPI_SIM_LP_RUSSIAN", str)
651 case TAPI_SIM_LP_JAPANESE:
652 TEST_DEBUG("%s TAPI_SIM_LP_JAPANESE", str)
656 case TAPI_SIM_LP_LANG_UNSPECIFIED:
658 TEST_DEBUG("%s Undefined Language Preference Code", str)
664 void __PrintPBResult(char *str, TelSimPbAccessResult_t tPBResult) {
666 case TAPI_SIM_PB_SUCCESS:
667 TEST_DEBUG("%s TAPI_SIM_PB_SUCCESS", str)
671 case TAPI_SIM_PB_FAIL:
672 TEST_DEBUG("%s TAPI_SIM_PB_FAIL", str)
676 case TAPI_SIM_PB_INVALID_INDEX:
677 TEST_DEBUG("%s TAPI_SIM_PB_INVALID_INDEX", str)
681 case TAPI_SIM_PB_INVALID_NUMBER_LENGTH:
682 TEST_DEBUG("%s TAPI_SIM_PB_INVALID_NUMBER_LENGTH", str)
686 case TAPI_SIM_PB_INVALID_NAME_LENGTH:
687 TEST_DEBUG("%s TAPI_SIM_PB_INVALID_NAME_LENGTH", str)
691 case TAPI_SIM_PB_ACCESS_CONDITION_NOT_SATISFIED:
692 TEST_DEBUG("%s TAPI_SIM_PB_ACCESS_CONDITION_NOT_SATISFIED", str)
697 TEST_DEBUG("%s Undefined PB Access Result", str)
703 void __PrintPBStorageList(char *str, TS_UINT16 StorageList) {
704 if (StorageList & (0x01 << TAPI_SIM_PB_FDN)) {
705 TEST_DEBUG("%s PB_FDN is in the StorageList", str);
708 if (StorageList & (0x01 << TAPI_SIM_PB_LDN)) {
709 TEST_DEBUG("%s PB_LDN is in the StorageList", str);
712 if (StorageList & (0x01 << TAPI_SIM_PB_MSISDN)) {
713 TEST_DEBUG("%s PB_MSISDN is in the StorageList", str);
716 if (StorageList & (0x01 << TAPI_SIM_PB_ADN)) {
717 TEST_DEBUG("%s PB_ADN is in the StorageList", str);
720 if (StorageList & (0x01 << TAPI_SIM_PB_SDN)) {
721 TEST_DEBUG("%s PB_SDN is in the StorageList", str);
724 if (StorageList & (0x01 << TAPI_SIM_PB_EN)) {
725 TEST_DEBUG("%s PB_EN is in the StorageList", str);
728 if (StorageList & (0x01 << TAPI_SIM_PB_3GSIM)) {
729 TEST_DEBUG("%s PB_3GSIM is in the StorageList", str);
732 if (StorageList & (0x01 << TAPI_SIM_PB_AAS)) {
733 TEST_DEBUG("%s PB_AAS is in the StorageList", str);
736 if (StorageList & (0x01 << TAPI_SIM_PB_GAS)) {
737 TEST_DEBUG("%s PB_GAS is in the StorageList", str);
742 TelSimReadFileRequestData_t __SelectBinary()
745 TelSimReadFileRequestData_t ReadFileReqData = { {0,}};
747 ReadFileReqData.Offset = 0; /**< offset if read binary */
749 ReadFileReqData.FileType = TAPI_SIM_FTYPE_TRANSPARENT;
751 ReadFileReqData.RecordIndex =0; /**< record index if read record */
752 ReadFileReqData.RecordIndexFrom=0;
753 ReadFileReqData.RecordIndexTo=0;
754 ReadFileReqData.RecordMode=TAPI_SIM_RECORD_NONE; /**< record index if read record */
756 TEST_DEBUG("---- EF File List ----");
757 TEST_DEBUG("1: ICCID");
758 TEST_DEBUG("2: SPN");
759 TEST_DEBUG("----------------------");
760 TEST_DEBUG("Select EF File: ");
762 scanf("%d", &iSelect);
765 ReadFileReqData.FileID.FileName = TAPI_SIM_EFILE_ICCID;
766 ReadFileReqData.DataLength = 0x0A; /* hard code 10 bytes */;
768 else if(iSelect == 2)
770 ReadFileReqData.FileID.FileName = TAPI_SIM_EFILE_SPN;
771 ReadFileReqData.DataLength = 17;
773 else if(iSelect == 2)
775 ReadFileReqData.FileID.FileName = TAPI_SIM_EFILE_LP;
779 TEST_DEBUG("Invalid Selection!");
782 return ReadFileReqData;
788 * This function is used for encoding a ASCII text into UNICODE text
790 * @return This function returns a TRUE on Success and FALSE on failure
791 * @param[in] text_len -input text lenght
792 * @param[in] text_data - input text data
793 * @param[in] unicode_text_len - unicode converted tex lenght
794 * @param[in] unicode_text - unicode text
795 * @Interface Asynchronous.
799 TS_BOOL __encode_text_unicode(char text_len, char *text_data,
800 char *unicode_text_len, char *unicode_text) {
805 TEST_DEBUG("Unicode encoding failed - input text string length is 0!");
808 /*UNicode conversion*/
809 /* a = Ascii is 61 and in Unicode it is 0061 but modem expects 6100 */
810 for (j = 0, i = 0; i < text_len * 2; i++) {
811 unicode_text[i++] = text_data[j++];
812 unicode_text[i] = 0x00;
814 *unicode_text_len = text_len * 2;
820 * This function is used for encoding a ASCII text into GSM7 bit text
822 * @return This function returns a TRUE on Success and FALSE on failure
823 * @param[in] text_len - input text lenght
824 * @param[in] text_data - input text data
825 * @param[in] out_len_max - gsm7bit converted text lenght
826 * @param[in] gsm7bit_text - gsm7bit converted tex data
827 * @return This function returns a TRUE on Success and FALSE on failure
829 TS_BOOL __encode_gsm_7_bit_chars(char text_len, const char* text_data,
830 char *out_len_max, char* gsm7bit_text) {
835 for (pos = 0, i = 0; i < text_len; pos++, i++) {
836 /* pack the low bits - for single char */
837 gsm7bit_text[pos] = text_data[i] >> shift;
839 if (i + 1 < text_len) {
840 /* pack the high bits using the low bits of the next character */
841 gsm7bit_text[pos] |= text_data[i + 1] << (7 - shift);
851 *out_len_max = (text_len * 7) / 8;
859 * This function converts unicode to ascii text
861 * @return This function returns a 1 on Success and -1 on failure
862 * @param[in] phone_pb_type
863 * @Interface Asynchronous.
867 TS_BOOL __decode_unicode_to_asci_str(char text_len, char *text_data,
868 char *ascii_text_len, char *ascii_text) {
871 if (text_len == 0 || text_data == NULL || ascii_text == NULL) {
872 TEST_DEBUG("Unicode Decode Failed as text length is 0");
876 if (0 != (text_len % 2)) {
877 TEST_DEBUG(" ##### Unicode decoding failed due to invalid text length [%d]", text_len );
881 for (i = 0; i < text_len; i++) {
882 ascii_text[i] = text_data[j];
885 *ascii_text_len = (text_len / 2);
886 ascii_text[i] = '\0';
890 int sim_test_subscribe_tapi_events() {
893 TapiResult_t api_err = TAPI_API_SUCCESS;
895 int SIMEvtList[] = { TAPI_EVENT_SIM_PB_STORAGE_COUNT_CNF,
896 TAPI_EVENT_SIM_PB_ENTRY_INFO_CNF,
897 TAPI_EVENT_SIM_PB_ACCESS_READ_CNF,
899 TAPI_EVENT_SIM_PB_UPDATE_CNF, TAPI_EVENT_SIM_PB_DELETE_CNF,
900 TAPI_EVENT_SIM_STATUS_IND, TAPI_EVENT_SIM_FDN_STATUS_IND,
902 TAPI_EVENT_SIM_PB_CAPABILITY_INFO_CNF,
903 TAPI_EVENT_SIM_ISIM_AUTHENTICATION_CNF,
904 TAPI_EVENT_SIM_SAP_CONNECT_NOTI, TAPI_EVENT_SIM_SAP_CONNECT_CNF,
905 TAPI_EVENT_SIM_SAP_CONNECT_STATUS_CNF,
906 TAPI_EVENT_SIM_SAP_TRANSFER_ATR_CNF,
907 TAPI_EVENT_SIM_SAP_TRANSFER_APDU_CNF,
908 TAPI_EVENT_SIM_SAP_SET_PROTOCOL_CNF,
909 TAPI_EVENT_SIM_SAP_SET_SIM_POWER_CNF,
910 TAPI_EVENT_SIM_SAP_CARD_READER_STATUS_CNF, TAPI_EVENT_SIM_APDU_CNF,
911 TAPI_EVENT_SIM_ATR_CNF,
913 TAPI_EVENT_SIM_GET_INDICATION_CNF,
914 TAPI_EVENT_SIM_SET_INDICATION_CNF, TAPI_EVENT_SIM_GET_MAILBOX_CNF,
915 TAPI_EVENT_SIM_SET_MAILBOX_CNF, TAPI_EVENT_SIM_SET_LANGUAGE_CNF,
916 TAPI_EVENT_SIM_RSIM_ACCESS_CNF, TAPI_EVENT_SIM_VERIFY_SEC_CNF,
917 TAPI_EVENT_SIM_VERIFY_PUK_CNF, TAPI_EVENT_SIM_CHANGE_PINS_CNF,
918 TAPI_EVENT_SIM_DISABLE_SEC_CNF, TAPI_EVENT_SIM_ENABLE_SEC_CNF,
919 TAPI_EVENT_SIM_DISABLE_FDNMODE_CNF,
920 TAPI_EVENT_SIM_ENABLE_FDNMODE_CNF, TAPI_EVENT_SIM_PERS_STATUS_CNF,
921 TAPI_EVENT_SIM_DISABLE_PERS_CNF, TAPI_EVENT_SIM_ENABLE_PERS_CNF };
923 iNumOfSIMEvt = sizeof(SIMEvtList) / sizeof(int);
924 TEST_DEBUG("Number of SIM Event List to be registered: %d", iNumOfSIMEvt);
925 //TAPI_CALLOC(SIM_subscription_id, iNumOfSIMEvt, unsigned int)
926 //#define TAPI_CALLOC(ptr, no_elements, type) s
927 SIM_subscription_id = (unsigned int *) calloc(iNumOfSIMEvt,
928 sizeof(unsigned int));
929 if (SIM_subscription_id == NULL) {
930 TEST_DEBUG("calloc error -NULL, errno is [%d]", errno);
933 for (i = 0; i < iNumOfSIMEvt; i++) {
934 api_err = tel_register_event(SIMEvtList[i], &SIM_subscription_id[i],
935 (TelAppCallback) &sim_async_event_callback, NULL);
937 if (api_err != TAPI_API_SUCCESS) {
938 TEST_DEBUG("isn't subscribed. sub id is [%d], api_err is [%d]\n", SIM_subscription_id[i],api_err);
948 int sim_test_unsubscribe_tapi_events(void) {
950 TapiResult_t api_err = TAPI_API_SUCCESS;
953 for (i = 0; i < iNumOfSIMEvt; i++) {
954 api_err = tel_deregister_event(SIM_subscription_id[i]);
955 if (api_err != TAPI_API_SUCCESS) {
956 TEST_DEBUG("TelTapiDeRegister isn't unsubscribed. sub id is [%d] api_err is [%d]\n",SIM_subscription_id[i],api_err);
966 void sim_async_event_callback(TelTapiEvent_t* sim_event)
969 //static unsigned int fileSize = 0;
971 TEST_DEBUG("Func Entrance");
972 TEST_DEBUG("Request ID : [0x%x]\n", sim_event->RequestId);
974 if (sim_event->pData == NULL) {
975 TEST_DEBUG("No Event Data!!");
979 TEST_DEBUG("*************** Callback data **********************");
980 TEST_DEBUG("EventClass [%d],EventType [0x%x], Reques Id[%d], Event status [%d], sim_event->pDataLen[%d]",
981 sim_event->EventClass, sim_event->EventType, sim_event->RequestId, sim_event->Status,sim_event->pDataLen);
983 if(sim_event->Status != TAPI_SIM_PB_SUCCESS)
985 __PrintPBResult("SIM Result", sim_event->Status);
986 TEST_DEBUG("TAPI Fail: EventStatus [%d]", sim_event->Status);
991 if (sim_event->EventClass == TAPI_EVENT_CLASS_SIM) {
992 switch (sim_event->EventType) {
993 case TAPI_EVENT_SIM_STATUS_IND: {
994 TEST_DEBUG("***********TAPI_EVENT_SIM_STATUS_IND**************");
996 // TEST_DEBUG("Event status [%d]", sim_event->Status);
998 if (sim_event->Status == TAPI_SIM_STATUS_CARD_ERROR) {
999 TEST_DEBUG("SIM CARD ERROR");
1000 } else if (sim_event->Status == TAPI_SIM_STATUS_CARD_NOT_PRESENT) {
1001 TEST_DEBUG("SIM CARD NOT INSERTED");
1002 } else if (sim_event->Status == TAPI_SIM_STATUS_SIM_INITIALIZING) {
1003 TelSimCardType_t CardType =
1004 *((TelSimCardType_t*) (sim_event->pData));
1006 TEST_DEBUG("SIM INITITIALIZING");
1007 __PrintCardType("CardType: ", CardType);
1008 } else if (sim_event->Status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED) {
1009 TEST_DEBUG("SIM INIT COMPLETED");
1010 } else if (sim_event->Status == TAPI_SIM_STATUS_SIM_PIN_REQUIRED) {
1011 TEST_DEBUG("SIM PIN REQUIRED");
1012 } else if (sim_event->Status == TAPI_SIM_STATUS_SIM_PUK_REQUIRED) {
1013 TEST_DEBUG("SIM PUK REQUIRED");
1014 } else if (sim_event->Status == TAPI_SIM_STATUS_CARD_BLOCKED) {
1015 TEST_DEBUG("SIM CARD BLOCKED");
1017 TEST_DEBUG("********************************************");
1022 case TAPI_EVENT_SIM_PB_CAPABILITY_INFO_CNF: {
1023 TEST_DEBUG("*****************TAPI_EVENT_SIM_PB_CAPABILITY_INFO_CNF***************************");
1025 //TEST_DEBUG("SIM PB Capability Info event status = [0x%x]", sim_event->Status);
1027 TelSimPbCapabilityInfo_t *sim_capability_info =
1028 (TelSimPbCapabilityInfo_t*) sim_event->pData;
1031 for (i = 0; i < sim_capability_info->FileTypeCount; i++) {
1033 sim_capability_info->FileTypeInfo[i].FileType3G);
1034 // TEST_DEBUG(" Filed tag type [%d]", sim_capability_info->FileTypeInfo[i].FileType3G);
1035 TEST_DEBUG(" max index [%d]", sim_capability_info->FileTypeInfo[i].PbIndexMax);
1036 TEST_DEBUG(" max entry [%d]", sim_capability_info->FileTypeInfo[i].PbTextMax);
1037 TEST_DEBUG(" used count [%d]", sim_capability_info->FileTypeInfo[i].TotalRecordCount);
1040 TEST_DEBUG("****************************************************");
1045 case TAPI_EVENT_SIM_PB_STORAGE_COUNT_CNF: {
1046 TEST_DEBUG("*****TAPI_EVENT_SIM_PB_STORAGE_COUNT_CNF*****");
1048 TelSimPbStorageInfo_t *storageInfo =
1049 (TelSimPbStorageInfo_t*) sim_event->pData;
1051 //TEST_DEBUG("SIM PB storage count event status = [0x%x]", sim_event->Status);
1054 __PrintStorageType(storageInfo->StorageFileType);
1055 //TEST_DEBUG("PB_STORAGE_TYPE 0x%x", storageInfo->StorageFileType);
1056 TEST_DEBUG("TOTAL_COUNT = %d", storageInfo->TotalRecordCount);
1057 TEST_DEBUG("USED_COUNT = %d", storageInfo->UsedRecordCount);
1059 TEST_DEBUG("********************************************");
1063 case TAPI_EVENT_SIM_PB_ENTRY_INFO_CNF: {
1064 TEST_DEBUG("**********TAPI_EVENT_SIM_PB_ENTRY_INFO_CNF********");
1066 TelSimPbEntryInfo_t *entryInfo =
1067 (TelSimPbEntryInfo_t*) sim_event->pData;
1069 //TEST_DEBUG("SIM PB entry info event status = [0x%x]", sim_event->Status);
1071 //TEST_DEBUG("STORAGE TYPE [%d]", entryInfo->StorageFileType);
1072 __PrintStorageType(entryInfo->StorageFileType);
1073 TEST_DEBUG("PB_INDEX_MIN %d", entryInfo->PbIndexMin);
1074 TEST_DEBUG("PB_INDEX_MAX = %d", entryInfo->PbIndexMax);
1075 TEST_DEBUG("PB_NUM_LEN_MAX = %d", entryInfo->PbNumLenMax);
1076 TEST_DEBUG("PB_TEXT_LEN_MAX = %d", entryInfo->PbTextLenMax);
1078 TEST_DEBUG("********************************************");
1082 case TAPI_EVENT_SIM_PB_ACCESS_READ_CNF: {
1083 TEST_DEBUG("*********TAPI_EVENT_SIM_PB_ACCESS_READ_CNF*********");
1085 //TEST_DEBUG("SIM PB access read event status = [0x%x]", sim_event->Status);
1087 TelSimPbRecordData_t *sim_acces_info =
1088 (TelSimPbRecordData_t*) sim_event->pData;
1090 __PrintStorageType(sim_acces_info->StorageFileType);
1091 //TEST_DEBUG("storaget type is [0x%x]",sim_acces_info->StorageFileType);
1093 if (sim_event->Status != TAPI_SIM_PB_SUCCESS) {
1094 TEST_DEBUG(" SIM phone book access error [%d]", sim_event->Status);
1098 int ascii_text_len = 0;
1099 char ascii_text[256] = { 0, };
1101 if (sim_acces_info->StorageFileType == TAPI_SIM_PB_EN
1102 || sim_acces_info->StorageFileType == TAPI_SIM_PB_FDN
1103 || sim_acces_info->StorageFileType == TAPI_SIM_PB_LDN
1104 || sim_acces_info->StorageFileType == TAPI_SIM_PB_MSISDN
1105 || sim_acces_info->StorageFileType == TAPI_SIM_PB_ADN
1106 || sim_acces_info->StorageFileType == TAPI_SIM_PB_SDN) {
1107 TEST_DEBUG(" 2G Type SIM phone book access");
1108 TEST_DEBUG(" sim_acces_info->StorageFileType[%d](0-fdn,1-ldn,2-msisdn,3-adn,4-sdn,5-en), number[%s]",sim_acces_info->StorageFileType, (char *)sim_acces_info->ContactInfo.Pb2GData.Number);
1110 /* unicode decoding */
1111 if (sim_acces_info->ContactInfo.Pb2GData.NameEncryptType
1112 == TAPI_SIM_TEXT_ENC_UCS2) {
1113 TEST_DEBUG("Decoding UCS2 to ASCII");
1115 == __decode_unicode_to_asci_str(
1116 sim_acces_info->ContactInfo.Pb2GData.NameLen,
1117 (char *) &sim_acces_info->ContactInfo.Pb2GData.Name,
1118 (char *) &ascii_text_len, ascii_text)) {
1119 TEST_DEBUG(" Deocing to ascii failed ");
1122 } else if (sim_acces_info->ContactInfo.Pb2GData.NameEncryptType
1123 == TAPI_SIM_TEXT_ENC_ASCII
1124 || sim_acces_info->ContactInfo.Pb2GData.NameEncryptType
1125 == TAPI_SIM_TEXT_ENC_GSM7BIT) {
1126 //TAPI_MEMCPY(ascii_text, sim_acces_info->ContactInfo.Pb2GData.Name, 256, TAPI_SIM_NUM_TEXT_LEN_MAX);
1127 //#define TAPI_MEMCPY(dest , src , dest_len , src_len)
1128 if (256 >= TAPI_SIM_NUM_TEXT_LEN_MAX) {
1130 sim_acces_info->ContactInfo.Pb2GData.Name,
1131 TAPI_SIM_NUM_TEXT_LEN_MAX);
1133 TEST_DEBUG("memcpy FAILURE - dest_len(%d) < src_len(%d)", 256, TAPI_SIM_NUM_TEXT_LEN_MAX);
1136 TEST_DEBUG("Name Encryption is not UCS2 / ASCII / unpacked GSM7bit");
1139 TEST_DEBUG("text[%s]", ascii_text);
1140 } else if (sim_acces_info->StorageFileType == TAPI_SIM_PB_3GSIM) {
1143 int num_of_pb_rec = 0;
1145 TEST_DEBUG(" sim_event->pDataLen [%d]",sim_event->pDataLen);
1146 TEST_DEBUG(" sizeof(TelSimPbRecordData_t)[%d]",sizeof(TelSimPbRecordData_t));
1147 TEST_DEBUG(" strlen(sim_event->pData)[%d]", strlen(sim_event->pData));
1149 num_of_pb_rec = (sim_event->pDataLen
1150 / sizeof(TelSimPbRecordData_t));
1152 TEST_DEBUG("Number of Saved Records [%d]",num_of_pb_rec);
1154 char * temp = (char*) malloc(sim_event->pDataLen);
1155 memcpy(temp, (char*) sim_event->pData, sim_event->pDataLen);
1157 TelSimPbRecordData_t *sim_3g_access_info;
1159 for (k = 0; k < num_of_pb_rec; k++) {
1160 tmp_size = k * sizeof(TelSimPbRecordData_t);
1161 sim_3g_access_info = (TelSimPbRecordData_t*) (temp
1164 TEST_DEBUG("****************************************************");
1165 TEST_DEBUG(" Record Num = [%d], index = [%d], next index = [%d] ",k , sim_3g_access_info->Index,sim_3g_access_info->NextIndex);
1167 TEST_DEBUG(" Num of Fields = [%d]",sim_3g_access_info->ContactInfo.Pb3GData.FileTypeCount);
1169 < sim_3g_access_info->ContactInfo.Pb3GData.FileTypeCount; i++) {
1170 TEST_DEBUG("-------------------------------------");
1171 TEST_DEBUG("Field_type = [%d], FiledLen = [%d]",
1172 sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileType,
1173 sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataLength);
1175 if (sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileType
1176 == TAPI_PB_3G_GRP) {
1178 TEST_DEBUG("Number of groups [%d]",sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataLength );
1180 for (grp_index = 0; grp_index
1181 < (sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataLength); grp_index++) {
1182 TEST_DEBUG(" Groupd Index [%d]",sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileData[grp_index]); //ignore data_type byte
1186 } else if (sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileType
1188 || sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileType
1190 || sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileType
1191 == TAPI_PB_3G_SNE) {
1192 TEST_DEBUG("3G Name or Email or SNE");
1193 if (sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataType.EncryptionType
1194 == TAPI_SIM_TEXT_ENC_UCS2) {
1195 TEST_DEBUG("EncryptionType: UCS2");
1197 == __decode_unicode_to_asci_str(
1198 sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataLength,
1199 (char *) &sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileData,
1200 (char *) &ascii_text_len,
1202 TEST_DEBUG("Deocing ucs2 to ascii failed ");
1205 } else if (sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataType.EncryptionType
1206 == TAPI_SIM_TEXT_ENC_ASCII) {
1207 TEST_DEBUG("EncryptionType: ASCII");
1208 //TAPI_MEMCPY(ascii_text, sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileData, 256, TAPI_SIM_NUM_TEXT_LEN_MAX);
1209 //#define TAPI_MEMCPY(dest , src , dest_len , src_len)
1210 if (256 >= TAPI_SIM_NUM_TEXT_LEN_MAX) {
1213 sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileData,
1214 TAPI_SIM_NUM_TEXT_LEN_MAX);
1216 TEST_DEBUG("memcpy FAILURE - dest_len(%d) < src_len(%d)", 256, TAPI_SIM_NUM_TEXT_LEN_MAX);
1219 } else if (sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataType.EncryptionType
1220 == TAPI_SIM_TEXT_ENC_GSM7BIT) {
1221 TEST_DEBUG("EncryptionType: GSM7 bit");
1222 //TAPI_MEMCPY(ascii_text, sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileData, 256, TAPI_SIM_NUM_TEXT_LEN_MAX);
1223 //#define TAPI_MEMCPY(dest , src , dest_len , src_len)
1224 if (256 >= TAPI_SIM_NUM_TEXT_LEN_MAX) {
1227 sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileData,
1228 TAPI_SIM_NUM_TEXT_LEN_MAX);
1230 TEST_DEBUG("memcpy FAILURE - dest_len(%d) < src_len(%d)", 256, TAPI_SIM_NUM_TEXT_LEN_MAX);
1234 TEST_DEBUG("Name Encryption is not UCS2 / ASCII / unpacked GSM7bit");
1238 TEST_DEBUG("Field_data[%s]", ascii_text);
1241 TEST_DEBUG("Number Type[%d]", sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataType.NumType);
1242 TEST_DEBUG("AAS RecID [0x%x]", sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].AasRecordIdentifier);
1244 if (sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileType
1245 == TAPI_PB_3G_ANR) {
1246 TEST_DEBUG("3G ANR Type");
1248 TEST_DEBUG("3G Number Type");
1250 TEST_DEBUG("Number_data[%s]",sim_3g_access_info->ContactInfo.Pb3GData.PbFileDataInfo[i].FileData);
1255 } else if (sim_acces_info->StorageFileType == TAPI_SIM_PB_AAS
1256 || sim_acces_info->StorageFileType == TAPI_SIM_PB_GAS) {
1257 TEST_DEBUG(" AAS and GAS");
1258 TEST_DEBUG(" index = [%d]",sim_acces_info->Index);
1259 __PrintStorageType(sim_acces_info->StorageFileType);
1260 TEST_DEBUG(" str len = [%d]",sim_acces_info->ContactInfo.PbAdditionalNumStringData.TextLength);
1261 TEST_DEBUG(" encrypt type = [%d]",sim_acces_info->ContactInfo.PbAdditionalNumStringData.EncryptionType);
1262 TEST_DEBUG(" string = [%s]",sim_acces_info->ContactInfo.PbAdditionalNumStringData.TextData);
1264 TEST_DEBUG("********************************************");
1268 case TAPI_EVENT_SIM_PB_UPDATE_CNF: {
1269 TEST_DEBUG("*****************TAPI_EVENT_SIM_PB_UPDATE_CNF***************************");
1271 TelSimPbUpdateResp_t *pUpdateResp =
1272 (TelSimPbUpdateResp_t*) sim_event->pData;
1274 __PrintStorageType(pUpdateResp->PbStorageInfo.StorageFileType);
1275 TEST_DEBUG("Storage Info Total Record cnt [%d]", pUpdateResp->PbStorageInfo.TotalRecordCount);
1276 TEST_DEBUG("Storage File Used Record Cnt [%d]", pUpdateResp->PbStorageInfo.UsedRecordCount);
1277 //TEST_DEBUG(" Storage File Type [%d] ", pUpdateResp->PbStorageInfo.StorageFileType);
1278 TEST_DEBUG("Storage File Index [%d]", pUpdateResp->PbIndex);
1279 TEST_DEBUG("********************************************");
1283 case TAPI_EVENT_SIM_PB_DELETE_CNF: {
1284 TEST_DEBUG("*****************TAPI_EVENT_SIM_PB_DELETE_CNF***************************");
1286 TEST_DEBUG("SIM Delete PB event status = [0x%x]", sim_event->Status);
1288 TelSimPbUpdateResp_t *pDeleteResp =
1289 (TelSimPbUpdateResp_t*) sim_event->pData;
1290 TEST_DEBUG(" Storage File Type [%d] ", pDeleteResp->PbStorageInfo.StorageFileType);
1291 TEST_DEBUG(" Storage File Index [%d]", pDeleteResp->PbIndex);
1293 TEST_DEBUG("********************************************");
1297 case TAPI_EVENT_SIM_FDN_STATUS_IND: {
1298 TEST_DEBUG("*****************TAPI_EVENT_SIM_FDN_STATUS_IND***************************");
1300 TEST_DEBUG("SIM FDN status event status = [0x%x]", sim_event->Status);
1302 TEST_DEBUG("********************************************");
1307 /** will be tested later **/
1309 case TAPI_EVENT_SIM_ISIM_AUTHENTICATION_CNF: {
1310 TEST_DEBUG("*****************IMS Authentication **********************");
1311 TelSimIsimAuthenticationResponse_t *auth_resp =
1312 (TelSimIsimAuthenticationResponse_t*) sim_event->pData;
1314 TEST_DEBUG("SIM ISIM authentication event status = [0x%x]", sim_event->Status);
1316 TEST_DEBUG(" auth resp data [%s]",auth_resp->ResponeData);
1317 TEST_DEBUG(" auth string [%s]",auth_resp->AuthenticationString);
1318 TEST_DEBUG(" auth cipher key [%s]",auth_resp->CipherKey);
1319 TEST_DEBUG(" auth integrity key [%s]",auth_resp->IntegrityKey);
1323 case TAPI_EVENT_SIM_SAP_CONNECT_CNF: {
1324 TEST_DEBUG("*********** SAP CONNECT RESP *************");
1326 TelSimSapConnect_t *sap_conn_resp =
1327 (TelSimSapConnect_t*) sim_event->pData;
1329 TEST_DEBUG("SIM SAP connect request event status = [0x%x]", sim_event->Status);
1331 TEST_DEBUG(" message id [0x%x]", sap_conn_resp->MsgId);
1332 TEST_DEBUG("connection status [0x%x] ", sap_conn_resp->ConnectionStatus);
1333 TEST_DEBUG("max message size [%d]", sap_conn_resp->MaxMsgSize);
1335 TEST_DEBUG("*****************************************");
1339 case TAPI_EVENT_SIM_SAP_CONNECT_STATUS_CNF: {
1340 TEST_DEBUG("*********** SAP CONNECT STATUS *************");
1342 TEST_DEBUG("SIM SAP connect event status = [0x%x]", sim_event->Status);
1344 TelSimSapStatusInfo_t *sap_conn_status =
1345 (TelSimSapStatusInfo_t*) sim_event->pData;
1346 TEST_DEBUG(" connection status info [0x%x]", *sap_conn_status);
1348 TEST_DEBUG("*****************************************");
1352 case TAPI_EVENT_SIM_SAP_TRANSFER_ATR_CNF: {
1353 TEST_DEBUG("*********** SAP TRANSFER ATR *************");
1356 TelSimSapAtrInfo_t *sap_transfer_atr =
1357 (TelSimSapAtrInfo_t*) sim_event->pData;
1359 TEST_DEBUG("SIM SAP trasfer ATR event status = [0x%x]", sim_event->Status);
1361 TEST_DEBUG(" ATR result [0x%x]", sap_transfer_atr->AtrResult);
1362 TEST_DEBUG(" ATR length [%lu]", sap_transfer_atr->AtrLength);
1363 TEST_DEBUG(" ATR data ---> " );
1364 for (i = 0; i < sap_transfer_atr->AtrLength; i++)
1365 TEST_DEBUG(" [0x%x]", sap_transfer_atr->AtrData[i]);
1367 TEST_DEBUG("*****************************************");
1371 case TAPI_EVENT_SIM_SAP_TRANSFER_APDU_CNF: {
1372 TEST_DEBUG("*********** SAP TRANSFER APDU *************");
1375 TelSimSapApduData_t *sap_transfer_apdu =
1376 (TelSimSapApduData_t*) sim_event->pData;
1378 TEST_DEBUG("SIM SAP trasfer APDU event status = [0x%x]", sim_event->Status);
1380 TEST_DEBUG(" APDU length [0x%x]", sap_transfer_apdu->ApduLength);
1381 TEST_DEBUG(" APDU data ---> " );
1382 for (i = 0; i < sap_transfer_apdu->ApduLength; i++)
1383 TEST_DEBUG(" [0x%x]", sap_transfer_apdu->Apdu[i]);
1385 TEST_DEBUG("*****************************************");
1389 case TAPI_EVENT_SIM_SAP_SET_PROTOCOL_CNF: {
1390 TEST_DEBUG("*********** SAP SET PROTOCOL *************");
1392 TelSimSapProtocol_t *sap_result_code =
1393 (TelSimSapProtocol_t*) sim_event->pData;
1395 TEST_DEBUG("SIM SAP set protocol event status = [0x%x]", sim_event->Status);
1396 TEST_DEBUG("SAP SET protocol result [0x%x]", *sap_result_code );
1398 TEST_DEBUG("*****************************************");
1402 case TAPI_EVENT_SIM_SAP_SET_SIM_POWER_CNF: {
1403 TEST_DEBUG("*********** SAP SET SIM POWER ON/OFF *************");
1405 TelSimSapPower_t *sap_sim_power =
1406 (TelSimSapPower_t*) sim_event->pData;
1408 TEST_DEBUG("SIM SAP set SIM power event status = [0x%x]", sim_event->Status);
1410 TEST_DEBUG("message id [0x%x]", sap_sim_power->MsgId);
1411 TEST_DEBUG(" sim power on/off result [0x%x]", sap_sim_power->SimPowerResult);
1413 TEST_DEBUG("*****************************************");
1417 case TAPI_EVENT_SIM_SAP_CARD_READER_STATUS_CNF: {
1418 TEST_DEBUG("*********** SAP CARD READER STATUS *************");
1420 TelSimCardReaderStatus_t *sap_card_reader_status =
1421 (TelSimCardReaderStatus_t*) sim_event->pData;
1423 TEST_DEBUG("SIM SAP card reader event status = [0x%x]", sim_event->Status);
1425 TEST_DEBUG(" card reader result [0x%x] ", sap_card_reader_status->CardReaderResult);
1426 TEST_DEBUG(" card reader status bitwise encoded data [%d]", sap_card_reader_status->CardReaderStatus);
1428 TEST_DEBUG("*****************************************");
1433 /******************************************************************************************************************************/
1435 /******************************************************************************************************************************/
1436 case TAPI_EVENT_SIM_RSIM_ACCESS_CNF: {
1437 TEST_DEBUG("********NEW*TAPI_EVENT_SIM_RSIM_ACCESS_CNF**********");
1439 TelSimReadFileRaw_t * rsim_resp =
1440 (TelSimReadFileRaw_t*) sim_event->pData;
1442 if (sim_event->Status == TAPI_SIM_ACCESS_SUCCESS) {
1443 TEST_DEBUG("rsim_resp->sw1[0x%x]", rsim_resp->sw1);
1444 TEST_DEBUG("rsim_resp->sw2[0x%x]", rsim_resp->sw2);
1445 TEST_DEBUG("rsim_resp->DataLen[%d]", rsim_resp->DataLen);
1446 TEST_DEBUG("rsim_resp->Data[%s]", rsim_resp->Data);
1448 TEST_DEBUG("OPERATION FAILED");
1451 TEST_DEBUG("********NEW*TAPI_EVENT_SIM_RSIM_ACCESS_CNF**********");
1455 case TAPI_EVENT_SIM_VERIFY_SEC_CNF: {
1456 TEST_DEBUG("********NEW*TAPI_EVENT_SIM_VERIFY_SEC_CNF**********");
1458 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*) sim_event->pData;
1460 //TEST_DEBUG("SIM Verify PIN event status = [0x%x]", sim_event->Status);
1462 if (sim_event->Status == TAPI_SIM_OPERATION_TIMEOUT) {
1463 TEST_DEBUG("TAPI SIM Operation Timeout!!");
1464 } else if (sim_event->Status == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1465 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1466 TEST_DEBUG("PIN1 Verification Success!");
1467 } else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM) {
1468 TEST_DEBUG("PIN1 Verification Success!");
1470 TEST_DEBUG("PIN2 Vefication Success!");
1473 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1474 TEST_DEBUG("PIN1 Verification Failed! - PIN Required ");
1475 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1476 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1) {
1477 TEST_DEBUG("PIN1 Verification Failed! - PUK Required ");
1478 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1479 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1480 TEST_DEBUG("PIN2 Verification Failed! - PIN2 Required ");
1481 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1482 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2) {
1483 TEST_DEBUG("PIN2 Verification Failed! - PUK2 Required ");
1484 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1485 } else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM) {
1486 TEST_DEBUG("SIM Lock Verification Failed! - SIM Lock code Required");
1487 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1490 TEST_DEBUG("********************************************");
1494 case TAPI_EVENT_SIM_VERIFY_PUK_CNF: {
1495 TEST_DEBUG("**********NEW*TAPI_EVENT_SIM_VERIFY_PUK_CNF********");
1497 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*) sim_event->pData;
1499 //TEST_DEBUG("SIM Unblock PIN event status = [0x%x]", sim_event->Status);
1501 if (sim_event->Status == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1502 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1503 TEST_DEBUG("Unblock PIN1 Success!");
1504 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1505 TEST_DEBUG("Unblock PIN2 Success!");
1508 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1509 TEST_DEBUG("PIN1 Verification Failed! - PIN Required ");
1510 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1511 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1) {
1512 TEST_DEBUG("PIN1 Verification Failed! - PUK Required ");
1513 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1514 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1515 TEST_DEBUG("PIN2 Verification Failed! - PIN2 Required ");
1516 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1517 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2) {
1518 TEST_DEBUG("PIN2 Verification Failed! - PUK2 Required ");
1519 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1522 TEST_DEBUG("********************************************");
1526 case TAPI_EVENT_SIM_CHANGE_PINS_CNF: {
1527 TEST_DEBUG("********NEW*TAPI_EVENT_SIM_CHANGE_PINS_CNF***************************");
1529 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*) sim_event->pData;
1531 //TEST_DEBUG("SIM Change PIN event status = [0x%x], pinType[%d]", sim_event->Status, pPinInfo->PinType);
1532 TEST_DEBUG("PinType[%d]", pPinInfo->type);
1534 if (sim_event->Status == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1535 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1536 TEST_DEBUG("Change PIN1 Success!");
1538 TEST_DEBUG("Change PIN2 Success!");
1541 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1542 TEST_DEBUG("PIN1 Verification Failed! - PIN Required ");
1543 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1544 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1) {
1545 TEST_DEBUG("PIN1 Verification Failed! - PUK Required ");
1546 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1547 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1548 TEST_DEBUG("PIN2 Verification Failed! - PIN2 Required ");
1549 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1550 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2) {
1551 TEST_DEBUG("PIN2 Verification Failed! - PUK2 Required ");
1552 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1555 TEST_DEBUG("********************************************");
1559 case TAPI_EVENT_SIM_DISABLE_SEC_CNF: {
1560 TEST_DEBUG("****************NEW*TAPI_EVENT_SIM_DISABLE_SEC_CNF****************");
1562 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*) sim_event->pData;
1564 //TEST_DEBUG("SIM Disable SEC event status = [0x%x]", sim_event->Status);
1566 if (sim_event->Status == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1567 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1568 TEST_DEBUG("Disable PIN1 Success!");
1569 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1570 TEST_DEBUG("Disable PIN2 Success!");
1571 } else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM) {
1572 TEST_DEBUG("Disable SIM LOCK Success!");
1575 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1576 TEST_DEBUG("PIN1 Verification Failed! - PIN1Required ");
1577 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1578 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1579 TEST_DEBUG("PIN2 Verification Failed! - PIN2 Required ");
1580 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1581 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1) {
1582 TEST_DEBUG("PIN1 Verification Failed! - PUK1 Required ");
1583 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1584 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2) {
1585 TEST_DEBUG("PIN2 Verification Failed! - PUK2 Required ");
1586 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1587 } else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM) {
1588 TEST_DEBUG("SIM LOCK Verification Failed! - SIM LOCK CODE Required ");
1589 TEST_DEBUG("Remainint attempts [%d] - Useless value", pPinInfo->retry_count);
1592 TEST_DEBUG("********************************************");
1597 case TAPI_EVENT_SIM_ENABLE_SEC_CNF: {
1598 TEST_DEBUG("****************NEW*TAPI_EVENT_SIM_ENABLE_SEC_CNF****************");
1600 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*) sim_event->pData;
1602 //TEST_DEBUG("SIM ENABLE SEC event status = [0x%x]", sim_event->Status);
1604 if (sim_event->Status == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1605 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1606 TEST_DEBUG("Enable PIN1 Success!");
1607 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1608 TEST_DEBUG("Enable PIN2 Success!");
1609 } else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM) {
1610 TEST_DEBUG("Enable SIM LOCK Success!");
1613 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1614 TEST_DEBUG("PIN1 Verification Failed! - PIN1Required ");
1615 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1616 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1617 TEST_DEBUG("PIN2 Verification Failed! - PIN2 Required ");
1618 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1619 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1) {
1620 TEST_DEBUG("PIN1 Verification Failed! - PUK1 Required ");
1621 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1622 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2) {
1623 TEST_DEBUG("PIN2 Verification Failed! - PUK2 Required ");
1624 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1625 } else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM) {
1626 TEST_DEBUG("SIM LOCK Verification Failed! - SIM LOCK CODE Required ");
1627 TEST_DEBUG("Remainint attempts [%d] - Useless value", pPinInfo->retry_count);
1630 TEST_DEBUG("********************************************");
1634 case TAPI_EVENT_SIM_DISABLE_FDNMODE_CNF: {
1635 TEST_DEBUG("****************NEW*TAPI_EVENT_SIM_DISABLE_FDNMODE_CNF****************");
1637 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*) sim_event->pData;
1639 //TEST_DEBUG("SIM Disable FDN event status = [0x%x]", sim_event->Status);
1641 if (sim_event->Status == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1642 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1643 TEST_DEBUG("Disable FDN Success!");
1645 TEST_DEBUG("Unhandled type[%d]", pPinInfo->type);
1648 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1649 TEST_DEBUG("PIN2 Verification Failed! - PIN2 Required ");
1650 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1651 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2) {
1652 TEST_DEBUG("PIN2 Verification Failed! - PUK2 Required ");
1653 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1655 TEST_DEBUG("Unhandled type[%d]", pPinInfo->type);
1658 TEST_DEBUG("********************************************");
1662 case TAPI_EVENT_SIM_ENABLE_FDNMODE_CNF: {
1663 TEST_DEBUG("****************NEW*TAPI_EVENT_SIM_ENABLE_FDNMODE_CNF****************");
1665 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*) sim_event->pData;
1667 //TEST_DEBUG("SIM Enable FDN event status = [0x%x]", sim_event->Status);
1669 if (sim_event->Status == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1670 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1671 TEST_DEBUG("Enable FDN Success!");
1673 TEST_DEBUG("Unhandled type[%d]", pPinInfo->type);
1676 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1677 TEST_DEBUG("PIN2 Verification Failed! - PIN2 Required ");
1678 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1679 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2) {
1680 TEST_DEBUG("PIN2 Verification Failed! - PUK2 Required ");
1681 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1683 TEST_DEBUG("Unhandled type[%d]", pPinInfo->type);
1686 TEST_DEBUG("********************************************");
1690 case TAPI_EVENT_SIM_PERS_STATUS_CNF: {
1691 TelSimPersStatus_t* pers_status =
1692 (TelSimPersStatus_t*) sim_event->pData;
1695 "[SIM APP]**********NEW* TAPI_EVENT_SIM_PERS_STATUS_CNF************\n");
1696 printf("[SIM APP]SIM lock personalisation event status = [%x]\n",
1699 "[SIM APP]SIM lock personalisation status - net0-ns1-sp2-cp3 = [%d]\n",
1702 "[SIM APP]SIM lock personalisation status - unlock0-lock1 = [%d]\n",
1705 "[SIM APP]***************************************************\n");
1709 case TAPI_EVENT_SIM_DISABLE_PERS_CNF: {
1710 TelSimPinOperationResult_t opResult =
1711 (TelSimPinOperationResult_t) sim_event->Status;
1714 "[SIM APP]*********NEW*TAPI_EVENT_SIM_DISABLE_PERS_CNF************\n");
1715 printf("[SIM APP]Eable Personalization event status = [%x]\n",
1718 if (opResult == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1719 printf("[SIM APP]Disable Personalization Success!\n");
1722 "[SIM APP]Verification Failed! - Correct Password Required\n");
1725 "\n***************************************************************\n");
1729 case TAPI_EVENT_SIM_ENABLE_PERS_CNF: {
1730 TelSimPinOperationResult_t opResult =
1731 (TelSimPinOperationResult_t) sim_event->Status;
1734 "[SIM APP]*********NEW*TAPI_EVENT_SIM_ENABLE_PERS_CNF************\n");
1735 printf("[SIM APP]Eable Personalization event status = [%x]\n",
1738 if (opResult == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1739 printf("[SIM APP]Enable Personalization Success!\n");
1742 "[SIM APP]Verification Failed! - Correct Password Required\n");
1745 "\n***************************************************************\n");
1749 case TAPI_EVENT_SIM_SET_LANGUAGE_CNF: {
1750 TEST_DEBUG("*********NEW*TAPI_EVENT_SIM_SET_LANGUAGE_CNF************");
1751 TEST_DEBUG("update event status = [0x%x]", sim_event->Status);
1752 TEST_DEBUG("**********************************************************");
1756 case TAPI_EVENT_SIM_APDU_CNF: {
1757 TelSimApduResp_t* apdu_resp = (TelSimApduResp_t*) sim_event->pData;
1759 TEST_DEBUG("*********NEW*TAPI_EVENT_SIM_APDU_CNF************");
1760 TEST_DEBUG("update event status = [0x%x]", sim_event->Status);
1762 if (sim_event->Status == 1234) {
1763 TEST_DEBUG("timeout happended. this means, modem didn`t reply");
1767 if (apdu_resp != NULL) {
1768 TEST_DEBUG("apdu_resp->apdu_resp_len[%d]",apdu_resp->apdu_resp_len);
1770 for (i = 0; i < apdu_resp->apdu_resp_len; i++)
1771 TEST_DEBUG("apdu_resp->apdu_resp[%d]=[0x%x]",i,apdu_resp->apdu_resp[i]);
1774 TEST_DEBUG("atr_resp == NULL");
1776 TEST_DEBUG("**********************************************************");;
1780 case TAPI_EVENT_SIM_ATR_CNF: {
1781 TelSimAtrResp_t* atr_resp = (TelSimAtrResp_t*) sim_event->pData;
1784 TEST_DEBUG("*********NEW*TAPI_EVENT_SIM_ATR_CNF************");
1785 TEST_DEBUG("update event status = [0x%x]", sim_event->Status);
1787 if (sim_event->Status == 1234) {
1788 TEST_DEBUG("timeout happended. this means, modem didn`t reply");
1792 if (atr_resp != NULL) {
1793 TEST_DEBUG("atr_resp->atr_resp_len[%d]",atr_resp->atr_resp_len);
1795 for (i = 0; i < atr_resp->atr_resp_len; i++)
1796 TEST_DEBUG("atr_resp->atr_resp[%d]=[0x%x]",i,atr_resp->atr_resp[i]);
1798 TEST_DEBUG("atr_resp == NULL");
1800 TEST_DEBUG("**********************************************************");
1806 case TAPI_SIM_EVENT_PB_GET_STORAGE_LIST:
1808 TEST_DEBUG("****************TAPI_SIM_EVENT_PB_GET_STORAGE_LIST****************************");
1809 char *p = (char*)&sim_event->pData;
1811 TEST_DEBUG("SIM phone book storage list Information ");
1813 TEST_DEBUG("IPC_PB_STORAGE_TYPE_DC - ME Dailled Call list");
1815 TEST_DEBUG("IPC_PB_STORAGE_TYPE_EN - Emergency Number");
1817 TEST_DEBUG("IPC_PB_STORAGE_TYPE_FD - Fixed dialing phonebook");
1819 TEST_DEBUG("IPC_PB_STORAGE_TYPE_LD - Last dialled phonebook");
1821 TEST_DEBUG("IPC_PB_STORAGE_TYPE_MC -Missed call list");
1823 TEST_DEBUG("IPC_PB_STORAGE_TYPE_ME - ME phone book");
1825 TEST_DEBUG("IPC_PB_STORAGE_TYPE_MT - ME and sim combined phone book");
1827 TEST_DEBUG("IPC_PB_STORAGE_TYPE_ON - My own number - MSISDN");
1829 TEST_DEBUG("IPC_PB_STORAGE_TYPE_RC - ME Received calls");
1831 TEST_DEBUG("IPC_PB_STORAGE_TYPE_SIM - SIM phone book");
1833 TEST_DEBUG("IPC_PB_STORAGE_TYPE_SDN - Service dailing number");
1835 TEST_DEBUG("********************************************");
1841 TEST_DEBUG("Undhandled event type [0x%x]",sim_event->EventType)
1845 }//end switch (Type)
1847 TEST_DEBUG("Undhandled EventClass [0x%x]",sim_event->EventClass);
1854 int sim_read_key_input(void) {
1855 char buf[256] = { 0, };
1857 TapiResult_t err_code = TAPI_API_SUCCESS;
1860 ret = read(0, buf, sizeof(buf));
1867 } else if (ret == 0)
1870 printf("************************************\n");
1871 printf("op : show all OP | q : quit sim test app \n");
1872 printf("************************************\n");
1873 printf("SIM OP in : %s\n", buf);
1875 if (memcmp(buf, "op", sizeof("op") - 1) == 0) {
1876 printf("***************************** NEW Asynchronous APIs *******************************\n");
1877 printf("rsim : rsim \n");
1878 printf("pin1 : verify pin1 number \n");
1879 printf("pin2 : verify pin2 number\n");
1880 printf("sim : verify sim lock number\n");
1881 printf("puk1 : Unblocking CHV1 \n");
1882 printf("puk2 : Unblocking CHV2 \n");
1883 printf("chpin1 : change pin1 number \n");
1884 printf("chpin2 : change pin2 number \n");
1885 printf("enpin : CHV enable\n");
1886 printf("dispin : CHV disable\n");
1887 printf("enfdn : FDN enable\n");
1888 printf("disfdn : FDN disable\n");
1889 printf("ensim : enable sim lock\n");
1890 printf("dissim : disable sim lock\n");
1891 printf("getpers : Get lock personalisation information \n");
1892 printf("medepers : de-personalization test\n");
1893 printf("mepers : personalization test\n");
1894 printf("setlang : update sim language info\n");
1895 printf("apdu : send apdu\n");
1896 printf("atr : request atr\n");
1897 printf("***************************** Synchronous APIs *******************************\n");
1898 printf("siminit : Get SIM init Information\n");
1899 printf("getpin1 : Get CHV1 status info\n");
1900 printf("getfdn : Get FDN status info\n");
1901 printf("getpin2 : Get CHV2 status Info \n");
1902 printf("getsim : Get CHV2 status Info \n");
1903 printf("gettype : show Sim Card Type\n");
1904 printf("getimsi : show Sim IMSI\n");
1905 printf("geticcid : show Sim ICCID\n");
1906 printf("getlang:Language Indication Info\n");
1907 printf("getecc : get SIM ECC\n");
1908 printf("getuecc : get USIM ECC\n");
1909 printf("getmb : get mailbox number\n");
1910 printf("getmw : get message waiting information\n");
1911 printf("getcf : get callforwarding information\n");
1912 printf("getcphs : get cphs information\n");
1913 printf("getmsisdn : get msisdn information\n");
1914 printf("******************************* PHONE BOOK ***********************************\n");
1915 printf("pbinit : Get pb init info\n");
1916 printf("pbcapa : pb capability info \n");
1917 printf("pbcnt : phonebook used and total count\n");
1918 printf("pbentry : phonebook entry info\n");
1919 printf("pbadd : phonebook add\n");
1920 printf("pbdel : phonebook delete\n");
1921 printf("pbread:phonebook read\n");
1922 // printf("****************************** SAP commands **********************************\n");
1923 // printf("sapconnect: SAP Connect request\n");
1924 // printf("sapstatus : SAP current connection status request \n");
1925 // printf("sapatr: SAP transfer atr request\n");
1926 // printf("sapapdu: SAP transfer apdu request\n");
1927 // printf("sapsetproto: SAP set protocol request\n");
1928 // printf("sapsimpwr: SAP SIM power on/off request\n");
1929 // printf("sapreaderstat: SAP card reader status request\n");
1930 // printf("*****************************************************************************\n");
1934 if (memcmp(buf, "siminit", sizeof("siminit") - 1) == 0) {
1935 TelSimCardStatus_t status = 0x00;
1936 int b_card_changed = 0;
1938 err_code = tel_get_sim_init_info(&status, &b_card_changed);
1940 if (err_code == TAPI_API_SUCCESS) {
1941 TEST_DEBUG("*************************************************************");
1942 __PrintCardStatus("CardStatus: ", status);
1943 TEST_DEBUG("b_card_changed[%d]\n",b_card_changed);
1944 TEST_DEBUG("*************************************************************");
1946 TEST_DEBUG("TAPI Fail: Error Code [%d]\n",err_code);
1948 } else if (memcmp(buf, "rsim", sizeof("rsim") - 1) == 0) {
1949 TEST_DEBUG("rsim....");
1951 TelSimRSimReq_t rsim = { 0, };
1953 rsim.file_id = 0x6F60;
1954 rsim.rsim_cmd = TAPI_SIM_GET_RESPONSE;
1956 err_code = tel_req_sim_access((const TelSimRSimReq_t*) &rsim,
1958 if (err_code != TAPI_API_SUCCESS) {
1959 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
1961 } else if (memcmp(buf, "pin1", sizeof("pin1") - 1) == 0) {
1962 TEST_DEBUG("Pin1 Verification");
1963 int length = TAPI_SIM_PIN_LENGTH + 1;
1964 char init_pin_val[TAPI_SIM_PIN_LENGTH + 1];
1968 TEST_DEBUG(" PUT PIN1 CODE: ");
1970 _fgets(init_pin_val, 9);
1972 TelSimSecPw_t pin_data = { 0, };
1974 pin_data.type = TAPI_SIM_PTYPE_PIN1; // 0x00
1975 pin_data.pw_len = strlen(init_pin_val);
1977 TEST_DEBUG("pw_len[%d]", pin_data.pw_len);
1979 pin_data.pw = (unsigned char*) malloc(length);
1980 memcpy(pin_data.pw, init_pin_val, length);
1982 err_code = tel_verifiy_sim_pins(&pin_data, &request_id);
1984 if (err_code != TAPI_API_SUCCESS) {
1985 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
1988 } else if (memcmp(buf, "pin2", sizeof("pin2") - 1) == 0) {
1989 TEST_DEBUG("Pin2 Verification");
1990 int length = TAPI_SIM_PIN_LENGTH + 1;
1991 char init_pin_val[TAPI_SIM_PIN_LENGTH + 1];
1995 TEST_DEBUG(" PUT PIN2 CODE: ");
1997 _fgets(init_pin_val, 9);
1999 TelSimSecPw_t pin_data = { 0, };
2001 pin_data.type = TAPI_SIM_PTYPE_PIN2; // 0x00
2002 pin_data.pw_len = strlen(init_pin_val);
2003 TEST_DEBUG("pw_len[%d]", pin_data.pw_len);
2005 pin_data.pw = (unsigned char*) malloc(length);
2006 memcpy(pin_data.pw, init_pin_val, length);
2008 err_code = tel_verifiy_sim_pins(&pin_data, &request_id);
2010 if (err_code != TAPI_API_SUCCESS) {
2011 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2014 } else if (memcmp(buf, "sim", sizeof("sim") - 1) == 0) {
2015 TEST_DEBUG("sim lock verification");
2016 int length = TAPI_SIM_PIN_LENGTH + 1;
2017 char init_pin_val[TAPI_SIM_PIN_LENGTH + 1];
2019 //puts("Flushing input - Enter \ to exit! ");
2020 //while ((ch = getchar()) != '\n' && ch != EOF);
2023 TEST_DEBUG(" PUT SIM LOCK CODE: 4 DIGIT ");
2025 _fgets(init_pin_val, 9);
2027 TelSimSecPw_t pin_data = { 0, };
2029 pin_data.type = TAPI_SIM_PTYPE_SIM; // 0x06
2030 pin_data.pw_len = strlen(init_pin_val);
2031 TEST_DEBUG("pw_len[%d]", pin_data.pw_len);
2033 pin_data.pw = (unsigned char*) malloc(length);
2034 memcpy(pin_data.pw, init_pin_val, length);
2036 err_code = tel_verifiy_sim_pins(&pin_data, &request_id);
2038 if (err_code != TAPI_API_SUCCESS) {
2039 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2043 else if (memcmp(buf, "dispin", sizeof("dispin") - 1) == 0) {
2046 TEST_DEBUG("Disable npin1");
2047 TEST_DEBUG("Plese input PIN1 CODE: ");
2049 int length = TAPI_SIM_PIN_LENGTH + 1;
2050 char init_pin_val[length];
2052 _fgets(init_pin_val, 9);
2054 TelSimSecPw_t sec_data = { 0, };
2055 sec_data.type = TAPI_SIM_PTYPE_PIN1; // 0x00
2056 sec_data.pw_len = strlen(init_pin_val);
2057 TEST_DEBUG("pw_len[%d]", sec_data.pw_len);
2059 sec_data.pw = (unsigned char*) malloc(length);
2060 memcpy(sec_data.pw, init_pin_val, length);
2062 err_code = tel_disable_sim_security(&sec_data, &request_id);
2064 if (err_code != TAPI_API_SUCCESS) {
2065 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2070 else if (memcmp(buf, "enpin", sizeof("enpin") - 1) == 0) {
2071 //TEST_DEBUG("Flushing input - Enter \ to exit!");
2072 //while ((ch = getchar()) != '\n' && ch != EOF);
2075 TEST_DEBUG("Enable npin1");
2076 TEST_DEBUG("Plese input PIN1 CODE: ");
2078 int length = TAPI_SIM_PIN_LENGTH + 1;
2079 char init_pin_val[length];
2081 _fgets(init_pin_val, 9);
2083 TelSimSecPw_t sec_data = { 0, };
2084 sec_data.type = TAPI_SIM_PTYPE_PIN1; // 0x00
2085 sec_data.pw_len = strlen(init_pin_val);
2086 TEST_DEBUG("pw_len[%d]", sec_data.pw_len);
2088 sec_data.pw = (unsigned char*) malloc(length);
2089 memcpy(sec_data.pw, init_pin_val, length);
2091 err_code = tel_enable_sim_security(&sec_data, &request_id);
2093 if (err_code != TAPI_API_SUCCESS) {
2094 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2099 else if (memcmp(buf, "dissim", sizeof("dissim") - 1) == 0) {
2102 TEST_DEBUG("Disable ndissim");
2103 TEST_DEBUG("Plese input SIM LOCK CODE: ");
2105 int length = TAPI_SIM_PIN_LENGTH + 1;
2106 char init_pin_val[length];
2108 _fgets(init_pin_val, 9);
2110 TelSimSecPw_t sec_data = { 0, };
2111 sec_data.type = TAPI_SIM_PTYPE_SIM; // 0x00
2112 sec_data.pw_len = strlen(init_pin_val);
2113 TEST_DEBUG("pw_len[%d]", sec_data.pw_len);
2115 sec_data.pw = (unsigned char*) malloc(length);
2116 memcpy(sec_data.pw, init_pin_val, length);
2118 err_code = tel_disable_sim_security(&sec_data, &request_id);
2120 if (err_code != TAPI_API_SUCCESS) {
2121 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2126 else if (memcmp(buf, "ensim", sizeof("ensim") - 1) == 0) {
2129 TEST_DEBUG("Enable nensim");
2130 TEST_DEBUG("Plese input SIM LOCK CODE: ");
2132 int length = TAPI_SIM_PIN_LENGTH + 1;
2133 char init_pin_val[length];
2135 _fgets(init_pin_val, 9);
2137 TelSimSecPw_t sec_data = { 0, };
2138 sec_data.type = TAPI_SIM_PTYPE_SIM; // 0x00
2139 sec_data.pw_len = strlen(init_pin_val);
2140 TEST_DEBUG("pw_len[%d]", sec_data.pw_len);
2142 sec_data.pw = (unsigned char*) malloc(length);
2143 memcpy(sec_data.pw, init_pin_val, length);
2145 err_code = tel_enable_sim_security(&sec_data, &request_id);
2147 if (err_code != TAPI_API_SUCCESS) {
2148 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2153 else if (memcmp(buf, "getpin1", sizeof("getpin1") - 1) == 0) {
2154 TelSimPinType_t type = TAPI_SIM_PTYPE_PIN1;
2155 TelSimPinStatus_t status = -1;
2156 TEST_DEBUG("Get pin1 status");
2158 err_code = tel_get_sim_security_status(type, &status);
2160 if (err_code == TAPI_API_SUCCESS) {
2162 TEST_DEBUG(" *****************************************************");
2164 case TAPI_SIM_PIN_STATUS_DISABLED: {
2165 TEST_DEBUG("TAPI_SIM_PIN_STATUS_DISABLED ");
2169 case TAPI_SIM_PIN_STATUS_ENABLED: {
2170 TEST_DEBUG("TAPI_SIM_PIN_STATUS_ENABLED ");
2174 case TAPI_SIM_PIN_STATUS_BLOCKED: {
2175 TEST_DEBUG("TAPI_SIM_PIN_STATUS_BLOCKED ");
2179 case TAPI_SIM_PIN_STATUS_PUK_BLOCKED: {
2180 TEST_DEBUG("TAPI_SIM_PIN_STATUS_PUK_BLOCKED ");
2184 case TAPI_SIM_PIN_STATUS_UNKNOWN: {
2185 TEST_DEBUG("TAPI_SIM_PIN_STATUS_UNKNOWN ");
2190 TEST_DEBUG(" Default case statment: pin1_status(%d)", status)
2194 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2197 TEST_DEBUG("*****************************************************");
2200 else if (memcmp(buf, "getpin2", sizeof("getpin2") - 1) == 0) {
2201 TelSimPinType_t type = TAPI_SIM_PTYPE_PIN2;
2202 TelSimPinStatus_t status = -1;
2203 TEST_DEBUG("Get pin2 status");
2205 err_code = tel_get_sim_security_status(type, &status);
2207 if (err_code == TAPI_API_SUCCESS) {
2209 TEST_DEBUG(" *****************************************************");
2211 case TAPI_SIM_PIN_STATUS_DISABLED: {
2212 TEST_DEBUG("TAPI_SIM_PIN_STATUS_DISABLED ");
2216 case TAPI_SIM_PIN_STATUS_ENABLED: {
2217 TEST_DEBUG("TAPI_SIM_PIN_STATUS_ENABLED ");
2221 case TAPI_SIM_PIN_STATUS_BLOCKED: {
2222 TEST_DEBUG("TAPI_SIM_PIN_STATUS_BLOCKED ");
2226 case TAPI_SIM_PIN_STATUS_PUK_BLOCKED: {
2227 TEST_DEBUG("TAPI_SIM_PIN_STATUS_PUK_BLOCKED ");
2231 case TAPI_SIM_PIN_STATUS_UNKNOWN: {
2232 TEST_DEBUG("TAPI_SIM_PIN_STATUS_UNKNOWN ");
2237 TEST_DEBUG(" Default case statment: pin2_status(%d)", status)
2241 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2244 TEST_DEBUG("*****************************************************");
2245 } else if (memcmp(buf, "getsim", sizeof("getsim") - 1) == 0) {
2246 TelSimPinType_t type = TAPI_SIM_PTYPE_SIM;
2247 TelSimPinStatus_t status = -1;
2248 TEST_DEBUG("Get SIM LOCK status");
2250 err_code = tel_get_sim_security_status(type, &status);
2252 if (err_code == TAPI_API_SUCCESS) {
2254 TEST_DEBUG(" *****************************************************");
2256 case TAPI_SIM_PIN_STATUS_DISABLED: {
2257 TEST_DEBUG("TAPI_SIM_PIN_STATUS_DISABLED ");
2261 case TAPI_SIM_PIN_STATUS_ENABLED: {
2262 TEST_DEBUG("TAPI_SIM_PIN_STATUS_ENABLED ");
2266 case TAPI_SIM_PIN_STATUS_BLOCKED: {
2267 TEST_DEBUG("TAPI_SIM_PIN_STATUS_BLOCKED ");
2271 case TAPI_SIM_PIN_STATUS_PUK_BLOCKED: {
2272 TEST_DEBUG("TAPI_SIM_PIN_STATUS_PUK_BLOCKED ");
2276 case TAPI_SIM_PIN_STATUS_UNKNOWN: {
2277 TEST_DEBUG("TAPI_SIM_PIN_STATUS_UNKNOWN ");
2282 TEST_DEBUG(" Default case statment: sim_status(%d)", status)
2286 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2289 TEST_DEBUG("*****************************************************");
2292 else if (memcmp(buf, "enfdn", sizeof("enfdn") - 1) == 0) {
2293 //puts("Flushing input - Enter \ to exit! ");
2294 //while ((ch = getchar()) != '\n' && ch != EOF);
2297 TEST_DEBUG("Enable FDN");
2298 TEST_DEBUG("Plese input PIN2 CODE: ");
2300 int length = TAPI_SIM_PIN_LENGTH + 1;
2301 char init_pin_val[length];
2303 _fgets(init_pin_val, 9);
2305 TelSimSecPw_t sec_data = { 0, };
2306 sec_data.type = TAPI_SIM_PTYPE_PIN2; // 0x00
2307 sec_data.pw_len = strlen(init_pin_val);
2308 TEST_DEBUG("pw_len[%d]", sec_data.pw_len);
2310 sec_data.pw = (unsigned char*) malloc(length);
2311 memcpy(sec_data.pw, init_pin_val, length);
2313 err_code = tel_enable_sim_fdn(sec_data.pw, (int *)&sec_data.pw_len,
2316 if (err_code != TAPI_API_SUCCESS) {
2317 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2321 else if (memcmp(buf, "disfdn", sizeof("disfdn") - 1) == 0) {
2324 TEST_DEBUG("Disable FDN");
2325 TEST_DEBUG("Plese input PIN2 CODE");
2327 int length = TAPI_SIM_PIN_LENGTH + 1;
2328 char init_pin_val[length];
2330 _fgets(init_pin_val, 9);
2332 TelSimSecPw_t sec_data = { 0, };
2333 sec_data.type = TAPI_SIM_PTYPE_PIN2; // 0x00
2334 sec_data.pw_len = strlen(init_pin_val);
2335 TEST_DEBUG("pw_len[%d]", sec_data.pw_len);
2337 sec_data.pw = (unsigned char*) malloc(length);
2338 memcpy(sec_data.pw, init_pin_val, length);
2340 err_code = tel_disable_sim_fdn(sec_data.pw, (int *)&sec_data.pw_len,
2343 if (err_code != TAPI_API_SUCCESS) {
2344 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2348 else if (memcmp(buf, "getfdn", sizeof("getfdn") - 1) == 0) {
2349 TEST_DEBUG("Get FDN status");
2352 err_code = tel_get_sim_fdn_status(&fdn_status);
2354 if (err_code == TAPI_API_SUCCESS) {
2355 if (fdn_status == 0) {
2356 TEST_DEBUG("*************************");
2357 TEST_DEBUG("FDN disabled ");
2358 TEST_DEBUG("*************************");
2360 TEST_DEBUG("*************************");
2361 TEST_DEBUG("FDN enabled");
2362 TEST_DEBUG("*************************");
2365 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2367 } else if (memcmp(buf, "gettype", sizeof("gettype") - 1) == 0) {
2368 TelSimCardType_t cardInfo;
2369 TEST_DEBUG("Get card type !!!");
2370 err_code = tel_get_sim_type(&cardInfo);
2372 if (err_code == TAPI_API_SUCCESS) {
2373 TEST_DEBUG("*************************************************************");
2374 __PrintCardType("", cardInfo);
2375 TEST_DEBUG("*************************************************************");
2377 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2379 } else if (memcmp(buf, "getimsi", sizeof("getimsi") - 1) == 0) {
2380 TelSimImsiInfo_t imsi;
2381 TEST_DEBUG("Get IMSI type !!!");
2382 err_code = tel_get_sim_imsi(&imsi);
2384 if (err_code == TAPI_API_SUCCESS) {
2385 TEST_DEBUG("*************************************************************");
2386 TEST_DEBUG("* imsi.bValid[%d]",imsi.bValid);
2387 TEST_DEBUG("* imsi.szMcc[%s]",imsi.szMcc);
2388 TEST_DEBUG("* imsi.szMnc[%s]",imsi.szMnc);
2389 TEST_DEBUG("* imsi.szMsin[%s]",imsi.szMsin);
2390 TEST_DEBUG("*************************************************************");
2392 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2394 } else if (memcmp(buf, "geticcid", sizeof("geticcid") - 1) == 0) {
2395 TelSimIccIdInfo_t iccid;
2396 TEST_DEBUG("Get ICCID !!!");
2397 err_code = tel_get_sim_iccid(&iccid);
2400 if (err_code == TAPI_API_SUCCESS) {
2401 TEST_DEBUG("*************************************************************");
2402 TEST_DEBUG("* iccid.icc_length[%d]",iccid.icc_length);
2403 for (i = 0; i < iccid.icc_length; i++) {
2404 TEST_DEBUG("* iccid.icc_num[%c]",iccid.icc_num[i]);
2406 TEST_DEBUG("*************************************************************");
2408 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2412 else if (memcmp(buf, "getlang", sizeof("getlang") - 1) == 0) {
2413 TEST_DEBUG("Language Preference INFO ");
2415 TelSimLanguageInfo_t li_info = { 0, };
2417 err_code = tel_get_sim_language(&li_info);
2419 if (err_code == TAPI_API_SUCCESS) {
2420 TEST_DEBUG(" ============================================");
2421 TEST_DEBUG("************ LI INFO ***********************");
2422 TEST_DEBUG("LpCount: [%lu]", li_info.LpCount);
2423 for (i = 0; i < li_info.LpCount; i++) {
2424 fprintf(stderr, "Loop(%d), ", i);
2425 __PrintLangInfo("LpCode: ", li_info.Lp[i]);
2427 TEST_DEBUG("============================================");
2429 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2433 else if (memcmp(buf, "getecc", sizeof("getecc") - 1) == 0) {
2434 TEST_DEBUG(" Get SIM ECC ");
2435 int ecc_rec_count = 0;
2436 TelSimEccData_t ecc_info = { { { 0, } } };
2437 TelSimEccInfo_t SimEccInfo = { { 0, } };
2439 err_code = tel_get_sim_ecc(&ecc_info, &ecc_rec_count);
2441 if (err_code == TAPI_API_SUCCESS) {
2442 SimEccInfo = ecc_info.EccInfo;
2443 TEST_DEBUG(" ============================================");
2444 TEST_DEBUG(" EEC count [%d]", ecc_rec_count);
2445 TEST_DEBUG(" ============================================");
2447 if (ecc_rec_count != 0) {
2448 TEST_DEBUG("ECC1 [%s]", SimEccInfo.szEcc1);
2449 TEST_DEBUG("ECC2 [%s]", SimEccInfo.szEcc2);
2450 TEST_DEBUG("ECC3 [%s]", SimEccInfo.szEcc3);
2451 TEST_DEBUG("ECC4 [%s]", SimEccInfo.szEcc4);
2452 TEST_DEBUG("ECC5 [%s]", SimEccInfo.szEcc5);
2454 TEST_DEBUG(" ============================================");
2456 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2460 else if (memcmp(buf, "getuecc", sizeof("getuecc") - 1) == 0) {
2462 int uecc_rec_count = 0;
2464 TEST_DEBUG(" Get USIM ECC ");
2466 TelSimEccData_t uecc_info = { { { 0, } } };
2468 err_code = tel_get_sim_ecc(&uecc_info, &uecc_rec_count);
2470 if (err_code == TAPI_API_SUCCESS) {
2472 TEST_DEBUG("ECC count [%d]",uecc_rec_count );
2474 for (i = 0; i < uecc_rec_count; i++) {
2475 TEST_DEBUG("Loop(%d): ", i);
2476 TEST_DEBUG(" ECC Used [%d]", uecc_info.UeccInfo[i].bUsed);
2477 TEST_DEBUG(" ECC Len [%d]", uecc_info.UeccInfo[i].EccLen);
2479 if (NULL != uecc_info.UeccInfo[i].szEcc) {
2480 TEST_DEBUG("ECC string [%s]", uecc_info.UeccInfo[i].szEcc);
2482 TEST_DEBUG("ECC string [null]");
2485 TEST_DEBUG("ECC alphaID [%s]",uecc_info.UeccInfo[i].szEccAlphaIdentifier);
2486 __PrintECCSvcInfo(uecc_info.UeccInfo[i].EccEmergencyServiceInfo);
2490 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2494 else if (memcmp(buf, "getimsi", sizeof("getimsi") - 1) == 0) {
2495 TEST_DEBUG("Get IMSI INFO ");
2497 TelSimImsiInfo_t sim_imsi_info;
2499 err_code = tel_get_sim_imsi(&sim_imsi_info);
2501 if (err_code == TAPI_API_SUCCESS) {
2502 TEST_DEBUG(" ============================================");
2503 TEST_DEBUG(" IMSI [mcc,mnc,msin]= ");
2504 TEST_DEBUG(" [%s]",sim_imsi_info.szMcc);
2505 TEST_DEBUG(" [%s]",sim_imsi_info.szMnc);
2506 TEST_DEBUG(" [%s]",sim_imsi_info.szMsin);
2507 TEST_DEBUG(" ============================================");
2509 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2513 else if (memcmp(buf, "getmb", sizeof("getmb") - 1) == 0) {
2514 TEST_DEBUG("Get MAILBOX INFO ");
2516 TelSimMailboxNumbers_s mbox;
2518 err_code = tel_get_sim_mailbox_info(&mbox);
2520 if (err_code == TAPI_API_SUCCESS) {
2521 TEST_DEBUG(" ============================================");
2524 TEST_DEBUG("Current SIM is CPHS");
2526 TEST_DEBUG("Current SIM is not CPHS but 3GPP");
2528 TEST_DEBUG(" ============================================");
2529 TEST_DEBUG(" voice_line1.bUsed[%d]",mbox.voice_line1.bUsed);
2530 TEST_DEBUG(" voice_line1.AlphaIdLength[%lu]",mbox.voice_line1.AlphaIdLength);
2531 TEST_DEBUG(" voice_line1.AlphaId[%s]",mbox.voice_line1.AlphaId);
2532 TEST_DEBUG(" voice_line1.DiallingnumLength[%lu]",mbox.voice_line1.DiallingnumLength);
2533 TEST_DEBUG(" voice_line1.DiallingNum[%s]",mbox.voice_line1.DiallingNum);
2534 TEST_DEBUG(" voice_line1.NumberingPlanIdent[%d]",mbox.voice_line1.NumberingPlanIdent);
2535 TEST_DEBUG(" voice_line1.TypeOfNumber[%u]",mbox.voice_line1.TypeOfNumber);
2536 TEST_DEBUG(" ============================================");
2537 TEST_DEBUG(" voice_line2.bUsed[%d]",mbox.voice_line2.bUsed);
2538 TEST_DEBUG(" voice_line2.AlphaIdLength[%lu]",mbox.voice_line2.AlphaIdLength);
2539 TEST_DEBUG(" voice_line2.AlphaId[%s]",mbox.voice_line2.AlphaId);
2540 TEST_DEBUG(" voice_line2.DiallingnumLength[%lu]",mbox.voice_line2.DiallingnumLength);
2541 TEST_DEBUG(" voice_line2.DiallingNum[%s]",mbox.voice_line2.DiallingNum);
2542 TEST_DEBUG(" voice_line2.NumberingPlanIdent[%d]",mbox.voice_line2.NumberingPlanIdent);
2543 TEST_DEBUG(" voice_line2.TypeOfNumber[%d]",mbox.voice_line2.TypeOfNumber);
2544 TEST_DEBUG(" ============================================");
2545 TEST_DEBUG(" video.bUsed[%d]",mbox.video.bUsed);
2546 TEST_DEBUG(" video.AlphaIdLength[%lu]",mbox.video.AlphaIdLength);
2547 TEST_DEBUG(" video.AlphaId[%s]",mbox.video.AlphaId);
2548 TEST_DEBUG(" video.DiallingnumLength[%lu]",mbox.video.DiallingnumLength);
2549 TEST_DEBUG(" video.DiallingNum[%s]",mbox.video.DiallingNum);
2550 TEST_DEBUG(" video.NumberingPlanIdent[%d]",mbox.video.NumberingPlanIdent);
2551 TEST_DEBUG(" video.TypeOfNumber[%d]",mbox.video.TypeOfNumber);
2552 TEST_DEBUG(" ============================================");
2553 TEST_DEBUG(" fax.bUsed[%d]",mbox.fax.bUsed);
2554 TEST_DEBUG(" fax.AlphaIdLength[%lu]",mbox.fax.AlphaIdLength);
2555 TEST_DEBUG(" fax.AlphaId[%s]",mbox.fax.AlphaId);
2556 TEST_DEBUG(" fax.DiallingnumLength[%lu]",mbox.fax.DiallingnumLength);
2557 TEST_DEBUG(" fax.DiallingNum[%s]",mbox.fax.DiallingNum);
2558 TEST_DEBUG(" fax.NumberingPlanIdent[%d]",mbox.fax.NumberingPlanIdent);
2559 TEST_DEBUG(" fax.TypeOfNumber[%d]",mbox.fax.TypeOfNumber);
2560 TEST_DEBUG(" ============================================");
2561 TEST_DEBUG(" email.bUsed[%d]",mbox.email.bUsed);
2562 TEST_DEBUG(" email.AlphaIdLength[%lu]",mbox.email.AlphaIdLength);
2563 TEST_DEBUG(" email.AlphaId[%s]",mbox.email.AlphaId);
2564 TEST_DEBUG(" email.DiallingnumLength[%lu]",mbox.email.DiallingnumLength);
2565 TEST_DEBUG(" email.DiallingNum[%s]",mbox.email.DiallingNum);
2566 TEST_DEBUG(" email.NumberingPlanIdent[%d]",mbox.email.NumberingPlanIdent);
2567 TEST_DEBUG(" email.TypeOfNumber[%d]",mbox.email.TypeOfNumber);
2568 TEST_DEBUG(" ============================================");
2571 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2575 else if (memcmp(buf, "getmw", sizeof("getmw") - 1) == 0) {
2576 TEST_DEBUG("Get MESSAGE WAITING INFO ");
2578 TelSimMessageWaiting_s mw;
2580 err_code = tel_get_sim_messagewaiting_info(&mw);
2582 if (err_code == TAPI_API_SUCCESS) {
2583 TEST_DEBUG(" ============================================");
2586 TEST_DEBUG("Current SIM is CPHS");
2587 TEST_DEBUG(" ============================================");
2588 TEST_DEBUG(" cphs_mw.bWaitVoiceMsgLine1[%d]",mw.mw_data_u.cphs_mw.bWaitVoiceMsgLine1);
2589 TEST_DEBUG(" cphs_mw.bWaitVoiceMsgLine2[%d]",mw.mw_data_u.cphs_mw.bWaitVoiceMsgLine2);
2590 TEST_DEBUG(" cphs_mw.bWaitFaxMsg[%d]",mw.mw_data_u.cphs_mw.bWaitFaxMsg);
2591 TEST_DEBUG(" cphs_mw.bWaitDataMsg[%d]",mw.mw_data_u.cphs_mw.bWaitDataMsg);
2594 TEST_DEBUG("Current SIM is not CPHS but 3GPP");
2595 TEST_DEBUG(" ============================================");
2596 TEST_DEBUG(" mw_data_u.mw.IndicatorType[0x%x]",mw.mw_data_u.mw.IndicatorType);
2597 TEST_DEBUG(" mw_data_u.mw.VoiceMailCount[%d]",mw.mw_data_u.mw.VoiceMailCount);
2598 TEST_DEBUG(" mw_data_u.mw.FaxCount[%d]",mw.mw_data_u.mw.FaxCount);
2599 TEST_DEBUG(" mw_data_u.mw.EmailCount[%d]",mw.mw_data_u.mw.EmailCount);
2600 TEST_DEBUG(" mw_data_u.mw.OtherCount[%d]",mw.mw_data_u.mw.OtherCount);
2601 TEST_DEBUG(" mw_data_u.mw.VideoMailCount[%d]",mw.mw_data_u.mw.VideoMailCount);
2603 TEST_DEBUG(" ============================================");
2606 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2610 else if (memcmp(buf, "getcf", sizeof("getcf") - 1) == 0) {
2611 TEST_DEBUG("Get CALLFORWARDING INFO ");
2613 TelSimCallForwarding_s cf;
2615 err_code = tel_get_sim_callforwarding_info(&cf);
2617 if (err_code == TAPI_API_SUCCESS) {
2618 TEST_DEBUG(" ============================================");
2621 TEST_DEBUG("Current SIM is CPHS");
2622 TEST_DEBUG(" ============================================");
2623 TEST_DEBUG(" cphs_cf.bCallForwardUnconditionalLine1[%d]",cf.cf_data_u.cphs_cf.bCallForwardUnconditionalLine1);
2624 TEST_DEBUG(" cphs_cf.bCallForwardUnconditionalLine2[%d]",cf.cf_data_u.cphs_cf.bCallForwardUnconditionalLine2);
2625 TEST_DEBUG(" cphs_cf.bCallForwardUnconditionalFax[%d]",cf.cf_data_u.cphs_cf.bCallForwardUnconditionalFax);
2626 TEST_DEBUG(" cphs_cf.bCallForwardUnconditionalData[%d]",cf.cf_data_u.cphs_cf.bCallForwardUnconditionalData);
2627 TEST_DEBUG(" cphs_cf.bCallForwardUnconditionalSms[%d]",cf.cf_data_u.cphs_cf.bCallForwardUnconditionalSms);
2628 TEST_DEBUG(" cphs_cf.bCallForwardUnconditionalBearer[%d]",cf.cf_data_u.cphs_cf.bCallForwardUnconditionalBearer);
2630 TEST_DEBUG("Current SIM is not CPHS but 3GPP");
2631 TEST_DEBUG(" ============================================");
2632 TEST_DEBUG(" cf.bUsed[%d]",cf.cf_data_u.cf.bUsed);
2633 TEST_DEBUG(" cf.MspNumber[%d]",cf.cf_data_u.cf.MspNumber);
2634 TEST_DEBUG(" cf.Status[0x%x]",cf.cf_data_u.cf.Status);
2635 TEST_DEBUG(" cf.DiallingnumLen[%lu]",cf.cf_data_u.cf.DiallingnumLen);
2636 TEST_DEBUG(" cf.TypeOfNumber[%d]",cf.cf_data_u.cf.TypeOfNumber);
2637 TEST_DEBUG(" cf.NumberingPlanIdent[%d]",cf.cf_data_u.cf.NumberingPlanIdent);
2638 TEST_DEBUG(" cf.DiallingNum[%s]",cf.cf_data_u.cf.DiallingNum);
2640 TEST_DEBUG(" ============================================");
2642 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2646 else if (memcmp(buf, "getcphs", sizeof("getcphs") - 1) == 0) {
2647 TEST_DEBUG("Get CPHS INFO ");
2649 TelSimCphsLocalInfo_t cphs;
2651 err_code = tel_get_sim_cphs_info(&cphs);
2653 if (err_code == TAPI_API_SUCCESS) {
2654 TEST_DEBUG(" ============================================");
2657 TEST_DEBUG("Current SIM is CPHS");
2658 TEST_DEBUG(" ============================================");
2659 TEST_DEBUG("cphs.cphsinfo.CphsPhase[%d]",cphs.cphsinfo.CphsPhase);
2660 TEST_DEBUG("cphs.cphsinfo.CphsServiceTable.bCustomerServiceProfile[%d]",cphs.cphsinfo.CphsServiceTable.bCustomerServiceProfile);
2661 TEST_DEBUG("cphs.cphsinfo.CphsServiceTable.bServiceStringTable[%d]",cphs.cphsinfo.CphsServiceTable.bServiceStringTable);
2662 TEST_DEBUG("cphs.cphsinfo.CphsServiceTable.bMailBoxNumbers[%d]",cphs.cphsinfo.CphsServiceTable.bMailBoxNumbers);
2663 TEST_DEBUG("cphs.cphsinfo.CphsServiceTable.bOperatorNameShortForm[%d]",cphs.cphsinfo.CphsServiceTable.bOperatorNameShortForm);
2664 TEST_DEBUG("cphs.cphsinfo.CphsServiceTable.bInformationNumbers[%d]",cphs.cphsinfo.CphsServiceTable.bInformationNumbers);
2665 TEST_DEBUG(" ============================================");
2666 TEST_DEBUG("cphs.csp.ServiceProfileEntry[0].CustomerServiceGroup[%d]",cphs.csp.ServiceProfileEntry[0].CustomerServiceGroup);
2667 TEST_DEBUG(" ============================================");
2668 TEST_DEBUG("cphs.infn.bUsed[%d]",cphs.infn.bUsed);
2669 TEST_DEBUG("cphs.infn.AlphaIdLength[%d]",cphs.infn.AlphaIdLength);
2670 TEST_DEBUG("cphs.infn.IndexLevelIndicator[%d]",cphs.infn.IndexLevelIndicator);
2671 TEST_DEBUG("cphs.infn.PremiumServiceIndicator[%d]",cphs.infn.PremiumServiceIndicator);
2672 TEST_DEBUG("cphs.infn.NetworkSpecificIndicator[%d]",cphs.infn.NetworkSpecificIndicator);
2673 TEST_DEBUG("cphs.infn.Alpha_id[%s]",cphs.infn.Alpha_id);
2674 TEST_DEBUG("cphs.infn.DiallingnumLength[%lu]",cphs.infn.DiallingnumLength);
2675 TEST_DEBUG("cphs.infn.TypeOfNumber[%d]",cphs.infn.TypeOfNumber);
2676 TEST_DEBUG("cphs.infn.NumberingPlanIdentity[%d]",cphs.infn.NumberingPlanIdentity);
2677 TEST_DEBUG("cphs.infn.DiallingNum[%s]",cphs.infn.DiallingNum);
2678 TEST_DEBUG("cphs.infn.Ext1RecordId[%d]",cphs.infn.Ext1RecordId);
2679 TEST_DEBUG(" ============================================");
2680 TEST_DEBUG("cphs.opname.NameLength[%d]",cphs.opname.NameLength);
2681 TEST_DEBUG("cphs.opname.OperatorName[%s]",cphs.opname.OperatorName);
2682 TEST_DEBUG(" ============================================");
2683 TEST_DEBUG("cphs.opshortform.ShortNameLength[%d]",cphs.opshortform.ShortNameLength);
2684 TEST_DEBUG("cphs.opshortform.OperatorShortName[%s]",cphs.opshortform.OperatorShortName);
2685 TEST_DEBUG(" ============================================");
2686 TEST_DEBUG("cphs.dflagsinfo.DynamicFlags[%d]",cphs.dflagsinfo.DynamicFlags);
2687 TEST_DEBUG(" ============================================");
2688 TEST_DEBUG("cphs.d2flagsinfo.Dynamic2Flag[%d]",cphs.d2flagsinfo.Dynamic2Flag);
2690 TEST_DEBUG("Current SIM is not CPHS but 3GPP");
2691 TEST_DEBUG(" ============================================");
2694 TEST_DEBUG(" ============================================");
2696 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2699 } else if (memcmp(buf, "getmsisdn", sizeof("getmsisdn") - 1) == 0) {
2700 TEST_DEBUG("Get MSISDN INFO ");
2702 TelSimSubscriberInfo_t msisdn;
2704 err_code = tel_get_sim_msisdn(&msisdn);
2706 if (err_code == TAPI_API_SUCCESS) {
2707 TEST_DEBUG(" ============================================");
2708 TEST_DEBUG("name[%s]",msisdn.name);
2709 TEST_DEBUG("num[%s]",msisdn.num);
2710 if (msisdn.name == '\0')
2711 TEST_DEBUG("name is null string");
2713 if (msisdn.num == '\0')
2714 TEST_DEBUG("number is null string");
2716 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2718 } else if (memcmp(buf, "pbinit", sizeof("pbinit") - 1) == 0) {
2719 TEST_DEBUG("npbinit status");
2721 int valid_index = 0;
2722 TelSimPbList_t pb_list = { 0, };
2723 int pPbInitCompleted = 0;
2725 err_code = tel_get_sim_pb_init_info(&pPbInitCompleted, &pb_list,
2728 if (err_code == TAPI_API_SUCCESS) {
2729 if (pPbInitCompleted == 0) {
2730 TEST_DEBUG(" SIM PB INIT NOT completed ");
2732 TEST_DEBUG("SIM PB INIT completed");
2733 /* if no sim records at all then valid_index = 0xFF */TEST_DEBUG("ADN First index is [%d]",valid_index);
2734 TEST_DEBUG("SIM phone book storage list Information ");
2735 TEST_DEBUG("********************************************");
2736 TEST_DEBUG("pb_list.b_fdn[%d]",pb_list.b_fdn);
2737 TEST_DEBUG("pb_list.b_msisdn[%d]",pb_list.b_msisdn);
2738 TEST_DEBUG("pb_list.b_adn[%d]",pb_list.b_adn);
2739 TEST_DEBUG("pb_list.b_sdn[%d]",pb_list.b_sdn);
2740 TEST_DEBUG("pb_list.b_3g[%d]",pb_list.b_3g);
2741 TEST_DEBUG("pb_list.b_aas[%d]",pb_list.b_aas);
2742 TEST_DEBUG("pb_list.b_gas[%d]",pb_list.b_gas);
2746 TEST_DEBUG("ME dialed calls list stored in NV");
2748 TEST_DEBUG("SIM(or ME) emergency number");
2750 TEST_DEBUG("SIM fixed-dialing phonebook");
2752 TEST_DEBUG("SIM last-dialing phonebook");
2754 TEST_DEBUG("ME missed calls list");
2756 TEST_DEBUG("ME phonebook");
2758 TEST_DEBUG("Combined ME and SIM phonebook");
2760 TEST_DEBUG("SIM(or ME) own numbers ( MSISDNs) list");
2762 TEST_DEBUG("ME received calls list stored in NV");
2764 TEST_DEBUG("2G SIM phonebook");
2766 TEST_DEBUG("Service Dialing Number");
2768 TEST_DEBUG("3G SIM phonebook");
2770 TEST_DEBUG("Incoming Call Information");
2772 TEST_DEBUG("Outgoing Call Information");
2774 TEST_DEBUG("Additional Number Alpha String");
2776 TEST_DEBUG("Grouping Information Alpha String");
2779 PB_DC 0x01 ME dialed calls list stored in NV
2780 PB_EN 0x02 SIM(or ME) emergency number
2781 PB_FD 0x03 SIM fixed-dialing phonebook
2782 PB_LD 0x04 SIM last-dialing phonebook
2783 PB_MC 0x05 ME missed calls list
2784 PB_ME 0x06 ME phonebook
2785 PB_MT 0x07 Combined ME and SIM phonebook
2786 PB_ON 0x08 SIM(or ME) own numbers ( MSISDNs) list
2787 PB_RC 0x09 ME received calls list stored in NV
2788 PB_SIM 0x0A 2G SIM phonebook
2789 PB_SDN 0x0B Service Dialing Number
2790 PB_3GSIM 0x0C 3G SIM phonebook
2791 PB_ICI 0x0D Incoming Call Information
2792 PB_OCI 0x0E Outgoing Call Information
2793 PB_AAS 0x0F Additional Number Alpha String
2794 PB_GAS 0x10 Grouping Information Alpha String
2797 TEST_DEBUG("********************************************");
2800 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2805 //change pin1 number
2806 else if (memcmp(buf, "chpin1", sizeof("chpin1") - 1) == 0) {
2807 int length = TAPI_SIM_PIN_LENGTH + 1;
2808 char init_old_pin_val[length];
2809 char init_new_pin_val[length];
2811 memset(&init_old_pin_val, 0, length);
2812 memset(&init_new_pin_val, 0, length);
2814 TelSimSecPw_t old_pin = { 0, };
2815 TelSimSecPw_t new_pin = { 0, };
2819 TEST_DEBUG("Change PIN1 CODE");
2820 TEST_DEBUG("Input Current PIN1 Code: ");
2822 _fgets(init_old_pin_val, 9);
2824 old_pin.type = TAPI_SIM_PTYPE_PIN1; // 0x00
2825 old_pin.pw_len = strlen(init_old_pin_val);
2826 TEST_DEBUG("pw_len[%d]", old_pin.pw_len);
2827 old_pin.pw = (unsigned char*) malloc(length);
2828 memcpy(old_pin.pw, init_old_pin_val, length);
2830 TEST_DEBUG("Input New PIN1 Code: ");
2832 _fgets(init_new_pin_val, 9);
2834 new_pin.type = TAPI_SIM_PTYPE_PIN1; // 0x00
2835 new_pin.pw_len = strlen(init_new_pin_val);
2836 TEST_DEBUG("pw_len[%d]", new_pin.pw_len);
2837 new_pin.pw = (unsigned char*) malloc(length);
2838 memcpy(new_pin.pw, init_new_pin_val, length);
2840 err_code = tel_change_sim_pins(&old_pin, &new_pin, &request_id);
2842 if (err_code != TAPI_API_SUCCESS) {
2843 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2847 //change pin2 number
2848 else if (memcmp(buf, "chpin2", sizeof("chpin2") - 1) == 0) {
2849 int length = TAPI_SIM_PIN_LENGTH + 1;
2850 char init_old_pin_val[length];
2851 char init_new_pin_val[length];
2853 memset(&init_old_pin_val, 0, length);
2854 memset(&init_new_pin_val, 0, length);
2856 TelSimSecPw_t old_pin = { 0, };
2857 TelSimSecPw_t new_pin = { 0, };
2861 TEST_DEBUG("Change PIN2 CODE");
2862 TEST_DEBUG("Input Current PIN2 Code: ");
2864 _fgets(init_old_pin_val, 9);
2866 old_pin.type = TAPI_SIM_PTYPE_PIN2; // 0x00
2867 old_pin.pw_len = strlen(init_old_pin_val);
2868 TEST_DEBUG("pw_len[%d]", old_pin.pw_len);
2869 old_pin.pw = (unsigned char*) malloc(length);
2870 memcpy(old_pin.pw, init_old_pin_val, length);
2872 TEST_DEBUG("Input New PIN2 Code: ");
2874 _fgets(init_new_pin_val, 9);
2876 new_pin.type = TAPI_SIM_PTYPE_PIN2; // 0x00
2877 new_pin.pw_len = strlen(init_new_pin_val);
2878 TEST_DEBUG("pw_len[%d]", new_pin.pw_len);
2879 new_pin.pw = (unsigned char*) malloc(length);
2880 memcpy(new_pin.pw, init_new_pin_val, length);
2882 err_code = tel_change_sim_pins(&old_pin, &new_pin, &request_id);
2884 if (err_code != TAPI_API_SUCCESS) {
2885 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2889 // unblock CHV and enter new pin code
2890 else if (memcmp(buf, "puk1", sizeof("puk1") - 1) == 0) {
2893 TEST_DEBUG("PUK1 verification");
2895 int length = TAPI_SIM_PIN_LENGTH + 1;
2896 char init_pin_val[length];
2897 char init_puk_val[length];
2899 TEST_DEBUG("Plese input PUK CODE: ");
2901 _fgets(init_puk_val, 9);
2903 TEST_DEBUG("NEW PIN1 CODE: ");
2904 _fgets(init_pin_val, 9);
2906 TelSimSecPw_t puk_data = { 0, };
2907 TelSimSecPw_t new_pin_data = { 0, };
2909 puk_data.type = TAPI_SIM_PTYPE_PUK1; // 0x00
2910 puk_data.pw_len = strlen(init_puk_val);
2911 TEST_DEBUG("pw_len[%d]", puk_data.pw_len);
2912 puk_data.pw = (unsigned char*) malloc(length);
2913 memcpy(puk_data.pw, init_puk_val, length);
2915 new_pin_data.type = TAPI_SIM_PTYPE_PIN1; // 0x00
2916 new_pin_data.pw_len = strlen(init_pin_val);
2917 TEST_DEBUG("pw_len[%d]", new_pin_data.pw_len);
2918 new_pin_data.pw = (unsigned char*) malloc(length);
2919 memcpy(new_pin_data.pw, init_pin_val, length);
2922 TEST_DEBUG("PUKtype Value %d",puk_data.type);
2923 TEST_DEBUG("PUK Value %s",puk_data.pw);
2924 TEST_DEBUG("New Pin Value %s",new_pin_data.pw);
2926 err_code = tel_verify_sim_puks(&puk_data, &new_pin_data, &request_id);
2928 if (err_code != TAPI_API_SUCCESS) {
2929 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2933 // unblock CHV2 and enter new pin2 code
2934 else if (memcmp(buf, "puk2", sizeof("puk2") - 1) == 0) {
2937 TEST_DEBUG("PUK2 verification");
2939 int length = TAPI_SIM_PIN_LENGTH + 1;
2940 char init_pin_val[length];
2941 char init_puk_val[length];
2943 TEST_DEBUG("Plese input PUK2 CODE: ");
2945 _fgets(init_puk_val, 9);
2947 TEST_DEBUG("NEW PIN2 CODE: ");
2948 _fgets(init_pin_val, 9);
2950 TelSimSecPw_t puk_data = { 0, };
2951 TelSimSecPw_t new_pin_data = { 0, };
2953 puk_data.type = TAPI_SIM_PTYPE_PUK2; // 0x00
2954 puk_data.pw_len = strlen(init_puk_val);
2955 TEST_DEBUG("pw_len[%d]", puk_data.pw_len);
2956 puk_data.pw = (unsigned char*) malloc(length);
2957 memcpy(puk_data.pw, init_puk_val, length);
2959 new_pin_data.type = TAPI_SIM_PTYPE_PIN2; // 0x00
2960 new_pin_data.pw_len = strlen(init_pin_val);
2961 TEST_DEBUG("pw_len[%d]", new_pin_data.pw_len);
2962 new_pin_data.pw = (unsigned char*) malloc(length);
2963 memcpy(new_pin_data.pw, init_pin_val, length);
2966 TEST_DEBUG("PUKtype Value %d",puk_data.type);
2967 TEST_DEBUG("PUK Value %s",puk_data.pw);
2968 TEST_DEBUG("New Pin Value %s",new_pin_data.pw);
2970 err_code = tel_verify_sim_puks(&puk_data, &new_pin_data, &request_id);
2972 if (err_code != TAPI_API_SUCCESS) {
2973 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2977 else if (memcmp(buf, "mepers", sizeof("mepers") - 1) == 0) {
2981 TelSimPersPw_t lock_pers = { 0, };
2983 printf("------------------------------ \n");
2984 printf("Personalization Type : \n");
2985 printf("------------------------------ \n");
2986 printf("1 - Network \n");
2987 printf("2 - Network Subset \n");
2988 printf("3 - Service Provider \n");
2989 printf("4 - Corporate \n");
2990 printf("------------------------------ \n");
2992 printf("\nPlease input type: \n");
2993 scanf("%d%c", &tempi, &dummy);
2997 lock_pers.type = TAPI_SIM_PERS_NET;
3002 lock_pers.type = TAPI_SIM_PERS_NS;
3007 lock_pers.type = TAPI_SIM_PERS_SP;
3012 lock_pers.type = TAPI_SIM_PERS_CP;
3017 printf("wrong pers type! exit!\n");
3023 switch (lock_pers.type) {
3024 case TAPI_SIM_PERS_NET: {
3025 puts("Flushing input - Enter \\n to exit! ");
3027 while ((ch = getchar()) != '\n' && ch != EOF)
3030 printf("Lock Personalisation MCC+MNC 5\n");
3032 "Plese input Network Lock CODE : length of MCC+MNC, MCC, MNC, NCK\n");
3034 "We need to use this for testing : length of MCC+MNC(5), MCC(450), MNC(01), NCK(12345678) => 54500112345678\n");
3036 int length = 14 + 1;
3037 char init_password_val[length];
3038 _fgets(init_password_val, 15);
3040 lock_pers.pw_len = 14;
3041 lock_pers.pw = (unsigned char*) malloc(length);
3042 memcpy(lock_pers.pw, init_password_val, length);
3047 case TAPI_SIM_PERS_NS: {
3048 puts("Flushing input - Enter \\n to exit! ");
3050 while ((ch = getchar()) != '\n' && ch != EOF)
3054 "Network Subset Personalisation MCC+MNC 5 byte, subset 2byte \n");
3056 "We need to use this for testing : length of MCC+MNC(5), MCC(450), MNC(01), lengthof NSP(2), NSP(11) NSPCK(12345678) => 54500121112345678\n");
3058 int length = 17 + 1;
3059 char init_password_val[length];
3060 _fgets(init_password_val, 18);
3062 lock_pers.pw_len = 17;
3063 lock_pers.pw = (unsigned char*) malloc(length);
3064 memcpy(lock_pers.pw, init_password_val, length);
3068 case TAPI_SIM_PERS_SP: {
3069 puts("Flushing input - Enter \\n to exit! ");
3071 while ((ch = getchar()) != '\n' && ch != EOF)
3075 "Service Provider Personalisation MCC+MNC 5 byte, SP 2byte \n");
3077 "We need to use this for testing : length of MCC+MNC(5), MCC(450), MNC(01), SP(11) SPCK(12345678) => 5450011112345678\n");
3079 int length = 16 + 1;
3080 char init_password_val[length];
3081 _fgets(init_password_val, 17);
3083 lock_pers.pw_len = 16;
3084 lock_pers.pw = (unsigned char*) malloc(length);
3085 memcpy(lock_pers.pw, init_password_val, length);
3089 case TAPI_SIM_PERS_CP: {
3090 puts("Flushing input - Enter \\n to exit! ");
3092 while ((ch = getchar()) != '\n' && ch != EOF)
3096 "Corporate Personalisation MCC+MNC 5 byte, SP 2byte CP 2byte \n");
3098 "We need to use this for testing : length of MCC+MNC(5), MCC(450), MNC(01), SP(11) CP(11) CPCK(12345678) => 545001111112345678\n");
3100 int length = 18 + 1;
3101 char init_password_val[length];
3102 _fgets(init_password_val, 19);
3104 lock_pers.pw_len = 18;
3105 lock_pers.pw = (unsigned char*) malloc(length);
3106 memcpy(lock_pers.pw, init_password_val, length);
3111 printf("wrong condition exit\n");
3117 err_code = tel_enable_sim_personalization(&lock_pers, &request_id);
3118 printf("Error Code [%x]\n", err_code);
3122 if (memcmp(buf, "medepers", sizeof("medepers") - 1) == 0) {
3126 TelSimPersPw_t lock_pers = { 0, };
3128 printf("------------------------------ \n");
3129 printf("de-Personalization Type : \n");
3130 printf("------------------------------ \n");
3131 printf("1 - Network \n");
3132 printf("2 - Network Subset \n");
3133 printf("3 - Service Provider \n");
3134 printf("4 - Corporate \n");
3135 printf("------------------------------ \n");
3137 printf("\nPlease input type: \n");
3138 scanf("%d%c", &tempi, &dummy);
3142 lock_pers.type = TAPI_SIM_PERS_NET;
3147 lock_pers.type = TAPI_SIM_PERS_NS;
3152 lock_pers.type = TAPI_SIM_PERS_SP;
3157 lock_pers.type = TAPI_SIM_PERS_CP;
3162 printf("wrong pers type! exit!\n");
3168 puts("Flushing input - Enter \\n to exit! ");
3170 while ((ch = getchar()) != '\n' && ch != EOF)
3173 printf("de Personalisation key is 8 byte \n");
3174 printf("We need to use this for testing : 12345678\n");
3177 char init_password_val[length];
3178 _fgets(init_password_val, 9);
3180 lock_pers.pw_len = 8 /*control key*/;
3181 lock_pers.pw = (unsigned char*) malloc(length);
3182 memcpy(lock_pers.pw, init_password_val, length);
3184 err_code = tel_disable_sim_personalization(&lock_pers, &request_id);
3186 printf("Error Code [%x]\n", err_code);
3190 if (memcmp(buf, "getpers", sizeof("getpers") - 1) == 0) {
3194 TelSimPersType_t type = 0;
3196 puts("Flushing input - Enter \\n to exit! ");
3198 while ((ch = getchar()) != '\n' && ch != EOF)
3201 printf("getpers status\n");
3202 printf("Here - 1\n");
3204 "================================================================ \n");
3205 printf("TAPI_SIM_PERS_NET = 0x00, /**< Network Lock */ \n");
3206 printf("TAPI_SIM_PERS_NS = 0x01, /**< Nettwork Subset Lock */\n");
3207 printf("TAPI_SIM_PERS_SP = 0x02, /**< Service Provider Lock */\n");
3208 printf("TAPI_SIM_PERS_CP = 0x03, /**< Coporate Lock */\n");
3210 "================================================================ \n");
3211 printf("Plese input Lock type \n");
3213 scanf("%d%c", &tempi, &dummy);
3216 err_code = tel_get_sim_personalization_status(type, &request_id);
3217 printf("Error Code [%x]\n", err_code);
3219 } else if (memcmp(buf, "setlang", sizeof("setlang") - 1) == 0) {
3223 TelSimLanguagePreferenceCode_t language = 0x00;
3225 printf("------------------------------ \n");
3226 printf("select language which will be updated: \n");
3227 printf("------------------------------ \n");
3228 printf("should select inside here ( 0.DE / 1.EN / 2.IT / 3.FR ) \n");
3230 "should select inside here ( 4.SPANISH / 5.DUTCH / 6.SWEDISH / 7.DANISH ) \n");
3232 "should select inside here ( 8.PORTUGUESE / 9.FINNISH / 10.NORWEGIAN / 11.GREEK ) \n");
3234 "should select inside here ( 12.TURKISH / 13.HUNGARIAN / 14.POLISH / 15.KOREAN ) \n");
3236 "should select inside here ( 16.CHINESE / 17.RUSSIAN / 18.JAPANESE ) \n");
3237 printf("------------------------------ \n");
3239 printf("\nPlease input type: \n");
3240 scanf("%d%c", &tempi, &dummy);
3242 language = (TelSimLanguagePreferenceCode_t) tempi;
3244 err_code = tel_set_sim_language(language, &request_id);
3246 if (err_code == TAPI_API_SUCCESS) {
3247 TEST_DEBUG("TAPI API SUCCESS");
3249 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3252 } else if (memcmp(buf, "apdu", sizeof("apdu") - 1) == 0) {
3253 printf("------------------------------ \n");
3255 printf("------------------------------ \n");
3257 TelSimApdu_t apdu_data = { 0, };
3259 char tmp_apdu[4] = { 0x41, 0xC0, 0x05, 0x6f };
3261 apdu_data.apdu_len = 4;
3262 apdu_data.apdu = (unsigned char*) &tmp_apdu;
3264 err_code = tel_req_sim_apdu(&apdu_data, &request_id);
3266 if (err_code == TAPI_API_SUCCESS) {
3267 TEST_DEBUG("TAPI API SUCCESS");
3269 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3272 } else if (memcmp(buf, "atr", sizeof("atr") - 1) == 0) {
3273 printf("------------------------------ \n");
3274 printf("ATR request: \n");
3275 printf("------------------------------ \n");
3277 err_code = tel_req_sim_atr(&request_id);
3279 if (err_code == TAPI_API_SUCCESS) {
3280 TEST_DEBUG("TAPI API SUCCESS");
3282 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3287 ////////////////////////////////////////////////////////////////////////
3288 /////////////////////// Phone Book ///////////////////////////////////
3289 ///////////////////////////////////////////////////////////////////////
3290 else if (memcmp(buf, "pbcapa", sizeof("pbcapa") - 1) == 0) {
3291 TEST_DEBUG("PB capability info");
3293 err_code = tel_get_sim_pb_3g_meta_info(&request_id);
3294 if (err_code != TAPI_API_SUCCESS) {
3295 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3299 else if (memcmp(buf, "pbcnt", sizeof("pbcnt") - 1) == 0) {
3300 TEST_DEBUG("PB storage count info");
3302 TelSimPbFileType_t storage_type = __InputStorageType();
3304 __PrintStorageType(storage_type);
3306 err_code = tel_get_sim_pb_count(storage_type, &request_id);
3308 if (err_code != TAPI_API_SUCCESS) {
3309 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3313 else if (memcmp(buf, "pbentry", sizeof("pbentry") - 1) == 0) {
3314 TEST_DEBUG("PB Entry info");
3316 TelSimPbFileType_t storage_type = __InputStorageType();
3318 err_code = tel_get_sim_pb_meta_info(storage_type, &request_id);
3320 if (err_code != TAPI_API_SUCCESS) {
3321 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3325 ///////////////////////////////////
3330 0x04 : WRITE (�ش� index�� data ������ ������ unconditional write)
3331 0x05 : DELETE ALL (�ش� phone book id�� ���� �����ϴ� ��� �����͸� delete)
3333 else if (memcmp(buf, "pbadd", sizeof("pbadd") - 1) == 0) {
3334 TelSimPbRecordData_t pb_add = { 0, };
3336 char unicode_text[256];
3337 int unicode_text_len = 0;
3340 TelSimPbFileType_t storage_type = __InputStorageType();
3341 pb_add.StorageFileType = storage_type;
3343 TEST_DEBUG("Plese input index : ");
3344 scanf("%d%c", &index, &dummy);
3345 pb_add.Index = index;
3347 if (pb_add.StorageFileType == TAPI_SIM_PB_EN || pb_add.StorageFileType
3348 == TAPI_SIM_PB_FDN || pb_add.StorageFileType
3349 == TAPI_SIM_PB_MSISDN || pb_add.StorageFileType
3350 == TAPI_SIM_PB_LDN || pb_add.StorageFileType == TAPI_SIM_PB_ADN
3351 || pb_add.StorageFileType == TAPI_SIM_PB_SDN) {
3353 TEST_DEBUG("2g phone book entry");
3355 TEST_DEBUG(" Number Types are below ");
3356 TEST_DEBUG(" 1 - INTERNATIONAL");
3357 TEST_DEBUG(" 2 - NATIONAL");
3358 TEST_DEBUG(" 3 - NETWORK");
3359 TEST_DEBUG(" 4 - DEDICATE");
3360 TEST_DEBUG("Select Numer Type: ");
3362 scanf("%d%c", &tmpInput, &dummy);
3363 pb_add.ContactInfo.Pb2GData.NumType = tmpInput;
3365 TEST_DEBUG("Plese input contact number : ");
3366 _fgets((char *) pb_add.ContactInfo.Pb2GData.Number, 15);
3367 pb_add.ContactInfo.Pb2GData.NumLen = strlen(
3368 (char*) pb_add.ContactInfo.Pb2GData.Number);
3370 TEST_DEBUG(" Encryption Types are below ");
3371 TEST_DEBUG(" 1 - ASCII - DO NOT SUPPORT");
3372 TEST_DEBUG(" 2 - GSM7 Bit");
3373 TEST_DEBUG(" 3 - UCS2");
3374 TEST_DEBUG(" 4 - HEX - DO NOT SUPPORT");
3375 TEST_DEBUG("Select Text Encryption Type: ");
3377 scanf("%d%c", &tmpInput, &dummy);
3378 pb_add.ContactInfo.Pb2GData.NameEncryptType = tmpInput - 1;
3380 TEST_DEBUG("Plese input contact name : ");
3381 _fgets((char *) pb_add.ContactInfo.Pb2GData.Name, 20);
3383 if (pb_add.ContactInfo.Pb2GData.NameEncryptType
3384 == TAPI_SIM_TEXT_ENC_UCS2) {
3385 TEST_DEBUG("TAPI_SIM_TEXT_ENC_UCS2 Encoding");
3386 /* unicode encoding */
3387 if (FALSE == __encode_text_unicode(
3388 strlen((char *) pb_add.ContactInfo.Pb2GData.Name),
3389 (char*) pb_add.ContactInfo.Pb2GData.Name,
3390 (char *) &unicode_text_len, unicode_text)) {
3391 TEST_DEBUG("Encoding failed ! ");
3394 pb_add.ContactInfo.Pb2GData.NameLen = unicode_text_len;
3395 memcpy(pb_add.ContactInfo.Pb2GData.Name, unicode_text,
3399 pb_add.ContactInfo.Pb2GData.NameLen = strlen(
3400 (char *) pb_add.ContactInfo.Pb2GData.Name);
3402 } else if (pb_add.StorageFileType == TAPI_SIM_PB_3GSIM) {
3404 char num_field_type;
3407 TEST_DEBUG("3g phone book entry");
3409 TEST_DEBUG("Input Nuumber of fields to be entered: ");
3411 scanf("%d%c", &tempi, &dummy);
3413 num_field_type = tempi;
3415 pb_add.ContactInfo.Pb3GData.FileTypeCount = num_field_type;
3417 for (i = 0; i < num_field_type; i++) {
3418 TEST_DEBUG(" Field Types are below ");
3419 TEST_DEBUG(" 1 - Contact Name : (EF_ADN)");
3420 TEST_DEBUG(" 2 - Contact Mobile Number (EF_ADN)");
3421 TEST_DEBUG(" 3 - Contact Another Number (EF_ANR)");
3422 TEST_DEBUG(" 4 - Contact Email (EF_EMAIL)");
3423 TEST_DEBUG(" 5 - Contact Nick Name (EF_SNE)");
3424 TEST_DEBUG(" 6 - Contact Group (EF_GRP)");
3425 TEST_DEBUG(" 7 - Contact Hidden entry (EF_PBC) - NOT SUPPORT YET");
3426 TEST_DEBUG(" 8 - Contact Another Number A (EF_ANRA)");
3427 TEST_DEBUG(" 9 - Contact Another Number B (EF_ANRB)");
3429 TEST_DEBUG("Select Field type: ");
3431 scanf("%d%c", &tempi, &dummy);
3433 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileType = tempi;
3435 if (tempi == 1 || tempi == 4 || tempi == 5 || tempi == 6) {
3436 TEST_DEBUG(" Encryption Types are below ");
3437 TEST_DEBUG(" 1 - ASCII");
3438 TEST_DEBUG(" 2 - GSM7 Bit");
3439 TEST_DEBUG(" 3 - UCS2");
3440 TEST_DEBUG(" 4 - HEX");
3441 TEST_DEBUG("Select Text Encryption Type: ");
3443 scanf("%d%c", &tempi, &dummy);
3444 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataType.EncryptionType
3448 TEST_DEBUG(" Number Types are below ");
3449 TEST_DEBUG(" 1 - INTERNATIONAL");
3450 TEST_DEBUG(" 2 - NATIONAL");
3451 TEST_DEBUG(" 3 - NETWORK");
3452 TEST_DEBUG(" 4 - DEDICATE");
3453 TEST_DEBUG("Select Numer Type: ");
3455 scanf("%d%c", &tempi, &dummy);
3456 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataType.NumType
3460 if (pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileType
3461 == TAPI_PB_3G_GRP) {
3462 int c, count, k = 0;
3464 TEST_DEBUG("Please input number of index to add in GRP");
3465 scanf("%d%c", &tempi, &dummy);
3468 for (c = 0; c < count; c++) {
3469 TEST_DEBUG("Please input index of GRP: ");
3470 scanf("%d%c", &tempi, &dummy);
3472 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData[k]
3475 //pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData[k] = 0;
3478 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataLength
3480 } else if (pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileType
3482 || pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileType
3484 || pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileType
3485 == TAPI_PB_3G_SNE) {
3486 TEST_DEBUG("Plese input field string data: ");
3488 (char *) pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData,
3491 TEST_DEBUG("strlen about input data[%d]",strlen((char *)pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData) );
3493 if (pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataType.EncryptionType
3494 == TAPI_SIM_TEXT_ENC_UCS2) {
3495 /* unicode encoding */
3497 == __encode_text_unicode(
3499 (char *) pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData),
3500 (char *) pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData,
3501 (char *) &unicode_text_len,
3503 TEST_DEBUG("Encoding failed ! ");
3506 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData,
3507 unicode_text, unicode_text_len);
3508 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataLength
3512 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataLength
3514 (char *) pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData);
3517 TEST_DEBUG("Plese input field data: ");
3519 (char *) pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData,
3521 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataLength
3523 (char *) pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData);
3528 } else if (pb_add.StorageFileType == TAPI_SIM_PB_AAS
3529 || pb_add.StorageFileType == TAPI_SIM_PB_GAS) {
3530 TEST_DEBUG("additional num Alpha string or Group Alpha string ");
3532 TEST_DEBUG("Plese input Alpha name : ");
3534 (char *) pb_add.ContactInfo.PbAdditionalNumStringData.TextData,
3537 /* GSM 7bit conversion */
3538 __encode_gsm_7_bit_chars(strlen((char *)pb_add.ContactInfo.PbAdditionalNumStringData.TextData) ,
3539 (char *)pb_add.ContactInfo.PbAdditionalNumStringData.TextData, (char *)&unicode_text_len, unicode_text);
3541 memcpy(pb_add.ContactInfo.PbAdditionalNumStringData.TextData, unicode_text, unicode_text_len );
3543 pb_add.ContactInfo.PbAdditionalNumStringData.TextLength = unicode_text_len;
3545 pb_add.ContactInfo.PbAdditionalNumStringData.EncryptionType = TAPI_SIM_TEXT_ENC_GSM7BIT; // always 2 for GAS and AAS
3547 pb_add.ContactInfo.PbAdditionalNumStringData.TextLength
3549 (char *) pb_add.ContactInfo.PbAdditionalNumStringData.TextData);
3550 pb_add.ContactInfo.PbAdditionalNumStringData.EncryptionType
3551 = TAPI_SIM_TEXT_ENC_GSM7BIT; // But real type is ASCII (because current GSM7 is GSM7 with bit 8 set to '0')
3554 TEST_DEBUG("Undefined Storage File Type [0x%x]", pb_add.StorageFileType);
3558 err_code = tel_update_sim_pb_record(&pb_add, &request_id);
3560 if (err_code != TAPI_API_SUCCESS) {
3561 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3564 } else if (memcmp(buf, "pbdel", sizeof("pbdel") - 1) == 0) {
3565 TelSimPbFileType_t storage_type = __InputStorageType();
3567 TEST_DEBUG(" PB delete ");
3569 unsigned short index = 0;
3571 TEST_DEBUG("Plese input index : ");
3572 scanf("%d%c", (int *)&index, &dummy);
3574 err_code = tel_delete_sim_pb_record(storage_type, index, &request_id);
3576 if (err_code != TAPI_API_SUCCESS) {
3577 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3580 } else if (memcmp(buf, "pbread", sizeof("pbread") - 1) == 0) {
3581 TEST_DEBUG("PB read");
3583 unsigned short index = 0;
3586 TelSimPbFileType_t storage_type = __InputStorageType();
3588 TEST_DEBUG("Plese input index : ");
3589 scanf("%d%c", (int *)&index, &dummy);
3591 err_code = tel_read_sim_pb_record(storage_type, index, &request_id);
3593 if (err_code != TAPI_API_SUCCESS) {
3594 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3598 else if (memcmp(buf, "isimauth", sizeof("isimauth") - 1) == 0) {
3599 TEST_DEBUG("ISIM Authentication ");
3603 TelSimIsimAuthenticationData_t auth_req = { 0, };
3605 memset(&auth_req, 0, sizeof(TelSimIsimAuthenticationData_t));
3607 TEST_DEBUG(" Enter RAND data ");
3608 _fgets((char *) &auth_req.RandomAccessData, 20);
3610 auth_req.RandomAccessLength
3611 = strlen((char *) auth_req.RandomAccessData);
3613 TEST_DEBUG(" Enter Authentication data ");
3614 _fgets((char *) &auth_req.AuthData, 20);
3616 auth_req.AuthDataLength = strlen((char *) auth_req.AuthData);
3618 TEST_DEBUG("TelTapiSimIsimAuthenticationRequest is not tested yet!");
3620 err_code = TelTapiSimIsimAuthenticationRequest( &auth_req, &request_id);
3622 if(err_code == TAPI_API_SUCCESS)
3624 TEST_DEBUG("TAPI API SUCCESS");
3628 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3634 else if (memcmp(buf, "sapcon", sizeof("sapcon") - 1) == 0) {
3635 TEST_DEBUG("SAP Connect request ");
3636 TelSimSapConnect_t con_req = { 0, };
3637 con_req.MsgId = TAPI_SIM_SAP_CONNECT_REQ;
3638 con_req.MaxMsgSize = 10; //temp for testing only - not clear
3640 err_code = tel_req_sap_connection(&con_req, &request_id);
3642 if (err_code != TAPI_API_SUCCESS) {
3643 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3647 else if (memcmp(buf, "sapdiscon", sizeof("sapdiscon") - 1) == 0) {
3648 TEST_DEBUG("SAP Disconnect request ");
3649 TelSimSapConnect_t con_req = { 0, };
3650 con_req.MsgId = TAPI_SIM_SAP_DISCONNECT_REQ;
3651 con_req.MaxMsgSize = 10; //temp for testing only - not clear
3653 err_code = tel_req_sap_connection(&con_req, &request_id);
3655 if (err_code != TAPI_API_SUCCESS) {
3656 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3660 else if (memcmp(buf, "sapstatus", sizeof("sapstatus") - 1) == 0) {
3661 TEST_DEBUG("SAP Status request ");
3663 err_code = tel_req_sap_connection_status(&request_id);
3665 if (err_code != TAPI_API_SUCCESS) {
3666 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3670 else if (memcmp(buf, "sapatr", sizeof("sapatr") - 1) == 0) {
3671 TEST_DEBUG("SAP ATR request ");
3673 err_code = tel_req_sap_transfer_atr(&request_id);
3675 if (err_code != TAPI_API_SUCCESS) {
3676 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3680 else if (memcmp(buf, "sapapdu", sizeof("sapapdu") - 1) == 0) {
3681 TEST_DEBUG("SAP APDU transfer ");
3683 int file_id = TAPI_SIM_EFILE_ICCID;
3685 /* for selecting EF ICCID */
3686 TelSimSapApduData_t apdu_data;
3688 apdu_data.ApduLength = 7;
3689 apdu_data.Apdu[0] = 0xA0; // class
3690 apdu_data.Apdu[1] = 0xA4; // instruction
3691 apdu_data.Apdu[2] = 0; // p1 = parameter 1
3692 apdu_data.Apdu[3] = 0; // p2 = parameter 2
3693 apdu_data.Apdu[4] = 2; // p3 - parameter 3
3695 memcpy(&apdu_data.Apdu[5], &file_id, sizeof(unsigned short));
3697 err_code = tel_req_sap_transfer_apdu(&apdu_data, &request_id);
3699 if (err_code == TAPI_API_SUCCESS) {
3700 TEST_DEBUG("TAPI API SUCCESS");
3702 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3706 else if (memcmp(buf, "sapsetproto", sizeof("sapsetproto") - 1) == 0) {
3707 TEST_DEBUG("SAP set protocol ");
3708 TelSimSapProtocol_t protocol = TAPI_SIM_SAP_PROTOCOL_T0;
3710 err_code = tel_req_sap_transport_protocol(protocol, &request_id);
3712 if (err_code != TAPI_API_SUCCESS) {
3713 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3717 else if (memcmp(buf, "sapsimpwr", sizeof("sapsimpwr") - 1) == 0) {
3719 TelSimSapMsgId_t msdId = 0;
3723 TEST_DEBUG("SAP SIM power ");
3725 TEST_DEBUG("Please input SAP SIM power on(1) / off(!1): ");
3727 scanf("%d%c", &tempi, &dummy);
3729 msdId = TAPI_SIM_SAP_POWER_SIM_ON_REQ;
3731 msdId = TAPI_SIM_SAP_POWER_SIM_OFF_REQ;
3733 err_code = tel_req_sap_power_operation(msdId, &request_id);// only for testing
3735 if (err_code != TAPI_API_SUCCESS) {
3736 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3740 if (memcmp(buf, "close", sizeof("close") - 1) == 0) {
3741 TEST_DEBUG(" close reuqest ");
3743 // err_code = tapi_sim_close(92);
3745 //err_code = tapi_sim_close(g_test_hsim);
3746 TEST_DEBUG(" ret value from close [0x%x]", err_code);
3748 if (err_code == TAPI_API_SUCCESS) {
3749 TEST_DEBUG(" sim close OK!");
3751 TEST_DEBUG(" SIM close request returned error [0x%x] !",err_code );
3753 TEST_DEBUG("Request ID [0x%x]", request_id);
3756 if (memcmp(buf, "q", sizeof("q") - 1) == 0) {
3757 TEST_DEBUG("Finished Testing this module, Going back to Main Menu");
3765 void sim_select_loop(void) {
3771 FD_SET(0, &readfds);
3773 ret = select(0 + 1, &readfds, NULL, NULL, NULL);
3776 if (FD_ISSET(0, &readfds)) {
3777 if (sim_read_key_input() < 0)
3784 void* sim_test_thread_loop(void* data) {
3785 TEST_DEBUG(" sim_test_thread_loop : called...");
3789 TEST_DEBUG(" sim_test_thread_loop : stdin Loop exited");
3794 int sim_main(int argc, char *argv[]) {
3797 p_thread = pthread_create(&p_thread, NULL, sim_test_thread_loop, NULL);
3799 if (p_thread != 0) {
3800 TEST_DEBUG("Failed while creating a thread to read from stdin");
3803 TEST_DEBUG("A thread was created to read from stdin ..");
3806 sim_test_subscribe_tapi_events();
3808 pthread_join(p_thread, NULL);
3810 TEST_DEBUG("Exiting sim test program bye bye !");