4 * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Ankit Jogi <ankit.jogi@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.
24 #include <tapi_common.h>
26 #include <TapiUtility.h>
28 #include "util_common.h"
31 enum async_state async_flag;
35 * tel_get_sim_init_info
38 static void utc_tel_get_sim_init_info (void)
41 TelSimCardStatus_t sim_status;
46 ret = tel_get_sim_init_info (handle, &sim_status, &card_changed);
47 if (ret != TAPI_API_SUCCESS) {
48 dts_fail("tel_get_sim_init_info", "Unexpected return");
51 dts_pass("tel_get_sim_init_info");
54 static void utc_fail_tel_get_sim_init_info (void)
57 TelSimCardStatus_t sim_status;
60 ret = tel_get_sim_init_info (NULL, &sim_status, &card_changed);
61 if (ret == TAPI_API_SUCCESS) {
62 dts_fail("tel_get_sim_init_info", "Parameter check failed");
65 ret = tel_get_sim_init_info (handle, NULL, &card_changed);
66 if (ret == TAPI_API_SUCCESS) {
67 dts_fail("tel_get_sim_init_info", "Parameter check failed");
70 ret = tel_get_sim_init_info (handle, &sim_status, NULL);
71 if (ret == TAPI_API_SUCCESS) {
72 dts_fail("tel_get_sim_init_info", "Parameter check failed");
75 ret = tel_get_sim_init_info (handle, NULL, NULL);
76 if (ret == TAPI_API_SUCCESS) {
77 dts_fail("tel_get_sim_init_info", "Parameter check failed");
80 dts_pass("tel_get_sim_init_info");
87 static void utc_tel_get_sim_type (void)
90 TelSimCardType_t card_type;
94 ret = tel_get_sim_type (handle, &card_type);
95 if (ret != TAPI_API_SUCCESS) {
96 dts_fail("tel_get_sim_type", "Unexpected return");
99 dts_pass("tel_get_sim_type");
102 static void utc_fail_tel_get_sim_type (void)
105 TelSimCardType_t card_type;
107 ret = tel_get_sim_type (NULL, &card_type);
108 if (ret == TAPI_API_SUCCESS) {
109 dts_fail("tel_get_sim_type", "Parameter check failed");
112 ret = tel_get_sim_type (handle, NULL);
113 if (ret == TAPI_API_SUCCESS) {
114 dts_fail("tel_get_sim_type", "Parameter check failed");
117 dts_pass("tel_get_sim_type");
124 static void utc_tel_get_sim_imsi (void)
127 TelSimImsiInfo_t imsi;
131 ret = tel_get_sim_imsi (handle, &imsi);
132 if (ret != TAPI_API_SUCCESS) {
133 dts_fail("tel_get_sim_imsi", "Unexpected return");
136 dts_pass("tel_get_sim_imsi");
139 static void utc_fail_tel_get_sim_imsi (void)
142 TelSimImsiInfo_t imsi;
144 ret = tel_get_sim_imsi (NULL, &imsi);
145 if (ret == TAPI_API_SUCCESS) {
146 dts_fail("tel_get_sim_imsi", "Parameter check failed");
149 ret = tel_get_sim_imsi (handle, NULL);
150 if (ret == TAPI_API_SUCCESS) {
151 dts_fail("tel_get_sim_imsi", "Parameter check failed");
154 dts_pass("tel_get_sim_imsi");
161 static void utc_tel_get_sim_ecc (void)
168 ret = tel_get_sim_ecc (handle, &ecc);
169 if (ret != TAPI_API_SUCCESS) {
170 dts_fail("tel_get_sim_ecc", "Unexpected return");
173 dts_pass("tel_get_sim_ecc");
176 static void utc_fail_tel_get_sim_ecc (void)
181 ret = tel_get_sim_ecc (NULL, &ecc);
182 if (ret == TAPI_API_SUCCESS) {
183 dts_fail("tel_get_sim_ecc", "Parameter check failed");
186 ret = tel_get_sim_ecc (handle, NULL);
187 if (ret == TAPI_API_SUCCESS) {
188 dts_fail("tel_get_sim_ecc", "Parameter check failed");
191 dts_pass("tel_get_sim_ecc");
195 * tel_set_sim_language
198 static void on_tel_set_sim_language (TapiHandle *handle, int result,
199 void *data, void *user_data)
201 int *value = user_data;
203 async_flag = ASYNC_DONE;
206 if (*value != 0xC0FFEE) {
207 dts_fail("tel_set_sim_language", "Callback userdata crashed");
211 static void utc_tel_set_sim_language (void)
214 int value = 0xC0FFEE;
218 async_flag = ASYNC_READY;
219 ret = tel_set_sim_language (handle, 2, on_tel_set_sim_language, &value);
220 if (ret != TAPI_API_SUCCESS) {
221 dts_fail("tel_set_sim_language", "Unexpected return");
227 if (async_flag != ASYNC_DONE) {
228 dts_fail("tel_set_sim_language", "Callback not invoked");
231 dts_pass("tel_set_sim_language");
234 static void utc_fail_tel_set_sim_language (void)
238 ret = tel_set_sim_language (NULL, 0, NULL, NULL);
239 if (ret == TAPI_API_SUCCESS) {
240 dts_fail("tel_set_sim_language", "Parameter check failed");
243 dts_pass("tel_set_sim_language");
247 * tel_set_sim_callforwarding_info
250 static void on_tel_set_sim_callforwarding_info (TapiHandle *handle, int result,
251 void *data, void *user_data)
253 int *value = user_data;
255 async_flag = ASYNC_DONE;
258 if (*value != 0xC0FFEE) {
259 dts_fail("tel_set_sim_callforwarding_info", "Callback userdata crashed");
263 static void utc_tel_set_sim_callforwarding_info (void)
266 int value = 0xC0FFEE;
267 TelSimCallForwardingReq_t req_cphs_cf;
269 memset (&req_cphs_cf, 0, sizeof(TelSimCallForwardingReq_t));
271 req_cphs_cf.b_cphs = 1;
272 req_cphs_cf.cf_data_u.cphs_cf.b_line1 = 1;
273 req_cphs_cf.cf_data_u.cphs_cf.b_line2 = 0;
274 req_cphs_cf.cf_data_u.cphs_cf.b_fax = 1;
275 req_cphs_cf.cf_data_u.cphs_cf.b_data = 0;
279 async_flag = ASYNC_READY;
280 ret = tel_set_sim_callforwarding_info (handle, &req_cphs_cf, on_tel_set_sim_callforwarding_info, &value);
281 if (ret != TAPI_API_SUCCESS) {
282 dts_fail("tel_set_sim_callforwarding_info", "Unexpected return");
288 if (async_flag != ASYNC_DONE) {
289 dts_fail("tel_set_sim_callforwarding_info", "Callback not invoked");
292 dts_pass("tel_set_sim_callforwarding_info");
295 static void utc_fail_tel_set_sim_callforwarding_info (void)
298 TelSimCallForwardingReq_t req_cphs_cf;
300 memset (&req_cphs_cf, 0, sizeof(TelSimCallForwardingReq_t));
302 req_cphs_cf.b_cphs = 1;
303 req_cphs_cf.cf_data_u.cphs_cf.b_line1 = 1;
304 req_cphs_cf.cf_data_u.cphs_cf.b_line2 = 0;
305 req_cphs_cf.cf_data_u.cphs_cf.b_fax = 1;
306 req_cphs_cf.cf_data_u.cphs_cf.b_data = 0;
308 ret = tel_set_sim_callforwarding_info (NULL, &req_cphs_cf, NULL, NULL);
309 if (ret == TAPI_API_SUCCESS) {
310 dts_fail("tel_set_sim_callforwarding_info", "Parameter check failed");
313 ret = tel_set_sim_callforwarding_info (handle, NULL, NULL, NULL);
314 if (ret == TAPI_API_SUCCESS) {
315 dts_fail("tel_set_sim_callforwarding_info", "Parameter check failed");
318 dts_pass("tel_set_sim_callforwarding_info");
322 * tel_set_sim_messagewaiting_info
325 static void on_tel_set_sim_messagewaiting_info (TapiHandle *handle, int result,
326 void *data, void *user_data)
328 int *value = user_data;
330 async_flag = ASYNC_DONE;
333 if (*value != 0xC0FFEE) {
334 dts_fail("tel_set_sim_messagewaiting_info", "Callback userdata crashed");
338 static void utc_tel_set_sim_messagewaiting_info (void)
341 int value = 0xC0FFEE;
342 TelSimMessageWaitingReq_t req_mw;
344 memset (&req_mw, 0, sizeof(TelSimMessageWaitingReq_t));
347 req_mw.mw_data_u.cphs_mw.b_voice1 = 1;
348 req_mw.mw_data_u.cphs_mw.b_voice2 = 0;
349 req_mw.mw_data_u.cphs_mw.b_fax = 1;
350 req_mw.mw_data_u.cphs_mw.b_data = 0;
354 async_flag = ASYNC_READY;
355 ret = tel_set_sim_messagewaiting_info (handle, &req_mw, on_tel_set_sim_messagewaiting_info, &value);
356 if (ret != TAPI_API_SUCCESS) {
357 dts_fail("tel_set_sim_messagewaiting_info", "Unexpected return");
363 if (async_flag != ASYNC_DONE) {
364 dts_fail("tel_set_sim_messagewaiting_info", "Callback not invoked");
367 dts_pass("tel_set_sim_callforwarding_info");
370 static void utc_fail_tel_set_sim_messagewaiting_info (void)
373 TelSimMessageWaitingReq_t req_mw;
375 memset (&req_mw, 0, sizeof(TelSimMessageWaitingReq_t));
378 req_mw.mw_data_u.cphs_mw.b_voice1 = 1;
379 req_mw.mw_data_u.cphs_mw.b_voice2 = 0;
380 req_mw.mw_data_u.cphs_mw.b_fax = 1;
381 req_mw.mw_data_u.cphs_mw.b_data = 0;
383 ret = tel_set_sim_messagewaiting_info (NULL, &req_mw, NULL, NULL);
384 if (ret == TAPI_API_SUCCESS) {
385 dts_fail("tel_set_sim_messagewaiting_info", "Parameter check failed");
388 ret = tel_set_sim_messagewaiting_info (handle, NULL, NULL, NULL);
389 if (ret == TAPI_API_SUCCESS) {
390 dts_fail("tel_set_sim_messagewaiting_info", "Parameter check failed");
393 dts_pass("tel_set_sim_messagewaiting_info");
397 * tel_set_sim_mailbox_info
400 static void on_tel_set_sim_mailbox_info (TapiHandle *handle, int result,
401 void *data, void *user_data)
403 int *value = user_data;
405 async_flag = ASYNC_DONE;
408 if (*value != 0xC0FFEE) {
409 dts_fail("tel_set_sim_mailbox_info", "Callback userdata crashed");
413 static void utc_tel_set_sim_mailbox_info (void)
416 int value = 0xC0FFEE;
417 TelSimMailBoxNumber_t req_mb;
419 memset (&req_mb, 0, sizeof(TelSimMailBoxNumber_t));
422 req_mb.rec_index = 1;
423 req_mb.profile_num = 1;
425 req_mb.alpha_id_max_len = 10;
426 strcpy (req_mb.alpha_id, "123456");
429 strcpy (req_mb.num, "9988776655");
433 async_flag = ASYNC_READY;
434 ret = tel_set_sim_mailbox_info (handle, &req_mb, on_tel_set_sim_mailbox_info, &value);
435 if (ret != TAPI_API_SUCCESS) {
436 dts_fail("tel_set_sim_mailbox_info", "Unexpected return");
442 if (async_flag != ASYNC_DONE) {
443 dts_fail("tel_set_sim_mailbox_info", "Callback not invoked");
446 dts_pass("tel_set_sim_mailbox_info");
449 static void utc_fail_tel_set_sim_mailbox_info (void)
452 TelSimMailBoxNumber_t req_mb;
454 memset (&req_mb, 0, sizeof(TelSimMailBoxNumber_t));
457 req_mb.rec_index = 1;
458 req_mb.profile_num = 1;
460 req_mb.alpha_id_max_len = 10;
461 strcpy (req_mb.alpha_id, "123456");
464 strcpy (req_mb.num, "9988776655");
466 ret = tel_set_sim_mailbox_info (NULL, &req_mb, NULL, NULL);
467 if (ret == TAPI_API_SUCCESS) {
468 dts_fail("tel_set_sim_mailbox_info", "Parameter check failed");
471 ret = tel_set_sim_mailbox_info (handle, NULL, NULL, NULL);
472 if (ret == TAPI_API_SUCCESS) {
473 dts_fail("tel_set_sim_mailbox_info", "Parameter check failed");
476 dts_pass("tel_set_sim_mailbox_info");
480 * tel_req_sim_authentication
483 static void on_tel_req_sim_authentication (TapiHandle *handle, int result,
484 void *data, void *user_data)
486 int *value = user_data;
488 async_flag = ASYNC_DONE;
491 if (*value != 0xC0FFEE) {
492 dts_fail("tel_set_sim_mailbox_info", "Callback userdata crashed");
496 static void utc_tel_req_sim_authentication (void)
499 int value = 0xC0FFEE;
500 TelSimAuthenticationData_t authentication_data;
502 memset (&authentication_data, 0, sizeof(TelSimAuthenticationData_t));
504 authentication_data.auth_type = 1;
505 authentication_data.rand_length = 16;
506 authentication_data.autn_length = 16;
507 strcpy (authentication_data.rand_data, "AAAAAAAAAAAAAAAA");
508 strcpy (authentication_data.autn_data, "AAAAAAAAAAAAAAAA");
512 async_flag = ASYNC_READY;
513 ret = tel_req_sim_authentication (handle, &authentication_data, on_tel_req_sim_authentication, &value);
514 if (ret != TAPI_API_SUCCESS) {
515 dts_fail("tel_req_sim_authentication", "Unexpected return");
521 if (async_flag != ASYNC_DONE) {
522 dts_fail("tel_req_sim_authentication", "Callback not invoked");
525 dts_pass("tel_req_sim_authentication");
528 static void utc_fail_tel_req_sim_authentication (void)
531 TelSimAuthenticationData_t authentication_data;
533 memset (&authentication_data, 0, sizeof(TelSimAuthenticationData_t));
535 authentication_data.auth_type = 1;
536 authentication_data.rand_length = 16;
537 authentication_data.autn_length = 16;
538 strcpy (authentication_data.rand_data, "AAAAAAAAAAAAAAAA");
539 strcpy (authentication_data.autn_data, "AAAAAAAAAAAAAAAA");
541 ret = tel_req_sim_authentication (NULL, &authentication_data, NULL, NULL);
542 if (ret == TAPI_API_SUCCESS) {
543 dts_fail("tel_req_sim_authentication", "Parameter check failed");
546 ret = tel_req_sim_authentication (handle, NULL, NULL, NULL);
547 if (ret == TAPI_API_SUCCESS) {
548 dts_fail("tel_req_sim_authentication", "Parameter check failed");
551 dts_pass("tel_req_sim_authentication");
555 * tel_verifiy_sim_pins
558 static void on_tel_verifiy_sim_pins (TapiHandle *handle, int result,
559 void *data, void *user_data)
561 int *value = user_data;
563 async_flag = ASYNC_DONE;
566 if (*value != 0xC0FFEE) {
567 dts_fail("tel_verifiy_sim_pins", "Callback userdata crashed");
571 static void utc_tel_verifiy_sim_pins (void)
574 int value = 0xC0FFEE;
575 TelSimSecPw_t pin_data;
577 memset (&pin_data, 0, sizeof(TelSimSecPw_t));
581 pin_data.pw = calloc(1, pin_data.pw_len);
582 strcpy ((char *)pin_data.pw, "1234");
586 async_flag = ASYNC_READY;
587 ret = tel_verifiy_sim_pins (handle, &pin_data, on_tel_verifiy_sim_pins, &value);
588 if (ret != TAPI_API_SUCCESS) {
589 dts_fail("tel_verifiy_sim_pins", "Unexpected return");
595 if (async_flag != ASYNC_DONE) {
596 dts_fail("tel_verifiy_sim_pins", "Callback not invoked");
599 dts_pass("tel_verifiy_sim_pins");
603 static void utc_fail_tel_verifiy_sim_pins (void)
607 TelSimSecPw_t pin_data;
609 memset (&pin_data, 0, sizeof(TelSimSecPw_t));
613 pin_data.pw = calloc(1, pin_data.pw_len);
614 strcpy ((char *)pin_data.pw, "1234");
616 ret = tel_verifiy_sim_pins (NULL, &pin_data, NULL, NULL);
617 if (ret == TAPI_API_SUCCESS) {
618 dts_fail("tel_verifiy_sim_pins", "Parameter check failed");
622 ret = tel_verifiy_sim_pins (handle, &pin_data, NULL, NULL);
623 if (ret == TAPI_API_SUCCESS) {
624 dts_fail("tel_verifiy_sim_pins", "Parameter check failed");
629 ret = tel_verifiy_sim_pins (handle, &pin_data, NULL, NULL);
630 if (ret == TAPI_API_SUCCESS) {
631 dts_fail("tel_verifiy_sim_pins", "Parameter check failed");
635 ret = tel_verifiy_sim_pins (handle, &pin_data, NULL, NULL);
636 if (ret == TAPI_API_SUCCESS) {
637 dts_fail("tel_verifiy_sim_pins", "Parameter check failed");
640 ret = tel_verifiy_sim_pins (handle, NULL, NULL, NULL);
641 if (ret == TAPI_API_SUCCESS) {
642 dts_fail("tel_verifiy_sim_pins", "Parameter check failed");
645 dts_pass("tel_verifiy_sim_pins");
650 * tel_verify_sim_puks
653 static void on_tel_verify_sim_puks (TapiHandle *handle, int result,
654 void *data, void *user_data)
656 int *value = user_data;
658 async_flag = ASYNC_DONE;
661 if (*value != 0xC0FFEE) {
662 dts_fail("tel_verify_sim_puks", "Callback userdata crashed");
666 static void utc_tel_verify_sim_puks (void)
669 int value = 0xC0FFEE;
670 TelSimSecPw_t puk_data;
671 TelSimSecPw_t new_pin_data;
673 memset (&puk_data, 0, sizeof(TelSimSecPw_t));
674 memset (&new_pin_data, 0, sizeof(TelSimSecPw_t));
678 puk_data.pw = calloc(1, puk_data.pw_len);
679 strcpy ((char *)puk_data.pw, "22222");
681 new_pin_data.type = 0;
682 new_pin_data.pw_len = 4;
683 new_pin_data.pw = calloc(1, new_pin_data.pw_len);
684 strcpy ((char *)new_pin_data.pw, "1111");
688 async_flag = ASYNC_READY;
689 ret = tel_verify_sim_puks (handle, &puk_data, &new_pin_data, on_tel_verify_sim_puks, &value);
690 if (ret != TAPI_API_SUCCESS) {
691 dts_fail("tel_verify_sim_puks", "Unexpected return");
697 if (async_flag != ASYNC_DONE) {
698 dts_fail("tel_verify_sim_puks", "Callback not invoked");
701 dts_pass("tel_verify_sim_puks");
703 free(new_pin_data.pw);
706 static void utc_fail_tel_verify_sim_puks (void)
709 TelSimSecPw_t puk_data;
710 TelSimSecPw_t new_pin_data;
712 memset (&puk_data, 0, sizeof(TelSimSecPw_t));
713 memset (&new_pin_data, 0, sizeof(TelSimSecPw_t));
717 puk_data.pw = calloc(1, puk_data.pw_len);
718 strcpy ((char *)puk_data.pw, "22222");
720 new_pin_data.type = 0;
721 new_pin_data.pw_len = 4;
722 new_pin_data.pw = calloc(1, new_pin_data.pw_len);
723 strcpy ((char *)new_pin_data.pw, "1111");
725 ret = tel_verify_sim_puks (NULL, &puk_data, &new_pin_data, NULL, NULL);
726 if (ret == TAPI_API_SUCCESS) {
727 dts_fail("tel_verify_sim_puks", "Parameter check failed");
729 ret = tel_verify_sim_puks (NULL, NULL , &new_pin_data, NULL, NULL);
730 if (ret == TAPI_API_SUCCESS) {
731 dts_fail("tel_verify_sim_puks", "Parameter check failed");
733 ret = tel_verify_sim_puks (NULL, &puk_data, NULL, NULL, NULL);
734 if (ret == TAPI_API_SUCCESS) {
735 dts_fail("tel_verify_sim_puks", "Parameter check failed");
737 ret = tel_verify_sim_puks (NULL, NULL, NULL, NULL, NULL);
738 if (ret == TAPI_API_SUCCESS) {
739 dts_fail("tel_verify_sim_puks", "Parameter check failed");
742 ret = tel_verify_sim_puks (NULL, &puk_data, &new_pin_data, NULL, NULL);
743 if (ret == TAPI_API_SUCCESS) {
744 dts_fail("tel_verify_sim_puks", "Parameter check failed");
747 new_pin_data.type = 2;
748 ret = tel_verify_sim_puks (NULL, &puk_data, &new_pin_data, NULL, NULL);
749 if (ret == TAPI_API_SUCCESS) {
750 dts_fail("tel_verify_sim_puks", "Parameter check failed");
753 new_pin_data.type = 0;
755 ret = tel_verify_sim_puks (NULL, &puk_data, &new_pin_data, NULL, NULL);
756 if (ret == TAPI_API_SUCCESS) {
757 dts_fail("tel_verify_sim_puks", "Parameter check failed");
760 ret = tel_verify_sim_puks (NULL, &puk_data, &new_pin_data, NULL, NULL);
761 if (ret == TAPI_API_SUCCESS) {
762 dts_fail("tel_verify_sim_puks", "Parameter check failed");
764 new_pin_data.pw_len = 3;
765 ret = tel_verify_sim_puks (NULL, &puk_data, &new_pin_data, NULL, NULL);
766 if (ret == TAPI_API_SUCCESS) {
767 dts_fail("tel_verify_sim_puks", "Parameter check failed");
769 new_pin_data.pw_len = 9;
770 ret = tel_verify_sim_puks (NULL, &puk_data, &new_pin_data, NULL, NULL);
771 if (ret == TAPI_API_SUCCESS) {
772 dts_fail("tel_verify_sim_puks", "Parameter check failed");
775 new_pin_data.pw_len = 5;
777 ret = tel_verify_sim_puks (NULL, &puk_data, &new_pin_data, NULL, NULL);
778 if (ret == TAPI_API_SUCCESS) {
779 dts_fail("tel_verify_sim_puks", "Parameter check failed");
781 new_pin_data.pw = NULL;
782 ret = tel_verify_sim_puks (NULL, &puk_data, &new_pin_data, NULL, NULL);
783 if (ret == TAPI_API_SUCCESS) {
784 dts_fail("tel_verify_sim_puks", "Parameter check failed");
787 dts_pass("tel_verify_sim_puks");
789 free(new_pin_data.pw);
793 * tel_change_sim_pins
796 static void on_tel_change_sim_pins (TapiHandle *handle, int result,
797 void *data, void *user_data)
799 int *value = user_data;
801 async_flag = ASYNC_DONE;
804 if (*value != 0xC0FFEE) {
805 dts_fail("tel_change_sim_pins", "Callback userdata crashed");
809 static void utc_tel_change_sim_pins (void)
812 int value = 0xC0FFEE;
813 TelSimSecPw_t old_pin;
814 TelSimSecPw_t new_pin;
816 memset (&old_pin, 0, sizeof(TelSimSecPw_t));
817 memset (&new_pin, 0, sizeof(TelSimSecPw_t));
821 old_pin.pw = calloc(1, old_pin.pw_len);
822 strcpy ((char *)old_pin.pw, "1111");
826 new_pin.pw = calloc(1, new_pin.pw_len);
827 strcpy ((char *)new_pin.pw, "2222");
831 async_flag = ASYNC_READY;
832 ret = tel_change_sim_pins (handle, &old_pin, &new_pin, on_tel_change_sim_pins, &value);
833 if (ret != TAPI_API_SUCCESS) {
834 dts_fail("tel_change_sim_pins", "Unexpected return");
840 if (async_flag != ASYNC_DONE) {
841 dts_fail("tel_change_sim_pins", "Callback not invoked");
844 dts_pass("tel_change_sim_pins");
849 static void utc_fail_tel_change_sim_pins (void)
852 TelSimSecPw_t old_pin;
853 TelSimSecPw_t new_pin;
855 memset (&old_pin, 0, sizeof(TelSimSecPw_t));
856 memset (&new_pin, 0, sizeof(TelSimSecPw_t));
860 old_pin.pw = calloc(1, old_pin.pw_len);
861 strcpy ((char *)old_pin.pw, "1111");
865 new_pin.pw = calloc(1, new_pin.pw_len);
866 strcpy ((char *)new_pin.pw, "2222");
868 ret = tel_change_sim_pins (NULL, &old_pin, &new_pin, NULL, NULL);
869 if (ret == TAPI_API_SUCCESS) {
870 dts_fail("tel_change_sim_pins", "Parameter check failed");
872 ret = tel_change_sim_pins (NULL, NULL , &new_pin, NULL, NULL);
873 if (ret == TAPI_API_SUCCESS) {
874 dts_fail("tel_change_sim_pins", "Parameter check failed");
876 ret = tel_change_sim_pins (NULL, &old_pin, NULL, NULL, NULL);
877 if (ret == TAPI_API_SUCCESS) {
878 dts_fail("tel_change_sim_pins", "Parameter check failed");
880 ret = tel_change_sim_pins (NULL, NULL, NULL, NULL, NULL);
881 if (ret == TAPI_API_SUCCESS) {
882 dts_fail("tel_change_sim_pins", "Parameter check failed");
885 ret = tel_change_sim_pins (NULL, &old_pin, &new_pin, NULL, NULL);
886 if (ret == TAPI_API_SUCCESS) {
887 dts_fail("tel_change_sim_pins", "Parameter check failed");
891 ret = tel_change_sim_pins (NULL, &old_pin, &new_pin, NULL, NULL);
892 if (ret == TAPI_API_SUCCESS) {
893 dts_fail("tel_change_sim_pins", "Parameter check failed");
898 ret = tel_change_sim_pins (NULL, &old_pin, &new_pin, NULL, NULL);
899 if (ret == TAPI_API_SUCCESS) {
900 dts_fail("tel_change_sim_pins", "Parameter check failed");
903 ret = tel_change_sim_pins (NULL, &old_pin, &new_pin, NULL, NULL);
904 if (ret == TAPI_API_SUCCESS) {
905 dts_fail("tel_change_sim_pins", "Parameter check failed");
908 ret = tel_change_sim_pins (NULL, &old_pin, &new_pin, NULL, NULL);
909 if (ret == TAPI_API_SUCCESS) {
910 dts_fail("tel_change_sim_pins", "Parameter check failed");
913 ret = tel_change_sim_pins (NULL, &old_pin, &new_pin, NULL, NULL);
914 if (ret == TAPI_API_SUCCESS) {
915 dts_fail("tel_change_sim_pins", "Parameter check failed");
920 ret = tel_change_sim_pins (NULL, &old_pin, &new_pin, NULL, NULL);
921 if (ret == TAPI_API_SUCCESS) {
922 dts_fail("tel_change_sim_pins", "Parameter check failed");
925 ret = tel_change_sim_pins (NULL, &old_pin, &new_pin, NULL, NULL);
926 if (ret == TAPI_API_SUCCESS) {
927 dts_fail("tel_change_sim_pins", "Parameter check failed");
930 dts_pass("tel_change_sim_pins");
936 * tel_disable_sim_facility
939 static void on_tel_disable_sim_facility (TapiHandle *handle, int result,
940 void *data, void *user_data)
942 int *value = user_data;
944 async_flag = ASYNC_DONE;
947 if (*value != 0xC0FFEE) {
948 dts_fail("tel_disable_sim_facility", "Callback userdata crashed");
952 static void utc_tel_disable_sim_facility (void)
955 int value = 0xC0FFEE;
956 TelSimFacilityPw_t pw;
958 memset (&pw, 0, sizeof(TelSimFacilityPw_t));
962 pw.pw = calloc(1, pw.pw_len);
963 strcpy ((char *)pw.pw, "12345");
967 async_flag = ASYNC_READY;
968 ret = tel_disable_sim_facility (handle, &pw, on_tel_disable_sim_facility, &value);
969 if (ret != TAPI_API_SUCCESS) {
970 dts_fail("tel_disable_sim_facility", "Unexpected return");
976 if (async_flag != ASYNC_DONE) {
977 dts_fail("tel_disable_sim_facility", "Callback not invoked");
980 dts_pass("tel_disable_sim_facility");
984 static void utc_fail_tel_disable_sim_facility (void)
987 TelSimFacilityPw_t pw;
989 memset (&pw, 0, sizeof(TelSimFacilityPw_t));
993 pw.pw = calloc(1, pw.pw_len);
994 strcpy ((char *)pw.pw, "12345");
996 ret = tel_disable_sim_facility (NULL, &pw, NULL, NULL);
997 if (ret == TAPI_API_SUCCESS) {
998 dts_fail("tel_disable_sim_facility", "Parameter check failed");
1001 ret = tel_disable_sim_facility (handle, NULL, NULL, NULL);
1002 if (ret == TAPI_API_SUCCESS) {
1003 dts_fail("tel_disable_sim_facility", "Parameter check failed");
1007 ret = tel_disable_sim_facility (handle, &pw, NULL, NULL);
1008 if (ret == TAPI_API_SUCCESS) {
1009 dts_fail("tel_disable_sim_facility", "Parameter check failed");
1013 ret = tel_disable_sim_facility (handle, &pw, NULL, NULL);
1014 if (ret == TAPI_API_SUCCESS) {
1015 dts_fail("tel_disable_sim_facility", "Parameter check failed");
1020 ret = tel_disable_sim_facility (handle, &pw, NULL, NULL);
1021 if (ret == TAPI_API_SUCCESS) {
1022 dts_fail("tel_disable_sim_facility", "Parameter check failed");
1025 dts_pass("tel_disable_sim_facility");
1030 * tel_enable_sim_facility
1033 static void on_tel_enable_sim_facility (TapiHandle *handle, int result,
1034 void *data, void *user_data)
1036 int *value = user_data;
1038 async_flag = ASYNC_DONE;
1041 if (*value != 0xC0FFEE) {
1042 dts_fail("tel_enable_sim_facility", "Callback userdata crashed");
1046 static void utc_tel_enable_sim_facility (void)
1049 int value = 0xC0FFEE;
1050 TelSimFacilityPw_t pw;
1052 memset (&pw, 0, sizeof(TelSimFacilityPw_t));
1056 pw.pw = calloc(1, pw.pw_len);
1057 strcpy ((char *)pw.pw, "12345");
1061 async_flag = ASYNC_READY;
1062 ret = tel_enable_sim_facility (handle, &pw, on_tel_enable_sim_facility, &value);
1063 if (ret != TAPI_API_SUCCESS) {
1064 dts_fail("tel_enable_sim_facility", "Unexpected return");
1070 if (async_flag != ASYNC_DONE) {
1071 dts_fail("tel_enable_sim_facility", "Callback not invoked");
1074 dts_pass("tel_enable_sim_facility");
1078 static void utc_fail_tel_enable_sim_facility (void)
1081 TelSimFacilityPw_t pw;
1083 memset (&pw, 0, sizeof(TelSimFacilityPw_t));
1087 pw.pw = calloc(1, pw.pw_len);
1088 strcpy ((char *)pw.pw, "12345");
1090 ret = tel_enable_sim_facility (NULL, &pw, NULL, NULL);
1091 if (ret == TAPI_API_SUCCESS) {
1092 dts_fail("tel_enable_sim_facility", "Parameter check failed");
1095 ret = tel_enable_sim_facility (handle, NULL, NULL, NULL);
1096 if (ret == TAPI_API_SUCCESS) {
1097 dts_fail("tel_enable_sim_facility", "Parameter check failed");
1101 ret = tel_enable_sim_facility (handle, &pw, NULL, NULL);
1102 if (ret == TAPI_API_SUCCESS) {
1103 dts_fail("tel_enable_sim_facility", "Parameter check failed");
1107 ret = tel_enable_sim_facility (handle, &pw, NULL, NULL);
1108 if (ret == TAPI_API_SUCCESS) {
1109 dts_fail("tel_enable_sim_facility", "Parameter check failed");
1114 ret = tel_enable_sim_facility (handle, &pw, NULL, NULL);
1115 if (ret == TAPI_API_SUCCESS) {
1116 dts_fail("tel_enable_sim_facility", "Parameter check failed");
1119 dts_pass("tel_enable_sim_facility");
1124 * tel_get_sim_facility
1127 static void on_tel_get_sim_facility (TapiHandle *handle, int result,
1128 void *data, void *user_data)
1130 int *value = user_data;
1132 async_flag = ASYNC_DONE;
1135 if (*value != 0xC0FFEE) {
1136 dts_fail("tel_get_sim_facility", "Callback userdata crashed");
1140 static void utc_tel_get_sim_facility (void)
1143 int value = 0xC0FFEE;
1147 async_flag = ASYNC_READY;
1148 ret = tel_get_sim_facility (handle, 3, on_tel_get_sim_facility, &value);
1149 if (ret != TAPI_API_SUCCESS) {
1150 dts_fail("tel_get_sim_facility", "Unexpected return");
1156 if (async_flag != ASYNC_DONE) {
1157 dts_fail("tel_get_sim_facility", "Callback not invoked");
1160 dts_pass("tel_get_sim_facility");
1163 static void utc_fail_tel_get_sim_facility (void)
1167 ret = tel_get_sim_facility (NULL, 3, NULL, NULL);
1168 if (ret == TAPI_API_SUCCESS) {
1169 dts_fail("tel_get_sim_facility", "Parameter check failed");
1172 ret = tel_get_sim_facility (handle, 0, NULL, NULL);
1173 if (ret == TAPI_API_SUCCESS) {
1174 dts_fail("tel_get_sim_facility", "Parameter check failed");
1177 ret = tel_get_sim_facility (handle, 9, NULL, NULL);
1178 if (ret == TAPI_API_SUCCESS) {
1179 dts_fail("tel_get_sim_facility", "Parameter check failed");
1182 dts_pass("tel_get_sim_facility");
1186 * tel_get_sim_lock_info
1189 static void on_tel_get_sim_lock_info (TapiHandle *handle, int result,
1190 void *data, void *user_data)
1192 int *value = user_data;
1194 async_flag = ASYNC_DONE;
1197 if (*value != 0xC0FFEE) {
1198 dts_fail("tel_get_sim_lock_info", "Callback userdata crashed");
1202 static void utc_tel_get_sim_lock_info (void)
1205 int value = 0xC0FFEE;
1209 async_flag = ASYNC_READY;
1210 ret = tel_get_sim_lock_info (handle, 3, on_tel_get_sim_lock_info, &value);
1211 if (ret != TAPI_API_SUCCESS) {
1212 dts_fail("tel_get_sim_lock_info", "Unexpected return");
1218 if (async_flag != ASYNC_DONE) {
1219 dts_fail("tel_get_sim_lock_info", "Callback not invoked");
1222 dts_pass("tel_get_sim_lock_info");
1225 static void utc_fail_tel_get_sim_lock_info (void)
1229 ret = tel_get_sim_lock_info (NULL, 3, NULL, NULL);
1230 if (ret == TAPI_API_SUCCESS) {
1231 dts_fail("tel_get_sim_facility", "Parameter check failed");
1234 ret = tel_get_sim_lock_info (handle, 0, NULL, NULL);
1235 if (ret == TAPI_API_SUCCESS) {
1236 dts_fail("tel_get_sim_lock_info", "Parameter check failed");
1239 ret = tel_get_sim_lock_info (handle, 9, NULL, NULL);
1240 if (ret == TAPI_API_SUCCESS) {
1241 dts_fail("tel_get_sim_lock_info", "Parameter check failed");
1244 dts_pass("tel_get_sim_lock_info");
1251 static void on_tel_req_sim_apdu (TapiHandle *handle, int result,
1252 void *data, void *user_data)
1254 int *value = user_data;
1256 async_flag = ASYNC_DONE;
1259 if (*value != 0xC0FFEE) {
1260 dts_fail("tel_req_sim_apdu", "Callback userdata crashed");
1264 static void utc_tel_req_sim_apdu (void)
1267 int value = 0xC0FFEE;
1268 TelSimApdu_t apdu_data;
1270 memset (&apdu_data, 0, sizeof(TelSimApdu_t));
1272 apdu_data.apdu_len = 7;
1273 apdu_data.apdu = calloc(1, apdu_data.apdu_len);
1274 strcpy ((char *)apdu_data.apdu, "a0a40000026f02");
1278 async_flag = ASYNC_READY;
1279 ret = tel_req_sim_apdu (handle, &apdu_data, on_tel_req_sim_apdu, &value);
1280 if (ret != TAPI_API_SUCCESS) {
1281 dts_fail("tel_req_sim_apdu", "Unexpected return");
1287 if (async_flag != ASYNC_DONE) {
1288 dts_fail("tel_req_sim_apdu", "Callback not invoked");
1291 dts_pass("tel_req_sim_apdu");
1292 free(apdu_data.apdu);
1295 static void utc_fail_tel_req_sim_apdu (void)
1298 TelSimApdu_t apdu_data;
1300 memset (&apdu_data, 0, sizeof(TelSimApdu_t));
1302 apdu_data.apdu_len = 7;
1303 apdu_data.apdu = calloc(1, apdu_data.apdu_len);
1304 strcpy ((char *)apdu_data.apdu, "a0a40000026f02");
1306 ret = tel_req_sim_apdu (NULL, &apdu_data, NULL, NULL);
1307 if (ret == TAPI_API_SUCCESS) {
1308 dts_fail("tel_req_sim_apdu", "Parameter check failed");
1311 ret = tel_req_sim_apdu (handle, NULL, NULL, NULL);
1312 if (ret == TAPI_API_SUCCESS) {
1313 dts_fail("tel_req_sim_apdu", "Parameter check failed");
1316 apdu_data.apdu = NULL;
1317 ret = tel_req_sim_apdu (handle, &apdu_data, NULL, NULL);
1318 if (ret == TAPI_API_SUCCESS) {
1319 dts_fail("tel_req_sim_apdu", "Parameter check failed");
1322 dts_pass("tel_req_sim_apdu");
1323 free(apdu_data.apdu);
1327 * Generate default TC for no-additional-parameter type API
1330 DO(tel_get_sim_iccid)
1331 DO(tel_get_sim_language)
1332 DO(tel_get_sim_callforwarding_info)
1333 DO(tel_get_sim_messagewaiting_info)
1334 DO(tel_get_sim_mailbox_info)
1335 DO(tel_get_sim_cphs_info)
1336 DO(tel_get_sim_service_table)
1337 DO(tel_get_sim_msisdn)
1338 DO(tel_get_sim_oplmnwact)
1340 DO(tel_get_sim_cphs_netname)
1343 struct tet_testlist tet_testlist[] = {
1345 { utc_tel_get_sim_iccid, 1 },
1346 { utc_fail_tel_get_sim_iccid, 2 },
1347 { utc_tel_get_sim_language, 1 },
1348 { utc_fail_tel_get_sim_language, 2 },
1349 { utc_tel_get_sim_callforwarding_info, 1 },
1350 { utc_fail_tel_get_sim_callforwarding_info, 2 },
1351 { utc_tel_get_sim_messagewaiting_info, 1 },
1352 { utc_fail_tel_get_sim_messagewaiting_info, 2 },
1353 { utc_tel_get_sim_mailbox_info, 1 },
1354 { utc_fail_tel_get_sim_mailbox_info, 2 },
1355 { utc_tel_get_sim_cphs_info, 1 },
1356 { utc_fail_tel_get_sim_cphs_info, 2 },
1357 { utc_tel_get_sim_service_table, 1 },
1358 { utc_fail_tel_get_sim_service_table, 2 },
1359 { utc_tel_get_sim_msisdn, 1 },
1360 { utc_fail_tel_get_sim_msisdn, 2 },
1361 { utc_tel_get_sim_oplmnwact, 1 },
1362 { utc_fail_tel_get_sim_oplmnwact, 2 },
1363 { utc_tel_get_sim_spn, 1 },
1364 { utc_fail_tel_get_sim_spn, 2 },
1365 { utc_tel_get_sim_cphs_netname, 1 },
1366 { utc_fail_tel_get_sim_cphs_netname, 2 },
1367 { utc_tel_req_sim_atr, 1 },
1368 { utc_fail_tel_req_sim_atr, 2 },
1370 { utc_tel_get_sim_init_info, 1 },
1371 { utc_fail_tel_get_sim_init_info, 2 },
1372 { utc_tel_get_sim_type, 1 },
1373 { utc_fail_tel_get_sim_type, 2 },
1374 { utc_tel_get_sim_imsi, 1 },
1375 { utc_fail_tel_get_sim_imsi, 2 },
1376 { utc_tel_get_sim_ecc, 1 },
1377 { utc_fail_tel_get_sim_ecc, 2 },
1378 { utc_tel_set_sim_language, 1 },
1379 { utc_fail_tel_set_sim_language, 2 },
1380 { utc_tel_set_sim_callforwarding_info, 1 },
1381 { utc_fail_tel_set_sim_callforwarding_info, 2 },
1382 { utc_tel_set_sim_messagewaiting_info, 1 },
1383 { utc_fail_tel_set_sim_messagewaiting_info, 2 },
1384 { utc_tel_set_sim_mailbox_info, 1 },
1385 { utc_fail_tel_set_sim_mailbox_info, 2 },
1386 { utc_tel_req_sim_authentication, 1 },
1387 { utc_fail_tel_req_sim_authentication, 2 },
1388 { utc_tel_verifiy_sim_pins, 1 },
1389 { utc_fail_tel_verifiy_sim_pins, 2 },
1390 { utc_tel_verify_sim_puks, 1 },
1391 { utc_fail_tel_verify_sim_puks, 2 },
1392 { utc_tel_change_sim_pins, 1 },
1393 { utc_fail_tel_change_sim_pins, 2 },
1394 { utc_tel_disable_sim_facility, 1 },
1395 { utc_fail_tel_disable_sim_facility, 2 },
1396 { utc_tel_enable_sim_facility, 1 },
1397 { utc_fail_tel_enable_sim_facility, 2 },
1398 { utc_tel_get_sim_facility, 1 },
1399 { utc_fail_tel_get_sim_facility, 2 },
1400 { utc_tel_get_sim_lock_info, 1 },
1401 { utc_fail_tel_get_sim_lock_info, 2 },
1402 { utc_tel_req_sim_apdu, 1 },
1403 { utc_fail_tel_req_sim_apdu, 2 },
1406 static void startup (void)
1409 tet_printf ("\n TC start");
1411 handle = tel_init (NULL);
1414 static void cleanup (void)
1416 tel_deinit (handle);
1419 tet_printf ("\n TC end");
1422 void (*tet_startup) (void) = startup;
1423 void (*tet_cleanup) (void) = cleanup;