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_AUTHENTICATION_CNF: {
1310 TEST_DEBUG("*****************IMS Authentication **********************");
1312 TelSimAuthenticationResponse_t *auth_resp =
1313 (TelSimAuthenticationResponse_t*) sim_event->pData;
1315 TEST_DEBUG("SIM ISIM authentication event status = [0x%x]", sim_event->Status);
1317 TEST_DEBUG(" auth resp data [%s]",auth_resp->ResponeData);
1318 TEST_DEBUG(" auth string [%s]",auth_resp->AuthenticationString);
1319 TEST_DEBUG(" auth cipher key [%s]",auth_resp->CipherKey);
1320 TEST_DEBUG(" auth integrity key [%s]",auth_resp->IntegrityKey);
1325 case TAPI_EVENT_SIM_SAP_CONNECT_CNF: {
1326 TEST_DEBUG("*********** SAP CONNECT RESP *************");
1328 TelSimSapConnect_t *sap_conn_resp =
1329 (TelSimSapConnect_t*) sim_event->pData;
1331 TEST_DEBUG("SIM SAP connect request event status = [0x%x]", sim_event->Status);
1333 TEST_DEBUG(" message id [0x%x]", sap_conn_resp->MsgId);
1334 TEST_DEBUG("connection status [0x%x] ", sap_conn_resp->ConnectionStatus);
1335 TEST_DEBUG("max message size [%d]", sap_conn_resp->MaxMsgSize);
1337 TEST_DEBUG("*****************************************");
1341 case TAPI_EVENT_SIM_SAP_CONNECT_STATUS_CNF: {
1342 TEST_DEBUG("*********** SAP CONNECT STATUS *************");
1344 TEST_DEBUG("SIM SAP connect event status = [0x%x]", sim_event->Status);
1346 TelSimSapStatusInfo_t *sap_conn_status =
1347 (TelSimSapStatusInfo_t*) sim_event->pData;
1348 TEST_DEBUG(" connection status info [0x%x]", *sap_conn_status);
1350 TEST_DEBUG("*****************************************");
1354 case TAPI_EVENT_SIM_SAP_TRANSFER_ATR_CNF: {
1355 TEST_DEBUG("*********** SAP TRANSFER ATR *************");
1358 TelSimSapAtrInfo_t *sap_transfer_atr =
1359 (TelSimSapAtrInfo_t*) sim_event->pData;
1361 TEST_DEBUG("SIM SAP trasfer ATR event status = [0x%x]", sim_event->Status);
1363 TEST_DEBUG(" ATR result [0x%x]", sap_transfer_atr->AtrResult);
1364 TEST_DEBUG(" ATR length [%lu]", sap_transfer_atr->AtrLength);
1365 TEST_DEBUG(" ATR data ---> " );
1366 for (i = 0; i < sap_transfer_atr->AtrLength; i++)
1367 TEST_DEBUG(" [0x%x]", sap_transfer_atr->AtrData[i]);
1369 TEST_DEBUG("*****************************************");
1373 case TAPI_EVENT_SIM_SAP_TRANSFER_APDU_CNF: {
1374 TEST_DEBUG("*********** SAP TRANSFER APDU *************");
1377 TelSimSapApduData_t *sap_transfer_apdu =
1378 (TelSimSapApduData_t*) sim_event->pData;
1380 TEST_DEBUG("SIM SAP trasfer APDU event status = [0x%x]", sim_event->Status);
1382 TEST_DEBUG(" APDU length [0x%x]", sap_transfer_apdu->ApduLength);
1383 TEST_DEBUG(" APDU data ---> " );
1384 for (i = 0; i < sap_transfer_apdu->ApduLength; i++)
1385 TEST_DEBUG(" [0x%x]", sap_transfer_apdu->Apdu[i]);
1387 TEST_DEBUG("*****************************************");
1391 case TAPI_EVENT_SIM_SAP_SET_PROTOCOL_CNF: {
1392 TEST_DEBUG("*********** SAP SET PROTOCOL *************");
1394 TelSimSapProtocol_t *sap_result_code =
1395 (TelSimSapProtocol_t*) sim_event->pData;
1397 TEST_DEBUG("SIM SAP set protocol event status = [0x%x]", sim_event->Status);
1398 TEST_DEBUG("SAP SET protocol result [0x%x]", *sap_result_code );
1400 TEST_DEBUG("*****************************************");
1404 case TAPI_EVENT_SIM_SAP_SET_SIM_POWER_CNF: {
1405 TEST_DEBUG("*********** SAP SET SIM POWER ON/OFF *************");
1407 TelSimSapPower_t *sap_sim_power =
1408 (TelSimSapPower_t*) sim_event->pData;
1410 TEST_DEBUG("SIM SAP set SIM power event status = [0x%x]", sim_event->Status);
1412 TEST_DEBUG("message id [0x%x]", sap_sim_power->MsgId);
1413 TEST_DEBUG(" sim power on/off result [0x%x]", sap_sim_power->SimPowerResult);
1415 TEST_DEBUG("*****************************************");
1419 case TAPI_EVENT_SIM_SAP_CARD_READER_STATUS_CNF: {
1420 TEST_DEBUG("*********** SAP CARD READER STATUS *************");
1422 TelSimCardReaderStatus_t *sap_card_reader_status =
1423 (TelSimCardReaderStatus_t*) sim_event->pData;
1425 TEST_DEBUG("SIM SAP card reader event status = [0x%x]", sim_event->Status);
1427 TEST_DEBUG(" card reader result [0x%x] ", sap_card_reader_status->CardReaderResult);
1428 TEST_DEBUG(" card reader status bitwise encoded data [%d]", sap_card_reader_status->CardReaderStatus);
1430 TEST_DEBUG("*****************************************");
1435 /******************************************************************************************************************************/
1437 /******************************************************************************************************************************/
1438 case TAPI_EVENT_SIM_RSIM_ACCESS_CNF: {
1439 TEST_DEBUG("********NEW*TAPI_EVENT_SIM_RSIM_ACCESS_CNF**********");
1441 TelSimReadFileRaw_t * rsim_resp =
1442 (TelSimReadFileRaw_t*) sim_event->pData;
1444 if (sim_event->Status == TAPI_SIM_ACCESS_SUCCESS) {
1445 TEST_DEBUG("rsim_resp->sw1[0x%x]", rsim_resp->sw1);
1446 TEST_DEBUG("rsim_resp->sw2[0x%x]", rsim_resp->sw2);
1447 TEST_DEBUG("rsim_resp->DataLen[%d]", rsim_resp->DataLen);
1448 TEST_DEBUG("rsim_resp->Data[%s]", rsim_resp->Data);
1450 TEST_DEBUG("OPERATION FAILED");
1453 TEST_DEBUG("********NEW*TAPI_EVENT_SIM_RSIM_ACCESS_CNF**********");
1457 case TAPI_EVENT_SIM_VERIFY_SEC_CNF: {
1458 TEST_DEBUG("********NEW*TAPI_EVENT_SIM_VERIFY_SEC_CNF**********");
1460 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*) sim_event->pData;
1462 //TEST_DEBUG("SIM Verify PIN event status = [0x%x]", sim_event->Status);
1464 if (sim_event->Status == TAPI_SIM_OPERATION_TIMEOUT) {
1465 TEST_DEBUG("TAPI SIM Operation Timeout!!");
1466 } else if (sim_event->Status == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1467 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1468 TEST_DEBUG("PIN1 Verification Success!");
1469 } else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM) {
1470 TEST_DEBUG("PIN1 Verification Success!");
1472 TEST_DEBUG("PIN2 Vefication Success!");
1475 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1476 TEST_DEBUG("PIN1 Verification Failed! - PIN Required ");
1477 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1478 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1) {
1479 TEST_DEBUG("PIN1 Verification Failed! - PUK Required ");
1480 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1481 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1482 TEST_DEBUG("PIN2 Verification Failed! - PIN2 Required ");
1483 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1484 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2) {
1485 TEST_DEBUG("PIN2 Verification Failed! - PUK2 Required ");
1486 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1487 } else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM) {
1488 TEST_DEBUG("SIM Lock Verification Failed! - SIM Lock code Required");
1489 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1492 TEST_DEBUG("********************************************");
1496 case TAPI_EVENT_SIM_VERIFY_PUK_CNF: {
1497 TEST_DEBUG("**********NEW*TAPI_EVENT_SIM_VERIFY_PUK_CNF********");
1499 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*) sim_event->pData;
1501 //TEST_DEBUG("SIM Unblock PIN event status = [0x%x]", sim_event->Status);
1503 if (sim_event->Status == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1504 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1505 TEST_DEBUG("Unblock PIN1 Success!");
1506 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1507 TEST_DEBUG("Unblock PIN2 Success!");
1510 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1511 TEST_DEBUG("PIN1 Verification Failed! - PIN Required ");
1512 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1513 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1) {
1514 TEST_DEBUG("PIN1 Verification Failed! - PUK Required ");
1515 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1516 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1517 TEST_DEBUG("PIN2 Verification Failed! - PIN2 Required ");
1518 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1519 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2) {
1520 TEST_DEBUG("PIN2 Verification Failed! - PUK2 Required ");
1521 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1524 TEST_DEBUG("********************************************");
1528 case TAPI_EVENT_SIM_CHANGE_PINS_CNF: {
1529 TEST_DEBUG("********NEW*TAPI_EVENT_SIM_CHANGE_PINS_CNF***************************");
1531 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*) sim_event->pData;
1533 //TEST_DEBUG("SIM Change PIN event status = [0x%x], pinType[%d]", sim_event->Status, pPinInfo->PinType);
1534 TEST_DEBUG("PinType[%d]", pPinInfo->type);
1536 if (sim_event->Status == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1537 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1538 TEST_DEBUG("Change PIN1 Success!");
1540 TEST_DEBUG("Change PIN2 Success!");
1543 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1544 TEST_DEBUG("PIN1 Verification Failed! - PIN Required ");
1545 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1546 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1) {
1547 TEST_DEBUG("PIN1 Verification Failed! - PUK Required ");
1548 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1549 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1550 TEST_DEBUG("PIN2 Verification Failed! - PIN2 Required ");
1551 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1552 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2) {
1553 TEST_DEBUG("PIN2 Verification Failed! - PUK2 Required ");
1554 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1557 TEST_DEBUG("********************************************");
1561 case TAPI_EVENT_SIM_DISABLE_SEC_CNF: {
1562 TEST_DEBUG("****************NEW*TAPI_EVENT_SIM_DISABLE_SEC_CNF****************");
1564 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*) sim_event->pData;
1566 //TEST_DEBUG("SIM Disable SEC event status = [0x%x]", sim_event->Status);
1568 if (sim_event->Status == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1569 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1570 TEST_DEBUG("Disable PIN1 Success!");
1571 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1572 TEST_DEBUG("Disable PIN2 Success!");
1573 } else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM) {
1574 TEST_DEBUG("Disable SIM LOCK Success!");
1577 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1578 TEST_DEBUG("PIN1 Verification Failed! - PIN1Required ");
1579 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1580 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1581 TEST_DEBUG("PIN2 Verification Failed! - PIN2 Required ");
1582 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1583 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1) {
1584 TEST_DEBUG("PIN1 Verification Failed! - PUK1 Required ");
1585 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1586 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2) {
1587 TEST_DEBUG("PIN2 Verification Failed! - PUK2 Required ");
1588 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1589 } else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM) {
1590 TEST_DEBUG("SIM LOCK Verification Failed! - SIM LOCK CODE Required ");
1591 TEST_DEBUG("Remainint attempts [%d] - Useless value", pPinInfo->retry_count);
1594 TEST_DEBUG("********************************************");
1599 case TAPI_EVENT_SIM_ENABLE_SEC_CNF: {
1600 TEST_DEBUG("****************NEW*TAPI_EVENT_SIM_ENABLE_SEC_CNF****************");
1602 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*) sim_event->pData;
1604 //TEST_DEBUG("SIM ENABLE SEC event status = [0x%x]", sim_event->Status);
1606 if (sim_event->Status == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1607 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1608 TEST_DEBUG("Enable PIN1 Success!");
1609 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1610 TEST_DEBUG("Enable PIN2 Success!");
1611 } else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM) {
1612 TEST_DEBUG("Enable SIM LOCK Success!");
1615 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1) {
1616 TEST_DEBUG("PIN1 Verification Failed! - PIN1Required ");
1617 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1618 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1619 TEST_DEBUG("PIN2 Verification Failed! - PIN2 Required ");
1620 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1621 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1) {
1622 TEST_DEBUG("PIN1 Verification Failed! - PUK1 Required ");
1623 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1624 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2) {
1625 TEST_DEBUG("PIN2 Verification Failed! - PUK2 Required ");
1626 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1627 } else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM) {
1628 TEST_DEBUG("SIM LOCK Verification Failed! - SIM LOCK CODE Required ");
1629 TEST_DEBUG("Remainint attempts [%d] - Useless value", pPinInfo->retry_count);
1632 TEST_DEBUG("********************************************");
1636 case TAPI_EVENT_SIM_DISABLE_FDNMODE_CNF: {
1637 TEST_DEBUG("****************NEW*TAPI_EVENT_SIM_DISABLE_FDNMODE_CNF****************");
1639 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*) sim_event->pData;
1641 //TEST_DEBUG("SIM Disable FDN event status = [0x%x]", sim_event->Status);
1643 if (sim_event->Status == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1644 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1645 TEST_DEBUG("Disable FDN Success!");
1647 TEST_DEBUG("Unhandled type[%d]", pPinInfo->type);
1650 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1651 TEST_DEBUG("PIN2 Verification Failed! - PIN2 Required ");
1652 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1653 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2) {
1654 TEST_DEBUG("PIN2 Verification Failed! - PUK2 Required ");
1655 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1657 TEST_DEBUG("Unhandled type[%d]", pPinInfo->type);
1660 TEST_DEBUG("********************************************");
1664 case TAPI_EVENT_SIM_ENABLE_FDNMODE_CNF: {
1665 TEST_DEBUG("****************NEW*TAPI_EVENT_SIM_ENABLE_FDNMODE_CNF****************");
1667 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*) sim_event->pData;
1669 //TEST_DEBUG("SIM Enable FDN event status = [0x%x]", sim_event->Status);
1671 if (sim_event->Status == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1672 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1673 TEST_DEBUG("Enable FDN Success!");
1675 TEST_DEBUG("Unhandled type[%d]", pPinInfo->type);
1678 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2) {
1679 TEST_DEBUG("PIN2 Verification Failed! - PIN2 Required ");
1680 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1681 } else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2) {
1682 TEST_DEBUG("PIN2 Verification Failed! - PUK2 Required ");
1683 TEST_DEBUG("Remainint attempts [%d]", pPinInfo->retry_count);
1685 TEST_DEBUG("Unhandled type[%d]", pPinInfo->type);
1688 TEST_DEBUG("********************************************");
1692 case TAPI_EVENT_SIM_PERS_STATUS_CNF: {
1693 TelSimPersStatus_t* pers_status =
1694 (TelSimPersStatus_t*) sim_event->pData;
1697 "[SIM APP]**********NEW* TAPI_EVENT_SIM_PERS_STATUS_CNF************\n");
1698 printf("[SIM APP]SIM lock personalisation event status = [%x]\n",
1701 "[SIM APP]SIM lock personalisation status - net0-ns1-sp2-cp3 = [%d]\n",
1704 "[SIM APP]SIM lock personalisation status - unlock0-lock1 = [%d]\n",
1707 "[SIM APP]***************************************************\n");
1711 case TAPI_EVENT_SIM_DISABLE_PERS_CNF: {
1712 TelSimPinOperationResult_t opResult =
1713 (TelSimPinOperationResult_t) sim_event->Status;
1716 "[SIM APP]*********NEW*TAPI_EVENT_SIM_DISABLE_PERS_CNF************\n");
1717 printf("[SIM APP]Eable Personalization event status = [%x]\n",
1720 if (opResult == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1721 printf("[SIM APP]Disable Personalization Success!\n");
1724 "[SIM APP]Verification Failed! - Correct Password Required\n");
1727 "\n***************************************************************\n");
1731 case TAPI_EVENT_SIM_ENABLE_PERS_CNF: {
1732 TelSimPinOperationResult_t opResult =
1733 (TelSimPinOperationResult_t) sim_event->Status;
1736 "[SIM APP]*********NEW*TAPI_EVENT_SIM_ENABLE_PERS_CNF************\n");
1737 printf("[SIM APP]Eable Personalization event status = [%x]\n",
1740 if (opResult == TAPI_SIM_PIN_OPERATION_SUCCESS) {
1741 printf("[SIM APP]Enable Personalization Success!\n");
1744 "[SIM APP]Verification Failed! - Correct Password Required\n");
1747 "\n***************************************************************\n");
1751 case TAPI_EVENT_SIM_SET_LANGUAGE_CNF: {
1752 TEST_DEBUG("*********NEW*TAPI_EVENT_SIM_SET_LANGUAGE_CNF************");
1753 TEST_DEBUG("update event status = [0x%x]", sim_event->Status);
1754 TEST_DEBUG("**********************************************************");
1758 case TAPI_EVENT_SIM_APDU_CNF: {
1759 TelSimApduResp_t* apdu_resp = (TelSimApduResp_t*) sim_event->pData;
1761 TEST_DEBUG("*********NEW*TAPI_EVENT_SIM_APDU_CNF************");
1762 TEST_DEBUG("update event status = [0x%x]", sim_event->Status);
1764 if (sim_event->Status == 1234) {
1765 TEST_DEBUG("timeout happended. this means, modem didn`t reply");
1769 if (apdu_resp != NULL) {
1770 TEST_DEBUG("apdu_resp->apdu_resp_len[%d]",apdu_resp->apdu_resp_len);
1772 for (i = 0; i < apdu_resp->apdu_resp_len; i++)
1773 TEST_DEBUG("apdu_resp->apdu_resp[%d]=[0x%x]",i,apdu_resp->apdu_resp[i]);
1776 TEST_DEBUG("atr_resp == NULL");
1778 TEST_DEBUG("**********************************************************");;
1782 case TAPI_EVENT_SIM_ATR_CNF: {
1783 TelSimAtrResp_t* atr_resp = (TelSimAtrResp_t*) sim_event->pData;
1786 TEST_DEBUG("*********NEW*TAPI_EVENT_SIM_ATR_CNF************");
1787 TEST_DEBUG("update event status = [0x%x]", sim_event->Status);
1789 if (sim_event->Status == 1234) {
1790 TEST_DEBUG("timeout happended. this means, modem didn`t reply");
1794 if (atr_resp != NULL) {
1795 TEST_DEBUG("atr_resp->atr_resp_len[%d]",atr_resp->atr_resp_len);
1797 for (i = 0; i < atr_resp->atr_resp_len; i++)
1798 TEST_DEBUG("atr_resp->atr_resp[%d]=[0x%x]",i,atr_resp->atr_resp[i]);
1800 TEST_DEBUG("atr_resp == NULL");
1802 TEST_DEBUG("**********************************************************");
1808 case TAPI_SIM_EVENT_PB_GET_STORAGE_LIST:
1810 TEST_DEBUG("****************TAPI_SIM_EVENT_PB_GET_STORAGE_LIST****************************");
1811 char *p = (char*)&sim_event->pData;
1813 TEST_DEBUG("SIM phone book storage list Information ");
1815 TEST_DEBUG("IPC_PB_STORAGE_TYPE_DC - ME Dailled Call list");
1817 TEST_DEBUG("IPC_PB_STORAGE_TYPE_EN - Emergency Number");
1819 TEST_DEBUG("IPC_PB_STORAGE_TYPE_FD - Fixed dialing phonebook");
1821 TEST_DEBUG("IPC_PB_STORAGE_TYPE_LD - Last dialled phonebook");
1823 TEST_DEBUG("IPC_PB_STORAGE_TYPE_MC -Missed call list");
1825 TEST_DEBUG("IPC_PB_STORAGE_TYPE_ME - ME phone book");
1827 TEST_DEBUG("IPC_PB_STORAGE_TYPE_MT - ME and sim combined phone book");
1829 TEST_DEBUG("IPC_PB_STORAGE_TYPE_ON - My own number - MSISDN");
1831 TEST_DEBUG("IPC_PB_STORAGE_TYPE_RC - ME Received calls");
1833 TEST_DEBUG("IPC_PB_STORAGE_TYPE_SIM - SIM phone book");
1835 TEST_DEBUG("IPC_PB_STORAGE_TYPE_SDN - Service dailing number");
1837 TEST_DEBUG("********************************************");
1843 TEST_DEBUG("Undhandled event type [0x%x]",sim_event->EventType)
1847 }//end switch (Type)
1849 TEST_DEBUG("Undhandled EventClass [0x%x]",sim_event->EventClass);
1856 int sim_read_key_input(void) {
1857 char buf[256] = { 0, };
1859 TapiResult_t err_code = TAPI_API_SUCCESS;
1862 ret = read(0, buf, sizeof(buf));
1869 } else if (ret == 0)
1872 printf("************************************\n");
1873 printf("op : show all OP | q : quit sim test app \n");
1874 printf("************************************\n");
1875 printf("SIM OP in : %s\n", buf);
1877 if (memcmp(buf, "op", sizeof("op") - 1) == 0) {
1878 printf("***************************** NEW Asynchronous APIs *******************************\n");
1879 printf("rsim : rsim \n");
1880 printf("pin1 : verify pin1 number \n");
1881 printf("pin2 : verify pin2 number\n");
1882 printf("sim : verify sim lock number\n");
1883 printf("puk1 : Unblocking CHV1 \n");
1884 printf("puk2 : Unblocking CHV2 \n");
1885 printf("chpin1 : change pin1 number \n");
1886 printf("chpin2 : change pin2 number \n");
1887 printf("enpin : CHV enable\n");
1888 printf("dispin : CHV disable\n");
1889 printf("enfdn : FDN enable\n");
1890 printf("disfdn : FDN disable\n");
1891 printf("ensim : enable sim lock\n");
1892 printf("dissim : disable sim lock\n");
1893 printf("getpers : Get lock personalisation information \n");
1894 printf("medepers : de-personalization test\n");
1895 printf("mepers : personalization test\n");
1896 printf("setlang : update sim language info\n");
1897 printf("apdu : send apdu\n");
1898 printf("atr : request atr\n");
1899 printf("***************************** Synchronous APIs *******************************\n");
1900 printf("siminit : Get SIM init Information\n");
1901 printf("getpin1 : Get CHV1 status info\n");
1902 printf("getfdn : Get FDN status info\n");
1903 printf("getpin2 : Get CHV2 status Info \n");
1904 printf("getsim : Get CHV2 status Info \n");
1905 printf("gettype : show Sim Card Type\n");
1906 printf("getimsi : show Sim IMSI\n");
1907 printf("geticcid : show Sim ICCID\n");
1908 printf("getlang:Language Indication Info\n");
1909 printf("getecc : get SIM ECC\n");
1910 printf("getuecc : get USIM ECC\n");
1911 printf("getmb : get mailbox number\n");
1912 printf("getmw : get message waiting information\n");
1913 printf("getcf : get callforwarding information\n");
1914 printf("getcphs : get cphs information\n");
1915 printf("getmsisdn : get msisdn information\n");
1916 printf("******************************* PHONE BOOK ***********************************\n");
1917 printf("pbinit : Get pb init info\n");
1918 printf("pbcapa : pb capability info \n");
1919 printf("pbcnt : phonebook used and total count\n");
1920 printf("pbentry : phonebook entry info\n");
1921 printf("pbadd : phonebook add\n");
1922 printf("pbdel : phonebook delete\n");
1923 printf("pbread:phonebook read\n");
1924 // printf("****************************** SAP commands **********************************\n");
1925 // printf("sapconnect: SAP Connect request\n");
1926 // printf("sapstatus : SAP current connection status request \n");
1927 // printf("sapatr: SAP transfer atr request\n");
1928 // printf("sapapdu: SAP transfer apdu request\n");
1929 // printf("sapsetproto: SAP set protocol request\n");
1930 // printf("sapsimpwr: SAP SIM power on/off request\n");
1931 // printf("sapreaderstat: SAP card reader status request\n");
1932 // printf("*****************************************************************************\n");
1936 if (memcmp(buf, "siminit", sizeof("siminit") - 1) == 0) {
1937 TelSimCardStatus_t status = 0x00;
1938 int b_card_changed = 0;
1940 err_code = tel_get_sim_init_info(&status, &b_card_changed);
1942 if (err_code == TAPI_API_SUCCESS) {
1943 TEST_DEBUG("*************************************************************");
1944 __PrintCardStatus("CardStatus: ", status);
1945 TEST_DEBUG("b_card_changed[%d]\n",b_card_changed);
1946 TEST_DEBUG("*************************************************************");
1948 TEST_DEBUG("TAPI Fail: Error Code [%d]\n",err_code);
1950 } else if (memcmp(buf, "rsim", sizeof("rsim") - 1) == 0) {
1951 TEST_DEBUG("rsim....");
1953 TelSimRSimReq_t rsim = { 0, };
1955 rsim.file_id = 0x6F60;
1956 rsim.rsim_cmd = TAPI_SIM_GET_RESPONSE;
1958 err_code = tel_req_sim_access((const TelSimRSimReq_t*) &rsim,
1960 if (err_code != TAPI_API_SUCCESS) {
1961 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
1963 } else if (memcmp(buf, "pin1", sizeof("pin1") - 1) == 0) {
1964 TEST_DEBUG("Pin1 Verification");
1965 int length = TAPI_SIM_PIN_LENGTH + 1;
1966 char init_pin_val[TAPI_SIM_PIN_LENGTH + 1];
1970 TEST_DEBUG(" PUT PIN1 CODE: ");
1972 _fgets(init_pin_val, 9);
1974 TelSimSecPw_t pin_data = { 0, };
1976 pin_data.type = TAPI_SIM_PTYPE_PIN1; // 0x00
1977 pin_data.pw_len = strlen(init_pin_val);
1979 TEST_DEBUG("pw_len[%d]", pin_data.pw_len);
1981 pin_data.pw = (unsigned char*) malloc(length);
1982 memcpy(pin_data.pw, init_pin_val, length);
1984 err_code = tel_verifiy_sim_pins(&pin_data, &request_id);
1986 if (err_code != TAPI_API_SUCCESS) {
1987 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
1990 } else if (memcmp(buf, "pin2", sizeof("pin2") - 1) == 0) {
1991 TEST_DEBUG("Pin2 Verification");
1992 int length = TAPI_SIM_PIN_LENGTH + 1;
1993 char init_pin_val[TAPI_SIM_PIN_LENGTH + 1];
1997 TEST_DEBUG(" PUT PIN2 CODE: ");
1999 _fgets(init_pin_val, 9);
2001 TelSimSecPw_t pin_data = { 0, };
2003 pin_data.type = TAPI_SIM_PTYPE_PIN2; // 0x00
2004 pin_data.pw_len = strlen(init_pin_val);
2005 TEST_DEBUG("pw_len[%d]", pin_data.pw_len);
2007 pin_data.pw = (unsigned char*) malloc(length);
2008 memcpy(pin_data.pw, init_pin_val, length);
2010 err_code = tel_verifiy_sim_pins(&pin_data, &request_id);
2012 if (err_code != TAPI_API_SUCCESS) {
2013 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2016 } else if (memcmp(buf, "sim", sizeof("sim") - 1) == 0) {
2017 TEST_DEBUG("sim lock verification");
2018 int length = TAPI_SIM_PIN_LENGTH + 1;
2019 char init_pin_val[TAPI_SIM_PIN_LENGTH + 1];
2021 //puts("Flushing input - Enter \ to exit! ");
2022 //while ((ch = getchar()) != '\n' && ch != EOF);
2025 TEST_DEBUG(" PUT SIM LOCK CODE: 4 DIGIT ");
2027 _fgets(init_pin_val, 9);
2029 TelSimSecPw_t pin_data = { 0, };
2031 pin_data.type = TAPI_SIM_PTYPE_SIM; // 0x06
2032 pin_data.pw_len = strlen(init_pin_val);
2033 TEST_DEBUG("pw_len[%d]", pin_data.pw_len);
2035 pin_data.pw = (unsigned char*) malloc(length);
2036 memcpy(pin_data.pw, init_pin_val, length);
2038 err_code = tel_verifiy_sim_pins(&pin_data, &request_id);
2040 if (err_code != TAPI_API_SUCCESS) {
2041 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2045 else if (memcmp(buf, "dispin", sizeof("dispin") - 1) == 0) {
2048 TEST_DEBUG("Disable npin1");
2049 TEST_DEBUG("Plese input PIN1 CODE: ");
2051 int length = TAPI_SIM_PIN_LENGTH + 1;
2052 char init_pin_val[length];
2054 _fgets(init_pin_val, 9);
2056 TelSimSecPw_t sec_data = { 0, };
2057 sec_data.type = TAPI_SIM_PTYPE_PIN1; // 0x00
2058 sec_data.pw_len = strlen(init_pin_val);
2059 TEST_DEBUG("pw_len[%d]", sec_data.pw_len);
2061 sec_data.pw = (unsigned char*) malloc(length);
2062 memcpy(sec_data.pw, init_pin_val, length);
2064 err_code = tel_disable_sim_security(&sec_data, &request_id);
2066 if (err_code != TAPI_API_SUCCESS) {
2067 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2072 else if (memcmp(buf, "enpin", sizeof("enpin") - 1) == 0) {
2073 //TEST_DEBUG("Flushing input - Enter \ to exit!");
2074 //while ((ch = getchar()) != '\n' && ch != EOF);
2077 TEST_DEBUG("Enable npin1");
2078 TEST_DEBUG("Plese input PIN1 CODE: ");
2080 int length = TAPI_SIM_PIN_LENGTH + 1;
2081 char init_pin_val[length];
2083 _fgets(init_pin_val, 9);
2085 TelSimSecPw_t sec_data = { 0, };
2086 sec_data.type = TAPI_SIM_PTYPE_PIN1; // 0x00
2087 sec_data.pw_len = strlen(init_pin_val);
2088 TEST_DEBUG("pw_len[%d]", sec_data.pw_len);
2090 sec_data.pw = (unsigned char*) malloc(length);
2091 memcpy(sec_data.pw, init_pin_val, length);
2093 err_code = tel_enable_sim_security(&sec_data, &request_id);
2095 if (err_code != TAPI_API_SUCCESS) {
2096 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2101 else if (memcmp(buf, "dissim", sizeof("dissim") - 1) == 0) {
2104 TEST_DEBUG("Disable ndissim");
2105 TEST_DEBUG("Plese input SIM LOCK CODE: ");
2107 int length = TAPI_SIM_PIN_LENGTH + 1;
2108 char init_pin_val[length];
2110 _fgets(init_pin_val, 9);
2112 TelSimSecPw_t sec_data = { 0, };
2113 sec_data.type = TAPI_SIM_PTYPE_SIM; // 0x00
2114 sec_data.pw_len = strlen(init_pin_val);
2115 TEST_DEBUG("pw_len[%d]", sec_data.pw_len);
2117 sec_data.pw = (unsigned char*) malloc(length);
2118 memcpy(sec_data.pw, init_pin_val, length);
2120 err_code = tel_disable_sim_security(&sec_data, &request_id);
2122 if (err_code != TAPI_API_SUCCESS) {
2123 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2128 else if (memcmp(buf, "ensim", sizeof("ensim") - 1) == 0) {
2131 TEST_DEBUG("Enable nensim");
2132 TEST_DEBUG("Plese input SIM LOCK CODE: ");
2134 int length = TAPI_SIM_PIN_LENGTH + 1;
2135 char init_pin_val[length];
2137 _fgets(init_pin_val, 9);
2139 TelSimSecPw_t sec_data = { 0, };
2140 sec_data.type = TAPI_SIM_PTYPE_SIM; // 0x00
2141 sec_data.pw_len = strlen(init_pin_val);
2142 TEST_DEBUG("pw_len[%d]", sec_data.pw_len);
2144 sec_data.pw = (unsigned char*) malloc(length);
2145 memcpy(sec_data.pw, init_pin_val, length);
2147 err_code = tel_enable_sim_security(&sec_data, &request_id);
2149 if (err_code != TAPI_API_SUCCESS) {
2150 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2155 else if (memcmp(buf, "getpin1", sizeof("getpin1") - 1) == 0) {
2156 TelSimPinType_t type = TAPI_SIM_PTYPE_PIN1;
2157 TelSimPinStatus_t status = -1;
2158 TEST_DEBUG("Get pin1 status");
2160 err_code = tel_get_sim_security_status(type, &status);
2162 if (err_code == TAPI_API_SUCCESS) {
2164 TEST_DEBUG(" *****************************************************");
2166 case TAPI_SIM_PIN_STATUS_DISABLED: {
2167 TEST_DEBUG("TAPI_SIM_PIN_STATUS_DISABLED ");
2171 case TAPI_SIM_PIN_STATUS_ENABLED: {
2172 TEST_DEBUG("TAPI_SIM_PIN_STATUS_ENABLED ");
2176 case TAPI_SIM_PIN_STATUS_BLOCKED: {
2177 TEST_DEBUG("TAPI_SIM_PIN_STATUS_BLOCKED ");
2181 case TAPI_SIM_PIN_STATUS_PUK_BLOCKED: {
2182 TEST_DEBUG("TAPI_SIM_PIN_STATUS_PUK_BLOCKED ");
2186 case TAPI_SIM_PIN_STATUS_UNKNOWN: {
2187 TEST_DEBUG("TAPI_SIM_PIN_STATUS_UNKNOWN ");
2192 TEST_DEBUG(" Default case statment: pin1_status(%d)", status)
2196 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2199 TEST_DEBUG("*****************************************************");
2202 else if (memcmp(buf, "getpin2", sizeof("getpin2") - 1) == 0) {
2203 TelSimPinType_t type = TAPI_SIM_PTYPE_PIN2;
2204 TelSimPinStatus_t status = -1;
2205 TEST_DEBUG("Get pin2 status");
2207 err_code = tel_get_sim_security_status(type, &status);
2209 if (err_code == TAPI_API_SUCCESS) {
2211 TEST_DEBUG(" *****************************************************");
2213 case TAPI_SIM_PIN_STATUS_DISABLED: {
2214 TEST_DEBUG("TAPI_SIM_PIN_STATUS_DISABLED ");
2218 case TAPI_SIM_PIN_STATUS_ENABLED: {
2219 TEST_DEBUG("TAPI_SIM_PIN_STATUS_ENABLED ");
2223 case TAPI_SIM_PIN_STATUS_BLOCKED: {
2224 TEST_DEBUG("TAPI_SIM_PIN_STATUS_BLOCKED ");
2228 case TAPI_SIM_PIN_STATUS_PUK_BLOCKED: {
2229 TEST_DEBUG("TAPI_SIM_PIN_STATUS_PUK_BLOCKED ");
2233 case TAPI_SIM_PIN_STATUS_UNKNOWN: {
2234 TEST_DEBUG("TAPI_SIM_PIN_STATUS_UNKNOWN ");
2239 TEST_DEBUG(" Default case statment: pin2_status(%d)", status)
2243 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2246 TEST_DEBUG("*****************************************************");
2247 } else if (memcmp(buf, "getsim", sizeof("getsim") - 1) == 0) {
2248 TelSimPinType_t type = TAPI_SIM_PTYPE_SIM;
2249 TelSimPinStatus_t status = -1;
2250 TEST_DEBUG("Get SIM LOCK status");
2252 err_code = tel_get_sim_security_status(type, &status);
2254 if (err_code == TAPI_API_SUCCESS) {
2256 TEST_DEBUG(" *****************************************************");
2258 case TAPI_SIM_PIN_STATUS_DISABLED: {
2259 TEST_DEBUG("TAPI_SIM_PIN_STATUS_DISABLED ");
2263 case TAPI_SIM_PIN_STATUS_ENABLED: {
2264 TEST_DEBUG("TAPI_SIM_PIN_STATUS_ENABLED ");
2268 case TAPI_SIM_PIN_STATUS_BLOCKED: {
2269 TEST_DEBUG("TAPI_SIM_PIN_STATUS_BLOCKED ");
2273 case TAPI_SIM_PIN_STATUS_PUK_BLOCKED: {
2274 TEST_DEBUG("TAPI_SIM_PIN_STATUS_PUK_BLOCKED ");
2278 case TAPI_SIM_PIN_STATUS_UNKNOWN: {
2279 TEST_DEBUG("TAPI_SIM_PIN_STATUS_UNKNOWN ");
2284 TEST_DEBUG(" Default case statment: sim_status(%d)", status)
2288 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2291 TEST_DEBUG("*****************************************************");
2294 else if (memcmp(buf, "enfdn", sizeof("enfdn") - 1) == 0) {
2295 //puts("Flushing input - Enter \ to exit! ");
2296 //while ((ch = getchar()) != '\n' && ch != EOF);
2299 TEST_DEBUG("Enable FDN");
2300 TEST_DEBUG("Plese input PIN2 CODE: ");
2302 int length = TAPI_SIM_PIN_LENGTH + 1;
2303 char init_pin_val[length];
2305 _fgets(init_pin_val, 9);
2307 TelSimSecPw_t sec_data = { 0, };
2308 sec_data.type = TAPI_SIM_PTYPE_PIN2; // 0x00
2309 sec_data.pw_len = strlen(init_pin_val);
2310 TEST_DEBUG("pw_len[%d]", sec_data.pw_len);
2312 sec_data.pw = (unsigned char*) malloc(length);
2313 memcpy(sec_data.pw, init_pin_val, length);
2315 err_code = tel_enable_sim_fdn(sec_data.pw, (int *)&sec_data.pw_len,
2318 if (err_code != TAPI_API_SUCCESS) {
2319 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2323 else if (memcmp(buf, "disfdn", sizeof("disfdn") - 1) == 0) {
2326 TEST_DEBUG("Disable FDN");
2327 TEST_DEBUG("Plese input PIN2 CODE");
2329 int length = TAPI_SIM_PIN_LENGTH + 1;
2330 char init_pin_val[length];
2332 _fgets(init_pin_val, 9);
2334 TelSimSecPw_t sec_data = { 0, };
2335 sec_data.type = TAPI_SIM_PTYPE_PIN2; // 0x00
2336 sec_data.pw_len = strlen(init_pin_val);
2337 TEST_DEBUG("pw_len[%d]", sec_data.pw_len);
2339 sec_data.pw = (unsigned char*) malloc(length);
2340 memcpy(sec_data.pw, init_pin_val, length);
2342 err_code = tel_disable_sim_fdn(sec_data.pw, (int *)&sec_data.pw_len,
2345 if (err_code != TAPI_API_SUCCESS) {
2346 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2350 else if (memcmp(buf, "getfdn", sizeof("getfdn") - 1) == 0) {
2351 TEST_DEBUG("Get FDN status");
2354 err_code = tel_get_sim_fdn_status(&fdn_status);
2356 if (err_code == TAPI_API_SUCCESS) {
2357 if (fdn_status == 0) {
2358 TEST_DEBUG("*************************");
2359 TEST_DEBUG("FDN disabled ");
2360 TEST_DEBUG("*************************");
2362 TEST_DEBUG("*************************");
2363 TEST_DEBUG("FDN enabled");
2364 TEST_DEBUG("*************************");
2367 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2369 } else if (memcmp(buf, "gettype", sizeof("gettype") - 1) == 0) {
2370 TelSimCardType_t cardInfo;
2371 TEST_DEBUG("Get card type !!!");
2372 err_code = tel_get_sim_type(&cardInfo);
2374 if (err_code == TAPI_API_SUCCESS) {
2375 TEST_DEBUG("*************************************************************");
2376 __PrintCardType("", cardInfo);
2377 TEST_DEBUG("*************************************************************");
2379 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2381 } else if (memcmp(buf, "getimsi", sizeof("getimsi") - 1) == 0) {
2382 TelSimImsiInfo_t imsi;
2383 TEST_DEBUG("Get IMSI type !!!");
2384 err_code = tel_get_sim_imsi(&imsi);
2386 if (err_code == TAPI_API_SUCCESS) {
2387 TEST_DEBUG("*************************************************************");
2388 TEST_DEBUG("* imsi.bValid[%d]",imsi.bValid);
2389 TEST_DEBUG("* imsi.szMcc[%s]",imsi.szMcc);
2390 TEST_DEBUG("* imsi.szMnc[%s]",imsi.szMnc);
2391 TEST_DEBUG("* imsi.szMsin[%s]",imsi.szMsin);
2392 TEST_DEBUG("*************************************************************");
2394 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2396 } else if (memcmp(buf, "geticcid", sizeof("geticcid") - 1) == 0) {
2397 TelSimIccIdInfo_t iccid;
2398 TEST_DEBUG("Get ICCID !!!");
2399 err_code = tel_get_sim_iccid(&iccid);
2402 if (err_code == TAPI_API_SUCCESS) {
2403 TEST_DEBUG("*************************************************************");
2404 TEST_DEBUG("* iccid.icc_length[%d]",iccid.icc_length);
2405 for (i = 0; i < iccid.icc_length; i++) {
2406 TEST_DEBUG("* iccid.icc_num[%c]",iccid.icc_num[i]);
2408 TEST_DEBUG("*************************************************************");
2410 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2414 else if (memcmp(buf, "getlang", sizeof("getlang") - 1) == 0) {
2415 TEST_DEBUG("Language Preference INFO ");
2417 TelSimLanguageInfo_t li_info = { 0, };
2419 err_code = tel_get_sim_language(&li_info);
2421 if (err_code == TAPI_API_SUCCESS) {
2422 TEST_DEBUG(" ============================================");
2423 TEST_DEBUG("************ LI INFO ***********************");
2424 TEST_DEBUG("LpCount: [%lu]", li_info.LpCount);
2425 for (i = 0; i < li_info.LpCount; i++) {
2426 fprintf(stderr, "Loop(%d), ", i);
2427 __PrintLangInfo("LpCode: ", li_info.Lp[i]);
2429 TEST_DEBUG("============================================");
2431 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2435 else if (memcmp(buf, "getecc", sizeof("getecc") - 1) == 0) {
2436 TEST_DEBUG(" Get SIM ECC ");
2437 int ecc_rec_count = 0;
2438 TelSimEccData_t ecc_info = { { { 0, } } };
2439 TelSimEccInfo_t SimEccInfo = { { 0, } };
2441 err_code = tel_get_sim_ecc(&ecc_info, &ecc_rec_count);
2443 if (err_code == TAPI_API_SUCCESS) {
2444 SimEccInfo = ecc_info.EccInfo;
2445 TEST_DEBUG(" ============================================");
2446 TEST_DEBUG(" EEC count [%d]", ecc_rec_count);
2447 TEST_DEBUG(" ============================================");
2449 if (ecc_rec_count != 0) {
2450 TEST_DEBUG("ECC1 [%s]", SimEccInfo.szEcc1);
2451 TEST_DEBUG("ECC2 [%s]", SimEccInfo.szEcc2);
2452 TEST_DEBUG("ECC3 [%s]", SimEccInfo.szEcc3);
2453 TEST_DEBUG("ECC4 [%s]", SimEccInfo.szEcc4);
2454 TEST_DEBUG("ECC5 [%s]", SimEccInfo.szEcc5);
2456 TEST_DEBUG(" ============================================");
2458 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2462 else if (memcmp(buf, "getuecc", sizeof("getuecc") - 1) == 0) {
2464 int uecc_rec_count = 0;
2466 TEST_DEBUG(" Get USIM ECC ");
2468 TelSimEccData_t uecc_info = { { { 0, } } };
2470 err_code = tel_get_sim_ecc(&uecc_info, &uecc_rec_count);
2472 if (err_code == TAPI_API_SUCCESS) {
2474 TEST_DEBUG("ECC count [%d]",uecc_rec_count );
2476 for (i = 0; i < uecc_rec_count; i++) {
2477 TEST_DEBUG("Loop(%d): ", i);
2478 TEST_DEBUG(" ECC Used [%d]", uecc_info.UeccInfo[i].bUsed);
2479 TEST_DEBUG(" ECC Len [%d]", uecc_info.UeccInfo[i].EccLen);
2481 if (NULL != uecc_info.UeccInfo[i].szEcc) {
2482 TEST_DEBUG("ECC string [%s]", uecc_info.UeccInfo[i].szEcc);
2484 TEST_DEBUG("ECC string [null]");
2487 TEST_DEBUG("ECC alphaID [%s]",uecc_info.UeccInfo[i].szEccAlphaIdentifier);
2488 __PrintECCSvcInfo(uecc_info.UeccInfo[i].EccEmergencyServiceInfo);
2492 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2496 else if (memcmp(buf, "getimsi", sizeof("getimsi") - 1) == 0) {
2497 TEST_DEBUG("Get IMSI INFO ");
2499 TelSimImsiInfo_t sim_imsi_info;
2501 err_code = tel_get_sim_imsi(&sim_imsi_info);
2503 if (err_code == TAPI_API_SUCCESS) {
2504 TEST_DEBUG(" ============================================");
2505 TEST_DEBUG(" IMSI [mcc,mnc,msin]= ");
2506 TEST_DEBUG(" [%s]",sim_imsi_info.szMcc);
2507 TEST_DEBUG(" [%s]",sim_imsi_info.szMnc);
2508 TEST_DEBUG(" [%s]",sim_imsi_info.szMsin);
2509 TEST_DEBUG(" ============================================");
2511 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2515 else if (memcmp(buf, "getmb", sizeof("getmb") - 1) == 0) {
2516 TEST_DEBUG("Get MAILBOX INFO ");
2518 TelSimMailboxNumbers_s mbox;
2520 err_code = tel_get_sim_mailbox_info(&mbox);
2522 if (err_code == TAPI_API_SUCCESS) {
2523 TEST_DEBUG(" ============================================");
2526 TEST_DEBUG("Current SIM is CPHS");
2528 TEST_DEBUG("Current SIM is not CPHS but 3GPP");
2530 TEST_DEBUG(" ============================================");
2531 TEST_DEBUG(" voice_line1.bUsed[%d]",mbox.voice_line1.bUsed);
2532 TEST_DEBUG(" voice_line1.AlphaIdLength[%lu]",mbox.voice_line1.AlphaIdLength);
2533 TEST_DEBUG(" voice_line1.AlphaId[%s]",mbox.voice_line1.AlphaId);
2534 TEST_DEBUG(" voice_line1.DiallingnumLength[%lu]",mbox.voice_line1.DiallingnumLength);
2535 TEST_DEBUG(" voice_line1.DiallingNum[%s]",mbox.voice_line1.DiallingNum);
2536 TEST_DEBUG(" voice_line1.NumberingPlanIdent[%d]",mbox.voice_line1.NumberingPlanIdent);
2537 TEST_DEBUG(" voice_line1.TypeOfNumber[%u]",mbox.voice_line1.TypeOfNumber);
2538 TEST_DEBUG(" ============================================");
2539 TEST_DEBUG(" voice_line2.bUsed[%d]",mbox.voice_line2.bUsed);
2540 TEST_DEBUG(" voice_line2.AlphaIdLength[%lu]",mbox.voice_line2.AlphaIdLength);
2541 TEST_DEBUG(" voice_line2.AlphaId[%s]",mbox.voice_line2.AlphaId);
2542 TEST_DEBUG(" voice_line2.DiallingnumLength[%lu]",mbox.voice_line2.DiallingnumLength);
2543 TEST_DEBUG(" voice_line2.DiallingNum[%s]",mbox.voice_line2.DiallingNum);
2544 TEST_DEBUG(" voice_line2.NumberingPlanIdent[%d]",mbox.voice_line2.NumberingPlanIdent);
2545 TEST_DEBUG(" voice_line2.TypeOfNumber[%d]",mbox.voice_line2.TypeOfNumber);
2546 TEST_DEBUG(" ============================================");
2547 TEST_DEBUG(" video.bUsed[%d]",mbox.video.bUsed);
2548 TEST_DEBUG(" video.AlphaIdLength[%lu]",mbox.video.AlphaIdLength);
2549 TEST_DEBUG(" video.AlphaId[%s]",mbox.video.AlphaId);
2550 TEST_DEBUG(" video.DiallingnumLength[%lu]",mbox.video.DiallingnumLength);
2551 TEST_DEBUG(" video.DiallingNum[%s]",mbox.video.DiallingNum);
2552 TEST_DEBUG(" video.NumberingPlanIdent[%d]",mbox.video.NumberingPlanIdent);
2553 TEST_DEBUG(" video.TypeOfNumber[%d]",mbox.video.TypeOfNumber);
2554 TEST_DEBUG(" ============================================");
2555 TEST_DEBUG(" fax.bUsed[%d]",mbox.fax.bUsed);
2556 TEST_DEBUG(" fax.AlphaIdLength[%lu]",mbox.fax.AlphaIdLength);
2557 TEST_DEBUG(" fax.AlphaId[%s]",mbox.fax.AlphaId);
2558 TEST_DEBUG(" fax.DiallingnumLength[%lu]",mbox.fax.DiallingnumLength);
2559 TEST_DEBUG(" fax.DiallingNum[%s]",mbox.fax.DiallingNum);
2560 TEST_DEBUG(" fax.NumberingPlanIdent[%d]",mbox.fax.NumberingPlanIdent);
2561 TEST_DEBUG(" fax.TypeOfNumber[%d]",mbox.fax.TypeOfNumber);
2562 TEST_DEBUG(" ============================================");
2563 TEST_DEBUG(" email.bUsed[%d]",mbox.email.bUsed);
2564 TEST_DEBUG(" email.AlphaIdLength[%lu]",mbox.email.AlphaIdLength);
2565 TEST_DEBUG(" email.AlphaId[%s]",mbox.email.AlphaId);
2566 TEST_DEBUG(" email.DiallingnumLength[%lu]",mbox.email.DiallingnumLength);
2567 TEST_DEBUG(" email.DiallingNum[%s]",mbox.email.DiallingNum);
2568 TEST_DEBUG(" email.NumberingPlanIdent[%d]",mbox.email.NumberingPlanIdent);
2569 TEST_DEBUG(" email.TypeOfNumber[%d]",mbox.email.TypeOfNumber);
2570 TEST_DEBUG(" ============================================");
2573 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2577 else if (memcmp(buf, "getmw", sizeof("getmw") - 1) == 0) {
2578 TEST_DEBUG("Get MESSAGE WAITING INFO ");
2580 TelSimMessageWaiting_s mw;
2582 err_code = tel_get_sim_messagewaiting_info(&mw);
2584 if (err_code == TAPI_API_SUCCESS) {
2585 TEST_DEBUG(" ============================================");
2588 TEST_DEBUG("Current SIM is CPHS");
2589 TEST_DEBUG(" ============================================");
2590 TEST_DEBUG(" cphs_mw.bWaitVoiceMsgLine1[%d]",mw.mw_data_u.cphs_mw.bWaitVoiceMsgLine1);
2591 TEST_DEBUG(" cphs_mw.bWaitVoiceMsgLine2[%d]",mw.mw_data_u.cphs_mw.bWaitVoiceMsgLine2);
2592 TEST_DEBUG(" cphs_mw.bWaitFaxMsg[%d]",mw.mw_data_u.cphs_mw.bWaitFaxMsg);
2593 TEST_DEBUG(" cphs_mw.bWaitDataMsg[%d]",mw.mw_data_u.cphs_mw.bWaitDataMsg);
2596 TEST_DEBUG("Current SIM is not CPHS but 3GPP");
2597 TEST_DEBUG(" ============================================");
2598 TEST_DEBUG(" mw_data_u.mw.IndicatorType[0x%x]",mw.mw_data_u.mw.IndicatorType);
2599 TEST_DEBUG(" mw_data_u.mw.VoiceMailCount[%d]",mw.mw_data_u.mw.VoiceMailCount);
2600 TEST_DEBUG(" mw_data_u.mw.FaxCount[%d]",mw.mw_data_u.mw.FaxCount);
2601 TEST_DEBUG(" mw_data_u.mw.EmailCount[%d]",mw.mw_data_u.mw.EmailCount);
2602 TEST_DEBUG(" mw_data_u.mw.OtherCount[%d]",mw.mw_data_u.mw.OtherCount);
2603 TEST_DEBUG(" mw_data_u.mw.VideoMailCount[%d]",mw.mw_data_u.mw.VideoMailCount);
2605 TEST_DEBUG(" ============================================");
2608 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2612 else if (memcmp(buf, "getcf", sizeof("getcf") - 1) == 0) {
2613 TEST_DEBUG("Get CALLFORWARDING INFO ");
2615 TelSimCallForwarding_s cf;
2617 err_code = tel_get_sim_callforwarding_info(&cf);
2619 if (err_code == TAPI_API_SUCCESS) {
2620 TEST_DEBUG(" ============================================");
2623 TEST_DEBUG("Current SIM is CPHS");
2624 TEST_DEBUG(" ============================================");
2625 TEST_DEBUG(" cphs_cf.bCallForwardUnconditionalLine1[%d]",cf.cf_data_u.cphs_cf.bCallForwardUnconditionalLine1);
2626 TEST_DEBUG(" cphs_cf.bCallForwardUnconditionalLine2[%d]",cf.cf_data_u.cphs_cf.bCallForwardUnconditionalLine2);
2627 TEST_DEBUG(" cphs_cf.bCallForwardUnconditionalFax[%d]",cf.cf_data_u.cphs_cf.bCallForwardUnconditionalFax);
2628 TEST_DEBUG(" cphs_cf.bCallForwardUnconditionalData[%d]",cf.cf_data_u.cphs_cf.bCallForwardUnconditionalData);
2629 TEST_DEBUG(" cphs_cf.bCallForwardUnconditionalSms[%d]",cf.cf_data_u.cphs_cf.bCallForwardUnconditionalSms);
2630 TEST_DEBUG(" cphs_cf.bCallForwardUnconditionalBearer[%d]",cf.cf_data_u.cphs_cf.bCallForwardUnconditionalBearer);
2632 TEST_DEBUG("Current SIM is not CPHS but 3GPP");
2633 TEST_DEBUG(" ============================================");
2634 TEST_DEBUG(" cf.bUsed[%d]",cf.cf_data_u.cf.bUsed);
2635 TEST_DEBUG(" cf.MspNumber[%d]",cf.cf_data_u.cf.MspNumber);
2636 TEST_DEBUG(" cf.Status[0x%x]",cf.cf_data_u.cf.Status);
2637 TEST_DEBUG(" cf.DiallingnumLen[%lu]",cf.cf_data_u.cf.DiallingnumLen);
2638 TEST_DEBUG(" cf.TypeOfNumber[%d]",cf.cf_data_u.cf.TypeOfNumber);
2639 TEST_DEBUG(" cf.NumberingPlanIdent[%d]",cf.cf_data_u.cf.NumberingPlanIdent);
2640 TEST_DEBUG(" cf.DiallingNum[%s]",cf.cf_data_u.cf.DiallingNum);
2642 TEST_DEBUG(" ============================================");
2644 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2648 else if (memcmp(buf, "getcphs", sizeof("getcphs") - 1) == 0) {
2649 TEST_DEBUG("Get CPHS INFO ");
2651 TelSimCphsLocalInfo_t cphs;
2653 err_code = tel_get_sim_cphs_info(&cphs);
2655 if (err_code == TAPI_API_SUCCESS) {
2656 TEST_DEBUG(" ============================================");
2659 TEST_DEBUG("Current SIM is CPHS");
2660 TEST_DEBUG(" ============================================");
2661 TEST_DEBUG("cphs.cphsinfo.CphsPhase[%d]",cphs.cphsinfo.CphsPhase);
2662 TEST_DEBUG("cphs.cphsinfo.CphsServiceTable.bCustomerServiceProfile[%d]",cphs.cphsinfo.CphsServiceTable.bCustomerServiceProfile);
2663 TEST_DEBUG("cphs.cphsinfo.CphsServiceTable.bServiceStringTable[%d]",cphs.cphsinfo.CphsServiceTable.bServiceStringTable);
2664 TEST_DEBUG("cphs.cphsinfo.CphsServiceTable.bMailBoxNumbers[%d]",cphs.cphsinfo.CphsServiceTable.bMailBoxNumbers);
2665 TEST_DEBUG("cphs.cphsinfo.CphsServiceTable.bOperatorNameShortForm[%d]",cphs.cphsinfo.CphsServiceTable.bOperatorNameShortForm);
2666 TEST_DEBUG("cphs.cphsinfo.CphsServiceTable.bInformationNumbers[%d]",cphs.cphsinfo.CphsServiceTable.bInformationNumbers);
2667 TEST_DEBUG(" ============================================");
2668 TEST_DEBUG("cphs.csp.ServiceProfileEntry[0].CustomerServiceGroup[%d]",cphs.csp.ServiceProfileEntry[0].CustomerServiceGroup);
2669 TEST_DEBUG(" ============================================");
2670 TEST_DEBUG("cphs.infn.bUsed[%d]",cphs.infn.bUsed);
2671 TEST_DEBUG("cphs.infn.AlphaIdLength[%d]",cphs.infn.AlphaIdLength);
2672 TEST_DEBUG("cphs.infn.IndexLevelIndicator[%d]",cphs.infn.IndexLevelIndicator);
2673 TEST_DEBUG("cphs.infn.PremiumServiceIndicator[%d]",cphs.infn.PremiumServiceIndicator);
2674 TEST_DEBUG("cphs.infn.NetworkSpecificIndicator[%d]",cphs.infn.NetworkSpecificIndicator);
2675 TEST_DEBUG("cphs.infn.Alpha_id[%s]",cphs.infn.Alpha_id);
2676 TEST_DEBUG("cphs.infn.DiallingnumLength[%lu]",cphs.infn.DiallingnumLength);
2677 TEST_DEBUG("cphs.infn.TypeOfNumber[%d]",cphs.infn.TypeOfNumber);
2678 TEST_DEBUG("cphs.infn.NumberingPlanIdentity[%d]",cphs.infn.NumberingPlanIdentity);
2679 TEST_DEBUG("cphs.infn.DiallingNum[%s]",cphs.infn.DiallingNum);
2680 TEST_DEBUG("cphs.infn.Ext1RecordId[%d]",cphs.infn.Ext1RecordId);
2681 TEST_DEBUG(" ============================================");
2682 TEST_DEBUG("cphs.opname.NameLength[%d]",cphs.opname.NameLength);
2683 TEST_DEBUG("cphs.opname.OperatorName[%s]",cphs.opname.OperatorName);
2684 TEST_DEBUG(" ============================================");
2685 TEST_DEBUG("cphs.opshortform.ShortNameLength[%d]",cphs.opshortform.ShortNameLength);
2686 TEST_DEBUG("cphs.opshortform.OperatorShortName[%s]",cphs.opshortform.OperatorShortName);
2687 TEST_DEBUG(" ============================================");
2688 TEST_DEBUG("cphs.dflagsinfo.DynamicFlags[%d]",cphs.dflagsinfo.DynamicFlags);
2689 TEST_DEBUG(" ============================================");
2690 TEST_DEBUG("cphs.d2flagsinfo.Dynamic2Flag[%d]",cphs.d2flagsinfo.Dynamic2Flag);
2692 TEST_DEBUG("Current SIM is not CPHS but 3GPP");
2693 TEST_DEBUG(" ============================================");
2696 TEST_DEBUG(" ============================================");
2698 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2701 } else if (memcmp(buf, "getmsisdn", sizeof("getmsisdn") - 1) == 0) {
2702 TEST_DEBUG("Get MSISDN INFO ");
2704 TelSimSubscriberInfo_t msisdn;
2706 err_code = tel_get_sim_msisdn(&msisdn);
2708 if (err_code == TAPI_API_SUCCESS) {
2709 TEST_DEBUG(" ============================================");
2710 TEST_DEBUG("name[%s]",msisdn.name);
2711 TEST_DEBUG("num[%s]",msisdn.num);
2712 if (msisdn.name == '\0')
2713 TEST_DEBUG("name is null string");
2715 if (msisdn.num == '\0')
2716 TEST_DEBUG("number is null string");
2718 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2720 } else if (memcmp(buf, "pbinit", sizeof("pbinit") - 1) == 0) {
2721 TEST_DEBUG("npbinit status");
2723 int valid_index = 0;
2724 TelSimPbList_t pb_list = { 0, };
2725 int pPbInitCompleted = 0;
2727 err_code = tel_get_sim_pb_init_info(&pPbInitCompleted, &pb_list,
2730 if (err_code == TAPI_API_SUCCESS) {
2731 if (pPbInitCompleted == 0) {
2732 TEST_DEBUG(" SIM PB INIT NOT completed ");
2734 TEST_DEBUG("SIM PB INIT completed");
2735 /* if no sim records at all then valid_index = 0xFF */TEST_DEBUG("ADN First index is [%d]",valid_index);
2736 TEST_DEBUG("SIM phone book storage list Information ");
2737 TEST_DEBUG("********************************************");
2738 TEST_DEBUG("pb_list.b_fdn[%d]",pb_list.b_fdn);
2739 TEST_DEBUG("pb_list.b_msisdn[%d]",pb_list.b_msisdn);
2740 TEST_DEBUG("pb_list.b_adn[%d]",pb_list.b_adn);
2741 TEST_DEBUG("pb_list.b_sdn[%d]",pb_list.b_sdn);
2742 TEST_DEBUG("pb_list.b_3g[%d]",pb_list.b_3g);
2743 TEST_DEBUG("pb_list.b_aas[%d]",pb_list.b_aas);
2744 TEST_DEBUG("pb_list.b_gas[%d]",pb_list.b_gas);
2748 TEST_DEBUG("ME dialed calls list stored in NV");
2750 TEST_DEBUG("SIM(or ME) emergency number");
2752 TEST_DEBUG("SIM fixed-dialing phonebook");
2754 TEST_DEBUG("SIM last-dialing phonebook");
2756 TEST_DEBUG("ME missed calls list");
2758 TEST_DEBUG("ME phonebook");
2760 TEST_DEBUG("Combined ME and SIM phonebook");
2762 TEST_DEBUG("SIM(or ME) own numbers ( MSISDNs) list");
2764 TEST_DEBUG("ME received calls list stored in NV");
2766 TEST_DEBUG("2G SIM phonebook");
2768 TEST_DEBUG("Service Dialing Number");
2770 TEST_DEBUG("3G SIM phonebook");
2772 TEST_DEBUG("Incoming Call Information");
2774 TEST_DEBUG("Outgoing Call Information");
2776 TEST_DEBUG("Additional Number Alpha String");
2778 TEST_DEBUG("Grouping Information Alpha String");
2781 PB_DC 0x01 ME dialed calls list stored in NV
2782 PB_EN 0x02 SIM(or ME) emergency number
2783 PB_FD 0x03 SIM fixed-dialing phonebook
2784 PB_LD 0x04 SIM last-dialing phonebook
2785 PB_MC 0x05 ME missed calls list
2786 PB_ME 0x06 ME phonebook
2787 PB_MT 0x07 Combined ME and SIM phonebook
2788 PB_ON 0x08 SIM(or ME) own numbers ( MSISDNs) list
2789 PB_RC 0x09 ME received calls list stored in NV
2790 PB_SIM 0x0A 2G SIM phonebook
2791 PB_SDN 0x0B Service Dialing Number
2792 PB_3GSIM 0x0C 3G SIM phonebook
2793 PB_ICI 0x0D Incoming Call Information
2794 PB_OCI 0x0E Outgoing Call Information
2795 PB_AAS 0x0F Additional Number Alpha String
2796 PB_GAS 0x10 Grouping Information Alpha String
2799 TEST_DEBUG("********************************************");
2802 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2807 //change pin1 number
2808 else if (memcmp(buf, "chpin1", sizeof("chpin1") - 1) == 0) {
2809 int length = TAPI_SIM_PIN_LENGTH + 1;
2810 char init_old_pin_val[length];
2811 char init_new_pin_val[length];
2813 memset(&init_old_pin_val, 0, length);
2814 memset(&init_new_pin_val, 0, length);
2816 TelSimSecPw_t old_pin = { 0, };
2817 TelSimSecPw_t new_pin = { 0, };
2821 TEST_DEBUG("Change PIN1 CODE");
2822 TEST_DEBUG("Input Current PIN1 Code: ");
2824 _fgets(init_old_pin_val, 9);
2826 old_pin.type = TAPI_SIM_PTYPE_PIN1; // 0x00
2827 old_pin.pw_len = strlen(init_old_pin_val);
2828 TEST_DEBUG("pw_len[%d]", old_pin.pw_len);
2829 old_pin.pw = (unsigned char*) malloc(length);
2830 memcpy(old_pin.pw, init_old_pin_val, length);
2832 TEST_DEBUG("Input New PIN1 Code: ");
2834 _fgets(init_new_pin_val, 9);
2836 new_pin.type = TAPI_SIM_PTYPE_PIN1; // 0x00
2837 new_pin.pw_len = strlen(init_new_pin_val);
2838 TEST_DEBUG("pw_len[%d]", new_pin.pw_len);
2839 new_pin.pw = (unsigned char*) malloc(length);
2840 memcpy(new_pin.pw, init_new_pin_val, length);
2842 err_code = tel_change_sim_pins(&old_pin, &new_pin, &request_id);
2844 if (err_code != TAPI_API_SUCCESS) {
2845 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2849 //change pin2 number
2850 else if (memcmp(buf, "chpin2", sizeof("chpin2") - 1) == 0) {
2851 int length = TAPI_SIM_PIN_LENGTH + 1;
2852 char init_old_pin_val[length];
2853 char init_new_pin_val[length];
2855 memset(&init_old_pin_val, 0, length);
2856 memset(&init_new_pin_val, 0, length);
2858 TelSimSecPw_t old_pin = { 0, };
2859 TelSimSecPw_t new_pin = { 0, };
2863 TEST_DEBUG("Change PIN2 CODE");
2864 TEST_DEBUG("Input Current PIN2 Code: ");
2866 _fgets(init_old_pin_val, 9);
2868 old_pin.type = TAPI_SIM_PTYPE_PIN2; // 0x00
2869 old_pin.pw_len = strlen(init_old_pin_val);
2870 TEST_DEBUG("pw_len[%d]", old_pin.pw_len);
2871 old_pin.pw = (unsigned char*) malloc(length);
2872 memcpy(old_pin.pw, init_old_pin_val, length);
2874 TEST_DEBUG("Input New PIN2 Code: ");
2876 _fgets(init_new_pin_val, 9);
2878 new_pin.type = TAPI_SIM_PTYPE_PIN2; // 0x00
2879 new_pin.pw_len = strlen(init_new_pin_val);
2880 TEST_DEBUG("pw_len[%d]", new_pin.pw_len);
2881 new_pin.pw = (unsigned char*) malloc(length);
2882 memcpy(new_pin.pw, init_new_pin_val, length);
2884 err_code = tel_change_sim_pins(&old_pin, &new_pin, &request_id);
2886 if (err_code != TAPI_API_SUCCESS) {
2887 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2891 // unblock CHV and enter new pin code
2892 else if (memcmp(buf, "puk1", sizeof("puk1") - 1) == 0) {
2895 TEST_DEBUG("PUK1 verification");
2897 int length = TAPI_SIM_PIN_LENGTH + 1;
2898 char init_pin_val[length];
2899 char init_puk_val[length];
2901 TEST_DEBUG("Plese input PUK CODE: ");
2903 _fgets(init_puk_val, 9);
2905 TEST_DEBUG("NEW PIN1 CODE: ");
2906 _fgets(init_pin_val, 9);
2908 TelSimSecPw_t puk_data = { 0, };
2909 TelSimSecPw_t new_pin_data = { 0, };
2911 puk_data.type = TAPI_SIM_PTYPE_PUK1; // 0x00
2912 puk_data.pw_len = strlen(init_puk_val);
2913 TEST_DEBUG("pw_len[%d]", puk_data.pw_len);
2914 puk_data.pw = (unsigned char*) malloc(length);
2915 memcpy(puk_data.pw, init_puk_val, length);
2917 new_pin_data.type = TAPI_SIM_PTYPE_PIN1; // 0x00
2918 new_pin_data.pw_len = strlen(init_pin_val);
2919 TEST_DEBUG("pw_len[%d]", new_pin_data.pw_len);
2920 new_pin_data.pw = (unsigned char*) malloc(length);
2921 memcpy(new_pin_data.pw, init_pin_val, length);
2924 TEST_DEBUG("PUKtype Value %d",puk_data.type);
2925 TEST_DEBUG("PUK Value %s",puk_data.pw);
2926 TEST_DEBUG("New Pin Value %s",new_pin_data.pw);
2928 err_code = tel_verify_sim_puks(&puk_data, &new_pin_data, &request_id);
2930 if (err_code != TAPI_API_SUCCESS) {
2931 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2935 // unblock CHV2 and enter new pin2 code
2936 else if (memcmp(buf, "puk2", sizeof("puk2") - 1) == 0) {
2939 TEST_DEBUG("PUK2 verification");
2941 int length = TAPI_SIM_PIN_LENGTH + 1;
2942 char init_pin_val[length];
2943 char init_puk_val[length];
2945 TEST_DEBUG("Plese input PUK2 CODE: ");
2947 _fgets(init_puk_val, 9);
2949 TEST_DEBUG("NEW PIN2 CODE: ");
2950 _fgets(init_pin_val, 9);
2952 TelSimSecPw_t puk_data = { 0, };
2953 TelSimSecPw_t new_pin_data = { 0, };
2955 puk_data.type = TAPI_SIM_PTYPE_PUK2; // 0x00
2956 puk_data.pw_len = strlen(init_puk_val);
2957 TEST_DEBUG("pw_len[%d]", puk_data.pw_len);
2958 puk_data.pw = (unsigned char*) malloc(length);
2959 memcpy(puk_data.pw, init_puk_val, length);
2961 new_pin_data.type = TAPI_SIM_PTYPE_PIN2; // 0x00
2962 new_pin_data.pw_len = strlen(init_pin_val);
2963 TEST_DEBUG("pw_len[%d]", new_pin_data.pw_len);
2964 new_pin_data.pw = (unsigned char*) malloc(length);
2965 memcpy(new_pin_data.pw, init_pin_val, length);
2968 TEST_DEBUG("PUKtype Value %d",puk_data.type);
2969 TEST_DEBUG("PUK Value %s",puk_data.pw);
2970 TEST_DEBUG("New Pin Value %s",new_pin_data.pw);
2972 err_code = tel_verify_sim_puks(&puk_data, &new_pin_data, &request_id);
2974 if (err_code != TAPI_API_SUCCESS) {
2975 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
2979 else if (memcmp(buf, "mepers", sizeof("mepers") - 1) == 0) {
2983 TelSimPersPw_t lock_pers = { 0, };
2985 printf("------------------------------ \n");
2986 printf("Personalization Type : \n");
2987 printf("------------------------------ \n");
2988 printf("1 - Network \n");
2989 printf("2 - Network Subset \n");
2990 printf("3 - Service Provider \n");
2991 printf("4 - Corporate \n");
2992 printf("------------------------------ \n");
2994 printf("\nPlease input type: \n");
2995 scanf("%d%c", &tempi, &dummy);
2999 lock_pers.type = TAPI_SIM_PERS_NET;
3004 lock_pers.type = TAPI_SIM_PERS_NS;
3009 lock_pers.type = TAPI_SIM_PERS_SP;
3014 lock_pers.type = TAPI_SIM_PERS_CP;
3019 printf("wrong pers type! exit!\n");
3025 switch (lock_pers.type) {
3026 case TAPI_SIM_PERS_NET: {
3027 puts("Flushing input - Enter \\n to exit! ");
3029 while ((ch = getchar()) != '\n' && ch != EOF)
3032 printf("Lock Personalisation MCC+MNC 5\n");
3034 "Plese input Network Lock CODE : length of MCC+MNC, MCC, MNC, NCK\n");
3036 "We need to use this for testing : length of MCC+MNC(5), MCC(450), MNC(01), NCK(12345678) => 54500112345678\n");
3038 int length = 14 + 1;
3039 char init_password_val[length];
3040 _fgets(init_password_val, 15);
3042 lock_pers.pw_len = 14;
3043 lock_pers.pw = (unsigned char*) malloc(length);
3044 memcpy(lock_pers.pw, init_password_val, length);
3049 case TAPI_SIM_PERS_NS: {
3050 puts("Flushing input - Enter \\n to exit! ");
3052 while ((ch = getchar()) != '\n' && ch != EOF)
3056 "Network Subset Personalisation MCC+MNC 5 byte, subset 2byte \n");
3058 "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");
3060 int length = 17 + 1;
3061 char init_password_val[length];
3062 _fgets(init_password_val, 18);
3064 lock_pers.pw_len = 17;
3065 lock_pers.pw = (unsigned char*) malloc(length);
3066 memcpy(lock_pers.pw, init_password_val, length);
3070 case TAPI_SIM_PERS_SP: {
3071 puts("Flushing input - Enter \\n to exit! ");
3073 while ((ch = getchar()) != '\n' && ch != EOF)
3077 "Service Provider Personalisation MCC+MNC 5 byte, SP 2byte \n");
3079 "We need to use this for testing : length of MCC+MNC(5), MCC(450), MNC(01), SP(11) SPCK(12345678) => 5450011112345678\n");
3081 int length = 16 + 1;
3082 char init_password_val[length];
3083 _fgets(init_password_val, 17);
3085 lock_pers.pw_len = 16;
3086 lock_pers.pw = (unsigned char*) malloc(length);
3087 memcpy(lock_pers.pw, init_password_val, length);
3091 case TAPI_SIM_PERS_CP: {
3092 puts("Flushing input - Enter \\n to exit! ");
3094 while ((ch = getchar()) != '\n' && ch != EOF)
3098 "Corporate Personalisation MCC+MNC 5 byte, SP 2byte CP 2byte \n");
3100 "We need to use this for testing : length of MCC+MNC(5), MCC(450), MNC(01), SP(11) CP(11) CPCK(12345678) => 545001111112345678\n");
3102 int length = 18 + 1;
3103 char init_password_val[length];
3104 _fgets(init_password_val, 19);
3106 lock_pers.pw_len = 18;
3107 lock_pers.pw = (unsigned char*) malloc(length);
3108 memcpy(lock_pers.pw, init_password_val, length);
3113 printf("wrong condition exit\n");
3119 err_code = tel_enable_sim_personalization(&lock_pers, &request_id);
3120 printf("Error Code [%x]\n", err_code);
3124 if (memcmp(buf, "medepers", sizeof("medepers") - 1) == 0) {
3128 TelSimPersPw_t lock_pers = { 0, };
3130 printf("------------------------------ \n");
3131 printf("de-Personalization Type : \n");
3132 printf("------------------------------ \n");
3133 printf("1 - Network \n");
3134 printf("2 - Network Subset \n");
3135 printf("3 - Service Provider \n");
3136 printf("4 - Corporate \n");
3137 printf("------------------------------ \n");
3139 printf("\nPlease input type: \n");
3140 scanf("%d%c", &tempi, &dummy);
3144 lock_pers.type = TAPI_SIM_PERS_NET;
3149 lock_pers.type = TAPI_SIM_PERS_NS;
3154 lock_pers.type = TAPI_SIM_PERS_SP;
3159 lock_pers.type = TAPI_SIM_PERS_CP;
3164 printf("wrong pers type! exit!\n");
3170 puts("Flushing input - Enter \\n to exit! ");
3172 while ((ch = getchar()) != '\n' && ch != EOF)
3175 printf("de Personalisation key is 8 byte \n");
3176 printf("We need to use this for testing : 12345678\n");
3179 char init_password_val[length];
3180 _fgets(init_password_val, 9);
3182 lock_pers.pw_len = 8 /*control key*/;
3183 lock_pers.pw = (unsigned char*) malloc(length);
3184 memcpy(lock_pers.pw, init_password_val, length);
3186 err_code = tel_disable_sim_personalization(&lock_pers, &request_id);
3188 printf("Error Code [%x]\n", err_code);
3192 if (memcmp(buf, "getpers", sizeof("getpers") - 1) == 0) {
3196 TelSimPersType_t type = 0;
3198 puts("Flushing input - Enter \\n to exit! ");
3200 while ((ch = getchar()) != '\n' && ch != EOF)
3203 printf("getpers status\n");
3204 printf("Here - 1\n");
3206 "================================================================ \n");
3207 printf("TAPI_SIM_PERS_NET = 0x00, /**< Network Lock */ \n");
3208 printf("TAPI_SIM_PERS_NS = 0x01, /**< Nettwork Subset Lock */\n");
3209 printf("TAPI_SIM_PERS_SP = 0x02, /**< Service Provider Lock */\n");
3210 printf("TAPI_SIM_PERS_CP = 0x03, /**< Coporate Lock */\n");
3212 "================================================================ \n");
3213 printf("Plese input Lock type \n");
3215 scanf("%d%c", &tempi, &dummy);
3218 err_code = tel_get_sim_personalization_status(type, &request_id);
3219 printf("Error Code [%x]\n", err_code);
3221 } else if (memcmp(buf, "setlang", sizeof("setlang") - 1) == 0) {
3225 TelSimLanguagePreferenceCode_t language = 0x00;
3227 printf("------------------------------ \n");
3228 printf("select language which will be updated: \n");
3229 printf("------------------------------ \n");
3230 printf("should select inside here ( 0.DE / 1.EN / 2.IT / 3.FR ) \n");
3232 "should select inside here ( 4.SPANISH / 5.DUTCH / 6.SWEDISH / 7.DANISH ) \n");
3234 "should select inside here ( 8.PORTUGUESE / 9.FINNISH / 10.NORWEGIAN / 11.GREEK ) \n");
3236 "should select inside here ( 12.TURKISH / 13.HUNGARIAN / 14.POLISH / 15.KOREAN ) \n");
3238 "should select inside here ( 16.CHINESE / 17.RUSSIAN / 18.JAPANESE ) \n");
3239 printf("------------------------------ \n");
3241 printf("\nPlease input type: \n");
3242 scanf("%d%c", &tempi, &dummy);
3244 language = (TelSimLanguagePreferenceCode_t) tempi;
3246 err_code = tel_set_sim_language(language, &request_id);
3248 if (err_code == TAPI_API_SUCCESS) {
3249 TEST_DEBUG("TAPI API SUCCESS");
3251 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3254 } else if (memcmp(buf, "apdu", sizeof("apdu") - 1) == 0) {
3255 printf("------------------------------ \n");
3257 printf("------------------------------ \n");
3259 TelSimApdu_t apdu_data = { 0, };
3261 char tmp_apdu[4] = { 0x41, 0xC0, 0x05, 0x6f };
3263 apdu_data.apdu_len = 4;
3264 apdu_data.apdu = (unsigned char*) &tmp_apdu;
3266 err_code = tel_req_sim_apdu(&apdu_data, &request_id);
3268 if (err_code == TAPI_API_SUCCESS) {
3269 TEST_DEBUG("TAPI API SUCCESS");
3271 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3274 } else if (memcmp(buf, "atr", sizeof("atr") - 1) == 0) {
3275 printf("------------------------------ \n");
3276 printf("ATR request: \n");
3277 printf("------------------------------ \n");
3279 err_code = tel_req_sim_atr(&request_id);
3281 if (err_code == TAPI_API_SUCCESS) {
3282 TEST_DEBUG("TAPI API SUCCESS");
3284 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3289 ////////////////////////////////////////////////////////////////////////
3290 /////////////////////// Phone Book ///////////////////////////////////
3291 ///////////////////////////////////////////////////////////////////////
3292 else if (memcmp(buf, "pbcapa", sizeof("pbcapa") - 1) == 0) {
3293 TEST_DEBUG("PB capability info");
3295 err_code = tel_get_sim_pb_3g_meta_info(&request_id);
3296 if (err_code != TAPI_API_SUCCESS) {
3297 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3301 else if (memcmp(buf, "pbcnt", sizeof("pbcnt") - 1) == 0) {
3302 TEST_DEBUG("PB storage count info");
3304 TelSimPbFileType_t storage_type = __InputStorageType();
3306 __PrintStorageType(storage_type);
3308 err_code = tel_get_sim_pb_count(storage_type, &request_id);
3310 if (err_code != TAPI_API_SUCCESS) {
3311 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3315 else if (memcmp(buf, "pbentry", sizeof("pbentry") - 1) == 0) {
3316 TEST_DEBUG("PB Entry info");
3318 TelSimPbFileType_t storage_type = __InputStorageType();
3320 err_code = tel_get_sim_pb_meta_info(storage_type, &request_id);
3322 if (err_code != TAPI_API_SUCCESS) {
3323 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3327 ///////////////////////////////////
3332 0x04 : WRITE (�ش� index�� data ������ ������ unconditional write)
3333 0x05 : DELETE ALL (�ش� phone book id�� ���� �����ϴ� ��� �����͸� delete)
3335 else if (memcmp(buf, "pbadd", sizeof("pbadd") - 1) == 0) {
3336 TelSimPbRecordData_t pb_add = { 0, };
3338 char unicode_text[256];
3339 int unicode_text_len = 0;
3342 TelSimPbFileType_t storage_type = __InputStorageType();
3343 pb_add.StorageFileType = storage_type;
3345 TEST_DEBUG("Plese input index : ");
3346 scanf("%d%c", &index, &dummy);
3347 pb_add.Index = index;
3349 if (pb_add.StorageFileType == TAPI_SIM_PB_EN || pb_add.StorageFileType
3350 == TAPI_SIM_PB_FDN || pb_add.StorageFileType
3351 == TAPI_SIM_PB_MSISDN || pb_add.StorageFileType
3352 == TAPI_SIM_PB_LDN || pb_add.StorageFileType == TAPI_SIM_PB_ADN
3353 || pb_add.StorageFileType == TAPI_SIM_PB_SDN) {
3355 TEST_DEBUG("2g phone book entry");
3357 TEST_DEBUG(" Number Types are below ");
3358 TEST_DEBUG(" 1 - INTERNATIONAL");
3359 TEST_DEBUG(" 2 - NATIONAL");
3360 TEST_DEBUG(" 3 - NETWORK");
3361 TEST_DEBUG(" 4 - DEDICATE");
3362 TEST_DEBUG("Select Numer Type: ");
3364 scanf("%d%c", &tmpInput, &dummy);
3365 pb_add.ContactInfo.Pb2GData.NumType = tmpInput;
3367 TEST_DEBUG("Plese input contact number : ");
3368 _fgets((char *) pb_add.ContactInfo.Pb2GData.Number, 15);
3369 pb_add.ContactInfo.Pb2GData.NumLen = strlen(
3370 (char*) pb_add.ContactInfo.Pb2GData.Number);
3372 TEST_DEBUG(" Encryption Types are below ");
3373 TEST_DEBUG(" 1 - ASCII - DO NOT SUPPORT");
3374 TEST_DEBUG(" 2 - GSM7 Bit");
3375 TEST_DEBUG(" 3 - UCS2");
3376 TEST_DEBUG(" 4 - HEX - DO NOT SUPPORT");
3377 TEST_DEBUG("Select Text Encryption Type: ");
3379 scanf("%d%c", &tmpInput, &dummy);
3380 pb_add.ContactInfo.Pb2GData.NameEncryptType = tmpInput - 1;
3382 TEST_DEBUG("Plese input contact name : ");
3383 _fgets((char *) pb_add.ContactInfo.Pb2GData.Name, 20);
3385 if (pb_add.ContactInfo.Pb2GData.NameEncryptType
3386 == TAPI_SIM_TEXT_ENC_UCS2) {
3387 TEST_DEBUG("TAPI_SIM_TEXT_ENC_UCS2 Encoding");
3388 /* unicode encoding */
3389 if (FALSE == __encode_text_unicode(
3390 strlen((char *) pb_add.ContactInfo.Pb2GData.Name),
3391 (char*) pb_add.ContactInfo.Pb2GData.Name,
3392 (char *) &unicode_text_len, unicode_text)) {
3393 TEST_DEBUG("Encoding failed ! ");
3396 pb_add.ContactInfo.Pb2GData.NameLen = unicode_text_len;
3397 memcpy(pb_add.ContactInfo.Pb2GData.Name, unicode_text,
3401 pb_add.ContactInfo.Pb2GData.NameLen = strlen(
3402 (char *) pb_add.ContactInfo.Pb2GData.Name);
3404 } else if (pb_add.StorageFileType == TAPI_SIM_PB_3GSIM) {
3406 char num_field_type;
3409 TEST_DEBUG("3g phone book entry");
3411 TEST_DEBUG("Input Nuumber of fields to be entered: ");
3413 scanf("%d%c", &tempi, &dummy);
3415 num_field_type = tempi;
3417 pb_add.ContactInfo.Pb3GData.FileTypeCount = num_field_type;
3419 for (i = 0; i < num_field_type; i++) {
3420 TEST_DEBUG(" Field Types are below ");
3421 TEST_DEBUG(" 1 - Contact Name : (EF_ADN)");
3422 TEST_DEBUG(" 2 - Contact Mobile Number (EF_ADN)");
3423 TEST_DEBUG(" 3 - Contact Another Number (EF_ANR)");
3424 TEST_DEBUG(" 4 - Contact Email (EF_EMAIL)");
3425 TEST_DEBUG(" 5 - Contact Nick Name (EF_SNE)");
3426 TEST_DEBUG(" 6 - Contact Group (EF_GRP)");
3427 TEST_DEBUG(" 7 - Contact Hidden entry (EF_PBC) - NOT SUPPORT YET");
3428 TEST_DEBUG(" 8 - Contact Another Number A (EF_ANRA)");
3429 TEST_DEBUG(" 9 - Contact Another Number B (EF_ANRB)");
3431 TEST_DEBUG("Select Field type: ");
3433 scanf("%d%c", &tempi, &dummy);
3435 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileType = tempi;
3437 if (tempi == 1 || tempi == 4 || tempi == 5 || tempi == 6) {
3438 TEST_DEBUG(" Encryption Types are below ");
3439 TEST_DEBUG(" 1 - ASCII");
3440 TEST_DEBUG(" 2 - GSM7 Bit");
3441 TEST_DEBUG(" 3 - UCS2");
3442 TEST_DEBUG(" 4 - HEX");
3443 TEST_DEBUG("Select Text Encryption Type: ");
3445 scanf("%d%c", &tempi, &dummy);
3446 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataType.EncryptionType
3450 TEST_DEBUG(" Number Types are below ");
3451 TEST_DEBUG(" 1 - INTERNATIONAL");
3452 TEST_DEBUG(" 2 - NATIONAL");
3453 TEST_DEBUG(" 3 - NETWORK");
3454 TEST_DEBUG(" 4 - DEDICATE");
3455 TEST_DEBUG("Select Numer Type: ");
3457 scanf("%d%c", &tempi, &dummy);
3458 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataType.NumType
3462 if (pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileType
3463 == TAPI_PB_3G_GRP) {
3464 int c, count, k = 0;
3466 TEST_DEBUG("Please input number of index to add in GRP");
3467 scanf("%d%c", &tempi, &dummy);
3470 for (c = 0; c < count; c++) {
3471 TEST_DEBUG("Please input index of GRP: ");
3472 scanf("%d%c", &tempi, &dummy);
3474 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData[k]
3477 //pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData[k] = 0;
3480 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataLength
3482 } else if (pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileType
3484 || pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileType
3486 || pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileType
3487 == TAPI_PB_3G_SNE) {
3488 TEST_DEBUG("Plese input field string data: ");
3490 (char *) pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData,
3493 TEST_DEBUG("strlen about input data[%d]",strlen((char *)pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData) );
3495 if (pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataType.EncryptionType
3496 == TAPI_SIM_TEXT_ENC_UCS2) {
3497 /* unicode encoding */
3499 == __encode_text_unicode(
3501 (char *) pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData),
3502 (char *) pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData,
3503 (char *) &unicode_text_len,
3505 TEST_DEBUG("Encoding failed ! ");
3508 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData,
3509 unicode_text, unicode_text_len);
3510 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataLength
3514 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataLength
3516 (char *) pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData);
3519 TEST_DEBUG("Plese input field data: ");
3521 (char *) pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData,
3523 pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileDataLength
3525 (char *) pb_add.ContactInfo.Pb3GData.PbFileDataInfo[i].FileData);
3530 } else if (pb_add.StorageFileType == TAPI_SIM_PB_AAS
3531 || pb_add.StorageFileType == TAPI_SIM_PB_GAS) {
3532 TEST_DEBUG("additional num Alpha string or Group Alpha string ");
3534 TEST_DEBUG("Plese input Alpha name : ");
3536 (char *) pb_add.ContactInfo.PbAdditionalNumStringData.TextData,
3539 /* GSM 7bit conversion */
3540 __encode_gsm_7_bit_chars(strlen((char *)pb_add.ContactInfo.PbAdditionalNumStringData.TextData) ,
3541 (char *)pb_add.ContactInfo.PbAdditionalNumStringData.TextData, (char *)&unicode_text_len, unicode_text);
3543 memcpy(pb_add.ContactInfo.PbAdditionalNumStringData.TextData, unicode_text, unicode_text_len );
3545 pb_add.ContactInfo.PbAdditionalNumStringData.TextLength = unicode_text_len;
3547 pb_add.ContactInfo.PbAdditionalNumStringData.EncryptionType = TAPI_SIM_TEXT_ENC_GSM7BIT; // always 2 for GAS and AAS
3549 pb_add.ContactInfo.PbAdditionalNumStringData.TextLength
3551 (char *) pb_add.ContactInfo.PbAdditionalNumStringData.TextData);
3552 pb_add.ContactInfo.PbAdditionalNumStringData.EncryptionType
3553 = TAPI_SIM_TEXT_ENC_GSM7BIT; // But real type is ASCII (because current GSM7 is GSM7 with bit 8 set to '0')
3556 TEST_DEBUG("Undefined Storage File Type [0x%x]", pb_add.StorageFileType);
3560 err_code = tel_update_sim_pb_record(&pb_add, &request_id);
3562 if (err_code != TAPI_API_SUCCESS) {
3563 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3566 } else if (memcmp(buf, "pbdel", sizeof("pbdel") - 1) == 0) {
3567 TelSimPbFileType_t storage_type = __InputStorageType();
3569 TEST_DEBUG(" PB delete ");
3571 unsigned short index = 0;
3573 TEST_DEBUG("Plese input index : ");
3574 scanf("%d%c", (int *)&index, &dummy);
3576 err_code = tel_delete_sim_pb_record(storage_type, index, &request_id);
3578 if (err_code != TAPI_API_SUCCESS) {
3579 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3582 } else if (memcmp(buf, "pbread", sizeof("pbread") - 1) == 0) {
3583 TEST_DEBUG("PB read");
3585 unsigned short index = 0;
3588 TelSimPbFileType_t storage_type = __InputStorageType();
3590 TEST_DEBUG("Plese input index : ");
3591 scanf("%d%c", (int *)&index, &dummy);
3593 err_code = tel_read_sim_pb_record(storage_type, index, &request_id);
3595 if (err_code != TAPI_API_SUCCESS) {
3596 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3600 else if (memcmp(buf, "isimauth", sizeof("isimauth") - 1) == 0) {
3601 TEST_DEBUG("ISIM Authentication ");
3605 TelSimAuthenticationData_t auth_req = { 0, };
3607 memset(&auth_req, 0, sizeof(TelSimAuthenticationData_t));
3609 TEST_DEBUG(" Enter RAND data ");
3610 _fgets((char *) &auth_req.rand_data, 20);
3612 auth_req.rand_length
3613 = strlen((char *) auth_req.rand_data);
3615 TEST_DEBUG(" Enter Authentication data ");
3616 _fgets((char *) &auth_req.autn_data, 20);
3618 auth_req.autn_length = strlen((char *) auth_req.autn_data);
3620 TEST_DEBUG("TelTapiSimIsimAuthenticationRequest is not tested yet!");
3622 err_code = TelTapiSimIsimAuthenticationRequest( &auth_req, &request_id);
3624 if(err_code == TAPI_API_SUCCESS)
3626 TEST_DEBUG("TAPI API SUCCESS");
3630 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3636 else if (memcmp(buf, "sapcon", sizeof("sapcon") - 1) == 0) {
3637 TEST_DEBUG("SAP Connect request ");
3638 TelSimSapConnect_t con_req = { 0, };
3639 con_req.MsgId = TAPI_SIM_SAP_CONNECT_REQ;
3640 con_req.MaxMsgSize = 10; //temp for testing only - not clear
3642 err_code = tel_req_sap_connection(&con_req, &request_id);
3644 if (err_code != TAPI_API_SUCCESS) {
3645 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3649 else if (memcmp(buf, "sapdiscon", sizeof("sapdiscon") - 1) == 0) {
3650 TEST_DEBUG("SAP Disconnect request ");
3651 TelSimSapConnect_t con_req = { 0, };
3652 con_req.MsgId = TAPI_SIM_SAP_DISCONNECT_REQ;
3653 con_req.MaxMsgSize = 10; //temp for testing only - not clear
3655 err_code = tel_req_sap_connection(&con_req, &request_id);
3657 if (err_code != TAPI_API_SUCCESS) {
3658 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3662 else if (memcmp(buf, "sapstatus", sizeof("sapstatus") - 1) == 0) {
3663 TEST_DEBUG("SAP Status request ");
3665 err_code = tel_req_sap_connection_status(&request_id);
3667 if (err_code != TAPI_API_SUCCESS) {
3668 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3672 else if (memcmp(buf, "sapatr", sizeof("sapatr") - 1) == 0) {
3673 TEST_DEBUG("SAP ATR request ");
3675 err_code = tel_req_sap_transfer_atr(&request_id);
3677 if (err_code != TAPI_API_SUCCESS) {
3678 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3682 else if (memcmp(buf, "sapapdu", sizeof("sapapdu") - 1) == 0) {
3683 TEST_DEBUG("SAP APDU transfer ");
3685 int file_id = TAPI_SIM_EFILE_ICCID;
3687 /* for selecting EF ICCID */
3688 TelSimSapApduData_t apdu_data;
3690 apdu_data.ApduLength = 7;
3691 apdu_data.Apdu[0] = 0xA0; // class
3692 apdu_data.Apdu[1] = 0xA4; // instruction
3693 apdu_data.Apdu[2] = 0; // p1 = parameter 1
3694 apdu_data.Apdu[3] = 0; // p2 = parameter 2
3695 apdu_data.Apdu[4] = 2; // p3 - parameter 3
3697 memcpy(&apdu_data.Apdu[5], &file_id, sizeof(unsigned short));
3699 err_code = tel_req_sap_transfer_apdu(&apdu_data, &request_id);
3701 if (err_code == TAPI_API_SUCCESS) {
3702 TEST_DEBUG("TAPI API SUCCESS");
3704 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3708 else if (memcmp(buf, "sapsetproto", sizeof("sapsetproto") - 1) == 0) {
3709 TEST_DEBUG("SAP set protocol ");
3710 TelSimSapProtocol_t protocol = TAPI_SIM_SAP_PROTOCOL_T0;
3712 err_code = tel_req_sap_transport_protocol(protocol, &request_id);
3714 if (err_code != TAPI_API_SUCCESS) {
3715 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3719 else if (memcmp(buf, "sapsimpwr", sizeof("sapsimpwr") - 1) == 0) {
3721 TelSimSapMsgId_t msdId = 0;
3725 TEST_DEBUG("SAP SIM power ");
3727 TEST_DEBUG("Please input SAP SIM power on(1) / off(!1): ");
3729 scanf("%d%c", &tempi, &dummy);
3731 msdId = TAPI_SIM_SAP_POWER_SIM_ON_REQ;
3733 msdId = TAPI_SIM_SAP_POWER_SIM_OFF_REQ;
3735 err_code = tel_req_sap_power_operation(msdId, &request_id);// only for testing
3737 if (err_code != TAPI_API_SUCCESS) {
3738 TEST_DEBUG("TAPI API FAIL: Error Code [0x%x]",err_code);
3742 if (memcmp(buf, "close", sizeof("close") - 1) == 0) {
3743 TEST_DEBUG(" close reuqest ");
3745 // err_code = tapi_sim_close(92);
3747 //err_code = tapi_sim_close(g_test_hsim);
3748 TEST_DEBUG(" ret value from close [0x%x]", err_code);
3750 if (err_code == TAPI_API_SUCCESS) {
3751 TEST_DEBUG(" sim close OK!");
3753 TEST_DEBUG(" SIM close request returned error [0x%x] !",err_code );
3755 TEST_DEBUG("Request ID [0x%x]", request_id);
3758 if (memcmp(buf, "q", sizeof("q") - 1) == 0) {
3759 TEST_DEBUG("Finished Testing this module, Going back to Main Menu");
3767 void sim_select_loop(void) {
3773 FD_SET(0, &readfds);
3775 ret = select(0 + 1, &readfds, NULL, NULL, NULL);
3778 if (FD_ISSET(0, &readfds)) {
3779 if (sim_read_key_input() < 0)
3786 void* sim_test_thread_loop(void* data) {
3787 TEST_DEBUG(" sim_test_thread_loop : called...");
3791 TEST_DEBUG(" sim_test_thread_loop : stdin Loop exited");
3796 int sim_main(int argc, char *argv[]) {
3799 p_thread = pthread_create(&p_thread, NULL, sim_test_thread_loop, NULL);
3801 if (p_thread != 0) {
3802 TEST_DEBUG("Failed while creating a thread to read from stdin");
3805 TEST_DEBUG("A thread was created to read from stdin ..");
3808 sim_test_subscribe_tapi_events();
3810 pthread_join(p_thread, NULL);
3812 TEST_DEBUG("Exiting sim test program bye bye !");