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.
31 #include "TelUtility_ext.h"
32 #include "ITapiMisc.h"
34 #include "TapiCommon.h"
38 #define TEST_DEBUG(frmt, args...) \
39 {do { fprintf(stderr, "[SS Test][%s:%04d] " frmt "\n", __func__, __LINE__, ##args); } while (FALSE) ;}
56 static unsigned int * SS_subscription_id;
58 extern int EvtDeliveryHandle ;
61 int ss_strlen2(register const char * s ) {
63 while( *s++ ) count ++ ;
68 int ss_fgets(register char * digit, int n)
70 if( ! fgets( digit , n , stdin ) ) return -1 ;
72 if( *(digit + (n = ss_strlen2(digit)-1)) ^ '\n' ) {
74 while( getchar() ^ '\n' ) n -- ;
84 static int _PrintTeleCommService(TelSsTeleService_t telservice)
88 case TAPI_SS_TS_ALL_TELESERVICES:
89 TEST_DEBUG("TeleService: TAPI_SS_TS_ALL_TELESERVICES ");
91 case TAPI_SS_TS_ALL_SPEECH:
92 TEST_DEBUG("TeleService: TAPI_SS_TS_ALL_SPEECH ");
94 case TAPI_SS_TS_ALL_DATA_TELESERVICES:
95 TEST_DEBUG("TeleService: TAPI_SS_TS_ALL_DATA_TELESERVICES ");
98 TEST_DEBUG("TeleService: TAPI_SS_TS_FACS ");
101 TEST_DEBUG("TeleService: TAPI_SS_TS_SMS ");
103 case TAPI_SS_TS_ALL_TELESERVICES_EXCEPT_SMS:
104 TEST_DEBUG("TeleService: TAPI_SS_TS_ALL_TELESERVICES_EXCEPT_SMS ");
106 case TAPI_SS_TS_ALL_PLMN_SPEC_TELE:
107 TEST_DEBUG("TeleService: TAPI_SS_TS_ALL_PLMN_SPEC_TELE ");
109 case TAPI_SS_BS_ALL_BEARER_SERVICES:
110 TEST_DEBUG("TeleService: TAPI_SS_BS_ALL_BEARER_SERVICES ");
112 case TAPI_SS_BS_ALL_ASYNCHRONOUS:
113 TEST_DEBUG("TeleService: TAPI_SS_BS_ALL_ASYNCHRONOUS ");
115 case TAPI_SS_BS_ALL_SYNCHRONOUS:
116 TEST_DEBUG("TeleService: TAPI_SS_BS_ALL_SYNCHRONOUS ");
118 case TAPI_SS_BS_DATA_CIRCUIT_SYNC:
119 TEST_DEBUG("TeleService: TAPI_SS_BS_DATA_CIRCUIT_SYNC ");
121 case TAPI_SS_TS_ALL_DATA:
122 TEST_DEBUG("TeleService: TAPI_SS_TS_ALL_DATA ");
124 case TAPI_SS_ALL_TELE_BEARER:
125 TEST_DEBUG("TeleService: TAPI_SS_ALL_TELE_BEARER ");
128 TEST_DEBUG("TeleService: %d ", telservice);
134 static int _PrintBarringType(TelSsCallBarType_t BarType)
138 case TAPI_CALL_BARRING_ALL:
139 TEST_DEBUG("BarringType: TAPI_CALL_BARRING_ALL ");
141 case TAPI_CALL_BARRING_OUTGOING:
142 TEST_DEBUG("BarringType: TAPI_CALL_BARRING_OUTGOING ");
144 case TAPI_CALL_BARRING_ALL_OUTGOING_CALLS:
145 TEST_DEBUG("BarringType: TAPI_CALL_BARRING_ALL_OUTGOING_CALLS ");
147 case TAPI_CALL_BARRING_ALL_OUTGOING_INTERN_CALL:
148 TEST_DEBUG("BarringType: TAPI_CALL_BARRING_ALL_OUTGOING_INTERN_CALL ");
150 case TAPI_CALL_BARRING_ALL_OUTGOING_INTERN_CALL_EXCEPT:
151 TEST_DEBUG("BarringType: TAPI_CALL_BARRING_ALL_OUTGOING_INTERN_CALL_EXCEPT ");
153 case TAPI_CALL_BARRING_INCOMING:
154 TEST_DEBUG("BarringType: TAPI_CALL_BARRING_INCOMING ");
156 case TAPI_CALL_BARRING_ALL_INCOMING_CALLS:
157 TEST_DEBUG("BarringType: TAPI_CALL_BARRING_ALL_INCOMING_CALLS ");
159 case TAPI_CALL_BARRING_ALL_INCOMING_CALLS_ROAMING:
160 TEST_DEBUG("BarringType: TAPI_CALL_BARRING_ALL_INCOMING_CALLS_ROAMING ");
162 case TAPI_CALL_BARRING_ALL_INCOMING_CALLS_INSIM:
163 TEST_DEBUG("BarringType: TAPI_CALL_BARRING_ALL_INCOMING_CALLS_INSIM ");
166 TEST_DEBUG("BarringType: None [%d] ", BarType);
173 static int _PrintSsStatus(TelSsStatus_t Status)
177 case TAPI_SS_STATUS_ACTIVE:
178 TEST_DEBUG("SS Status: TAPI_SS_STATUS_ACTIVE ");
180 case TAPI_SS_STATUS_REGISTERED:
181 TEST_DEBUG("SS Status: TAPI_SS_STATUS_REGISTERED (for CF) ");
184 TEST_DEBUG("SS Status: Not Active ");
191 static int _PrintSsCliType(TelSsLineIdentificationType_t CliType)
195 case TAPI_CALLING_LINE_IDENTITY_PRESENTATION:
196 TEST_DEBUG("Type: TAPI_CALLING_LINE_IDENTITY_PRESENTATION ");
198 case TAPI_CALLING_LINE_IDENTITY_RESTRICTION:
199 TEST_DEBUG("Type: TAPI_CALLING_LINE_IDENTITY_RESTRICTION ");
201 case TAPI_CONNECTED_LINE_IDENTITY_PRESENTATION:
202 TEST_DEBUG("Type: TAPI_CONNECTED_LINE_IDENTITY_PRESENTATION ");
204 case TAPI_CONNECTED_LINE_IDENTITY_RESTRICTION:
205 TEST_DEBUG("Type: TAPI_CONNECTED_LINE_IDENTITY_RESTRICTION ");
207 case TAPI_CALLED_LINE_IDENTITY_PRESENTATION:
208 TEST_DEBUG("Type: TAPI_CALLED_LINE_IDENTITY_PRESENTATION ");
210 case TAPI_CALLING_NAME_PRESENTATION:
211 TEST_DEBUG("Type: TAPI_CALLING_NAME_PRESENTATION ");
214 TEST_DEBUG("Type: None [%d] ", CliType);
221 static int _PrintSsCliStatus(TelSsCliStatus_t CliStatus)
225 case TAPI_CLI_STATUS_NOT_PROVISONED:
226 TEST_DEBUG("CliStatus: TAPI_CLI_STATUS_NOT_PROVISONED ");
228 case TAPI_CLI_STATUS_PROVISIONED:
229 TEST_DEBUG("CliStatus: TAPI_CLI_STATUS_PROVISIONED ");
231 case TAPI_CLI_STATUS_ACTIVATED:
232 TEST_DEBUG("CliStatus: TAPI_CLI_STATUS_ACTIVATED ");
234 case TAPI_CLI_STATUS_UNKOWN:
235 TEST_DEBUG("CliStatus: TAPI_CLI_STATUS_UNKOWN ");
237 case TAPI_CLI_STATUS_TEMP_RESTRICTED:
238 TEST_DEBUG("CliStatus: TAPI_CLI_STATUS_TEMP_RESTRICTED ");
240 case TAPI_CLI_STATUS_TEMP_ALLOWED:
241 TEST_DEBUG("CliStatus: TAPI_CLI_STATUS_TEMP_ALLOWED ");
244 TEST_DEBUG("CliStatus: None [%d] ", CliStatus);
251 static int _PrintSsUssdRecord(TelSsUssdMsgIndInfo_t ussd_record)
253 switch(ussd_record.IndType)
255 case TAPI_USSD_IND_NOTIFY:
256 TEST_DEBUG("UssdIndType: TAPI_USSD_IND_NOTIFY ");
258 case TAPI_USSD_IND_NO_ACTION_REQUIRE:
259 TEST_DEBUG("UssdIndType: TAPI_USSD_IND_NO_ACTION_REQUIRE ");
261 case TAPI_USSD_IND_ACTION_REQUIRE:
262 TEST_DEBUG("UssdIndType: TAPI_USSD_IND_ACTION_REQUIRE ");
264 case TAPI_USSD_IND_TERMINATED_BY_NET:
265 TEST_DEBUG("UssdIndType: TAPI_USSD_IND_TERMINATED_BY_NET ");
267 case TAPI_USSD_IND_OTHER_CLIENT:
268 TEST_DEBUG("UssdIndType: TAPI_USSD_IND_OTHER_CLIENT ");
270 case TAPI_USSD_IND_NOT_SUPPORT:
271 TEST_DEBUG("UssdIndType: TAPI_USSD_IND_NOT_SUPPORT ");
273 case TAPI_USSD_IND_TIME_OUT:
274 TEST_DEBUG("UssdIndType: TAPI_USSD_IND_TIME_OUT ");
277 TEST_DEBUG("UssdIndType: None [%d] ", ussd_record.IndType);
281 TEST_DEBUG("RequestedBySAT:[%d]",ussd_record.UssdInfo.RequestedBySAT);
282 TEST_DEBUG("DCS : [0x%x]",ussd_record.UssdInfo.Dcs);
283 TEST_DEBUG("ussd length : [%d] ", ussd_record.UssdInfo.UssdStringLength);
284 TEST_DEBUG("ussd string : [\n%s\n] ", ussd_record.UssdInfo.szUssdString);
289 static int _PrintCFNoReplyWaitTime(TelSsNoReplyTime_t time)
293 case TAPI_SS_CF_NO_REPLY_TIME_5_SECS:
294 TEST_DEBUG("CF reply time : TAPI_SS_CF_NO_REPLY_TIME_5_SECS ");
296 case TAPI_SS_CF_NO_REPLY_TIME_10_SECS:
297 TEST_DEBUG("CF reply time : TAPI_SS_CF_NO_REPLY_TIME_10_SECS ");
299 case TAPI_SS_CF_NO_REPLY_TIME_15_SECS:
300 TEST_DEBUG("CF reply time : TAPI_SS_CF_NO_REPLY_TIME_15_SECS ");
302 case TAPI_SS_CF_NO_REPLY_TIME_20_SECS:
303 TEST_DEBUG("CF reply time : TAPI_SS_CF_NO_REPLY_TIME_20_SECS ");
305 case TAPI_SS_CF_NO_REPLY_TIME_25_SECS:
306 TEST_DEBUG("CF reply time : TAPI_SS_CF_NO_REPLY_TIME_25_SECS ");
308 case TAPI_SS_CF_NO_REPLY_TIME_30_SECS:
309 TEST_DEBUG("CF reply time : TAPI_SS_CF_NO_REPLY_TIME_30_SECS ");
312 TEST_DEBUG("CF reply time: None [%d] ", time);
318 static int _PrintCFCondition(TelSsForwardWhen_t cond)
322 case TAPI_SS_FORWARD_WHEN_UNCONDITIONAL_EV:
323 TEST_DEBUG("CF condition : TAPI_SS_FORWARD_WHEN_UNCONDITIONAL_EV ");
325 case TAPI_SS_FORWARD_WHEN_BUSY_EV:
326 TEST_DEBUG("CF condition : TAPI_SS_FORWARD_WHEN_BUSY_EV ");
328 case TAPI_SS_FORWARD_WHEN_NO_ANSWER_EV:
329 TEST_DEBUG("CF condition : TAPI_SS_FORWARD_WHEN_NO_ANSWER_EV ");
331 case TAPI_SS_FORWARD_WHEN_NOT_REACHABLE_EV:
332 TEST_DEBUG("CF condition : TAPI_SS_FORWARD_WHEN_NOT_REACHABLE_EV ");
334 case TAPI_SS_FORWARD_WHEN_ALL_FORWARDING_EV:
335 TEST_DEBUG("CF condition : TAPI_SS_FORWARD_WHEN_ALL_FORWARDING_EV ");
337 case TAPI_SS_FORWARD_WHEN_ALL_CONDITIONAL_EV:
338 TEST_DEBUG("CF condition : TAPI_SS_FORWARD_WHEN_ALL_CONDITIONAL_EV ");
341 TEST_DEBUG("CF condition : None [%d] ", cond);
347 //static int ss_async_event_callback(TelTapiEventClass_t eventClass, int eventType, int param1,void * param2)
348 static int ss_async_event_callback(TelTapiEvent_t *event)
350 TEST_DEBUG("EVENT TYPE:[0x%x], STATUS:[0x%x]", event->EventType, event->Status);
354 switch(event->EventClass)
356 case TAPI_EVENT_CLASS_SS:
358 switch(event->EventType)
360 case TAPI_EVENT_SS_REL_COMP_MSG_NOTIFY:
362 TelSsRelCompMsgInfo_t rel_comp_msg;
363 memcpy(&rel_comp_msg, (TelSsRelCompMsgInfo_t *)event->pData, sizeof(TelSsRelCompMsgInfo_t));
364 TEST_DEBUG("#### Received Event :TAPI_EVENT_SS_REL_COMP_MSG_NOTIFY ##### ");
368 case TAPI_EVENT_SS_WAITING_CNF:
370 TelSsInfo_t SsInfo = {0,};
371 TEST_DEBUG("#### Received Event :TAPI_EVENT_SS_WAITING_CNF ##### ");
373 if (event->pData!=NULL)
375 memcpy(&SsInfo, (TelSsInfo_t*)event->pData, sizeof(TelSsInfo_t));
377 TEST_DEBUG("Number of records %d ",SsInfo.NumberOfRecords);
378 for(i=0;i<SsInfo.NumberOfRecords;i++)
380 TEST_DEBUG("Index:[%d]",i);
381 _PrintSsStatus(SsInfo.SsRecord.WaitingRecord.rec_class[i].Status);
382 _PrintTeleCommService(SsInfo.SsRecord.WaitingRecord.rec_class[i].TeleCommService);
389 case TAPI_EVENT_SS_WAITING_QUERYSTATUS_CNF:
391 TelSsInfo_t SsInfo = {0,};
392 TEST_DEBUG("#### Received Event :TAPI_EVENT_SS_WAITING_QUERYSTATUS_CNF ##### ");
394 if (event->pData!=NULL)
396 memcpy(&SsInfo, (TelSsInfo_t*)event->pData, sizeof(TelSsInfo_t));
398 TEST_DEBUG("Number of records %d ",SsInfo.NumberOfRecords);
399 for(i=0;i<SsInfo.NumberOfRecords;i++)
401 TEST_DEBUG("Index:[%d]",i);
402 _PrintSsStatus(SsInfo.SsRecord.WaitingRecord.rec_class[i].Status);
403 _PrintTeleCommService(SsInfo.SsRecord.WaitingRecord.rec_class[i].TeleCommService);
408 case TAPI_EVENT_SS_BARRING_CNF:
410 TEST_DEBUG("#### Received Event :TAPI_EVENT_SS_BARRING_CNF ##### ");
411 TelSsInfo_t SsInfo = {0,};
413 if (event->pData!=NULL)
415 memcpy(&SsInfo, (TelSsInfo_t*)event->pData, sizeof(TelSsInfo_t));
417 TEST_DEBUG("Number of records %d ",SsInfo.NumberOfRecords);
418 for(i=0;i<SsInfo.NumberOfRecords;i++)
420 TEST_DEBUG("index:[%d] ",i);
421 _PrintSsStatus(SsInfo.SsRecord.BarringRecord.rec_class[i].Status);
422 _PrintTeleCommService(SsInfo.SsRecord.BarringRecord.rec_class[i].TeleCommService);
423 _PrintBarringType(SsInfo.SsRecord.BarringRecord.rec_class[i].Flavour);
430 case TAPI_EVENT_SS_BARRING_QUERYSTATUS_CNF:
432 TEST_DEBUG("#### Received Event :TAPI_EVENT_SS_BARRING_QUERYSTATUS_CNF ##### ");
433 TelSsInfo_t SsInfo = {0,};
435 if (event->pData!=NULL)
437 memcpy(&SsInfo, (TelSsInfo_t*)event->pData, sizeof(TelSsInfo_t));
439 TEST_DEBUG("Number of records %d ",SsInfo.NumberOfRecords);
440 for(i=0;i<SsInfo.NumberOfRecords;i++)
442 TEST_DEBUG("index:[%d] ",i);
443 _PrintSsStatus(SsInfo.SsRecord.BarringRecord.rec_class[i].Status);
444 _PrintTeleCommService(SsInfo.SsRecord.BarringRecord.rec_class[i].TeleCommService);
445 _PrintBarringType(SsInfo.SsRecord.BarringRecord.rec_class[i].Flavour);
453 case TAPI_EVENT_SS_FORWARD_CNF:
455 TEST_DEBUG("#### Received Event :TAPI_EVENT_SS_FORWARD_CNF ##### ");
456 TelSsInfo_t SsInfo = {0,};
458 if (event->pData!=NULL)
460 memcpy(&SsInfo, (TelSsInfo_t*)event->pData, sizeof(TelSsInfo_t));
462 TEST_DEBUG("Number of records %d ",SsInfo.NumberOfRecords);
463 for(i=0;i<SsInfo.NumberOfRecords;i++)
465 TEST_DEBUG("index:[%d] ",i);
466 _PrintSsStatus(SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status);
467 _PrintTeleCommService(SsInfo.SsRecord.ForwardingRecord.rec_class[i].TeleCommService);
468 _PrintCFNoReplyWaitTime(SsInfo.SsRecord.ForwardingRecord.rec_class[i].NoReplyWaitTime);
469 _PrintCFCondition(SsInfo.SsRecord.ForwardingRecord.rec_class[i].ForwardCondition);
470 TEST_DEBUG("bCFNumPresent:[%d] ",SsInfo.SsRecord.ForwardingRecord.rec_class[i].bCallForwardingNumberPresent);
471 TEST_DEBUG("bCFNum:[%s] ",SsInfo.SsRecord.ForwardingRecord.rec_class[i].szCallForwardingNumber);
477 case TAPI_EVENT_SS_FORWARD_QUERYSTATUS_CNF:
479 TEST_DEBUG("#### Received Event :TAPI_EVENT_SS_FORWARD_QUERYSTATUS_CNF ##### ");
480 TelSsInfo_t SsInfo = {0,};
482 if (event->pData!=NULL)
484 memcpy(&SsInfo, (TelSsInfo_t*)event->pData, sizeof(TelSsInfo_t));
486 TEST_DEBUG("Number of records %d ",SsInfo.NumberOfRecords);
488 for(i=0;i<SsInfo.NumberOfRecords;i++)
490 TEST_DEBUG("index:[%d] ",i);
491 _PrintSsStatus(SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status);
492 _PrintTeleCommService(SsInfo.SsRecord.ForwardingRecord.rec_class[i].TeleCommService);
493 _PrintCFNoReplyWaitTime(SsInfo.SsRecord.ForwardingRecord.rec_class[i].NoReplyWaitTime);
494 _PrintCFCondition(SsInfo.SsRecord.ForwardingRecord.rec_class[i].ForwardCondition);
495 TEST_DEBUG("bCFNumPresent:[%d] ",SsInfo.SsRecord.ForwardingRecord.rec_class[i].bCallForwardingNumberPresent);
496 TEST_DEBUG("bCFNum:[%s] ",SsInfo.SsRecord.ForwardingRecord.rec_class[i].szCallForwardingNumber);
502 case TAPI_EVENT_SS_BARRING_CHANGEPASS_CNF:
504 TEST_DEBUG("#### Received Event : TAPI_EVENT_SS_BARRING_CHANGEPASS_CNF ##### ");
508 case TAPI_EVENT_SS_CLI_QUERYSTATUS_CNF:
510 TelSsInfo_t SsInfo = {0,};
512 TEST_DEBUG("#### Received Event : TAPI_EVENT_SS_CLI_QUERYSTATUS_CNF #### ");
514 if (event->pData!=NULL)
516 memcpy(&SsInfo, (TelSsInfo_t*)event->pData, sizeof(TelSsInfo_t));
517 _PrintSsCliType(SsInfo.SsRecord.CliRecord.IdentificationType);
518 _PrintSsCliStatus(SsInfo.SsRecord.CliRecord.CliStatus);
524 case TAPI_EVENT_SS_USSD_CNF:
526 TelSsUssdMsgIndInfo_t ussd_record;
527 TEST_DEBUG("#### Received Event : TAPI_EVENT_SS_USSD_CNF #### ");
529 if (event->pData != NULL)
531 memcpy(&ussd_record, (TelSsUssdMsgIndInfo_t *)event->pData, sizeof(TelSsUssdMsgInfo_t));
532 _PrintSsUssdRecord(ussd_record);
536 TEST_DEBUG("NULL param");
541 //Indication with ACTION_REQUIRE
542 case TAPI_EVENT_SS_USSD_IND:
544 TelSsUssdMsgIndInfo_t ussd_record;
545 TEST_DEBUG("#### Received Event : TAPI_EVENT_SS_USSD_IND ##### ");
547 if (event->pData != NULL)
549 memcpy(&ussd_record, (TelSsUssdMsgInfo_t *)event->pData, sizeof(TelSsUssdMsgInfo_t));
550 _PrintSsUssdRecord(ussd_record);
554 TEST_DEBUG("NULL param");
561 case TAPI_EVENT_SS_AOC_RSP:
563 TelCallAocInfo_t aoc_info;
564 TEST_DEBUG("#### Received Event : SS -- TAPI_EVENT_SS_AOC_RSP---#### ");
565 if(event->Status != 0)
567 memcpy(&aoc_info, (TelCallAocInfo_t*)event->pData, sizeof(TelCallAocInfo_t));
569 TEST_DEBUG("############# AOC TYPE :%d",aoc_info.AocType);
570 TEST_DEBUG("Printing ### ACM : [%ld] MAX_ACM :[%ld] CCM:[%0.4f] Char type:[%d] ",aoc_info.ACM,aoc_info.MaxAcm,aoc_info.CCM,aoc_info.CharTypeOfCurrency);
571 TEST_DEBUG("Currency : %c %c %c ",aoc_info.szCurrency[0], aoc_info.szCurrency[1], aoc_info.szCurrency[2]);
576 case TAPI_EVENT_SS_SET_AOC_CNF:
577 TEST_DEBUG("#### Received Event : SS -- TAPI_EVENT_SS_SET_AOC_CNF---#### ");
579 case TAPI_EVENT_SS_BARRING_TYPE_IND:
581 TelSsCallBarType_t BarringType;
582 TEST_DEBUG("#### Received Event : SS -- TAPI_EVENT_SS_BARRING_TYPE_IND---#### ");
584 memcpy(&BarringType, (TelSsCallBarType_t*)event->pData, sizeof(TelSsCallBarType_t));
585 TEST_DEBUG("########### BarringType received is [%x]",BarringType);
598 TEST_DEBUG("###################################################################");
606 int ss_read_key_input(void)
611 TapiResult_t ret = TAPI_API_SUCCESS;
613 ret2 = read(0, buf, sizeof(buf));
618 } else if (ret2 == 0) return ret2;
621 printf("\n########## SS TEST Application #########\n");
622 printf("########## Supplementary Services - Options ############\n");
624 printf("Call Waiting [1] Call Barring [2] Call Forwarding [3] \n");
625 printf("Query Status [a] Activate [b] Deactivate [c] Registration [d] Deregistration [e]\n");
626 printf("Change Call barring Password Enter - [cbp]\n");
627 printf("Interrogate the Status of Line Identity Services like CLIP, CLIR etc - Enter [cli]\n");
628 printf("Send USSD String - Enter [ussd]\n");
629 printf("Test AOC - First - SimOpen and Enter PIN2 ---[simopen] [pin2]\n");
630 printf("Read AOC Information - Enter [raoc] \n");
631 printf("Set Maximum Cost limit- [5e], Set Price/Unit Currency-[5f], Reset Cost Limit-[5g]\n");
632 printf("quit - [quit]\n");
634 printf("##########################################\n");
635 printf("SS Enter key : %s", buf);
638 if(strncmp(buf, "1a", 2) == 0 )
641 TelSsWaitingInfo_t cwInfo = {0,};
642 TEST_DEBUG("### Interrogate the status of Call Waiting #### ");
644 TEST_DEBUG("Select the Call Waiting Type ");
645 TEST_DEBUG(" voice-[0], data circuit sync-[6], all tele bearer-[7]");
648 cwInfo.CallType = atoi(cwType);
650 TEST_DEBUG("SS CallType:[%d]",cwInfo.CallType);
652 ret = tel_get_ss_waiting_status(cwInfo.CallType,&request_id);
654 TEST_DEBUG("Tapi return api_err value is [0x%x] RequestID:[%d]", ret,request_id);
657 if(strncmp(buf, "1b", 2) == 0 )
660 TEST_DEBUG("### Activate Call Waiting #### ");
661 TelSsWaitingInfo_t cwInfo = {0,};
663 TEST_DEBUG("Select the Call Waiting Type ");
664 TEST_DEBUG(" voice-[0], data circuit sync-[6], all tele bearer-[7]");
667 cwInfo.CallType = atoi(cwType);
668 cwInfo.Mode = TAPI_SS_CW_ACTIVATE;
670 TEST_DEBUG("SS CallType:[%d]",cwInfo.CallType);
671 ret = tel_set_ss_waiting(&cwInfo,&request_id);
673 TEST_DEBUG("Tapi return api_err value is [0x%x] RequestID:[%d]", ret,request_id);
676 if(strncmp(buf, "1c", 2) == 0 )
679 TEST_DEBUG("### DeActivate Call Waiting #### ");
680 TelSsWaitingInfo_t cwInfo = {0,};
682 TEST_DEBUG("Select the Call Waiting Type ");
683 TEST_DEBUG(" voice-[0], data circuit sync-[6], all tele bearer-[7]");
686 cwInfo.CallType = atoi(cwType);
687 cwInfo.Mode = TAPI_SS_CW_DEACTIVATE;
689 TEST_DEBUG("SS CallType:[%d]",cwInfo.CallType);
690 ret = tel_set_ss_waiting(&cwInfo,&request_id);
692 TEST_DEBUG("Tapi return api_err value is [0x%x] RequestID:[%d]", ret,request_id);
697 if(strncmp(buf, "2a", 2) == 0)
699 TelSsCallBarringInfo_t cb_req = {0,};
702 TEST_DEBUG("#### Interrogate Status of Call barring for Voice Calls ####");
704 TEST_DEBUG("Enter Call Barring Flavor type(BAOC -2, BAIC-6) ");
705 TEST_DEBUG(" All Barring -[0] Out Going calls - [1] All outgoing calls [2] ");
706 TEST_DEBUG(" Outgoing Intl calls -[3] All ougoing intl calls except home[4] - Barring incoming [5] All Incoming calls [6]");
707 TEST_DEBUG(" All incoming calls in roaming -[7] All incoming calls in Sim [2] ");
709 cb_req.Type = atoi(cba_fla);
711 TEST_DEBUG("Select the SS Call Type ");
712 TEST_DEBUG(" voice-[0], data circuit sync-[6], all tele bearer-[7]");
714 cb_req.CallType = atoi(cbType);
716 TEST_DEBUG("CB type:[%d], SS CallType:[%d]", cb_req.Type, cb_req.CallType);
718 ret = tel_get_ss_barring_status(cb_req.Type, cb_req.CallType,&request_id);
720 TEST_DEBUG("Tapi return api_err value is [0x%x] RequestID:[%d]", ret,request_id);
723 if(strncmp(buf, "2b",2) == 0)
725 TelSsCallBarringInfo_t cb_req = {0,};
730 TEST_DEBUG("#### Activate the Call Barring for Voice calls. ####");
732 TEST_DEBUG("Enter Call Barring Flavor type(BAOC -2, BAIC-6) ");
733 TEST_DEBUG(" All Barring -[0] Out Going calls - [1] All outgoing calls [2] ");
734 TEST_DEBUG(" Outgoing Intl calls -[3] All ougoing intl calls except home[4] - Barring incoming [5] All Incoming calls [6]");
735 TEST_DEBUG(" All incoming calls in roaming -[7] All incoming calls in Sim [8] ");
738 cb_req.Type = atoi(cba_fla);
739 TEST_DEBUG(" Enter Call Barring Password - size minimum 4 bytes");
741 memcpy(&cb_req.szPassword,&new_pwd,4);
742 cb_req.Mode = TAPI_SS_CALL_BAR_ACTIVATE;
744 TEST_DEBUG("Select the SS Call Type ");
745 TEST_DEBUG(" voice-[0], data circuit sync-[6], all tele bearer-[7]");
747 cb_req.CallType = atoi(cbType);
749 TEST_DEBUG("CB type:[%d], SS CallType:[%d]", cb_req.Type, cb_req.CallType);
751 ret = tel_set_ss_barring(&cb_req,&request_id);
753 TEST_DEBUG("Tapi return api_err value is [0x%x] RequestID:[%d]", ret,request_id);
756 if(strncmp(buf, "2c", 2) == 0)
758 TelSsCallBarringInfo_t cb_req = {0,};
763 TEST_DEBUG("Enter Call Barring Flavor type(BAOC -2, BAIC-6) ");
764 TEST_DEBUG(" All Barring -[0] Out Going calls - [1] All outgoing calls [2] ");
765 TEST_DEBUG(" Outgoing Intl calls -[3] All ougoing intl calls except home[4] - Barring incoming [5] All Incoming calls [6]");
766 TEST_DEBUG(" All incoming calls in roaming -[7] All incoming calls in Sim [8] ");
769 cb_req.Type = atoi(cba_fla);
771 TEST_DEBUG(" Enter Call Barring Password - size minimum 4 bytes");
773 memcpy(&cb_req.szPassword,&new_pwd,4);
775 TEST_DEBUG("Select the SS Call Type ");
776 TEST_DEBUG(" voice-[0], data circuit sync-[6], all tele bearer-[7]");
778 cb_req.CallType = atoi(cbType);
780 cb_req.Mode = TAPI_SS_CALL_BAR_DEACTIVATE;
782 TEST_DEBUG("CB type:[%d], SS CallType:[%d]", cb_req.Type, cb_req.CallType);
784 ret = tel_set_ss_barring(&cb_req,&request_id);
785 TEST_DEBUG("Tapi return api_err value is [0x%x] RequestID:[%d]", ret, request_id);
789 if(strncmp(buf, "3a", 2) == 0)
794 TelSsForwardInfo_t cfReq ={0,};
797 TEST_DEBUG("### Interrogate the Status of Call forwarding .");
798 TEST_DEBUG("Select the Call Forwarding Flavor ");
799 TEST_DEBUG(" CF-Unconditional -[0] CF-Busy [1] CF-No Reply [2] CF-Not reachable [3] CF -All forwarding[4] All Cond CF [5] ");
801 cfReq.Condition = atoi(flavor);
803 TEST_DEBUG("Select the Call Forwarding Type ");
804 TEST_DEBUG("voice -[0] data -[3] fax-[4] all_tele and bearer -[5] ");
806 cfReq.Type = atoi(cfType);
808 TEST_DEBUG("CF Flavor:[%d], SS CF CallType:[%d]", cfReq.Condition, cfReq.Type);
810 ret = tel_get_ss_forward_status(cfReq.Type, cfReq.Condition,&request_id);
812 TEST_DEBUG("Tapi return api_err value is [0x%x] RequestID:[%d]", ret,request_id);
815 if(strncmp(buf, "3b", 2) == 0)
823 TelSsForwardInfo_t cfActReq ={0,};
825 TEST_DEBUG("#### Call Forwarding Activation #### ");
826 TEST_DEBUG("Enter the Call forwarding number ");
827 ss_fgets(cf_number,15);
828 len = strlen(cf_number);
829 TEST_DEBUG("Length of CF number :%d ",len);
830 memcpy(&(cfActReq.szPhoneNumber),cf_number,len);
832 TEST_DEBUG("Select the Call Forwarding Flavor ");
833 TEST_DEBUG(" CF-Unconditional -[0] CF-Busy [1] CF-No Reply [2] CF-Not reachable [3] CF -All forwarding[4] All Cond CF [5] ");
835 cfActReq.Condition = atoi(flavor);
836 TEST_DEBUG("********** flavor=%x ",cfActReq.Condition);
838 TEST_DEBUG("Select the Call Forwarding Type ");
839 TEST_DEBUG("voice -[0] data -[3] fax-[4] all_tele and bearer -[5] ");
841 cfActReq.Type = atoi(cfType);
843 cfActReq.NoReplyConditionTimer = TAPI_SS_CF_NO_REPLY_TIME_10_SECS;
844 cfActReq.Mode= TAPI_CALL_FORWARD_MODE_ENABLE_EV;
846 TEST_DEBUG("CF Flavor:[%d], SS CF CallType:[%d]", cfActReq.Condition, cfActReq.Type);
848 ret = tel_set_ss_forward(&cfActReq,&request_id);
850 TEST_DEBUG("Tapi return api_err value is [0x%x] RequestID:[%d]", ret,request_id);
853 if(strncmp(buf, "3c", 2) == 0)
859 TelSsForwardInfo_t cfActReq ={0,};
861 TEST_DEBUG("#### Call Forwarding DEActivation #### ");
862 TEST_DEBUG("Enter the Call forwarding number ");
863 ss_fgets(cf_number,15);
864 len = strlen(cf_number);
865 TEST_DEBUG("Length of CF number :%d ",len);
866 memcpy(&(cfActReq.szPhoneNumber),cf_number,len);
868 TEST_DEBUG("Select the Call Forwarding Flavor ");
869 TEST_DEBUG(" CF-Unconditional -[0] CF-Busy [1] CF-No Reply [2] CF-Not reachable [3] CF -All forwarding[4] All Cond CF [5] ");
872 cfActReq.Condition = atoi(flavor);
873 TEST_DEBUG("********** flavor=%x ",cfActReq.Condition);
875 TEST_DEBUG("Select the Call Forwarding Type ");
876 TEST_DEBUG("voice -[0] data -[3] fax-[4] all_tele and bearer -[5] ");
878 cfActReq.Type = atoi(cfType);
880 cfActReq .NoReplyConditionTimer = TAPI_SS_CF_NO_REPLY_TIME_10_SECS;
881 cfActReq.Mode= TAPI_CALL_FORWARD_MODE_DISABLE_EV;
883 TEST_DEBUG("CF Flavor:[%d], SS CF CallType:[%d]", cfActReq.Condition, cfActReq.Type);
885 ret = tel_set_ss_forward(&cfActReq,&request_id);
886 TEST_DEBUG("Tapi return api_err value is [0x%x] RequestID:[%d]", ret,request_id);
889 if(strncmp(buf, "3d", 2) == 0)
897 TelSsForwardInfo_t cfActReq ={0,};
899 TEST_DEBUG("#### Call Forwarding Registration #### ");
900 TEST_DEBUG("Enter the Call forwarding number ");
901 ss_fgets(cf_number,15);
902 len = strlen(cf_number);
903 TEST_DEBUG("Length of CF number :%d ",len);
904 memcpy(&(cfActReq.szPhoneNumber),cf_number,len);
906 TEST_DEBUG("Select the Call Forwarding Flavor ");
907 TEST_DEBUG(" CF-Unconditional -[0] CF-Busy [1] CF-No Reply [2] CF-Not reachable [3] CF -All forwarding[4] All Cond CF [5] ");
910 cfActReq.Condition = atoi(flavor);
911 TEST_DEBUG("********** flavor=%x ",cfActReq.Condition);
914 TEST_DEBUG("Select the Call Forwarding Type ");
915 TEST_DEBUG("voice -[0] data -[3] fax-[4] all_tele and bearer -[5] ");
918 cfActReq.Type = atoi(cfType);
920 cfActReq.NoReplyConditionTimer = TAPI_SS_CF_NO_REPLY_TIME_10_SECS;
921 cfActReq.Mode= TAPI_CALL_FORWARD_MODE_REGISTRATION_EV;
923 TEST_DEBUG("CF Flavor:[%d], SS CF CallType:[%d]", cfActReq.Condition, cfActReq.Type);
925 ret = tel_set_ss_forward(&cfActReq,&request_id);
926 TEST_DEBUG("Tapi return api_err value is [0x%x] RequestID:[%d]", ret,request_id);
930 if(strncmp(buf, "3e", 2) == 0)
936 TelSsForwardInfo_t cfActReq ={0,};
938 TEST_DEBUG("#### Call Forwarding Deregistration #### ");
939 TEST_DEBUG("Enter the Call forwarding number ");
940 ss_fgets(cf_number,15);
941 len = strlen(cf_number);
942 TEST_DEBUG("Length of CF number :%d ",len);
943 memcpy(&(cfActReq.szPhoneNumber),cf_number,len);
945 TEST_DEBUG("Select the Call Forwarding Flavor ");
946 TEST_DEBUG(" CF-Unconditional -[0] CF-Busy [1] CF-No Reply [2] CF-Not reachable [3] CF -All CF [4] All Cond CF [5] ");
948 cfActReq.Condition = atoi(flavor);
949 TEST_DEBUG("********** flavor=%x ",cfActReq.Condition);
951 TEST_DEBUG("Select the Call Forwarding Type ");
952 TEST_DEBUG("voice -[0] data -[3] fax-[4] all_tele and bearer -[5] ");
955 cfActReq.Type = atoi(cfType);
957 cfActReq.NoReplyConditionTimer = TAPI_SS_CF_NO_REPLY_TIME_10_SECS;
958 cfActReq.Mode= TAPI_CALL_FORWARD_MODE_ERASURE_EV;
960 TEST_DEBUG("CF Flavor:[%d], SS CF CallType:[%d]", cfActReq.Condition, cfActReq.Type);
962 ret = tel_set_ss_forward(&cfActReq,&request_id);
963 TEST_DEBUG("Tapi return api_err value is [0x%x] RequestID:[%d]", ret,request_id);
967 /* Change Call barring password */
968 if(strncmp(buf, "cbp",3) == 0)
972 char new_pwd_again[10];
974 memset(old_pwd, 0, 10);
975 memset(new_pwd, 0, 10);
976 memset(new_pwd_again, 0, 10);
978 TEST_DEBUG("#### Change the Call Barring Password ####");
979 TEST_DEBUG(" Enter Call Barring Old Password - size minimum 4 bytes");
982 TEST_DEBUG(" Enter Call Barring New Password - size minimum 4 bytes");
985 TEST_DEBUG(" Enter Call Barring New Password Again - size minimum 4 bytes");
986 ss_fgets(new_pwd_again,5);
988 ret = tel_change_ss_barring_password(old_pwd, new_pwd, new_pwd_again,&request_id);
989 TEST_DEBUG("Tapi return api_err value is [0x%x] RequestID:[%d]", ret,request_id);
993 if(strncmp(buf, "cli", 3) == 0)
996 TEST_DEBUG("#### Interrogate the Status of CLI Services (except CDIP) ####");
997 TEST_DEBUG(" CLIP -[1] CLIR -[2] COLP -[3] COLR-[4] CDIP-[5] CNAP -[6] ");
998 ss_fgets(cli_type,2);
1000 TEST_DEBUG("CLI type:[%d]", atoi(cli_type));
1002 ret = tel_get_ss_cli_status(atoi(cli_type),&request_id);
1003 TEST_DEBUG("Tapi return api_err value is [0x%x] RequestID:[%d]", ret,request_id);
1006 if(strncmp(buf, "ussd", 4) == 0)
1009 char ussdString[TAPI_SS_USSD_DATA_SIZE_MAX];
1012 memset(ussdString, 0, TAPI_SS_USSD_DATA_SIZE_MAX);
1013 strcpy(ussdString , "*124#");
1015 TEST_DEBUG("ussd string:[%s],ussd len:[%d]", ussdString, strlen(ussdString));
1016 ret= tel_send_ss_ussd_request(ussdString,&request_id);
1017 TEST_DEBUG(" API RETURN VAL:[%d]",ret);
1022 if(strncmp(buf, "raoc", 4) == 0)
1025 TEST_DEBUG("Read AOC Information - Select AOC type");
1026 TEST_DEBUG("ACM Accumulated Call meter -[1] CCM -[2] Cost Limit MAX ACM -[4] Price per unit currency PUC [8]");
1028 ss_fgets(aoc_type,2);
1029 TEST_DEBUG("Aoc Type :%d",atoi(aoc_type));
1031 ret = tel_get_ss_aoc_info(atoi(aoc_type),&request_id);
1033 TEST_DEBUG("Tapi return api_err value is [0x%x] RequestID:[%d]", ret);
1037 if(strncmp(buf, "simopen", 7) == 0)
1040 TelSimStatusData_t SimOpenData = {0,};
1042 TEST_DEBUG("********************************************");
1044 TEST_DEBUG("open sim");
1048 if(strncmp(buf, "pin2", 4) == 0)
1053 if(strncmp(buf, "5e", 2) == 0)
1055 TEST_DEBUG("########### Setting Maximum Cost Limit - MAX_ACM Value..############# ");
1056 TelCallAocInfo_t pAocSetInfo = {0,};
1057 char maxacm_val[10];
1058 TEST_DEBUG("Enter the MAX ACM value ");
1059 ss_fgets(maxacm_val,5);
1061 pAocSetInfo.AocType = TAPI_SS_AOC_TYPE_MAXACM;
1063 pAocSetInfo.MaxAcm =atoi(maxacm_val);
1065 ret = tel_set_ss_aoc_info(&pAocSetInfo, &request_id);
1067 TEST_DEBUG("Tapi return api_err value is [0x%x] RequestID:[%d]", ret, request_id);
1069 if(strncmp(buf, "5f", 2) == 0)
1071 TEST_DEBUG("########### Setting Price/Unit Currency - PPUC Value.############# ");
1072 TelCallAocInfo_t *pAocSetInfo;
1075 TEST_DEBUG("Enter price per unit currency Characters ");
1076 ss_fgets(ppu_curr,3);
1077 pAocSetInfo = calloc(1,sizeof(TelCallAocInfo_t));
1079 pAocSetInfo->AocType = TAPI_SS_AOC_TYPE_PUC;
1082 pAocSetInfo->PPM = 0x02;
1084 pAocSetInfo->CharTypeOfCurrency = 0x02;
1085 pAocSetInfo->szCurrency[0] = ppu_curr[0];
1086 pAocSetInfo->szCurrency[1] = ppu_curr[1];
1087 pAocSetInfo->szCurrency[2] = ppu_curr[2];
1089 TEST_DEBUG("Set AOC Request");
1091 ret = tel_set_ss_aoc_info(pAocSetInfo,&request_id);
1092 TEST_DEBUG("Tapi return api_err value is [0x%x] RequestID:[%d]", ret, request_id);
1097 if(strncmp(buf, "5g", 2) == 0)
1099 TEST_DEBUG("################## Resetting Total Cost MAX ACM..################ ");;
1100 TelCallAocInfo_t *pAocSetInfo;
1101 pAocSetInfo = calloc(1,sizeof(TelCallAocInfo_t));
1103 pAocSetInfo->AocType = TAPI_SS_AOC_TYPE_RESET;
1105 ret = tel_set_ss_aoc_info(pAocSetInfo,&request_id);
1106 TEST_DEBUG("Tapi return api_err value is [0x%x] RequestID:[%d]", ret, request_id);
1111 if(strncmp(buf, "quit", 4) == 0)
1113 TEST_DEBUG("Finished Testing this module, Going back to Main Menu");
1117 memset(buf, '\0', 256);
1122 /*****************************************************************/
1124 void ss_select_loop(void)
1131 FD_SET(0, &readfds);
1134 ret = select(0 + 1, &readfds, NULL, NULL, NULL);
1137 if (FD_ISSET(0, &readfds)) {
1138 if(ss_read_key_input()<0)
1145 int ss_test_subscribe_tapi_events(void)
1149 int iNumOfSSEvt = 0;
1150 TapiResult_t api_err = TAPI_API_SUCCESS;
1155 TAPI_EVENT_SS_BARRING_CNF, /**<0x0400, This confirmation event is sent when Barring activation/deactivation is requested*/
1156 TAPI_EVENT_SS_BARRING_CHANGEPASS_CNF, /**< This event is returned as Barring password change confirmation*/
1157 TAPI_EVENT_SS_BARRING_QUERYSTATUS_CNF, /**< This event is returned as Barring status query confirmation*/
1158 TAPI_EVENT_SS_FORWARD_CNF, /**< This event is returned as confirmation for Forward Activation/Deactivation/Registration/Erasure */
1159 TAPI_EVENT_SS_FORWARD_QUERYSTATUS_CNF, /**< This event is returned as confirmation for Forward Status query confirmation*/
1160 TAPI_EVENT_SS_WAITING_CNF, /**< This event is returned as confirmation for Call waiting activation/deactivation*/
1161 TAPI_EVENT_SS_WAITING_QUERYSTATUS_CNF, /**< This event is returned as Call waiting status query confirmation*/
1162 TAPI_EVENT_SS_USSD_CNF, /**< This event is returned as USSD send confirmation*/
1163 TAPI_EVENT_SS_USSD_CANCEL_CNF, /**< This event is returned as USSD cancel confirmation >**/
1164 TAPI_EVENT_SS_USSD_IND, /**< This is an unsolicited USSD indication*/
1165 TAPI_EVENT_SS_CLI_QUERYSTATUS_CNF, /**< This event is indicated to the Application for CLI service interrogation*/
1166 TAPI_EVENT_SS_REL_COMP_MSG_NOTIFY, /**< This event is indicated to the Application when tapi receives Release complete message notification for any SS transactions*/
1167 TAPI_EVENT_SS_AOC_RSP, /**<This event is used to send the aoc information */
1168 TAPI_EVENT_SS_SET_AOC_CNF, /**<This event is used to send the confirmation for setting aoc values */
1169 TAPI_EVENT_SS_BARRING_TYPE_IND, /**<This event is used to send the barring type while making an MO call */
1172 iNumOfSSEvt = sizeof(SSEvtList)/sizeof(int);
1173 TAPI_CALLOC(SS_subscription_id, iNumOfSSEvt, unsigned int)
1176 for( i=0 ; i< iNumOfSSEvt; i++ )
1178 api_err = tel_register_event(SSEvtList[i], &SS_subscription_id[i],(TelAppCallback)&ss_async_event_callback,NULL);
1179 if(api_err != TAPI_API_SUCCESS)
1181 TEST_DEBUG("isn't subscribed. event id is %d, api_err is %d\n", SSEvtList[i],api_err);