4 * Copyright (c) 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Ja-young Gu <jygu@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.
23 * @defgroup TELEPHONY Telephony
26 <h1 class="pg">Introduction</h1>
27 <h2 class="pg">Purpose</h2>
28 The purpose of this document is to describe how applications can use Telephony Framework APIs. This document gives programming guidelines to application engineers.
30 <h2 class="pg">Scope</h2>
31 The scope of this document is limited to Samsung Linux platform Telephony Framework API usage.
33 <h2 class="pg">Abbreviations</h2>
35 <tr><td>OEM</td><td>Original Equipment Manufacturer</td></tr>
36 <tr><td>RPC</td><td>Remote Procedure Call</td></tr>
37 <tr><td>SAP</td><td>Sim Access Profile</td></tr>
38 <tr><td>SAT</td><td>SIM Application Toolkit</td></tr>
39 <tr><td>SIM</td><td>Subscriber Identity Module</td></tr>
40 <tr><td>SVC</td><td>Service</td></tr>
41 <tr><td>TAPI</td><td>Telephony API</td></tr>
42 <tr><td>EFL</td><td>Enlightenment Foundation Libraries</td></tr>
45 <h2 class="pg">Restriction Modules</h2>
46 CALL, SMS, GPRS, SAT have the permission. Refer to each module API description
48 @defgroup Telephony_Architecture 1.Architecture
51 <h1 class="pg">Telephony Framework Architecture</h1>
52 @image html SLP_TelephonyFW_PG_image001.png
54 @image html SLP_TelephonyFW_PG_image002.png System Architecture of Telephony Framework
56 Telephony is a middleware component which acts as an interface layer between applications and the OEM.
57 @n Telephony Framework provides interfaces to applications in the form of a library and to the OEM providers in the form of OEM plug-in.
58 @n The applications make use of the library of exported APIs, which uses a RPC mechanism for making telephony service requests.
59 @n On the other side, OEM-Plug-in library is the OEM layer, which is the wireless protocol stack specific implementation. This layer acts as a plug-in giving flexibility for any wireless protocol stack to be used avoiding any changes to be made in the Telephony clients.
60 @n Telephony has certain synchronous and asynchronous exported APIs. Synchronous APIs provide data as the function parameter passed to Telephony. Asynchronous APIs provide data using an event based mechanism.
61 @image html SLP_TelephonyFW_PG_image003.png Asynchronous service request (response Use-Case Diagram)
62 @image html SLP_TelephonyFW_PG_image003.png Synchronous service request (response Use-Case Diagram)
64 @defgroup Telephony_Feature 2.SubModules & Services
68 <h1 class="pg">Telephony Framework SubModules & Services</h1>
69 <h2 class="pg">Call & Call-dependent SS</h2>
70 Also see Use Cases of @ref Use_Cases2_CALL
71 - Initiate, accept, reject and end calls.
72 - Call supplementary service ( Hold,CLI, Multiparty, Call Waiting, Forwarding, Barring)
73 - Get Call Time, Status, Duration, Conference List
74 - Get and Set Active Line
75 - Retrieve, swap, and transfer call.
77 - Call Flash Information
78 - Get and Set voice privacy mode
80 <h2 class="pg">SMS</h2>
81 Also see Use Cases of @ref Use_Cases4_SMS
82 SMS service in Telephony Framework only provides the interface to the modem and doesn’t handle Transport layer, storing and deleting the SMS in the storage except SIM. We recommend you use MAPI of Message Framework.
83 - Send, save, receive, read and delete network texts.
84 - Receive Cell-Broadcast Message.
85 - Set and Get Cell broadcast configuration.
86 - Set message status, memory status.
87 - Set and Get sms parameters
89 <h2 class="pg">Supplementary Service</h2>
90 - Interrogation and activation for Call Barring, forwarding and waiting.
91 - USSD services, AOC Services.
93 <h2 class="pg">Network Registration/Configuration</h2>
94 - Search and Select Network.
95 - Set and Get Selection Mode, Service Domain, network Mode and Band.
96 - Get Network information.
98 - Get and Set CDMA Hybrid Mode
99 - Get and Set Roaming Mode, Preferred PLMN
101 <h2 class="pg">SIM</h2>
102 - Handling SIM security procedure (PIN, PUK).
103 - Get / Update / Delete SIM EF files.
104 - Support 2G/3G Phonebook data.
105 - SIM Lock Personalisation enable or disable
106 - SIM lock enable or disable
109 <h2 class="pg">SAT (SIM Application Tool Kit)</h2>
110 - Get main menu information from the SIM application
111 - Send envelope commands to the SIM application
112 - Send the execution results of which the SIM application requests to applications
113 - Send UI / User confirmation to the SIM application
115 <h2 class="pg">Sound</h2>
116 Sound that is related with voice call is used to control modem configuration
117 - Sound user configuration
122 <h2 class="pg">Common</h2>
124 - TAPI initialization & De-initialization
125 - Register, Deregister event
126 - TAPI Initialization & De-initialization for Ecore
127 - Register, Deregister Ecore event
128 - Request Connection name
132 <h1 class="pg">Feature Description</h1>
133 <h2 class="pg">COMMON</h2>
135 @defgroup Use_Cases1_1 TAPI Initialization
136 @ingroup Use_Cases1_COMMON
138 <h3 class="pg">TAPI Initialization</h3>
139 This API shall be used to initialize the TAPI library. This API internally performs initialization routines related to Event delivery.
140 @n This API should be called before any other TAPI APIs. This API should be used by GTK/Glib applications.
150 #include <TapiCommon.h>
156 api_err = tel_init();
157 if (api_err != TAPI_API_SUCCESS)
159 printf ("tel_init Failed - api_err = %d\n", api_err);
164 @defgroup Use_Cases1_2 TAPI De-initialization
165 @ingroup Use_Cases1_COMMON
167 <h3 class="pg">TAPI De-initialization</h3>
168 This API shall be used to de initialize the Tapi library.
169 @n It shall perform the deinitializing routines related to event delivery.
170 @n The API shall be called finally, as a part of clean up routines. This API should be used by GTK/Glib applications.
173 int tel_deinit (void);
180 #include <TapiCommon.h>
186 api_err = tel_deinit();
187 if (api_err != TAPI_API_SUCCESS)
189 printf ("tel_deinit Failed - api_err = %d\n", api_err);
194 @defgroup Use_Cases1_3 Register Event
195 @ingroup Use_Cases1_COMMON
198 <h3 class="pg">Register Event</h3>
199 API is used to register the callback function for a specific TAPI Event. Upon successful registration of the event, the function shall return a valid subscription id.
201 If Application registers multiple callbacks for a specific event, then all the callbacks will be called when an event indication is received.
202 @n This API should be used by GTK/Glib applications.
205 int tel_register_event (int EventType , unsigned int * SubscriptionId, TelAppCallback AppCallBack);
212 #include <TapiCommon.h>
214 void app_callback(TelTapiEvent_t *event);
219 unsigned int subscription_id = 0;
222 api_err = tel_init();
223 if (api_err != TAPI_API_SUCCESS)
225 printf ("tel_init Failed - api_err = %d\n", api_err);
228 api_err = tel_register_event (TAPI_EVENT_CALL_SETUP_CNF, &subscription_id, (TelAppCallback)&app_callback);
230 printf("MISC Event registeration is Done: sub id is %d, api_err is %d\n", subscription_id, api_err);
232 tel_register_app_name("com.samsung.appname");
235 void app_callback(TelTapiEvent_t *event)
237 //Callback function to be called
242 @defgroup Use_Cases1_4 Deregister Event
243 @ingroup Use_Cases1_COMMON
246 <h3 class="pg">Deregister Event</h3>
247 API shall de-register the pre-registered TAPI event and the associated application callback, based on the subscription id.
248 @n This identifier is the same as the subscription identifier returned to the application during the TAPI registration procedure. If the de-register API is called during any service requests, the registered callback will be cleared based on the subscription id. No application callback shall be called when any confirmation/indication events are received after de-registration.
249 @n This API should be used by GTK/Glib applications.
252 int tel_deregister_event ( unsigned int SubscriptionId);
259 #include <TapiCommon.h>
261 void app_callback(TelTapiEvent_t *event);
265 unsigned int subscription_id = 0;
268 api_err = tel_init();
269 if (api_err != TAPI_API_SUCCESS)
271 printf ("tel_deregister_event Failed - api_err = %d\n", api_err);
275 api_err = tel_register_event (TAPI_EVENT_CALL_SETUP_CNF, &subscription_id, (TelAppCallback)&app_callback);
276 printf("MISC Event registeration is Done: sub id is %d, api_err is %d\n",subscription_id,api_err);
278 tel_register_app_name("com.samsung.appname");
281 api_err = tel_deregister_event (subscription_id);
282 if (api_err != TAPI_API_SUCCESS)
284 printf("Event Deregistration Failed\n");
288 void app_callback(TelTapiEvent_t *event)
290 // callback function to be called
296 @defgroup Use_Cases1_5 TAPI Ecore Initialization
297 @ingroup Use_Cases1_COMMON
300 <h3 class="pg">TAPI Ecore Initialization</h3>
301 This API shall be used by Ecore based applications, to initialize TAPI library. This API internally performs event delivery related initialization routines. This API shall be called before any other TAPI APIs.
302 @n This API is for applications using Ecore library.
305 int tel_init_ecore_loop (void);
312 #include <TapiCommon.h>
318 api_err = tel_init_ecore_loop();
319 if (api_err != TAPI_API_SUCCESS)
321 printf("tel_init_ecore_loop Failed - api_err = %d\n", api_err);
326 5 <h3 class="pg">TAPI Ecore De-Initialization</h3>
327 API shall be used to de-initialize the TAPI library. It shall be used by Ecore based applications.
328 @n This API shall be called finally, as a part of cleanup routine. This API is for applications using Ecore library.
331 int tel_deinit_ecore_loop (void);
338 #include <TapiCommon.h>
340 void tapideinitecore()
344 api_err = tel_deinit_ecore_loop();
345 if (api_err != TAPI_API_SUCCESS)
347 printf("tel_deinit_ecore_loop Failed - api_err = %d\n", api_err);
353 @defgroup Use_Cases1_6 TAPI RegisterEvent Ecore
354 @ingroup Use_Cases1_COMMON
357 <h3 class="pg">TAPI RegisterEvent Ecore</h3>
358 API shall be used to register for TAPI events (for application that use EFL).
359 @n Upon successful registration of the event, the API shall return a valid subscription id.
360 @n If Application registers multiple callbacks for a specific event, then all the callbacks will be called when an event indication is received
361 @n This API is for applications using Ecore library.
364 int tel_register_event_at_ecore_loop(int EventType, unsigned int * SubscriptionId, TelAppCallback AppCallBack);
371 #include <TapiCommon.h>
373 void app_callback(TelTapiEvent_t *event);
375 void registereventecore()
378 unsigned int subscription_id = 0;
380 api_err = tel_register_event_at_ecore_loop (TAPI_EVENT_CALL_SETUP_CNF, &subscription_id, (TellAppCallback)&app_callback);
381 if (api_err != TAPI_API_SUCCESS)
383 printf ("tel_register_event_at_ecore_loop Failed - api_err = %d \n", api_err);
385 printf("RegisterEventEcore done with subscription_id:%d and return Status:%d\n", subscription_id, api_err);
387 tel_register_app_name("com.samsung.appname");
390 void app_callback(TelTapiEvent_t *event)
392 //Callback function to be called
398 @defgroup Use_Cases1_7 TAPI DeRegisterEvent Ecore
399 @ingroup Use_Cases1_COMMON
402 <h3 class="pg">TAPI DeRegisterEvent Ecore</h3>
403 API shall de-register the pre-registered TAPI event and the associated application callback, based on the subscription id.
404 @n This identifier is the same as the subscription identifier returned to the application during the TAPI registration procedure.
405 @n If the de-register API is called during any service requests, the registered callback will be cleared based on the subscription id. No application callback shall be called when any confirmation/indication events are received after de-registration.
406 @n This API is for applications based on Ecore library.
409 int tel_deregister_event_at_ecore_loop (unsigned int SubscriptionId);
416 #include <TapiCommon.h>
418 Void deregistereventecore()
421 unsigned int subscription_id = 0;
424 api_err = tel_register_event_at_ecore_loop (TAPI_EVENT_CALL_SETUP_CNF, &subscription_id, (TellAppCallback)&app_callback);
425 printf("RegisterEventEcore done with subscription_id:%d and return Status:%d\n", subscription_id, api_err);
427 tel_register_app_name("com.samsung.appname");
430 api_err = tel_deregister_event_at_ecore_loop (subscription_id);
431 if (api_err != TAPI_API_SUCCESS)
433 printf("tel_deregister_event_at_ecore_loop Failed - api_err = %d\n", api_err);
439 @defgroup Use_Cases1_8 Register Application Name
440 @ingroup Use_Cases1_COMMON
443 <h3 class="pg">Register Application Name</h3>
444 This function registers the application name which requests any telephony service. Telephony Server uses this name as the destination name of response message upon the service request. If the name is not set, the request will fails. Before an application invoke this function, it shall initialize a connection to Telephony Sever with #tel_init or #tel_init_ecore_loop. And the application name shall be registered prior to start a event loop.
447 int tel_register_app_name(char *name)
454 #include <TapiCommon.h>
456 Void register_app_name()
459 //register telephony event
460 tel_register_event(...);
462 tel_register_app_name("com.samsung.appname");
463 GMainLoop *loop = g_main_loop_new(NULL, false);
464 g_main_loop_run(loop);
469 @defgroup Use_Cases1_9 Get Application Name
470 @ingroup Use_Cases1_COMMON
473 <h3 class="pg">Get Application Name</h3>
474 This function get the application name which was registered with #tel_register_application_name.
477 int tel_get_app_name(tapi_dbus_connection_name *app_name)
483 #include <TapiCommon.h>
487 tapi_dbus_connection_name app_name;
488 tel_get_app_name(&app_name);
489 printf("app_name = %s\n", app_name.name);
493 @defgroup Use_Cases1_10 TAPI Check service ready
494 @ingroup Use_Cases1_COMMON
497 <h3 class="pg">TAPI Check service ready </h3>
498 API is used to get the modem status i.e. whether modem is on or off.
501 int tel_check_service_ready (int* bStatus)
507 #include <TapiCommon.h>
509 void getmodemstatus()
514 err_code = tel_check_service_ready(&bStatus);
515 if (err_code != TAPI_API_SUCCESS) {
516 printf("Error Code [%x]\n", err_code);
520 printf("Telephony Service Not Ready";
521 else if (bStatus == 1)
522 printf("Telephony Service Ready";
529 <h2 class="pg">CALL</h2>
531 @defgroup Use_Cases2_1 Event Register and Deregister
532 @ingroup Use_Cases2_CALL
535 <h3 class="pg">Event Register and Deregister</h3>
536 To receive asynchronous event notifications for the call APIs, the registration of related events with their associated call backs is required. After these are registered, when an asynchronous API is called, the confirmation is returned as an asynchronous event notification which invokes the callback function along with the event data.
542 unsigned int subscription_id = 0;
544 api_err = tel_init();
545 if (api_err != TAPI_API_SUCCESS)
547 printf("tel_init Failed - api_err = %d \n", api_err);
550 api_err = tel_register_event (TAPI_EVENT_CALL_CALL_SETUP_CNF, &subscription_id, (TelAppCallback)&app_callback);
551 printf("VOICE CALL Event registration is Done: sub id is %d, api_err is %d\n",subscription_id,api_err);
553 tel_register_app_name("com.samsung.appname");
556 api_err = tel_deregister_event (subscription_id);
557 if (api_err != TAPI_API_SUCCESS)
559 printf("Event Class Unregistration Fail\n");
564 @defgroup Use_Cases2_2 Call Setup
565 @ingroup Use_Cases2_CALL
568 <h3 class="pg">Call Setup</h3>
569 This API originates an MO call setup.
572 int tel_exe_call_mo _t (const TelCallSetupParams_t* const pParams, unsigned int * pCallHandle, int * pRequestID);
575 On success, this API returns a valid call handle and the request ID as out parameters.
576 @n The MO call setup procedure continues in background. There are multiple states involved in the call setup procedure. Upon completion of the setup request, the event notifications and associated event data are sent to the client, based on the indication or response received by the Telephony Server.
578 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
582 #include <ITapiCall.h>
584 #include "TapiCommon.h"
586 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
591 unsigned int pCallHandle;
592 TelCallSetupParams_t pParams;
593 char normal[16] = "1234"; //Called party number
595 memset(&pParams, 0, sizeof(TelCallSetupParams_t));
596 pParams.CallType = TAPI_CALL_TYPE_VOICE;
597 strcpy(pParams.szNumber, normal);
599 ret_status = tel_exe_call_mo (&pParams, &pCallHandle, &pRequestID);
600 if (ret_status == TAPI_API_SUCCESS)
601 printf("successful\n");
603 printf("error=%d\n", ret_status); //WAIT FOR EVENT HERE
606 //CALLBACK FUNCTION TO BE USED
607 static void app_callback (TelTapiEvent_t *event)
613 void* EventData = NULL;
615 unsigned int temp_handle = 0;
617 eventClass = event->EventClass;
618 eventType = event->EventType;
619 requestId = event->RequestId;
620 status = event->Status;
621 EventData = event->pData;
623 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
627 //TEST_DEBUG("******This is nonzero status. ******\n");
633 case TAPI_EVENT_CALL_SETUP_CNF:
634 printf("TAPI_EVENT_CALL_SETUP_CNF");
635 memcpy(&temp_handle, EventData, sizeof(unsigned int));
636 TEST_DEBUG("Received setup cnf for call Handle [%d]", temp_handle);
640 case TAPI_EVENT_CALL_ALERT_IND:
642 TEST_DEBUG("TAPI_EVENT_CALL_ALERT_IND");
643 memcpy(&temp_handle, event->pData, sizeof(unsigned int));
644 TEST_DEBUG("Received Alert for call Handle [%d]", temp_handle);
647 case TAPI_EVENT_CALL_CONNECTED_IND:
649 TEST_DEBUG("TAPI_EVENT_CALL_CONNECTED_IND");
650 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
651 TEST_DEBUG("Received Connected Event for call Handle [%d]", temp_handle);
658 @defgroup Use_Cases2_3 Call Answer
659 @ingroup Use_Cases2_CALL
662 <h3 class="pg">Call Answer</h3>
663 This API responds to an incoming call either by accepting or rejecting the call.
666 @n Call associated with the call handle should be in TAPI_CALL_STATE_INCOM state.
667 @n There should be no more than one existing call.
670 int tel_answer_call (unsigned int CallHandle,TelCallAnswerType_t AnsType, int * pRequestID);
673 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
677 #include <ITapiCall.h>
679 #include "TapiCommon.h"
680 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
682 void callsetup(unsigned int CallHandle)
687 ret_status = tel_answer_call (CallHandle, &pRequestID);
688 if (ret_status == TAPI_API_SUCCESS)
689 printf("successful\n");
691 printf("error=%d\n", ret_status); //WAIT FOR EVENT HERE
694 //CALLBACK FUNCTION TO BE USED
695 static void app_callback (TelTapiEvent_t *event)
698 switch (eventType) //REFER Call Setup TO GET eventType
700 //GET CALL HANDLE FROM INCOMING CALL EVENT DATA
701 case TAPI_EVENT_CALL_INCOM_IND:
702 unsigned int CallHandle;
703 TelCallIncomingCallInfo_t IncomingInfo;
704 memcpy(&IncomingInfo, event->pData, sizeof(TelCallIncomingCallInfo_t));
705 CallHandle = IncomingInfo.CallHandle;
708 case TAPI_EVENT_CALL_ANSWER_CNF:
709 memcpy(&CallHandle, event->pData, sizeof(unsigned int));
710 printf("TAPI_EVENT_CALL_ANSWER_CNF\n");
717 @defgroup Use_Cases2_4 Call Release
718 @ingroup Use_Cases2_CALL
721 <h3 class="pg">Call Release</h3>
722 This API is used to release the call.
723 @n The call to be released can be a single call based on the call handle, or all active calls or all calls.
726 @n Call handle should be valid and there should be an existing call in Active/hold state.
729 int tel_release_call (unsigned int CallHandle, int * pRequestID);
730 int tel_release_call_all (int * pRequestId);
731 int tel_release_call_all_active (int *pRequestID);
732 int tel_release_call_all_held (int *pRequestID);
735 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
739 #include <ITapiCall.h>
741 #include "TapiCommon.h"
743 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
745 void callrelease(unsigned int CallHandle)
750 ret_status = tel_release_call (CallHandle, &pRequestID);
752 ret_status = tel_release_call_all (&pRequestID);
754 ret_status = tel_release_call_all_active (&pRequestID);
756 ret_status = tel_release_call_all_held (&pRequestID);
758 if (ret_status == TAPI_API_SUCCESS)
759 printf("successful\n");
761 printf("error=%d\n", ret_status);
762 } //WAIT FOR EVENT HERE
764 //CALLBACK FUNCTION TO BE USED
765 static void app_callback(TelTapiEvent_t *event)
768 switch (eventType) //REFER Call Setup TO GET eventType
770 //GET CALL HANDLE FROM INCOMING CALL EVENT DATA
771 case TAPI_EVENT_CALL_INCOM_IND:
772 TelCallIncomingCallInfo_t IncomingInfo;
773 memcpy(&IncomingInfo, event->pData, sizeof(TelCallIncomingCallInfo_t));
774 CallHandle = IncomingInfo.CallHandle;
777 case TAPI_EVENT_CALL_RELEASE_CNF:
778 case TAPI_EVENT_CALL_RELEASE_ALL_CNF:
779 case TAPI_EVENT_CALL_RELEASE_ALL_ACTIVE_CNF:
780 case TAPI_EVENT_CALL_RELEASE_ALL_HELD_CNF:
781 case TAPI_EVENT_CALL_END_IND_IND:
783 memcpy(&handle, event->pData, sizeof(unsigned int));
784 printf("TAPI_EVENT_CALL_RELEASE_CNF\n");
791 @defgroup Use_Cases2_5 Call Hold
792 @ingroup Use_Cases2_CALL
795 <h3 class="pg">Call Hold</h3>
796 This API puts the specified call on hold. The call identified by Call Handle should be in the active state.
799 int tel_hold_call (unsigned int CallHandle, int * pRequestID);
802 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
806 #include <ITapiCall.h>
808 #include "TapiCommon.h"
810 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
811 void callhold(unsigned int CallHandle)
816 ret_status = tel_hold_call(CallHandle, &pRequestID);
817 if (ret_status == TAPI_API_SUCCESS)
818 printf("successful\n");
820 printf("error=%d\n", ret_status);
821 } //WAIT FOR EVENT HERE
823 //CALLBACK FUNCTION TO BE USED
824 static void app_callback (TelTapiEvent_t *event)
827 switch (eventType) //REFER Call Setup TO GET eventType
829 case TAPI_EVENT_CALL_HOLD_CNF:
830 unsigned int CallHandle;
831 memcpy(&CallHandle, event->pData, sizeof(unsigned int));
832 printf("TAPI_EVENT_CALL_HOLD_CNF\n");
840 @defgroup Use_Cases2_6 Call Retrieve
841 @ingroup Use_Cases2_CALL
844 <h3 class="pg">Call Retrieve</h3>
845 This API can be used to retrieve a held call.
848 @n Call should be in held state in order to return to the active state, and no other call should be active.
851 int tel_retrieve_call (unsigned int CallHandle, int * pRequestID);
854 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
858 #include <ITapiCall.h>
860 #include "TapiCommon.h"
863 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
864 void callretrieve(unsigned int CallHandle)
869 ret_status = tel_retrieve_call(CallHandle, &pRequestID);
870 if (ret_status == TAPI_API_SUCCESS)
871 printf("successful\n");
873 printf("error=%d\n", ret_status);
874 } //WAIT FOR EVENT HERE
876 //CALLBACK FUNCTION TO BE USED
877 static void app_callback(TelTapiEvent_t *event)
880 switch (eventType) //REFER Call Setup TO GET eventType
882 case TAPI_EVENT_CALL_HOLD_CNF:
883 unsigned int CallHandle;
884 memcpy(&CallHandle, event->pData, sizeof(unsigned int));
885 printf("TAPI_EVENT_CALL_HOLD_CNF\n");
888 case TAPI_EVENT_CALL_RETRIEVE_CNF:
889 unsigned int CallHandle;
890 memcpy(&CallHandle, event->pData, sizeof(unsigned int));
891 printf("TAPI_EVENT_CALL_RETRIEVE_CNF ");
899 @defgroup Use_Cases2_7 Call Swap
900 @ingroup Use_Cases2_CALL
903 <h3 class="pg">Call Swap</h3>
904 This API can be used to swap calls. This feature is only available for the calls that have been setup and answered using the Telephony service. The swap functionality is only available for voice calls.
907 @n Two calls should be present, one of them in the Active state and the other in the held state
910 int tel_swap_call (unsigned int CallHandle1, const TS_UINT CallHandle2, int * pRequestID);
913 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
917 #include <ITapiCall.h>
919 #include "TapiCommon.h"
920 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
922 void callswap(unsigned int CallHandle1, unsigned int CallHandle2)
927 ret_status = tel_swap_call(CallHandle1, CallHandle2, &pRequestID);
928 if (ret_status == TAPI_API_SUCCESS)
929 printf("successful\n");
931 printf("error=%d\n", ret_status);
933 } //WAIT FOR EVENT HERE
935 //CALLBACK FUNCTION TO BE USED
936 static void app_callback (TelTapiEvent_t *event)
939 switch (eventType) //REFER Call Setup TO GET eventType
941 case TAPI_EVENT_CALL_SWAP_CNF:
942 printf("TAPI_EVENT_CALL_RETRIEVE_CNF\n");
950 @defgroup Use_Cases2_8 Send DTMF
951 @ingroup Use_Cases2_CALL
954 <h3 class="pg">Send DTMF</h3>
955 This API can be used for sending one or more DTMF digits during the call.
958 @n Active call should be present.
961 int tel_send_call_dtmf (char const * const pDtmfString, int * pRequestID);
964 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
968 #include <ITapiCall.h>
970 #include "TapiCommon.h"
972 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
979 strcpy(DtmfString, "123456789"); //Sample DTMF digits that need to be sent
981 ret_status = tel_send_call_dtmf(DtmfString, &pRequestID);
982 if (ret_status == TAPI_API_SUCCESS)
983 printf("successful\n");
985 printf("error=%d\n", ret_status);
987 //WAIT FOR EVENT HERE
988 static void app_callback(TelTapiEvent_t *event)
991 switch (eventType) //REFER Call Setup TO GET eventType
993 case TAPI_EVENT_CALL_SEND_DTMF_CNF:
994 printf("TAPI_EVENT_CALL_SEND_DTMF_CNF\n");
1001 @defgroup Use_Cases2_9 Call Join
1002 @ingroup Use_Cases2_CALL
1005 <h3 class="pg">Call Join</h3>
1006 This API joins the specified two calls (one call which is in the active state and other call which is in the held state) into a conference call.
1009 @n For a Multiparty call or for joining two calls into conference, there should be one call in active state and another call in held state.
1012 int tel_join_call (unsigned int CallHandle1, const unsigned int CallHandle2,int * pRequestID);
1015 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1019 #include <ITapiCall.h>
1021 #include "TapiCommon.h"
1023 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1024 void calljoin(unsigned int CallHandle1, unsigned int CallHandle2)
1029 ret_status= tel_join_call(CallHandle1, CallHandle2, &pRequestID);
1030 if (ret_status == TAPI_API_SUCCESS)
1031 printf("successful\n");
1033 printf("error=%d\n", ret_status);
1034 } //WAIT FOR EVENT HERE
1036 //CALLBACK FUNCTION TO BE USED
1037 static void app_callback (TelTapiEvent_t *event)
1040 switch (eventType) //REFER Call Setup TO GET eventType
1042 case TAPI_EVENT_CALL_SETUPCONFERENCE_CNF:
1043 unsigned int temp_handle;
1044 memcpy(&temp_handle, event->pData, sizeof(unsigned int));
1045 printf("TAPI_EVENT_CALL_SETUPCONFERENCE_CNF ");
1052 @defgroup Use_Cases2_10 Call Split
1053 @ingroup Use_Cases2_CALL
1056 <h3 class="pg">Call Split</h3>
1057 This API triggers the split of a single call from multiparty call. This can be used for creating a private communication with one of remote parties in a multiparty session.
1058 @n TAPI client application has to pass the call handle which should be split from the multiparty call.
1061 @n Call should be in multiparty conference call.
1064 @n Split call will be the active call and the conference will be held call.
1067 int tel_split_call (unsigned int CallHandle, int * pRequestID);
1070 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1074 #include <ITapiCall.h>
1076 #include "TapiCommon.h"
1078 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1079 void callsplit(unsigned int CallHandle)
1084 ret_status = tel_split_call(CallHandle, &pRequestID);
1085 if (ret_status == TAPI_API_SUCCESS)
1086 printf("successful\n");
1088 printf("error=%d\n", ret_status);
1089 }//WAIT FOR EVENT HERE
1091 //CALLBACK FUNCTION TO BE USED
1092 static void app_callback (TelTapiEvent_t *event)
1095 switch (eventType) //REFER Call Setup TO GET eventType
1097 case TAPI TAPI_EVENT_CALL_SPLITCONFERENCE_CNF:
1098 unsigned int temp_handle;
1099 memcpy(&temp_handle, event->pData, sizeof(unsigned int));
1100 printf("TAPI_EVENT_CALL_SPLITCONFERENCE_CNF ");
1107 @defgroup Use_Cases2_11 Active Line
1108 @ingroup Use_Cases2_CALL
1111 <h3 class="pg">Active Line </h3>
1112 <strong>[Note] Telephony Emulator does not support this feature.</strong>
1113 @n Telephony provides APIs for setting and getting the current calling line identification number.
1116 int tel_set_call_act_line const TelCallActiveLine_t active_line, int * pRequestID);
1117 int tel_get_call_act_line ( int * pRequestID);
1120 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1124 #include <ITapiCall.h>
1126 #include "TapiCommon.h"
1133 TelCallActiveLine_t g_curLine = TAPI_CALL_ACTIVE_LINE1;
1134 TelCallActiveLine_t active_line;
1136 printf (" Set Active Line with TAPI_ACTIVE_LINE1.");
1138 ret_status = tel_set_call_act_line (g_curLine, &pRequestID);
1139 if (ret_status == TAPI_API_SUCCESS)
1140 printf("successful\n");
1142 printf("error=%d\n", ret_status);
1145 ret_status = tel_get_call_act_line (&pRequestID);
1146 if (ret_status == TAPI_API_SUCCESS)
1147 printf("successful\n");
1149 printf("error=%d\n", ret_status);
1153 //CALLBACK FUNCTION TO BE USED
1154 static void app_callback (TelTapiEvent_t *event)
1157 switch (eventType) //REFER Call Setup TO GET eventType
1159 case TAPI_EVENT_CALL_SET_LINEID_CNF:
1160 //TEST_DEBUG("Received TAPI_EVENT_CALL_SET_LINEID_CNF");
1161 //AUTO_LOG("EVENT: SET_LINEID_CNF:");
1164 case TAPI_EVENT_CALL_GET_LINEID_CNF:
1165 TelCallActiveLine_t active_line;
1166 memcpy(&active_line, event->pData, sizeof(TelCallActiveLine_t));
1167 TEST_DEBUG("Received TAPI_EVENT_CALL_GET_LINEID_CNF");
1174 @defgroup Use_Cases2_12 Call transfer
1175 @ingroup Use_Cases2_CALL
1178 <h3 class="pg">Call transfer</h3>
1179 This API triggers an explicit call transfer by connecting two parties, one of which is in the active state with the other in the held state.
1182 @n In order to call transfer, 2 calls should be present. One in the active state and the other in the Held state.
1185 @n When the request has been completed successfully, Call end indication will be sent to both the calls (active and held).
1188 int tel_exe_call_explicit_transfer (unsigned int CallHandle, int * pRequestID);
1191 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1195 #include <ITapiCall.h>
1197 #include "TapiCommon.h"
1199 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1200 void calltransfer(unsigned int CallHandle)
1205 ret_status = tel_exe_call_explicit_transfer (CallHandle, &pRequestID);
1206 if (ret_status == TAPI_API_SUCCESS)
1207 printf("successful\n");
1209 printf("error=%d\n", ret_status);
1210 }//WAIT FOR EVENT HERE
1212 //CALLBACK FUNCTION TO BE USED
1213 static void app_callback (TelTapiEvent_t *event)
1216 switch (eventType) //REFER Call Setup TO GET eventType
1218 case TAPI_EVENT_CALL_TRANSFER_CNF:
1219 unsigned int temp_handle = 0;
1220 memcpy(&temp_handle, event->pData, sizeof(unsigned int));
1221 printf("TAPI_EVENT_CALL_TRANSFER_CNF. ");
1228 @defgroup Use_Cases2_13 Get Call Status
1229 @ingroup Use_Cases2_CALL
1232 <h3 class="pg">Get Call Status</h3>
1233 When call status is requested by the application, this API gets the status of the call associated with the input Call Handle. Call status information consists of destination number, call direction (MO or MT), call type (voice or data etc), multiparty state (whether the call is in conference state or not) and present call state.
1234 @n Call handle must be valid.
1237 int tel_get_call_status (unsigned int CallHandle, TelCallStatus_t * pCallStatus)
1240 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1244 #include <ITapiCall.h>
1246 #include "TapiCommon.h"
1248 void getcallstatus(unsigned int CallHandle)
1251 TelCallStatus_t callStatus;
1253 ret_status = tel_get_call_status(CallHandle, &callStatus);
1254 if (ret_status == TAPI_API_SUCCESS)
1256 printf("successful\n");
1257 printf("CallNumber: %s\n", callStatus.pNumber);
1258 printf("Is Mobile Originated:%d n\t CallType : %d \n\t CallActiveState: %d\n\t CallState : %d\n\t isConferenceState:%d \n",
1260 callStatus.CallType,
1261 callStatus.CallActiveState,
1262 callStatus.CallState,
1263 callStatus.bConferenceState);
1266 printf("error=%d\n", ret_status);
1271 @defgroup Use_Cases2_14 Get Call Duration
1272 @ingroup Use_Cases2_CALL
1275 <h3 class="pg">Get Call Duration</h3>
1276 This API gets the duration of the specified call.
1277 @n This is a synchronous API. Duration is timed from the moment the connection is established, i.e. call goes into active state for first time. The total call duration is provided in seconds, from the call connecting time to the current time.
1280 int tel_get_call_duration unsigned int CallHandle, unsigned int * pDurationInSecs);
1283 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1287 #include <ITapiCall.h>
1289 #include "TapiCommon.h"
1291 void getcallduration(unsigned int CallHandle)
1294 unsigned int duration;
1296 ret_status = tel_get_call_duration (CallHandle, &duration);
1297 if (ret_status == TAPI_API_SUCCESS)
1299 printf("successful\n");
1300 printf("Call Duration : %d Seconds\n", duration);
1303 printf("error=%d\n", ret_status);
1308 @defgroup Use_Cases2_15 Get Call Conference List
1309 @ingroup Use_Cases2_CALL
1312 <h3 class="pg">Get Call Conference List</h3>
1313 This is a synchronous API which returns information about all the call handles and the total number of call handles, within the specified conference call.
1316 @n Call should be a multi-party conference call in order to return actual number of calls and call handles in the conference call.
1319 int tel_get_call_conf_list(unsigned int CallHandle, unsigned int * pCallList, int * pNoOfCalls);
1322 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1326 #include <ITapiCall.h>
1328 #include "TapiCommon.h"
1330 void getconferencelist(unsigned int CallHandle)
1333 unsigned int callList[5];
1336 ret_status = tel_get_call_conf_list(CallHandle, callList, &noOfCalls);
1337 if (ret_status == TAPI_API_SUCCESS)
1339 printf("successful\n");
1340 printf("\n No.of Calls %d, \n", noOfCalls);
1341 for (i = 0; i < noOfCalls; i++)
1343 printf("\n Call Handle in conference calls %d \n", callList[i]);
1347 printf("error=%d\n", ret_status);
1352 @defgroup Use_Cases2_16 Voice Privacy Mode
1353 @ingroup Use_Cases2_CALL
1356 <h3 class="pg">Voice Privacy Mode</h3>
1357 Telephony provides two APIs which can be used to set and get the CDMA voice privacy mode .
1360 int tel_get_call_privacy_mode (TelCallVoicePrivacyInfo_t PrivacyInfo, int *pRequestID);
1361 int tel_set_call_privacy_mode (TelCallPrivacyType_t PrivacyType, int *pRequestID);
1364 This API is restricted for direct use. Use the Voice call engine API instead.
1368 #include <ITapiCall.h>
1370 #include "TapiCommon.h"
1372 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1374 //SetVoicePrivacyMode
1375 void setvoiceprivacymode()
1378 int ret_status = -1;
1380 TelCallPrivacyMode_t PrivacyMode_info;
1382 pPrivacyMode_info = TAPI_CALL_PRIVACY_MODE_STANDARD;
1384 ret_status = tel_set_call_privacy_mode (pPrivacyMode_info, &reqId);
1385 if (ret_status == TAPI_API_SUCCESS)
1386 printf("Successful\n");
1388 printf("error:%d\n", ret_status);
1390 //WAIT FOR EVENT HERE
1392 //CALLBACK FUNCTION TO BE USED
1394 bool call_app_callback (TelTapiEvent_t *Event)
1397 int eventClass = Event->EventClass;
1398 int eventType = Event->EventType;
1399 int RequestId = Event->RequestId;
1400 int Status = Event->Status;
1402 if (eventClass == TAPI_EVENT_CLASS_CALL_VOICE)
1404 switch (eventType) {
1405 case TAPI_EVENT_CALL_SET_PRIVACYMODE_CNF:
1406 if (RequestId != reqId) {
1407 printf("Invalid RequestID received %d \n", reqId);
1411 if (Status != TAPI_CAUSE_SUCCESS) {
1412 printf("Invalid Status value received");
1420 //GetVoicePrivacyMode
1421 void getprivacymode()
1424 int ret_status = -1;
1426 TelCallPrivacyType_t privacyType;
1428 privacyType = TAPI_CALL_PRIVACY_TYPE_MS;
1430 ret_status = tel_get_call_privacy_mode (privacyType, &req_id);
1431 if (ret_status == TAPI_API_SUCCESS)
1432 printf("Successful\n");
1434 printf("error:%d\n", ret_status);
1437 //WAIT FOR EVENT HERE
1439 //CALLBACK FUNCTION TO BE USED
1441 bool call_app_callback (TelTapiEvent_t *Event)
1444 int eventClass = Event->EventClass;
1445 int eventType = Event->EventType;
1446 int RequestId = Event->RequestId;
1447 int Status = Event->Status;
1449 if (eventClass == TAPI_EVENT_CLASS_CALL_VOICE)
1451 switch (eventType) {
1452 case TAPI_EVENT_CALL_GET_PRIVACYMODE_CNF:
1453 TelCallVoicePrivacyInfo_t vp_info;
1454 memcpy(&vp_info, event->pData, sizeof(TelCallVoicePrivacyInfo_t));
1455 if (Status != TAPI_CAUSE_SUCCESS)
1457 printf("Invalid Status value received");
1466 @defgroup Use_Cases2_17 Call FlashInformation
1467 @ingroup Use_Cases2_CALL
1470 <h3 class="pg">Call FlashInformation</h3>
1471 The user makes an additional outgoing call in CDMA, this API is used instead of the CALL Outgoing API because there is no additional voice call transaction in CDMA. So the voice call id is only one in CDMA. The multiparty call is not supported in CDMA.
1474 int tel_exe_call_flash_info (const char* pDialNumber, int *pRequestID);
1477 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1481 #include <ITapiCall.h>
1483 #include "TapiCommon.h"
1485 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1487 void callflashinfo()
1489 int ret_status = -1;
1491 const char *pDialNumber = "9999900000";
1493 ret_status = tel_exe_call_flash_info(pDialNumber, &reqId);
1494 if (ret_status == TAPI_API_SUCCESS)
1495 printf("Successful\n");
1497 printf("error:%d\n", ret_status);
1499 //WAIT FOR EVENT HERE
1501 //CALLBACK FUNCTION TO BE USED
1502 bool call_app_callback(TelTapiEvent_t *Event)
1505 int eventClass = Event->EventClass;
1506 int eventType = Event->EventType;
1507 int RequestId = Event->RequestId;
1508 int Status = Event->Status;
1510 if (eventClass == TAPI_EVENT_CLASS_CALL_VOICE)
1514 case TAPI_EVENT_CALL_FLASHINFO_CNF:
1515 if (RequestId != reqId)
1517 printf("Invalid RequestID received %d \n", reqId);
1521 if (Status != TAPI_CAUSE_SUCCESS)
1523 printf("Invalid Status value received");
1526 printf("\n Received TAPI_EVENT_CALL_FLASHINFO_CNF \n");
1535 @defgroup Use_Cases2_18 Getting Call Time
1536 @ingroup Use_Cases2_CALL
1539 <h3 class="pg">Getting Call Time</h3>
1540 This API is used to query information about a call time and call count.
1543 int tel_get_call_time (const TS_WORD req_mask, int *pRequestID);
1546 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1550 #include <ITapiCall.h>
1552 #include "TapiCommon.h"
1556 int ret_status = -1;
1558 TelCallTimeMaskType_t mask_byte1;
1559 TelCallTimeMaskType_t mask_byte2;
1560 unsigned short mask_type;
1562 mask_byte1 = TAPI_CALL_TIME_TYPE_TOTAL_CALL_CNT;
1563 mask_byte2 = TAPI_CALL_TIME_TYPE_TOTAL_CALL_TIME;
1565 mask_type = (mask_byte1 | mask_byte2);
1567 ret_status = tel_get_call_time(mask_type, &reqId);
1568 if (ret_status == TAPI_API_SUCCESS)
1569 printf("Successful\n");
1571 printf("error:%d\n", ret_status);
1573 //WAIT FOR EVENT HERE
1575 bool call_app_callback(TelTapiEvent_t *Event)
1578 int eventClass = Event->EventClass;
1579 int eventType = Event->EventType;
1580 int RequestId = Event->RequestId;
1581 int Status = Event->Status;
1583 if (eventClass == TAPI_EVENT_CLASS_CALL_VOICE)
1587 case TAPI_EVENT_CALL_SET_PRIVACYMODE_CNF:
1588 if (RequestId != reqId)
1590 printf("Invalid RequestID received %d \n", reqId);
1594 if (Status != TAPI_CAUSE_SUCCESS)
1596 printf("Invalid Status value received");
1606 <h2 class="pg">SUPPLEMENTARY SERVICE </h2>
1607 @defgroup Use_Cases3_1 Event register and deregister
1608 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
1610 <h3 class="pg">Event register and deregister</h3>
1611 To receive asynchronous event notifications for the SS APIs, the registration of related events with their associated call backs is required. After these are registered, when an asynchronous API is called, the confirmation is returned as an asynchronous event notification which invokes the callback function along with the event data.
1616 unsigned int subscription_id = 0;
1619 api_err = tel_init();
1620 if (api_err != TAPI_API_SUCCESS)
1622 TEST_DEBUG("tel_init Failed - api_err = %d \n", api_err);
1625 api_err = tel_register_event (TAPI_EVENT_SS_WAITING_CNF, &subscription_id, (TelAppCallback)&app_callback);
1626 printf("SS Event registration is Done: sub id is %d, api_err is %d\n",subscription_id,api_err);
1628 tel_register_app_name("com.samsung.appname");
1631 api_err = tel_deregister_event(subscription_id);
1632 if (api_err != TAPI_API_SUCCESS)
1634 printf("Event Class Unregisteration Fail\n");
1638 @defgroup Use_Cases3_2 Call Barring
1639 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
1642 <h3 class="pg">Call Barring </h3>
1643 Telephony provides APIs to activate/deactivate call barring, get the barring status and change the barring password. It also provides APIs for applications to provide barring password requested by network for Call Barring Request or Change barring password request.
1644 @n This service makes it possible for a mobile subscriber to activate barring for certain categories of outgoing or incoming calls. It also allows the deactivation of call barring based on categories set.
1645 @n The mobile subscriber may also determine the type of barring preferrred for incoming/outgoing calls, by subscribing to a set of one or more unique barring programs .
1648 int tel_set_ss_barring (const TelSsCallBarringInfo_t *pBarringInfo, int * pRequestId);
1649 int tel_get_ss_barring_status (TelSsCallBarType_t BarType, TelSsCallType_t CallType, int * pRequestId )
1650 int tel_change_ss_barring_password ( const char* pOldPassword,const char* pNewPassword,const char * pNewPasswordAgain, int * pRequestId);
1653 SAMPLE CODE FOR CALL BARRING
1656 #include <TapiCommon.h>
1657 #include <ITapiSS.h>
1659 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1662 int ret_status = -1;
1663 TelSsCallBarringInfo_t BarringInfo;
1665 char *bar_pwd = "0000";
1667 BarringInfo.Mode = TAPI_SS_CALL_BAR_ACTIVATE;
1668 BarringInfo.Type = TAPI_CALL_BARRING_ALL_OUTGOING_CALLS;
1669 BarringInfo.CallType = TAPI_CALL_TYPE_VOICE_EV;
1670 strcpy(BarringInfo.szPassword, bar_pwd);
1672 ret_status = tel_set_ss_barring (&BarringInfo, &RequestId);
1673 if (ret_status == TAPI_API_SUCCESS) {
1674 printf("successful\n");
1677 printf("Error = %d \n", ret_status);
1680 //WAIT FOR THE EVENT HERE
1682 static void app_callback (TelTapiEvent_t *event)
1688 void* EventData = NULL;
1689 unsigned int temp_handle = -1;
1692 eventClass = event->EventClass;
1693 eventType = event->EventType;
1694 requestId = event->RequestId;
1695 status = event->Status;
1696 EventData = event->pData;
1698 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
1702 //TEST_DEBUG("******This is nonzero status. ******\n");
1708 case TAPI_EVENT_SS_BARRING_CNF:
1710 memcpy(&SsInfo, (TelSsInfo_t*)event->pData, sizeof(TelSsInfo_t));
1711 printf("Received Event :TAPI_EVENT_SS_BARRING_CNF\n");
1717 SAMPLE CODE FOR BARRING STATUS
1720 #include <TapiCommon.h>
1721 #include <ITapiSS.h>
1723 void callbarringstatus()
1725 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1727 TelSsCallBarType_t BarType = TAPI_CALL_BARRING_ALL_OUTGOING_INTERN_CALL;
1728 TelSsCallType_t CallType = TAPI_CALL_TYPE_VOICE_EV;
1731 ret_status = tel_get_ss_barring_status (BarType, CallType, &pRequestId);
1732 if (ret_status == TAPI_API_SUCCESS)
1734 printf("successful\n");
1738 printf("Error = %d \n", ret_status);
1741 //WAIT FOR THE EVENT HERE
1743 static void app_callback (TelTapiEvent_t *event)
1749 void* EventData = NULL;
1750 unsigned int temp_handle = -1;
1753 eventClass = event->EventClass;
1754 eventType = event->EventType;
1755 requestId = event->RequestId;
1756 status = event->Status;
1757 EventData = event->pData;
1761 //TEST_DEBUG("******This is nonzero status. ******\n");
1767 case TAPI_EVENT_SS_BARRING_QUERYSTATUS_CNF:
1768 printf(" Received Event :TAPI_EVENT_SS_BARRING_QUERYSTATUS_CNF \n");
1770 memcpy(&SsInfo, (TelSsInfo_t*)EventData, sizeof(TelSsInfo_t));
1772 for (i=0; i<SsInfo.NumberOfRecords; i++) {
1773 printf("Number of records %d \n", SsInfo.NumberOfRecords);
1774 printf("Record:%d Status:%d Teleservice:%d \n", i,
1775 SsInfo.SsRecord.BarringRecord.rec_class[i].Status,
1776 SsInfo.SsRecord.BarringRecord.rec_class[i].TeleCommService);
1778 if (SsInfo.SsRecord.BarringRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
1779 printf(" Status: Active \n");
1781 printf("Status: Not Active \n");
1789 SAMPLE CODE FOR CHANGING BARRING PASSWORD
1792 #include <TapiCommon.h>
1793 #include <ITapiSS.h>
1795 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1801 ret_status = tel_change_ss_barring_password ("0000", "0000", "0000", &pRequestId);
1802 if (ret_status == TAPI_API_SUCCESS)
1804 printf("successful\n");
1808 printf("Error = %d \n", ret_status);
1812 //WAIT FOR THE EVENT HERE
1814 static void app_callback (TelTapiEvent_t *event)
1820 void* EventData = NULL;
1821 unsigned int temp_handle = -1;
1824 eventClass = event->EventClass;
1825 eventType = event->EventType;
1826 requestId = event->RequestId;
1827 status = event->Status;
1828 EventData = event->pData;
1832 //TEST_DEBUG("******This is nonzero status. ******\n");
1839 case TAPI_EVENT_SS_BARRING_CHANGEPASS_CNF:
1840 printf("Received Event : TAPI_EVENT_SS_BARRING_CHANGEPASS_CNF\n");
1843 printf("Call barring Password Changed successfully\n");
1850 @defgroup Use_Cases3_3 Call Forward
1851 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
1855 <h3 class="pg">Call Forward</h3>
1856 These APIs are used to set (activate/deactivate) the call forwarding option at the Network and to get call forward status. Call forwarding allows a user to forward incoming calls to another party. This service permits a called mobile subscriber to have the network send all incoming calls, or just those associated with a specific Basic service group meeting various call FORWARD conditions, to another directory number. The ability of the served mobile subscriber to originate calls is unaffected. If the service is activated, a call is forwarded only if the enabled forward condition is satisfied.
1857 @n Application has to call this API in order to explicitly register/erase/activate/deactivate the call forwarding. Request will be sent irrespective of whether another SS call forward is already ongoing.
1860 int tel_set_ss_forward ( const TelSsForwardInfo_t *pForwardInfo, int * pRequestId);
1861 int tel_get_ss_forward_status (TelSsForwardType_t Type, TelSsForwardWhen_t Condition, int * pRequestId);
1864 SAMPLE CODE FOR CALL FORWARD
1867 #include <TapiCommon.h>
1868 #include <ITapiSS.h>
1870 //SUBSCRIBE FOR EVENTS AS MENTIONED INEvent Register and Deregister
1875 TelSsForwardInfo_t pForwardInfo;
1877 pForwardInfo.Mode = TAPI_CALL_FORWARD_MODE_ENABLE_EV;
1878 pForwardInfo.Type = TAPI_CS_FORWARD_TYPE_VOICE_EV;
1879 pForwardInfo.Condition = TAPI_SS_FORWARD_WHEN_UNCONDITIONAL_EV;
1880 pForwardInfo.NoReplyConditionTimer = 10;
1883 char *cf_number = "9986529874"; //number to which calles need to be forwarded.
1885 len = strlen(cf_number);
1886 printf("Length of CF number :%d \n", len);
1887 memcpy(&(pForwardInfo.szPhoneNumber), cf_number, len);
1889 ret_status = tel_set_ss_forward (&pForwardInfo, &pRequestId);
1890 if (ret_status == TAPI_API_SUCCESS)
1892 printf("successful\n");
1896 printf("Error = %d \n", ret_status);
1899 //WAIT FOR THE EVENT HERE
1901 static void app_callback (TelTapiEvent_t *event)
1907 void* EventData = NULL;
1908 unsigned int temp_handle = -1;
1911 eventClass = event->EventClass;
1912 eventType = event->EventType;
1913 requestId = event->RequestId;
1914 status = event->Status;
1915 EventData = event->pData;
1919 //TEST_DEBUG("******This is nonzero status. ******\n");
1923 //REFER Call Barring TO GET eventType AND EventData
1926 case TAPI_EVENT_SS_FORWARD_CNF:
1927 printf("Received Event :TAPI_EVENT_SS_FORWARD_CNF \n");
1930 if (EventData != NULL) {
1931 memcpy(&SsInfo, (TelSsInfo_t*)EventData, sizeof(TelSsInfo_t));
1932 printf("Number of records %d\n", SsInfo.NumberOfRecords);
1935 for (i=0; i<SsInfo.NumberOfRecords; i++)
1937 printf("Number of records %d\n", SsInfo.NumberOfRecords);
1938 printf("Record:%d Status:%d Teleservice:%d \n",
1940 SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status,
1941 SsInfo.SsRecord.ForwardingRecord.rec_class[i].TeleCommService);
1943 if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_REGISTERED)
1944 printf("Status: Registered \n");
1945 else if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
1946 printf("Status: Active \n");
1948 printf("Status: Not Registered /Not Active\n");
1955 SAMPLE CODE FOR CALL FORWARD STATUS
1958 #include <TapiCommon.h>
1959 #include <ITapiSS.h>
1961 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1962 void callfwdstatus()
1965 TelSsForwardType_t Type = TAPI_CS_FORWARD_TYPE_VOICE_EV;
1966 TelSsForwardWhen_t Condition = TAPI_SS_FORWARD_WHEN_UNCONDITIONAL_EV;
1969 ret_status = tel_get_ss_forward_status(Type, Condition, &pRequestId);
1970 if (ret_status == TAPI_API_SUCCESS)
1972 printf("successful\n");
1976 printf("Error = %d \n", ret_status);
1980 //WAIT FOR THE EVENT HERE
1982 static void app_callback (TelTapiEvent_t *event)
1988 void* EventData = NULL;
1989 unsigned int temp_handle = -1;
1992 eventClass = event->EventClass;
1993 eventType = event->EventType;
1994 requestId = event->RequestId;
1995 status = event->Status;
1996 EventData = event->pData;
1998 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
2002 //TEST_DEBUG("******This is nonzero status. ******\n");
2010 case TAPI_EVENT_SS_FORWARD_QUERYSTATUS_CNF:
2011 // REFER Call Barring TO GET eventType AND EventData
2014 if (EventData != NULL)
2015 memcpy(&SsInfo, (TelSsInfo_t*)EventData, sizeof(TelSsInfo_t));
2017 for (i=0; i<SsInfo.NumberOfRecords; i++)
2019 printf("Number of records %d \n",SsInfo.NumberOfRecords);
2020 printf("Record:%d Status:%d Teleservice:%d \n",
2022 SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status,
2023 SsInfo.SsRecord.ForwardingRecord.rec_class[i].TeleCommService);
2025 if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_REGISTERED)
2026 printf(" Status: Registered \n");
2027 else if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
2028 printf(" Status: Active \n");
2030 printf(" Status: Not Registered /Not Active \n");
2038 @defgroup Use_Cases3_4 Call Waiting
2039 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2043 <h3 class="pg">Call Waiting</h3>
2044 These APIs activate/deactivate the call waiting service and provide the status of call wait feature. The call waiting service permits a mobile to be notified of an incoming call (as per basic call procedures) whilst the traffic channel is not available for the incoming call or when the mobile subscriber is engaged in an active or held call. Subsequently, the subscriber can accept, reject, or ignore the incoming call.
2047 int tel_set_ss_waiting ( const TelSsWaitingInfo_t *waitInfo, int * RequestID);
2048 int tel_get_ss_waiting_status ( const TelSsCallType_t CallType, int * RequestID);
2051 SAMPLE CODE FOR CALL WAITING
2054 #include <TapiCommon.h>
2055 #include <ITapiSS.h>
2057 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2062 TelSsWaitingInfo_t waitInfo;
2064 waitInfo.Mode = TAPI_SS_CW_ACTIVATE;
2065 waitInfo.CallType = TAPI_CALL_TYPE_VOICE_EV;
2067 ret_status = tel_set_ss_waiting (&waitInfo, &RequestID);
2068 if (ret_status == TAPI_API_SUCCESS)
2070 printf("successful\n");
2074 printf("Error = %d \n", ret_status);
2077 //WAIT FOR THE EVENT HERE
2079 //CALLBACK FUNCTION TO BE USED
2080 static void app_callback (TelTapiEvent_t *event)
2086 void* EventData = NULL;
2087 unsigned int temp_handle = -1;
2090 eventClass = event->EventClass;
2091 eventType = event->EventType;
2092 requestId = event->RequestId;
2093 status = event->Status;
2094 EventData = event->pData;
2096 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
2100 //TEST_DEBUG("******This is nonzero status. ******\n");
2107 case TAPI_EVENT_SS_WAITING_CNF:
2108 printf("Received Event : TAPI_EVENT_SS_WAITING_CNF \n");
2109 //REFER Call Barring TO GET eventType AND EventData
2113 memcpy(&SsInfo, (TelSsInfo_t*)EventData, sizeof(TelSsInfo_t));
2115 for (i=0; i<SsInfo.NumberOfRecords; i++)
2117 printf("Number of records %d \n", SsInfo.NumberOfRecords);
2118 printf("Record:%d Status:%d Teleservice:%d \n",
2120 SsInfo.SsRecord.WaitingRecord.rec_class[i].Status,
2121 SsInfo.SsRecord.WaitingRecord.rec_class[i].TeleCommService);
2123 if (SsInfo.SsRecord.WaitingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
2124 printf("Status: Active \n");
2126 printf(" Status: Not Active \n");
2134 SAMPLE CODE FOR CALL WAITING STATUS
2137 #include <TapiCommon.h>
2138 #include <ITapiSS.h>
2140 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2144 TelSsCallType_t CallType = TAPI_CALL_TYPE_VOICE_EV;
2147 ret_status = tel_get_ss_waiting_status(CallType, &RequestID);
2148 if (ret_status == TAPI_API_SUCCESS)
2150 printf("successful\n");
2154 printf("Error = %d \n", ret_status);
2157 //WAIT FOR THE EVENT HERE
2159 //CALLBACK FUNCTION TO BE USED
2160 static void app_callback (TelTapiEvent_t *event)
2166 void* EventData = NULL;
2167 unsigned int temp_handle = -1;
2170 eventClass = event->EventClass;
2171 eventType = event->EventType;
2172 requestId = event->RequestId;
2173 status = event->Status;
2174 EventData = event->pData;
2176 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
2180 //TEST_DEBUG("******This is nonzero status. ******\n");
2187 case TAPI_EVENT_SS_WAITING_QUERYSTATUS_CNF:
2188 printf("Received Event :TAPI_EVENT_SS_WAITING_QUERYSTATUS_CNF\n");
2189 //REFER Call Barring TO GET eventType AND EventData
2192 if (EventData != NULL)
2193 memcpy(&SsInfo, (TelSsInfo_t*)EventData, sizeof(TelSsInfo_t));
2195 for (i=0; i<SsInfo.NumberOfRecords; i++)
2197 printf("Number of records %d \n", SsInfo.NumberOfRecords);
2198 printf("Record:%d Status:%d Teleservice:%d \n",
2200 SsInfo.SsRecord.WaitingRecord.rec_class[i].Status,
2201 SsInfo.SsRecord.WaitingRecord.rec_class[i].TeleCommService);
2203 if (SsInfo.SsRecord.WaitingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
2204 printf(" Status: Active \n");
2206 printf("Status: Not Active \n");
2214 @defgroup Use_Cases3_5 CLI Service Status
2215 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2219 <h3 class="pg">CLI Service Status</h3>
2220 <strong>[Note] Telephony Emulator does not support this feature.</strong>
2222 Telephony provides an API to query the status of calling line identity service. The CLI service permits a mobile to show or hide his identity to the called party.
2225 int tel_get_ss_cli_status (TelSsCliType_t CliType,int * pRequestId );
2231 #include <TapiCommon.h
2232 #include <ITapiSS.h>
2234 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2235 void cliservicestatus()
2238 TelSsCliType_t CliType = TAPI_SS_CLI_CDIP;
2241 ret_status = tel_get_ss_cli_status (CliType, &pRequestId);
2242 if (ret_status == TAPI_API_SUCCESS)
2244 printf("successful\n");
2248 printf("Error = %d \n", ret_status);
2251 //WAIT FOR THE EVENT HERE
2253 //CALLBACK FUNCTION TO BE USED
2254 static void app_callback (TelTapiEvent_t *event)
2260 void* EventData = NULL;
2261 unsigned int temp_handle = -1;
2264 eventClass = event->EventClass;
2265 eventType = event->EventType;
2266 requestId = event->RequestId;
2267 status = event->Status;
2268 EventData = event->pData;
2270 // TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
2274 //TEST_DEBUG("******This is nonzero status. ******\n");
2281 //REFER Call Barring TO GET eventType AND EventData
2283 case TAPI_EVENT_SS_IDENTIFY_IND:
2285 memcpy(&SsInfo, (TelSsInfo_t*)EventData, sizeof(TelSsInfo_t));
2286 printf("Received Event : TAPI_EVENT_SS_IDENTIFY_IND \n");
2287 printf("Status :%d CLI Service : %d\n",
2288 SsInfo.SsRecord.CliRecord.CliStatus,
2289 SsInfo.SsRecord.CliRecord.IdentificationType);
2296 @defgroup Use_Cases3_6 Send USSD Request
2297 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2301 <h3 class="pg">Send USSD Request </h3>
2302 This API is used to send a USSD string to the Network. This is an Asynchronous API.
2305 @n No SS and USSD Transaction should be ongoing. If there an ongoing transaction, new USSD request will be returned to the Application with an error (USSD_BUSY)
2308 int tel_send_ss_ussd_request( const char* szUssdString, int * pRequestId);
2314 #include <TapiCommon.h>
2315 #include <ITapiSS.h>
2317 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2320 char ussdString[TAPI_SS_USSD_DATA_SIZE_MAX];
2323 memset(ussdString, 0, TAPI_SS_USSD_DATA_SIZE_MAX);
2324 strcpy(ussdString, "*124#");
2326 ret = tel_send_ss_ussd_request (ussdString, &request_id);
2328 ret = tel_send_ss_ussd_request (pAppMsg, &pRequestId);
2330 //WAIT FOR THE EVENT HERE
2332 static void app_callback (TelTapiEvent_t *event)
2338 void* EventData = NULL;
2339 unsigned int temp_handle = -1;
2342 eventClass = event->EventClass;
2343 eventType = event->EventType;
2344 requestId = event->RequestId;
2345 status = event->Status;
2346 EventData = event->pData;
2348 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
2352 //TEST_DEBUG("******This is nonzero status. ******\n");
2359 case TAPI_EVENT_SS_USSD_CNF:
2360 TelSsUssdMsgIndInfo_t UssdRecord;
2361 memcpy(&UssdRecord, (TelSsInfo_t*)EventData, sizeof(TelSsUssdMsgIndInfo_t));
2362 printf("got event : TAPI_EVENT_SS_USSD_CNF:\n");
2370 @defgroup Use_Cases3_7 Send USSD Response
2371 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2375 <h3 class="pg">Send USSD Response</h3>
2376 This API is used to send a User response to the Network. This is an Asynchronous API.
2379 No SS and USSD Transaction should be ongoing. If there an ongoing transaction, new USSD request will be returned to the Application with an error (USSD_BUSY)
2381 int tel_send_ss_ussd_response( const TelSsUssdMsgRspInfo_t* ussdRspRecord, int * RequestID);
2387 #include <TapiCommon.h>
2388 #include <ITapiSS.h>
2390 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2393 char *ussd_str = "*123*0#";
2397 TelSsUssdMsgRspInfo_t *ussdRspRecord;
2399 ussdRspRecord = (TelSsUssdMsgRspInfo_t*)malloc(sizeof(TelSsUssdMsgRspInfo_t));
2400 ussdRspRecord->SsRespType = TAPI_USSD_RES_OK;
2401 ussdRspRecord->IndType = TAPI_USSD_IND_NOTIFY;
2402 ussdRspRecord->UssdInfo.Dcs = 0x0f;
2403 ussdRspRecord->UssdInfo.RequestedBySAT = 0;
2404 strncpy(ussdRspRecord->UssdInfo.szUssdString, ussd_str, TAPI_SS_USSD_DATA_SIZE_MAX);
2405 ussdRspRecord->UssdInfo.szUssdString[strlen(ussdRspRecord->UssdInfo.szUssdString)] = '\0';
2406 ussdRspRecord->UssdInfo.UssdStringLength = strlen(ussd_str);
2408 ret = tel_send_ss_ussd_response (ussdRspRecord, &pRequestId);
2409 printf ("The return value is %d\n", ret);
2411 //WAIT FOR THE EVENT HERE
2413 static void app_callback (TelTapiEvent_t *event)
2419 void* EventData = NULL;
2420 unsigned int temp_handle = -1;
2423 eventClass = event->EventClass;
2424 eventType = event->EventType;
2425 requestId = event->RequestId;
2426 status = event->Status;
2427 EventData = event->pData;
2429 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
2433 //TEST_DEBUG("******This is nonzero status. ******\n");
2440 case TAPI_EVENT_SS_USSD_CNF:
2441 TelSsUssdMsgIndInfo_t UssdRecord;
2442 memcpy(&UssdRecord, (TelSsInfo_t*)EventData, sizeof(TelSsUssdMsgIndInfo_t));
2443 printf("got event : TAPI_EVENT_SS_USSD_CNF:\n");
2451 @defgroup Use_Cases3_8 Send USSD Cancel Request
2452 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2456 <h3 class="pg">Send USSD Cancel Request </h3>
2457 This API sends a USSD cancel request to the Network to release USSD session.
2460 @n SS and USSD Transaction should be ongoing.
2463 int tel_send_ss_ussd_cancel ( int * pRequestId);
2469 #include <TapiCommon.h>
2470 #include <ITapiSS.h>
2472 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2473 void sendussdcancelreq()
2475 char ussdString[TAPI_SS_USSD_DATA_SIZE_MAX];
2479 memset(ussdString, 0, TAPI_SS_USSD_DATA_SIZE_MAX);
2480 strcpy(ussdString, "*124#");
2482 ret = tel_send_ss_ussd_request(ussdString, &requestId);
2483 printf ("The return value is %d\n", ret);
2485 ret = tel_send_ss_ussd_cancel(&equestId);
2486 printf ("The return value is %d\n", ret);
2489 //WAIT FOR THE EVENTS HERE
2491 static void app_callback (TelTapiEvent_t *event)
2497 void* EventData = NULL;
2498 unsigned int temp_handle = -1;
2501 eventClass = event->EventClass;
2502 eventType = event->EventType;
2503 requestId = event->RequestId;
2504 status = event->Status;
2505 EventData = event->pData;
2507 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
2511 //TEST_DEBUG("******This is nonzero status. ******\n");
2518 case TAPI_EVENT_SS_USSD_CNF:
2519 printf("got event : TAPI_EVENT_SS_USSD_CNF:\n");
2523 case TAPI_EVENT_SS_USSD_CANCEL_CNF:
2524 printf("got event : TAPI_EVENT_SS_USSD_CANCEL_CNF:\n");
2533 @defgroup Use_Cases3_9 AOC Info
2534 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2538 <h3 class="pg">AOC Info</h3>
2539 These APIs set and read AOC parameter values on the SIM.
2542 @n Advice of charge feature is dependent on the SIM for setting or reading aoc parameters. Setting of AOC requires PIN2 Verification
2545 int tel_get_ss_aoc_info ( TelSsAocType_t AocType, int * pRequestId);
2546 int tel_set_ss_aoc_info ( TelCallAocInfo_t * pAocSetInfo, int * pRequestId);
2552 #include <TapiCommon.h>
2553 #include <ITapiSS.h>
2555 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2557 //Complete PIN2verification process as mentioned in SIM
2561 printf(" Resetting Total Cost \n");
2563 TelCallAocInfo_t *pAocSetInfo;
2567 pAocSetInfo = (TelCallAocInfo_t *)calloc(1, sizeof(TelCallAocInfo_t));
2568 pAocSetInfo->AocType = TAPI_SS_AOC_TYPE_RESET;
2570 ret = tel_set_ss_aoc_info (pAocSetInfo, &request_id);
2571 if (ret_status == TAPI_API_SUCCESS)
2573 printf("successful\n");
2577 printf("Error = %d \n", ret_status);
2581 //WAIT FOR THE EVENT HERE
2582 static void app_callback (TelTapiEvent_t *event)
2588 void* EventData = NULL;
2589 unsigned int temp_handle = -1;
2592 eventClass = event->EventClass;
2593 eventType = event->EventType;
2594 requestId = event->RequestId;
2595 status = event->Status;
2596 EventData = event->pData;
2598 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
2602 //TEST_DEBUG("******This is nonzero status. ******\n");
2607 case TAPI_EVENT_SS_SET_AOC_CNF:
2608 printf("Received Event : SS -- TAPI_EVENT_SS_SET_AOC_CNF\n");
2616 TelSsAocType_t AocType = TAPI_SS_AOC_TYPE_ACM;
2618 ret_status = tel_get_ss_aoc_info (AocType, &pRequestId);
2619 if (ret_status == TAPI_API_SUCCESS)
2621 printf("successful\n");
2625 printf("Error = %d \n", ret_status);
2628 //WAIT FOR THE EVENT HERE
2630 static void app_callback (TelTapiEvent_t *event)
2636 void* EventData = NULL;
2637 unsigned int temp_handle = -1;
2639 eventClass = event->EventClass;
2640 eventType = event->EventType;
2641 requestId = event->RequestId;
2642 status = event->Status;
2643 EventData = event->pData;
2645 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
2649 //TEST_DEBUG("******This is nonzero status. ******\n");
2655 case TAPI_EVENT_SS_AOC_RSP:
2656 TelCallAocInfo_t aoc_info;
2657 memcpy(&aoc_info, (TelCallAocInfo_t*)EventData, sizeof(TelCallAocInfo_t));
2658 printf("Received Event : SS -- TAPI_EVENT_SS_AOC_RSP\n");
2659 printf(" AOC TYPE :%d\n", aoc_info.AocType);
2667 <h2 class="pg">SMS</h2>
2669 @defgroup Use_Cases4_1 Event register and deregister
2670 @ingroup Use_Cases4_SMS
2673 <h3 class="pg">Event register and deregister</h3>
2674 To receive asynchronous event notifications for the SMS APIs, the registration of related events with their associated call backs is required. When an asynchronous API is called, the confirmation is returned as an asynchronous event notification which invokes the callback function along with the event data.
2675 @nSMS in the telephony framework only provides an interface to the modem and doesn’t handle Transport layer, storing and deleting the SMS in the storage except SIM. Because of this we recommend you shouldn’t access this API directly, and should use the MAPI of Message Framework instead.
2677 Notification Events are as follows.
2679 TAPI_EVENT_NETTEXT_INCOM_IND
2680 TAPI_EVENT_NETTEXT_CB_INCOM_IND
2681 TAPI_EVENT_NETTEXT_INCOM_EX_IND
2682 TAPI_EVENT_NETTEXT_CB_INCOM_EX_IND
2683 TAPI_EVENT_NETTEXT_MEMORY_STATUS_IND
2684 TAPI_EVENT_NETTEXT_DEVICE_READY_IND
2690 unsigned int subscription_id = 0;
2693 api_err = tel_init();
2694 if (api_err != TAPI_API_SUCCESS)
2696 TEST_DEBUG("tel_init Failed - api_err = %d \n", api_err);
2698 api_err = tel_register_event(TAPI_EVENT_NETTEXT_SENTSTATUS_CNF, &subscription_id, (TelAppCallback)&app_callback);
2699 printf("Nettext Class registration is Done: sub id is %d, api_err is %d\n", subscription_id, api_err);
2701 tel_register_app_name("com.samsung.appname");
2704 api_err = tel_deregister_event(subscription_id);
2705 if (api_err != TAPI_API_SUCCESS)
2707 printf("Event Class Unregistration Fail\n");
2710 // SMS notification callback function
2711 void app_callback(void)
2717 void *EventData = NULL;
2719 eventClass = event->EventClass;
2720 eventType = event->EventType;
2721 requestId = event->RequestId;
2722 status = event->Status;
2723 EventData = event->pData;
2725 printf(" app _callback is called \n");
2727 print_events((int)eventType);
2728 printf("\n event came in power_callback [%d] \n", eventType);
2729 printf("\n expected event is in callback [%d] \n", expected_event);
2733 case TAPI_EVENT_NETTEXT_INCOM_IND:
2734 TelSmsDatapackageInfo_t *ptrDataPackage;
2735 printf("SMS Incoming Message\n");
2736 ptrDataPackage = (TelSmsDatapackageInfo_t *)EventData;
2737 // Decoding Service Center Address
2738 // Decoding TPDU(SMS-DELIVER, SMS-STATUS)
2741 case TAPI_EVENT_NETTEXT_CB_INCOM_IND:
2742 TelSmsCbMsg_t *ptrCbMsgInfo;
2743 printf("SMS Cell Broadcasting Incoming Message\n");
2744 ptrCbMsgInfo = (TelSmsCbMsg_t *)EventData;
2745 // Decoding Cell broadcasting Message in szData [Refer to 3GPP TS23.041 9.4.1]
2748 case TAPI_EVENT_NETTEXT_INCOM_EX_IND:
2749 TelSmsMsgInfo_t *pMsgInfo;
2750 printf("CDMA SMS Incoming Message\n");
2751 pMsgInfo = (TelSmsMsgInfo_t *)EventData;
2752 // Decoding TPDU(SMS-DELIVER, SMS-STATUS)
2755 case TAPI_EVENT_NETTEXT_CB_INCOM_EX_IND:
2756 TelSmsMsgInfo_t *pMsgInfo = NULL;
2757 printf("CDMA SMS Incoming Message\n");
2758 pMsgInfo = (TelSmsMsgInfo_t *)EventData;
2759 // Decoding Cell broadcasting Message in szData
2762 case TAPI_EVENT_NETTEXT_MEMORY_STATUS_IND:
2764 printf("SIM Memory Status Notification\n");
2765 status = (TelSmsMemStatusType *)EventData;
2766 if (*status == TAPI_NETTEXT_PHONE_MEMORY_STATUS_AVAILABLE)
2767 printf("SIM Memory Available\n");
2768 else if (*status == TAPI_NETTEXT_PHONE_MEMORY_STATUS_FULL)
2769 printf("SIM Memory Full\n");
2771 printf("Unknown Type\n");
2774 case TAPI_EVENT_NETTEXT_DEVICE_READY_IND:
2775 int *pDeviceReady = NULL;
2776 printf("SMS Device Ready Status Notification\n");
2777 pDeviceReady = (int*)EventData;
2778 if (pDeviceReady->Result == 1)
2779 printf("Device Ready\n");
2781 printf("Unknown Type\n");
2788 @defgroup Use_Cases4_2 Send SMS
2789 @ingroup Use_Cases4_SMS
2793 <h3 class="pg">Send SMS</h3>
2794 Telephony provides an API to send an SMS to the network. This API allows the transmission of an SMS PDU as defined by 3GPP TS 23.040 (SMS-SUBMIT, SMS-COMMAND) to the lower layers. If there is a need to send multiple parts of a concatenated message, this API requests for a dedicated link, through the input parameter MoreMessageToSend, from the lower layers. This will ensure the lower layers do not release the dedicated connection if there are more messages expected.
2797 int tel_send_sms (const TelSmsDatapackageInfo_t* pDataPackage, int bMoreMsgToSend, int *pRequestId);
2800 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
2806 #include <TapiCommon.h>
2807 #include <ITapiNetText.h>
2811 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2812 TelSmsDatapackageInfo_t *pDataPackage;
2816 pDataPackage = (TelSmsDatapackageInfo_t *)malloc(sizeof(TelSmsDatapackageInfo_t));
2818 //fill the structure appropriately
2819 //Sca parameter is optional. If you don't provide Service center address, you should fill "00" in sca array.
2820 //MsgLength is length of szData//fill the szData in TelSmsDatapackageInfo_t with SMS-SUBMIT or SMS-COMMAND TPDU.
2822 ret_status = tel_send_sms (pDataPackage, 0, &pRequestId);
2823 if (ret_status == TAPI_API_SUCCESS)
2825 printf("successful\n");
2829 printf("error = %d\n", ret_status);
2831 //WAIT FOR THE EVENT HERE
2834 static void app_callback (TelTapiEvent_t* event)
2840 void* EventData = NULL;
2843 eventClass = event->EventClass;
2844 eventType = event->EventType;
2845 requestId = event->RequestId;
2846 status = event->Status;
2847 EventData = event->pData;
2849 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
2853 //TEST_DEBUG("******This is nonzero status. ******\n");
2857 switch (eventType) {
2858 case TAPI_EVENT_NETTEXT_SENTSTATUS_CNF:
2859 printf("\n***************************************\n");
2860 printf("\n$$$ TAPI_EVENT_NETTEXT_SENTSTATUS_CNF $$$\n");
2861 // Extract the Event Data here
2869 @defgroup Use_Cases4_3 Send SMS Message
2870 @ingroup Use_Cases4_SMS
2874 <h3 class="pg">Send SMS Message</h3>
2875 This API is used to send an SMS message to the network. This API allows the transmission of an SMS PDU as defined by 3GPP2 C.S0015 (SMS-SUBMIT, SMS-ACK, SMS-CANCEL) to the lower layers. If there is a need to send multiple parts of a concatenated message, this API requests for a dedicated link, through the input parameter MoreMessageToSend, from the lower layers. This will ensure the lower layers do not release the dedicated connection if there are more messages expected. This is currently supported in CDMA.
2878 int tel_send_sms_msg (const TelSmsMsgInfo_t* pSmsMsgInfo,unsigned int MoreMsgToSend, int *pRequestId);
2881 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
2887 #include <TapiCommon.h>
2888 #include <ITapiNetText.h>
2892 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2895 TelSmsMsgInfo_t pMsgInfo;
2898 TelSmsMsgInfo_t *pDataPackage = malloc(sizeof(TelSmsMsgInfo_t));
2900 memset(pDataPackage, 0, sizeof(TelSmsMsgInfo_t));
2901 pDataPackage->MsgType = TAPI_NETTEXT_MESSAGETYPE_SUBMIT;
2902 pDataPackage->ParamMask |= TAPI_NETTEXT_PARAM_TELESERVICE_MASK;
2903 //fill structure appropriately
2905 ret_status = tel_send_sms_msg (pDataPackage, 0, &requestId);
2906 if (ret_status == TAPI_API_SUCCESS)
2908 printf("successful\n");
2912 printf("error = %d\n", ret_status);
2915 //WAIT FOR EVENT HERE
2916 //CALLBACK FUNTION TO BE USED
2917 static void app_callback (TelTapiEvent_t *event)
2923 void* EventData = NULL;
2926 eventClass = event->EventClass;
2927 eventType = event->EventType;
2928 requestId = event->RequestId;
2929 status = event->Status;
2930 EventData = event->pData;
2932 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
2936 //TEST_DEBUG("******This is nonzero status. ******\n");
2940 switch (eventType) {
2941 case TAPI_EVENT_NETTEXT_SENTSTATUS_EX_CNF:
2942 printf("\n***************************************\n");
2943 printf("\n$$$ TAPI_EVENT_NETTEXT_SENTSTATUS_EX_CNF $$$\n");
2950 @defgroup Use_Cases4_4 Read SMS
2951 @ingroup Use_Cases4_SMS
2955 <h3 class="pg">Read SMS</h3>
2956 This API reads a message from SIM card storage. You should not access this API directly; instead use the Message Framework API.
2959 int tel_read_sms_in_sim(int Index, int *pRequestId);
2962 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
2968 #include <TapiCommon.h>
2969 #include <ITapiNetText.h>
2973 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2977 ret_status = tel_read_sms_in_sim(0, &pRequestId);
2978 if (ret_status == TAPI_API_SUCCESS)
2980 printf("successful\n");
2984 printf("Error = %d \n", ret_status);
2986 //WAIT FOR EVENT HERE
2989 static void app_callback (TelTapiEvent_t *event)
2995 void* EventData = NULL;
2998 eventClass = event->EventClass;
2999 eventType = event->EventType;
3000 requestId = event->RequestId;
3001 status = event->Status;
3002 EventData = event->pData;
3004 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3008 //TEST_DEBUG("******This is nonzero status. ******\n");
3013 switch (eventType) //REFER Send SMS TO GET eventType
3015 case TAPI_EVENT_NETTEXT_READ_SMS_CNF:
3016 TelSmsData_t *pReadData;
3017 printf("\n$$Read Msg Notification $$$\n");
3018 pReadData = (TelSmsData_t *) event->pData;
3019 printf("\n$$Read Msg index = [%d] $$$\n", pReadData->SimIndex);
3020 printf("\n$$Read Msg status = [%d] $$$\n", pReadData->MsgStatus);
3022 // pReadData->SmsData.szData
3030 @defgroup Use_Cases4_5 Write Sms
3031 @ingroup Use_Cases4_SMS
3035 <h3 class="pg">Write Sms</h3>
3036 This API writes a message to SIM storage area.
3037 @n The parameter of this API is changed into TelSmsData_t.
3038 @n If SIM index in TelSmsData_t is -1, SMS message is stored at the first empty SIM index . The contents of szData is SMS-SUBMIT, SMS-DELIVER or SMS-STATUS REPORT TPDU. You should not access this API directly; use the Message Framework API.
3041 int tel_write_sms_in_sim(const TelSmsData_t *pWriteData, int *pRequestId);
3044 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
3050 #include <TapiCommon.h>
3051 #include <ITapiNetText.h>
3055 // SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3057 TelSmsData_t *pWriteData;
3059 char *msg = "This is an Test SMS";
3060 char *SCA = "821091";
3062 pWriteData = malloc(sizeof(TelSmsData_t));
3063 if (pWriteData == NULL) {
3064 printf("Memory Allocation fails\n");
3068 // conv_service_center_address(pWriteData->SmsData.Sca, SCA);
3069 // conv_msg_into_tpdu(pWriteData->SmsData.szData, pWriteData->SmsData.MsgLength, msg);
3070 pWrite->MsgStatus = TAPI_NETTEXT_STATUS_READ;
3071 pWrite-> SimIndex = -1;
3073 ret_status = tel_write_sms_in_sim (pWriteData, &pRequestId);
3074 if (ret_status == TAPI_API_SUCCESS)
3076 printf("successful\n");
3080 printf("error = %d\n", ret_status);
3082 //WAIT FOR EVENT HERE
3084 static void app_callback (TelTapiEvent_t *event)
3090 void* EventData = NULL;
3093 eventClass = event->EventClass;
3094 eventType = event->EventType;
3095 requestId = event->RequestId;
3096 status = event->Status;
3097 EventData = event->pData;
3099 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3103 //TEST_DEBUG("******This is nonzero status. ******\n");
3107 switch (eventType) //REFER Send SMS TO GET eventType
3109 case TAPI_EVENT_NETTEXT_SAVE_STATUS_CNF:
3110 int *SimIndex = NULL;
3111 printf("\n***************************************\n");
3112 printf("\n$$Save Status Notification$$\n");
3113 SimIndex = (int *)EventData;
3114 printf("SIM Index stored SMS is [%d]\n", *SimIndex);
3121 @defgroup Use_Cases4_6 Delete Sms
3122 @ingroup Use_Cases4_SMS
3126 <h3 class="pg">Delete Sms</h3>
3127 This API deletes a message specified by the index (SIM index used when storing the sms) number or all the messages in the SIM storage area. If SIM index is -1, all SMS stored in SIM are deleted. You should not access this API directly; use the Message Framework API.
3130 int tel_delete_sms_in_sim(int Index, int *pRequestId);
3133 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
3139 #include <TapiCommon.h>
3140 #include <ITapiNetText.h>
3144 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3148 ret_status = tel_delete_sms_in_sim(1, &pRequestId);
3149 if (ret_status == TAPI_API_SUCCESS)
3151 printf("successful\n");
3155 printf("error = %d\n", ret_status);
3157 //WAIT FOR EVENT HERE
3159 static void app_callback (TelTapiEvent_t *event)
3165 void* EventData = NULL;
3168 eventClass = event->EventClass;
3169 eventType = event->EventType;
3170 requestId = event->RequestId;
3171 status = event->Status;
3172 EventData = event->pData;
3174 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3178 //TEST_DEBUG("******This is nonzero status. ******\n");
3182 switch (eventType) //REFER Send SMS TO GET eventType
3184 case TAPI_EVENT_NETTEXT_DELETE_STATUS_CNF:
3185 printf("\n***************************************\n");
3186 printf("\n$$Delete Notification$$$\n");
3193 @defgroup Use_Cases4_7 Getting Sms Count
3194 @ingroup Use_Cases4_SMS
3198 <h3 class="pg">Getting Sms Count</h3>
3199 This API is used to retrieve message count information such as Total record count, used record count and the indices list for SIM Storage. You should not access this API directly; use the Message Framework API.
3202 int tel_get_sms_count (int *pRequestId);
3205 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
3211 #include <TapiCommon.h>
3212 #include <ITapiNetText.h>
3216 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3220 ret_status = tel_get_sms_count (&pRequestId);
3221 if (ret_status == TAPI_API_SUCCESS)
3223 printf("successful\n");
3227 printf("error = %d\n", ret_status);
3229 //WAIT FOR EVENT HERE
3231 static void app_callback (TelTapiEvent_t *event)
3237 void* EventData = NULL;
3240 eventClass = event->EventClass;
3241 eventType = event->EventType;
3242 requestId = event->RequestId;
3243 status = event->Status;
3244 EventData = event->pData;
3246 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3250 //TEST_DEBUG("******This is nonzero status. ******\n");
3254 switch (eventType) //REFER Send SMS TO GET eventType
3256 case TAPI_EVENT_NETTEXT_GET_COUNT_CNF:
3257 printf("\n***************************************\n");
3258 printf("\n$$$GetMsgCountNotification$$$$\n");
3259 MsgCountNotification(tapiEvent.pData);
3264 void MsgCountNotification (char *pData)
3266 static TelSmsStoredMsgCountInfo_t *countInfo;
3267 int loop_counter = 0;
3269 countInfo = (TelSmsStoredMsgCountInfo_t *)pData;
3272 if (countInfo->UsedCount != 0x00)
3274 fprintf(stderr, "Index LIST..........\n");
3275 for (loop_counter = 0; loop_counter < countInfo->UsedCount; loop_counter++)
3277 fprintf(stderr, "[%02x]", countInfo->IndexList[loop_counter]);
3278 returnStatus = tel_read_sms_in_sim (countInfo->IndexList[loop_counter], &requestId);
3279 printf("After read msg: returnstatus %d request id is %d\n", returnStatus, requestId);
3281 printf("In MsgCountNotification total cnt is %d, usedcnt is %dapi_err %d\n",
3282 countInfo->TotalCount,
3283 countInfo->UsedCount,
3287 printf("In MsgCountNotification total cnt is %d, usedcnt is %d\n", countInfo->TotalCount, countInfo->UsedCount);
3291 @defgroup Use_Cases4_8 Setting Sms CB message
3292 @ingroup Use_Cases4_SMS
3296 <h3 class="pg">Setting Sms CB message</h3>
3297 <strong>[Note] Telephony Emulator does not support this feature.</strong>
3298 @n This API is used to set the SMS CB Message Identifiers in the appropriate EF-CBMI/EF-CBMIR file in (U)SIM. This API also indicates the underlying provider to enable or disable CB Channel on which CB messages are received. You should not access this API directly; use the Message Framework API.
3301 int tel_set_sms_cb_config(const TelSmsCbConfig_t *pCBConfig, int *pRequestId);
3304 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
3310 #include <TapiCommon.h>
3311 #include <ITapiNetText.h>
3315 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3318 TelSmsCbConfig_t *pCBConfig = NULL;
3320 pCBConfig = (TelSmsCbConfig_t *)malloc(sizeof(TelSmsCbConfig_t));
3321 pCBConfig->bCBEnabled = 1;
3322 pCBConfig->SelectedId = 0x01;
3323 pCBConfig->MsgIdCount = 0x02;
3325 pCBConfig->MsgIDs[0] = 0x0c;
3326 pCBConfig->MsgIDs[1] = 0x0c;
3327 pCBConfig->MsgIDs[2] = 0xdf;
3328 pCBConfig->MsgIDs[3] = 0x00;
3330 ret_status = tel_set_sms_cb_config(pCBConfig, &pRequestId);
3331 if (ret_status == TAPI_API_SUCCESS)
3333 printf("successful\n");
3337 printf("error = %d\n", ret_status);
3339 //WAIT FOR EVENT HERE
3342 //CALLBACK FUNCTION TO BE USED
3343 static void app_callback (TelTapiEvent_t *event)
3349 void* EventData = NULL;
3352 eventClass = event->EventClass;
3353 eventType = event->EventType;
3354 requestId = event->RequestId;
3355 status = event->Status;
3356 EventData = event->pData;
3358 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3362 //TEST_DEBUG("******This is nonzero status. ******\n");
3366 switch (eventType) //REFER Send SMS TO GET eventType
3368 case TAPI_EVENT_NETTEXT_SET_REQUEST_CNF:
3369 TelSmsSetResponse *RequestType;
3370 printf("\n***************************************\n");
3371 printf("\n$$$$$$ SET CONFIRMATION $$$$$$ \n");
3372 RequestType = (TelSmsSetResponse *)EventData;
3373 if (*RequestType == TAPI_NETTEXT_CBSETCONFIG_RSP) {
3374 printf("\n$$$$$$ SET CB CONFIRMATION $$$$$$ \n");
3381 @defgroup Use_Cases4_9 Getting Sms CB configuration
3382 @ingroup Use_Cases4_SMS
3386 <h3 class="pg">Getting Sms CB configuration</h3>
3387 <strong>[Note] Telephony Emulator does not support this feature.</strong>
3388 @n This API is used to retrieve SMS CB configuration options from EFcbmi file in the SIM. You should not access this API directly; use the Message Framework API.
3391 TapiResult_t tel_get_sms_cb_config (int *pRequestId);
3394 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
3401 #include <TapiCommon.h>
3402 #include <ITapiNetText.h>
3409 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3410 ret_status = tel_get_sms_cb_config (&pRequestId);
3412 printf ("The return value is %d\n", ret_status);
3413 if (ret_status == TAPI_API_SUCCESS)
3415 printf("successful\n");
3419 printf("error = %d\n", ret_status);
3421 //WAIT FOR EVENT HERE
3423 static void app_callback (TelTapiEvent_t *event)
3429 void* EventData = NULL;
3432 eventClass = event->EventClass;
3433 eventType = event->EventType;
3434 requestId = event->RequestId;
3435 status = event->Status;
3436 EventData = event->pData;
3438 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3442 //TEST_DEBUG("******This is nonzero status. ******\n");
3446 switch (eventType) //REFER Send SMS TO GET eventType
3448 case TAPI_EVENT_NETTEXT_GET_CB_CONFIG_CNF:
3449 printf("\n***************************************\n");
3450 printf("\n$$$GET CB Config$$$\n");
3451 GetCBNotification(tapiEvent.pData);
3457 void GetCBNotification (char *pData)
3459 TelSmsCbConfig_t *CBConfig;
3462 CBConfig = (TelSmsCbConfig_t *) pData;
3463 printf("=========CB Configuration=========\n");
3466 if (CBConfig->bCBEnabled == 0x01)
3467 printf("Cell Broadcast Msg Enabled...\n");
3468 else if (CBConfig->bCBEnabled == 0x02)
3469 printf("Cell Broadcast Msg Disabled...\n");
3472 if (CBConfig->SelectedId == 0x01)
3473 printf("All CBMI is selected... \n");
3474 else if (CBConfig->SelectedId == 0x02)
3475 printf("There are some selected CBMI...\n");
3478 printf("CBMI Count: %d \n\n", CBConfig->MsgIdCount);
3480 if (CBConfig->MsgIdCount != 0)
3482 printf("----- CBMI List -----\n");
3483 for (i=0; i < CBConfig->MsgIdCount; i++)
3485 printf("No.%d - [0x%04x]\n", i, CBConfig->MsgIDs[i]);
3492 @defgroup Use_Cases4_10 Service Center Address
3493 @ingroup Use_Cases4_SMS
3497 <h3 class="pg">Service Center Address</h3>
3498 This API sets the SMS Service Centre Address information in order to send the SMS.
3499 @n It is also possible to get current SMS Service Centre Address information. Currently Only index 0 is supported in Aquila’s Telephony OEM Plugin. You should not access this API directly; use the Message Framework API.
3502 int tel_set_sms_sca(const TelSmsAddressInfo_t *pSCA, int Index, int *pRequestId);
3503 int tel_get_sms_sca (int Index, int *pRequestId)
3506 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
3512 #include <TapiCommon.h>
3513 #include <ITapiNetText.h>
3518 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3522 char scaNum[TAPI_NETTEXT_SCADDRESS_LEN_MAX];
3523 BYTE scaNum_len = 0;
3524 TelSmsAddressInfo_t *sc_addr = NULL;
3529 printf("***Setting the SCA(Api:SetSCA)****\n");
3530 sc_addr = (TelSmsAddressInfo_t *)malloc(sizeof(TelSmsAddressInfo_t));
3531 memset(sc_addr, 0, sizeof(sc_addr));
3532 memset(scaNum, 0, sizeof(scaNum));
3533 memset(scabuf, 0, sizeof(scabuf));
3534 sprintf(scaNum, "821091");
3535 scaNum_len = strlen(scaNum);
3536 scaNum_len = strlen(scaNum);
3537 scaNum[scaNum_len] = 0;
3538 scaNum_len = scaNum_len - 1;
3540 printf("==========================\n");
3541 printf("Sca Number :%s\n", scaNum);
3542 printf("sca number length : %d \n", scaNum_len);
3543 printf("==========================\n");
3545 //idx = SmsUtilEncodeAddrField( packet, scaNum, scaNum_len, 0x01, 0x01);
3547 printf("idx =%d\n", idx);
3548 sc_addr->DialNumLen = idx ;
3549 memcpy(sc_addr->szDiallingNum, packet, (unsigned int)idx);
3551 ret_status = tel_set_sms_sca(sc_addr, 0, &pRequestId);
3552 //[Note] Telephony Emulator Not Support
3554 printf("returnstatus after scaddr set is %d requestId:%d \n", ret_status, pRequestId);
3555 if (ret_status == TAPI_API_SUCCESS)
3557 printf("successful\n");
3561 printf("error = %d\n", ret_status);
3563 //WAIT FOR EVENT HERE
3566 static void app_callback (TelTapiEvent_t *event)
3572 void* EventData = NULL;
3575 eventClass = event->EventClass;
3576 eventType = event->EventType;
3577 requestId = event->RequestId;
3578 status = event->Status;
3579 EventData = event->pData;
3581 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3585 //TEST_DEBUG("******This is nonzero status. ******\n");
3589 switch (eventType) //REFER Send SMS TO GET eventType
3591 case TAPI_EVENT_NETTEXT_SET_REQUEST_CNF:
3592 TelSmsSetResponse *RequestType;
3593 printf("\n***************************************\n");
3594 RequestType = (TelSmsSetResponse *)EventData;
3595 if (*RequestType == TAPI_NETTEXT_SETSCADDR_RSP) {
3596 printf("\n$$$TAPI_EVENT_NETTEXT_SET_SCA_CNF$$$\n");
3597 // service center address decoding
3607 #include <TapiCommon.h>
3608 #include <ITapiNetText.h>
3615 ret_status = tel_get_sms_sca(0, &pRequestId);
3616 if (ret_status == TAPI_API_SUCCESS)
3618 printf("successful\n");
3622 printf("error = %d\n", ret_status);
3625 //WAIT FOR EVENT HERE
3628 static void app_callback (TelTapiEvent_t *event)
3634 void* EventData = NULL;
3635 unsigned int temp_handle = -1;
3638 eventClass = event->EventClass;
3639 eventType = event->EventType;
3640 requestId = event->RequestId;
3641 status = event->Status;
3642 EventData = event->pData;
3644 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3648 //TEST_DEBUG("******This is nonzero status. ******\n");
3653 switch (eventType) //REFER Send SMS TO GET eventType
3655 case TAPI_EVENT_NETTEXT_GET_SCA_CNF:
3656 printf("\n****************************************\n");
3657 printf("\n$$$ TAPI_EVENT_NETTEXT_GET_SCA_CNF$$$\n");
3658 // SCA address decoding
3659 printf("\n****************************************\n");
3666 @defgroup Use_Cases4_11 Sms Preferred Bearer
3667 @ingroup Use_Cases4_SMS
3671 <h3 class="pg">Sms Preferred Bearer</h3>
3672 <strong>[Note] Telephony Emulator and Aquila’s Telephony OEM Plugin do not support this feature.</strong>
3673 @n Telephony provides APIs to set SMS preferred bearer on which SMS has to be transmitted. You should not access this API directly; use the Message Framework API.
3676 int tel_set_sms_preferred_bearer (TelSmsBearerType_t BearerType, int *pRequestId);
3677 int tel_get_sms_preferred_bearer(int *pRequestId);
3680 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
3686 #include <TapiCommon.h>
3687 #include <ITapiNetText.h>
3691 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3694 TelSmsBearerType_t BearerType = TAPI_NETTEXT_BEARER_PS_ONLY;
3696 ret_status = tel_set_sms_preferred_bearer(BearerType, &pRequestId);
3697 if (ret_status == TAPI_API_SUCCESS)
3699 printf("successful\n");
3703 printf("error = %d\n", ret_status);
3705 //WAIT FOR EVENT HERE
3707 static void app_callback (TelTapiEvent_t *event)
3713 void* EventData = NULL;
3716 eventClass = event->EventClass;
3717 eventType = event->EventType;
3718 requestId = event->RequestId;
3719 status = event->Status;
3720 EventData = event->pData;
3722 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3726 //TEST_DEBUG("******This is nonzero status. ******\n");
3731 switch (eventType) //REFER Send SMS TO GET eventType
3733 case TAPI_EVENT_NETTEXT_SET_REQUEST_CNF:
3734 TelSmsSetResponse *RequestType;
3735 RequestType = (TelSmsSetResponse *)EventData;
3736 if (*RequestType == TAPI_NETTEXT_SETPREFERREDBEARER_RSP) {
3737 printf("\n$$$TAPI_EVENT_NETTEXT_SET_Preferred Bearer_CNF$$$\n");
3744 //get preferred bearer
3747 #include <TapiCommon.h>
3748 #include <ITapiNetText.h>
3754 ret_status = tel_get_sms_preferred_bearer(&pRequestId);
3755 if (ret_status == TAPI_API_SUCCESS)
3757 printf("successful\n");
3761 printf("error = %d\n", ret_status);
3763 //WAIT FOR EVENT HERE
3766 static void app_callback (TelTapiEvent_t *event)
3772 void* EventData = NULL;
3775 eventClass = event->EventClass;
3776 eventType = event->EventType;
3777 requestId = event->RequestId;
3778 status = event->Status;
3779 EventData = event->pData;
3781 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3785 //TEST_DEBUG("******This is nonzero status. ******\n");
3791 switch (eventType) //REFER Send SMS TO GET eventType
3793 case TAPI_EVENT_NETTEXT_GET_SMSBEARER_CNF:
3794 printf("\n****************************************\n");
3795 printf("\n$$$ GET PREFERRED BEARER$$$\n");
3796 printf("\n****************************************\n");
3803 @defgroup Use_Cases4_12 Sms Parameters
3804 @ingroup Use_Cases4_SMS
3808 <h3 class="pg">Sms Parameters</h3>
3809 <strong>[Note] Telephony Emulator does not support this feature.</strong>
3810 @n Telephony provides APIs to set the header parameters of SMS, which are used in the origination of MO messages. It also provides API to get the SMS parameters for a particular SMS (sent/received) based on the SIM index where it is stored. You should not access this API directly; use the Message Framework API.
3813 int tel_set_sms_parameters(const TelSmsParams_t SmsSetParameters, int *pRequestId);
3814 int tel_get_sms_parameters(const int SmsRecordIndex, int *pRequestId);
3817 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
3823 #include <TapiCommon.h>
3824 #include <ITapiNetText.h>
3828 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3831 TelSmsParams_t SmsSetParameters;
3833 SmsSetParameters.RecordIndex = 0x01;
3834 SmsSetParameters.RecordLen = 28;
3835 memcpy(SmsSetParameters.TpDestAddr.szDiallingNum, "9986529874", 10);
3836 printf("\ndial no is %s\n", SmsSetParameters.TpDestAddr.szDiallingNum);
3838 SmsSetParameters.TpDestAddr.DialNumLen = 10;
3839 SmsSetParameters.TpDestAddr.Ton = TAPI_SIM_TON_NATIONAL;//national no
3840 SmsSetParameters.TpDestAddr.Npi = TAPI_SIM_NPI_NATIONAL;
3842 ret_status = tel_set_sms_parameters(SmsSetParameters, &pRequestId);
3843 if (ret_status == TAPI_API_SUCCESS)
3845 printf("successful\n");
3849 printf("error = %d\n", ret_status);
3851 //WAIT FOR EVENT HERE
3853 static void app_callback (TelTapiEvent_t *event)
3859 void* EventData = NULL;
3862 eventClass = event->EventClass;
3863 eventType = event->EventType;
3864 requestId = event->RequestId;
3865 status = event->Status;
3866 EventData = event->pData;
3868 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3872 //TEST_DEBUG("******This is nonzero status. ******\n");
3877 switch (eventType) //REFER Send SMS TO GET eventType
3879 case TAPI_EVENT_NETTEXT_SET_REQUEST_CNF:
3880 TelSmsSetResponse *RequestType;
3881 RequestType = (TelSmsSetResponse *)EventData;
3882 if (*RequestType == TAPI_NETTEXT_SETPARAMETERS_RSP) {
3883 printf("\n$$$TAPI_EVENT_NETTEXT_SET_Parameter_CNF$$$\n");
3893 #include <TapiCommon.h>
3894 #include <ITapiNetText.h>
3901 ret_status = tel_get_sms_parameters(1, &pRequestId);
3902 if (ret_status == TAPI_API_SUCCESS)
3904 printf("successful\n");
3908 printf("error = %d\n", ret_status);
3910 //WAIT FOR EVENT HERE
3912 static void app_callback (TelTapiEvent_t *event)
3918 void* EventData = NULL;
3921 eventClass = event->EventClass;
3922 eventType = event->EventType;
3923 requestId = event->RequestId;
3924 status = event->Status;
3925 EventData = event->pData;
3927 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
3931 //TEST_DEBUG("******This is nonzero status. ******\n");
3936 switch (eventType) //REFER Send SMS TO GET eventType
3938 case TAPI_EVENT_NETTEXT_GET_PARAM_CNF:
3939 printf("\n***************************************\n");
3940 printf("\n$$$ GET PARAM NOTI$$$\n");
3941 // decoding SMS parameter
3948 @defgroup Use_Cases4_13 Sending Delivery Report
3949 @ingroup Use_Cases4_SMS
3953 <h3 class="pg">Sending Delivery Report</h3>
3954 This API sends a SMS-deliver report to the network, after receiving an incoming SMS. You should not access this API directly.
3957 int tel_send_sms_deliver_report(const TelSmsDatapackageInfo_t *pDataPackage, TelSmsResponse_t RPCause, int *pRequestId);
3960 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
3966 #include <TapiCommon.h>
3967 #include <ITapiNetText.h>
3968 void send_delivery()
3972 TelSmsResponse_t RPCause;
3973 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3974 TelSmsDatapackageInfo_t *del_report = NULL;
3976 del_report = malloc(sizeof(TelSmsDatapackageInfo_t));
3977 memset(del_report, 0, sizeof(TelSmsDatapackageInfo_t));
3978 //Encode Send Delivery Report here
3979 //EncodeSmsDeliveryReportTpdu();
3981 RPCause = TAPI_NETTEXT_SENDSMS_SUCCESS;
3982 printf("***receive message (Api:SendDeliverreport)****\n");
3984 ret_status = tel_send_sms_deliver_report(del_report, RPCause, &requestId);
3985 if (ret_status == TAPI_API_SUCCESS)
3987 printf("successful\n");
3991 printf("error = %d\n", ret_status);
3993 //WAIT FOR EVENT HERE
3995 static void app_callback (TelTapiEvent_t *event)
4001 void* EventData = NULL;
4004 eventClass = event->EventClass;
4005 eventType = event->EventType;
4006 requestId = event->RequestId;
4007 status = event->Status;
4008 EventData = event->pData;
4010 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
4014 //TEST_DEBUG("******This is nonzero status. ******\n");
4019 switch (eventType) //REFER Send SMS TO GET eventType
4021 case TAPI_EVENT_NETTEXT_DELIVERY_REPORT_CNF:
4022 printf("\n***************************************\n");
4023 printf("\n$$$ DELIVER REPORT NOTI$$$\n");
4024 printf("\n***************************************\n");
4031 @defgroup Use_Cases4_14 Setting Memory Status
4032 @ingroup Use_Cases4_SMS
4036 <h3 class="pg">Setting Memory Status</h3>
4037 <strong>[Note] Telephony Emulator does not support this feature.</strong>
4038 @n This API is used by applications to inform the modem about the memory status of PDA (whether FULL or AVAILABLE) so that modem can inform network. You should not access this API directly.
4041 int tel_set_sms_memory_status (int MemoryStatus , int *pRequestId);
4044 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
4050 #include <TapiCommon.h>
4051 #include <ITapiNetText.h>
4052 void set_memstatus()
4055 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
4058 int MemoryStatus = TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE;
4060 ret_status = tel_set_sms_memory_status(MemoryStatus, &pRequestId);
4061 if (ret_status == TAPI_API_SUCCESS)
4063 printf("successful\n");
4067 printf("error = %d\n", ret_status);
4069 //WAIT FOR EVENT HERE
4071 static void app_callback (TelTapiEvent_t *event)
4077 void* EventData = NULL;
4080 eventClass = event->EventClass;
4081 eventType = event->EventType;
4082 requestId = event->RequestId;
4083 status = event->Status;
4084 EventData = event->pData;
4086 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4090 //TEST_DEBUG("******This is nonzero status. ******\n");
4095 switch (eventType) //REFER Send SMS TO GET eventType
4097 case TAPI_EVENT_NETTEXT_SET_REQUEST_CNF:
4098 TelSmsSetResponse *RequestType;
4099 printf("\n***************************************\n");
4100 printf("\n$$$$$$ SET CONFIRMATION $$$$$$ \n");
4101 RequestType = (TelSmsSetResponse *)EventData;
4102 if (*RequestType == TAPI_NETTEXT_SETMEMORYSTATUS_RSP) {
4103 printf("\n$$$$$$ SET Memory Status $$$$$$ \n");
4111 @defgroup Use_Cases4_15 Setting Message Status
4112 @ingroup Use_Cases4_SMS
4116 <h3 class="pg">Setting Message Status</h3>
4117 <strong>[Note] Telephony Emulator does not support this feature.</strong>
4118 This API is used by applications to set the message status in the Sim file. You should not access this API directly; use the Message Framework API.
4121 int tel_set_sms_message_status(int Index, TelSmsMsgStatus_t MsgStatus, int *pRequestId);
4124 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
4130 #include <TapiCommon.h>
4131 #include <ITapiNetText.h>
4133 void set_msgstatus()
4135 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
4139 TelSmsMsgStatus_t MsgStatus = TAPI_NETTEXT_STATUS_READ;
4141 ret_status = tel_set_sms_message_status (Index, MsgStatus, &pRequestId);
4142 printf ("The return value is %d\n", ret_status);
4143 printf("RequestId is %d\n", pRequestId);
4144 if (ret_status == TAPI_API_SUCCESS)
4146 printf("successful\n");
4150 printf("error = %d\n", ret_status);
4152 //WAIT FOR EVENT HERE
4154 static void app_callback (TelTapiEvent_t *event)
4160 void* EventData = NULL;
4163 eventClass = event->EventClass;
4164 eventType = event->EventType;
4165 requestId = event->RequestId;
4166 status = event->Status;
4167 EventData = event->pData;
4169 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4173 //TEST_DEBUG("******This is nonzero status. ******\n");
4180 case TAPI_EVENT_NETTEXT_SET_REQUEST_CNF:
4181 TelSmsSetResponse *RequestType;
4182 printf("\n***************************************\n");
4183 printf("\n$$$$$$ SET CONFIRMATION $$$$$$ \n");
4184 RequestType = (TelSmsSetResponse *)EventData;
4185 if (*RequestType == TAPI_NETTEXT_SETMESSAGESTATUS_RSP) {
4186 printf("\n$$$$$$ SET Memory Status $$$$$$ \n");
4194 @defgroup Use_Cases4_16 Getting SMS Parameter Count
4195 @ingroup Use_Cases4_SMS
4199 <h3 class="pg">Getting SMS Parameter Count</h3>
4200 <strong>[Note] Telephony Emulator does not support this feature.</strong>
4201 @n This API is used by applications to get the count of sms parameter records stored in Sim EF. You should not access this API directly.
4204 int tel_get_sms_parameter_count (int *pRequestId);
4207 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
4213 #include <TapiCommon.h>
4214 #include <ITapiNetText.h>
4216 void get_paramcount()
4218 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
4222 ret_status = tel_get_sms_parameter_count (&pRequestId);
4223 printf ("The return value is %d\n", ret_status);
4224 if (ret_status == TAPI_API_SUCCESS)
4226 printf("successful\n");
4230 printf("error = %d\n", ret_status);
4232 //WAIT FOR EVENT HERE
4234 static void app_callback (TelTapiEvent_t *event)
4240 void* EventData = NULL;
4243 eventClass = event->EventClass;
4244 eventType = event->EventType;
4245 requestId = event->RequestId;
4246 status = event->Status;
4247 EventData = event->pData;
4249 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4253 //TEST_DEBUG("******This is nonzero status. ******\n");
4258 switch (eventType) //REFER Send SMS TO GET eventType
4260 case TAPI_EVENT_NETTEXT_PARAM_COUNT_IND:
4261 printf("\n***************************************\n");
4262 printf("\n$$$ PARAM COUNT NOTI$$$\n");
4263 printf("\n***************************************\n");
4270 <h2 class="pg">NETWORK Registration and Configuration<h/h2>
4272 @defgroup Use_Cases5_1 Event register and deregister
4273 @ingroup Use_Cases5_NETWORK
4276 <h3 class="pg">Event register and deregister</h3>
4277 To receive asynchronous event notifications for the network APIs, the registration of related events with their associated call backs is required. When an asynchronous API is called, the confirmation is returned as an asynchronous event notification which invokes the callback function along with the event data.
4279 Network Notification Events
4281 TAPI_EVENT_NETWORK_LOCATIONCELLINFO_IND
4282 TAPI_EVENT_NETWORK_RADIO_INFO_IND
4283 TAPI_EVENT_NETWORK_SPN_INFO
4284 TAPI_EVENT_NETWORK_DISPLAYINFO_IND
4290 unsigned int subscription_id = 0;
4293 api_err = tel_init();
4294 if (api_err != TAPI_API_SUCCESS)
4296 TEST_DEBUG("TelTapiInit Failed - api_err = %d \n", api_err);
4299 api_err = tel_register_event(TAPI_EVENT_NETWORK_GETNWBAND_CNF, &subscription_id, (TelAppCallback)&app_callback);
4300 printf("Network Event registration is Done: sub id is %d, api_err is %d\n", subscription_id, api_err);
4302 tel_register_app_name("com.samsung.appname");
4305 api_err = tel_deregister_event (subscription_id);
4306 if (api_err != TAPI_API_SUCCESS)
4308 printf("Event Class Unregeration Fail\n");
4311 // Network notification callback function
4312 void app_callback(void)
4318 void *EventData = NULL;
4320 eventClass = event->EventClass;
4321 eventType = event->EventType;
4322 requestId = event->RequestId;
4323 status = event->Status;
4324 EventData = event->pData;
4325 printf(" app _callback is called \n");
4327 print_events((int)eventType);
4328 printf("\n event came in power_callback [%d] \n", eventType);
4329 printf("\n expected event is in callback [%d] \n", expected_event);
4333 case TAPI_EVENT_NETWORK_LOCATIONCELLINFO_IND:
4334 TelSmsDatapackageInfo_t *ptrDataPackage = NULL;
4335 printf("SMS Incoming Message\n");
4336 ptrDataPackage = (TelSmsDatapackageInfo_t *)EventData;
4337 // Decoding Service Center Address
4338 // Decoding TPDU(SMS-DELIVER, SMS-STATUS)
4341 case TAPI_EVENT_NETWORK_RADIO_INFO_IND:
4342 TelSmsDatapackageInfo_t *ptrDataPackage = NULL;
4343 printf("SMS Incoming Message\n");
4344 ptrDataPackage = (TelSmsDatapackageInfo_t *)EventData;
4345 // Decoding Service Center Address
4346 // Decoding TPDU(SMS-DELIVER, SMS-STATUS)
4349 case TAPI_EVENT_NETWORK_SPN_INFO:
4350 TelSmsDatapackageInfo_t *ptrDataPackage = NULL;
4351 printf("SMS Incoming Message\n");
4352 ptrDataPackage = (TelSmsDatapackageInfo_t *)EventData;
4353 // Decoding Service Center Address
4354 // Decoding TPDU(SMS-DELIVER, SMS-STATUS)
4357 case TAPI_EVENT_NETWORK_DISPLAYINFO_IND:
4358 TelSmsDatapackageInfo_t *ptrDataPackage = NULL;
4359 printf("SMS Incoming Message\n");
4360 ptrDataPackage = (TelSmsDatapackageInfo_t *)EventData;
4361 // Decoding Service Center Address
4362 // Decoding TPDU(SMS-DELIVER, SMS-STATUS)
4368 @defgroup Use_Cases5_2 Network Selection
4369 @ingroup Use_Cases5_NETWORK
4373 <h3 class="pg">Network Selection</h3>
4374 Telephony provides APIs which can request the lower layers use the network (PLMN) which has been selected by the user from the Network List displayed to the User.
4377 int tel_select_network_automatic(int *pRequestId)
4378 int tel_select_network_manual(unsigned int Plmn, int *pRequestId)
4383 #include <ITapiNetwork.h>
4385 #include "TapiCommon.h"
4389 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
4392 unsigned int plmn = 0;
4394 //CASE 1. MANUAL MODE
4396 ret_status = tel_select_network_manual(Plmn, &pRequestId);
4398 // CASE 2. AUTOMATIC MODE
4399 // selectionMode = TAPI_NETWORK_SELECTIONMODE_AUTOMATIC;
4400 ret_status = tel_select_network_automatic(&pRequestId);
4401 if (ret_status == TAPI_API_SUCCESS)
4402 printf("successful\n");
4404 printf("error=%d\n", ret_status);
4406 //WAIT FOR EVENT HERE
4409 //CALLBACK FUNCTION TO BE USED
4410 static void app_callback (TelTapiEvent_t *event)
4416 void* EventData = NULL;
4419 eventClass = event->EventClass;
4420 eventType = event->EventType;
4421 requestId = event->RequestId;
4422 status = event->Status;
4423 EventData = event->pData;
4425 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4429 //TEST_DEBUG("******This is nonzero status. ******\n");
4436 case TAPI_EVENT_NETWORK_SELECT_CNF:
4437 printf("\n$$$$$$ TAPI_EVENT_NETWORK_SELECT_CNF $$$$$$ \n");
4442 @defgroup Use_Cases5_3 Network Search
4443 @ingroup Use_Cases5_NETWORK
4447 <h3 class="pg">Network Search</h3>
4448 This API is used to search for the available networks, and to provide the Network List to the User/Application.
4451 int tel_search_network (int *pRequestId);
4456 #include <ITapiNetwork.h>
4458 #include "TapiCommon.h"
4462 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
4465 ret_status = tel_search_network(&pRequestId);
4466 if (ret_status == TAPI_API_SUCCESS)
4467 printf("successful\n");
4469 printf("error=%d\n", ret_status);
4470 //WAIT FOR EVENT HERE
4472 //CALLBACK FUNCTION TO BE USED
4473 static void app_callback (TelTapiEvent_t *event)
4479 void* EventData = NULL;
4480 unsigned int temp_handle = -1;
4483 eventClass = event->EventClass;
4484 eventType = event->EventType;
4485 requestId = event->RequestId;
4486 status = event->Status;
4487 EventData = event->pData;
4489 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4493 //TEST_DEBUG("******This is nonzero status. ******\n");
4498 switch (eventType) //REFER Network Selection TO GET eventType
4500 case TAPI_EVENT_NETWORK_SEARCH_CNF:
4501 int ui_entry_count = 0;
4502 TelNetworkPlmnList_t *pNetSearchCnf;
4503 pNetSearchCnf = (TelNetworkPlmnList_t *)EventData;
4504 while (ui_entry_count < pNetSearchCnf->networks_count)
4506 printf("Type_of_plmn[%d] 0:unkwon,1:home,2:available,3:forbidden, NetworkName[%s]",
4507 pNetSearchCnf->network_list[ui_entry_count].type_of_plmn,
4508 pNetSearchCnf->network_list[ui_entry_count].network_name);
4509 printf("ServiceProviderName[%s]", pNetSearchCnf->network_list[ui_entry_count].service_provider_name);
4510 printf("PLMN ID[%lu]", pNetSearchCnf->network_list[ui_entry_count].plmn_id);
4519 @defgroup Use_Cases5_4 Selection Mode
4520 @ingroup Use_Cases5_NETWORK
4524 <h3 class="pg">Selection Mode</h3>
4525 Telephony provides APIs to set and retrieve the current mode of network selection i.e. automatic or manual. Request for Automatic network selection or Manual network selection will allow OEM provider to do PLMN Selection based on network selection preference.
4528 int tel_get_network_selection_mode (int *pRequestId);
4533 #include <ITapiNetwork.h>
4535 #include "TapiCommon.h"
4538 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
4541 //GET THE SELECTION MODE
4543 ret_status = tel_get_network_selection_mode (&pRequestId);
4544 if (ret_status == TAPI_API_SUCCESS)
4545 printf("successful\n");
4547 printf("error=%d\n", ret_status);
4548 //WAIT FOR EVENT HERE
4550 //CALLBACK FUNCTION TO BE USED
4551 static void app_callback (TelTapiEvent_t *event)
4557 void* EventData = NULL;
4560 eventClass = event->EventClass;
4561 eventType = event->EventType;
4562 requestId = event->RequestId;
4563 status = event->Status;
4564 EventData = event->pData;
4566 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4570 //TEST_DEBUG("******This is nonzero status. ******\n");
4575 switch (eventType) // REFER Network Selection TO GET eventType
4577 case TAPI_EVENT_NETWORK_GETSELECTIONMODE_CNF:
4578 printf("\n$$$$$$ TAPI_EVENT_NETWORK_GETSELECTIONMODE_CNF $$$$$$ \n");
4585 @defgroup Use_Cases5_5 Service Domain
4586 @ingroup Use_Cases5_NETWORK
4590 <h3 class="pg">Service Domain</h3>
4591 Telephony provides APIs so that User/application can configure the service domain and also retrieve the present network service domain.
4594 int tel_set_network_service_domain (TelNetworkServiceDomain_t ServiceDomain, int *pRequestId);
4595 int tel_get_network_service_domain (int *pRequestId);
4601 #include <ITapiNetwork.h>
4603 #include "TapiCommon.h"
4605 void set_servicedomain()
4607 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
4610 //SET NETWORK SERVICE DOMAIN
4611 TelNetworkServiceDomain_t ServiceDomain = TAPI_NETWORK_SERVICE_DOMAIN_AUTOMATIC;
4613 ret_status = tel_set_network_service_domain (ServiceDomain, &pRequestId);
4614 if (ret_status == TAPI_API_SUCCESS)
4615 printf("successful\n");
4617 printf("error=%d\n", ret_status);
4618 //WAIT FOR EVENT HERE
4620 //CALLBACK FUNCTION TO BE USED
4621 static void app_callback (TelTapiEvent_t *event)
4627 void* EventData = NULL;
4628 unsigned int temp_handle = -1;
4631 eventClass = event->EventClass;
4632 eventType = event->EventType;
4633 requestId = event->RequestId;
4634 status = event->Status;
4635 EventData = event->pData;
4637 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4641 //TEST_DEBUG("******This is nonzero status. ******\n");
4646 switch (eventType) //REFER Network Selection TO GET eventType
4648 case TAPI_EVENT_NETWORK_SET_SVC_DOMAIN_CNF:
4649 printf("\n$$$$$$ TAPI_EVENT_NETWORK_SET_SVC_DOMAIN_CNF $$$$$$ \n");
4656 //GET NETWORK SERVICE DOMAIN
4657 #include <ITapiNetwork.h>
4659 #include "TapiCommon.h"
4660 void get_servicedomain()
4663 ret_status = tel_get_network_service_domain (&pRequestId);
4664 if (ret_status == TAPI_API_SUCCESS)
4665 printf("successful\n");
4667 printf("error=%d\n", ret_status);
4668 //WAIT FOR EVENT HERE
4670 //CALLBACK FUNCTION TO BE USED
4671 static void app_callback (TelTapiEvent_t *event)
4677 void* EventData = NULL;
4679 eventClass = event->EventClass;
4680 eventType = event->EventType;
4681 requestId = event->RequestId;
4682 status = event->Status;
4683 EventData = event->pData;
4685 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4689 //TEST_DEBUG("******This is nonzero status. ******\n");
4694 switch (eventType) //REFER Network Selection TO GET eventType
4696 case TAPI_EVENT_NETWORK_GET_SVC_DOMAIN_CNF:
4697 printf("\n$$$$$$ TAPI_EVENT_NETWORK_GET_SVC_DOMAIN_CNF $$$$$$ \n");
4704 @defgroup Use_Cases5_6 Network Mode
4705 @ingroup Use_Cases5_NETWORK
4709 <h3 class="pg">Network Mode</h3>
4710 <strong>[Note] Telephony Emulator does not support this feature.</strong>
4711 @n The Network Mode (Automatic, GSM, and WCDMA) can be configured at OEM provider, based on which lower layers can scan only those radio access technologies, to register with network.
4714 int tel_set_network_mode (TelNetworkMode_t NwMode, int *pRequestId);
4715 int tel_get_network_mode (int *pRequestId);
4720 #include <ITapiNetwork.h>
4722 #include "TapiCommon.h"
4725 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
4729 ret_status = tel_set_network_mode(NwMode, &pRequestId);
4730 if (ret_status == TAPI_API_SUCCESS)
4731 printf("successful\n");
4733 printf("error=%d\n", ret_status);
4734 //WAIT FOR EVENT HERE
4736 //CALLBACK FUNCTION TO BE USED
4737 static void app_callback (TelTapiEvent_t *event)
4743 void* EventData = NULL;
4746 eventClass = event->EventClass;
4747 eventType = event->EventType;
4748 requestId = event->RequestId;
4749 status = event->Status;
4750 EventData = event->pData;
4752 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4756 //TEST_DEBUG("******This is nonzero status. ******\n");
4761 switch (eventType) //REFER Network Selection TO GET eventType
4763 case TAPI_EVENT_NETWORK_SETNWMODE_CNF:
4764 printf("\n$$$$$$ TAPI_EVENT_NETWORK_SETNWMODE_CNF $$$$$$ \n");
4771 #include <ITapiNetwork.h>
4773 #include "TapiCommon.h"
4780 ret_status = tel_get_network_mode(&pRequestId);
4781 if (ret_status == TAPI_API_SUCCESS)
4782 printf("successful\n");
4784 printf("error=%d\n", ret_status);
4785 //WAIT FOR EVENT HERE
4787 //CALLBACK FUNCTION TO BE USED
4788 static void app_callback (TelTapiEvent_t *event)
4794 void* EventData = NULL;
4797 eventClass = event->EventClass;
4798 eventType = event->EventType;
4799 requestId = event->RequestId;
4800 status = event->Status;
4801 EventData = event->pData;
4803 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4807 //TEST_DEBUG("******This is nonzero status. ******\n");
4812 switch (eventType) //REFER Network Selection TO GET eventType
4814 case TAPI_EVENT_NETWORK_GETNWMODE_CNF:
4815 printf("\n$$$$$$ TAPI_EVENT_NETWORK_GETNWMODE_CNF $$$$$$ \n");
4822 @defgroup Use_Cases5_7 Network Band
4823 @ingroup Use_Cases5_NETWORK
4827 <h3 class="pg">Network Band</h3>
4828 Telephony provides APIs to set and retrieve the network band and allows the underlying OEM provider to scan the set band.
4831 int tel_set_network_band (TelNetworkBandPreferred_t BandMode, TelNetworkBand_t Band, int *pRequestId);
4832 int tel_get_network_band ( int *pRequestId);
4837 #include <ITapiNetwork.h>
4839 #include "TapiCommon.h"
4842 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
4845 TelNetworkBandPreferred_t BandMode = TAPI_NETWORK_BAND_MODE_PREFERRED;
4846 TelNetworkBand_t Band = TAPI_NETWORK_BAND_TYPE_GSM_900_1800;
4849 ret_status = tel_set_network_band (BandMode,Band, &pRequestId);
4850 if (ret_status == TAPI_API_SUCCESS)
4851 printf("successful\n");
4853 printf("error=%d\n", ret_status);
4854 //WAIT FOR EVENT HERE
4856 //CALLBACK FUNCTION TO BE USED
4857 static void app_callback (TelTapiEvent_t *event)
4863 void* EventData = NULL;
4865 eventClass = event->EventClass;
4866 eventType = event->EventType;
4867 requestId = event->RequestId;
4868 status = event->Status;
4869 EventData = event->pData;
4871 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4875 //TEST_DEBUG("******This is nonzero status. ******\n");
4880 switch (eventType) //REFER Network Selection TO GET eventType
4882 case TAPI_EVENT_NETWORK_SETNWBAND_CNF:
4883 printf("\n$$$$$$ TAPI_EVENT_NETWORK_SETNWBAND_CNF $$$$$$ \n");
4890 #include <ITapiNetwork.h>
4892 #include "TapiCommon.h"
4897 ret_status = tel_get_network_band (BandMode, Band, &pRequestId);
4898 if (ret_status == TAPI_API_SUCCESS)
4899 printf("successful\n");
4901 printf("error=%d\n", ret_status);
4902 //WAIT FOR EVENT HERE
4904 //CALLBACK FUNCTION TO BE USED
4905 static void app_callback (TelTapiEvent_t *event)
4911 void* EventData = NULL;
4914 eventClass = event->EventClass;
4915 eventType = event->EventType;
4916 requestId = event->RequestId;
4917 status = event->Status;
4918 EventData = event->pData;
4920 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4924 //TEST_DEBUG("******This is nonzero status. ******\n");
4929 switch (eventType) // REFER Network Selection TO GET eventType
4931 case TAPI_EVENT_NETWORK_GETNWBAND_CNF:
4932 printf("\n$$$$$$ TAPI_EVENT_NETWORK_GTNWBAND_CNF $$$$$$ \n");
4939 @defgroup Use_Cases5_8 Preferred PLMN
4940 @ingroup Use_Cases5_NETWORK
4944 <h3 class="pg">Preferred PLMN</h3>
4945 <strong>[Note] Telephony Emulator does not support this feature.</strong>
4946 @n Telephony provides APIs which can be used to set and retrieve the preferred plmn of network.
4949 int tel_set_network_preferred_plmn (TelNetworkPrefferedPlmnOp_t Operation, TelNetworkPrefferedPlmnInfo_t PreffPlmnInfo, int *pRequestId);
4950 int tel_get_network_preferred_plmn ( int *pRequestId);
4955 #include <ITapiNetwork.h>
4957 #include "TapiCommon.h"
4958 void set_preferredplmn()
4960 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
4965 TelNetworkPrefferedPlmnOp_t Operation = TAPI_NETWORK_PREF_PLMN_ADD;
4966 TelNetworkPrefferedPlmnInfo_t PreffPlmnInfo;
4967 unsigned char *plmn = "45454";
4969 memset(&PreffPlmnInfo, 0, sizeof(TelNetworkPrefferedPlmnInfo_t));
4970 PreffPlmnInfo.Index = 0;
4971 PreffPlmnInfo.SystemType = TAPI_NETWORK_SYSTEM_GSM;
4972 memcpy(PreffPlmnInfo.Plmn, plmn, 6);
4974 ret_status = tel_set_network_preferred_plmn (Operation,PreffPlmnInfo, &pRequestId);
4975 if (ret_status == TAPI_API_SUCCESS)
4976 printf("successful\n");
4978 printf("error=%d\n", ret_status);
4979 //WAIT FOR EVENT HERE
4981 //CALLBACK FUNCTION TO BE USED
4982 static void app_callback (TelTapiEvent_t *event)
4988 void* EventData = NULL;
4991 eventClass = event->EventClass;
4992 eventType = event->EventType;
4993 requestId = event->RequestId;
4994 status = event->Status;
4995 EventData = event->pData;
4997 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
5001 //TEST_DEBUG("******This is nonzero status. ******\n");
5007 switch (eventType) //REFER Network Selection TO GET eventType
5009 case TAPI_EVENT_NETWORK_SETPREFFPLMN_CNF:
5010 printf("\n$$$$$$ TAPI TAPI_EVENT_NETWORK_SETPREFFPLMN_CNF $$$$$$ \n");
5019 #include <ITapiNetwork.h>
5021 #include "TapiCommon.h"
5022 void get_preferredplmn()
5027 ret_status = tel_get_network_preferred_plmn (&pRequestId);
5028 if (ret_status == TAPI_API_SUCCESS)
5029 printf("successful\n");
5031 printf("error=%d\n", ret_status); //WAIT FOR EVENT HERE
5032 //WAIT FOR EVENT HERE
5035 //CALLBACK FUNCTION TO BE USED
5036 static void app_callback (TelTapiEvent_t *event)
5042 void* EventData = NULL;
5045 eventClass = event->EventClass;
5046 eventType = event->EventType;
5047 requestId = event->RequestId;
5048 status = event->Status;
5049 EventData = event->pData;
5051 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
5055 //TEST_DEBUG("******This is nonzero status. ******\n");
5060 switch (eventType) //REFER Network Selection TO GET eventType
5062 case TAPI_EVENT_NETWORK_GETPREFFPLMN_CNF:
5063 printf("\n$$$$$$ TAPI TAPI_EVENT_NETWORK_GETPREFFPLMN_CNF $$$$$$ \n");
5068 @defgroup Use_Cases5_9 Network Roaming Mode
5069 @ingroup Use_Cases5_NETWORK
5073 <h3 class="pg">Network Roaming Mode</h3>
5074 <strong>[Note] Telephony Emulator does not support this feature.</strong>
5075 Telephony provides APIs which can be used to set and retrieve the mode of network roaming. This is for CDMA.
5078 int tel_set_network_roaming (TelNetworkRoamingMode_t *RoamingMode, int *pRequestId);
5079 int tel_get_network_roaming (int *pRequestId);
5085 #include <ITapiNetwork.h>
5087 #include "TapiCommon.h"
5088 void set_roamingmode()
5090 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
5092 TelNetworkRoamingMode_t roamingMode;
5095 roamingMode.pref_net_type = TAPI_NETWORK_PREF_NET_HOME_ONLY;
5096 roamingMode.prl_pref_only = TAPI_NETWORK_PRL_PREF_ONLY_ON;
5098 ret_status = tel_get_network_roaming (&roamingMode, &requestId);
5099 if (ret_status == TAPI_API_SUCCESS)
5100 printf("Successful\n");
5102 printf("error:%d\n", ret_status);
5104 //WAIT FOR EVENT HERE
5106 //CALLBACK FUNCTION TO BE USED
5107 static void app_callback (TelTapiEvent_t *event)
5113 void* EventData = NULL;
5115 eventClass = event->EventClass;
5116 eventType = event->EventType;
5117 requestId = event->RequestId;
5118 status = event->Status;
5119 EventData = event->pData;
5121 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
5125 //TEST_DEBUG("******This is nonzero status. ******\n");
5130 switch (eventType) //REFER Network Selection TO GET eventType
5132 case TAPI_EVENT_NETWORK_SET_ROAMING_MODE_CNF:
5133 printf("$$$$$TAPI_EVENT_NETWORK_SET_ROAMING_MODE_CNF$$$$$\n");
5144 #include<TapiCommon.h>
5145 #include<ITapiNetwork.h>
5146 void set_roamingmode()
5150 ret_status = tel_get_network_roaming(&requestId);
5151 if (ret_status == TAPI_API_SUCCESS)
5154 printf("error:%d\n", ret_status);
5156 //WAIT FOR EVENT HERE
5159 //CALLBACK FUNCTION TO BE USED
5160 static void app_callback (TelTapiEvent_t *event)
5166 void* EventData = NULL;
5168 eventClass = event->EventClass;
5169 eventType = event->EventType;
5170 requestId = event->RequestId;
5171 status = event->Status;
5172 EventData = event->pData;
5174 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
5178 //TEST_DEBUG("******This is nonzero status. ******\n");
5183 switch (eventType) //REFER Network Selection TO GET eventType
5185 case TAPI_EVENT_NETWORK_GET_ROAMING_MODE_CNF:
5186 printf("$$$$TAPI_EVENT_NETWORK_GET_ROAMING_MODE_CNF$$$$\n");
5194 @defgroup Use_Cases5_10 Network CDMA Hybrid Mode
5195 @ingroup Use_Cases5_NETWORK
5199 <h3 class="pg">Network CDMA Hybrid Mode</h3>
5200 <strong>[Note] Telephony Emulator does not support this feature.</strong>
5201 Telephony provides APIs which can be used to set and get the CDMA Hybrid Mode. This is for CDMA.
5202 Hybrid means 1x only, EVDO only combined. we can set network mode separately also in CDMA network.
5205 int tel_set_network_hybrid_in_cdma (TelNetworkCDMAHybridMode_t CDMAHybridMode, int *pRequestId);
5206 int tel_get_network_hybrid_in_cdma (int *pRequestId);
5211 //Set CDMA Hybrid Mode
5212 #include <ITapiNetwork.h>
5214 #include "TapiCommon.h"
5215 void set_hybridmode()
5219 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
5221 TelNetworkCDMAHybridMode_t cdmaHybridMode;
5222 cdmaHybridMode = TAPI_NETWORK_CDMA_HYBRID; // TAPI_NETWORK_CDMA_1X_ONLY, TAPI_NETWORK_CDMA_EVDO_ONLY, TAPI_NETWORK_CDMA_HYBRID(1X + EVDO)
5224 ret_status = tel_get_network_hybrid_in_cdma(cdmaHybridMode, &requestId);
5225 if (ret_status == TAPI_API_SUCCESS)
5226 printf("Successful\n");
5228 printf("error:%d\n", ret_status);
5230 //WAIT FOR EVENT HERE
5232 //CALLBACK FUNCTION TO BE USED
5234 static void app_callback (TelTapiEvent_t *event)
5240 void* EventData = NULL;
5243 eventClass = event->EventClass;
5244 eventType = event->EventType;
5245 requestId = event->RequestId;
5246 status = event->Status;
5247 EventData = event->pData;
5249 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
5253 //TEST_DEBUG("******This is nonzero status. ******\n");
5258 switch (eventType) //REFER Network Selection TO GET eventType
5260 case TAPI_EVENT_NETWORK_SET_CDMA_HYBRID_MODE_CNF:
5261 printf("\n$$$$$$ TAPI_EVENT_NETWORK_SET_CDMA_HYBRID_MODE_CNF $$$$$$ \n");
5269 //Get CDMA Hybrid Mode
5271 #include<TapiCommon.h>
5272 #include<ITapiNetwork.h>
5273 void get_hybridmode()
5277 ret_status = tel_get_network_hybrid_in_cdma (&requestId);
5278 if (ret_status == TAPI_API_SUCCESS)
5279 printf(successful\n);
5281 printf(error=%d\n, ret_status);
5282 //WAIT FOR EVENT HERE
5285 //CALLBACK FUNCTION TO BE USED
5286 static void app_callback (TelTapiEvent_t *event)
5292 void* EventData = NULL;
5296 eventClass = event->EventClass;
5298 eventType = event->EventType;
5300 requestId = event->RequestId;
5301 status = event->Status;
5302 EventData = event->pData;
5304 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
5308 //TEST_DEBUG("******This is nonzero status. ******\n");
5313 switch (eventType) //REFER Network Selection TO GET eventType
5315 case TAPI_EVENT_NETWORK_GET_CDMA_HYBRID_MODE_CNF:
5316 printf("$$$$$TAPI_EVENT_NETWORK_GET_CDMA_HYBRID_MODE_CNF$$$$\n");
5323 @defgroup Use_Cases5_11 SIM
5324 @ingroup Use_Cases5_NETWORK
5328 <h3 class="pg">SIM</h3>
5329 Event Register and Deregister
5330 To receive asynchronous event notifications for the SIM APIs, the registration of related events with their associated call backs is required. When an asynchronous API is called, the confirmation is returned as an asynchronous event notification which invokes the callback function along with the event data.
5335 unsigned int subscription_id = 0;
5336 TapiResult_t api_err;
5338 api_err = TelTapiInit();
5339 if (api_err != TAPI_API_SUCCESS)
5341 TEST_DEBUG("TelTapiInit Failed - api_err = %d \n", api_err);
5344 api_err = TelTapiRegisterEvent (TAPI_EVENT_SIM_ENABLE_PERS_CNF, &subscription_id, (TelAppCallback)&app_callback);
5345 printf("VSIM Event registration is Done: sub id is %d, api_err is %d\n",subscription_id,api_err);
5349 api_err = TelTapiDeRegister(subscription_id);
5350 if (api_err != TAPI_API_SUCCESS)
5352 printf("Event Class Unregeration Fail\n");
5357 @defgroup Use_Cases5_12 PIN, SIM Lock operations
5358 @ingroup Use_Cases5_NETWORK
5362 <h3 class="pg">PIN, SIM Lock operations</h3>
5363 Telephony provides APIs to enable/disable pin, change pin, unblock pin, pin verification and sim lock enable/disable/verification. It is also possible to retrieve the pin/sim lock status.
5366 int tel_enable_sim_security(TelSimSecPw_t *sec_data, int *req_id);
5367 int tel_disable_sim_security(TelSimSecPw_t *sec_data, int *req_id);
5368 int tel_change_sim_pins(const TelSimSecPw_t *old_pin , const TelSimSecPw_t *new_pin, int *req_id);
5369 int tel_verify_sim_puks(const TelSimSecPw_t *puk_data, const TelSimSecPw_t *new_pin_data, int *req_id)
5370 int tel_verifiy_sim_pins(const TelSimSecPw_t *pin_data, int *req_id)
5371 int tel_get_sim_security_status(TelSimPinType_t type, TelSimPinStatus_t *status)
5374 SAMPLE CODE: PIN1/PIN2/SIM LOCK/PUK1 VERIFICATION AND CHANGE PIN1
5376 #include <ITapiSim.h>
5378 #include "TapiCommon.h"
5380 // OPERATION REQUEST PIN1 VERIFICATION PART
5381 #define PIN1_NORMAL "0000" //Sample PIN1 code
5387 int length = TAPI_SIM_PIN_LENGTH + 1;
5388 char init_pin_val[length] ;
5389 TelSimSecPw_t pin_data;
5391 strcpy(init_pin_val, PIN1_NORMAL);
5393 pin_data.type = TAPI_SIM_PTYPE_PIN1;
5394 pin_data.pw_len = strlen(init_pin_val);
5396 printf("pw_len[%d]", pin_data.pw_len);
5398 pin_data.pw = (char*)malloc(length);
5399 memcpy(pin_data.pw, init_pin_val, length);
5401 err_code = tel_verifiy_sim_pins(&pin_data, &request_id);
5402 if (err_code != TAPI_API_SUCCESS)
5404 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5406 // WAIT FOR EVENT FROM HERE
5409 // OPERATION REQUEST PIN2 VERIFICATION PART
5410 #define PIN2_NORMAL "0000" //Sample PIN2 code
5415 int length = TAPI_SIM_PIN_LENGTH+1;
5416 char init_pin_val[length] ;
5417 TelSimSecPw_t pin_data;
5419 strcpy(init_pin_val, PIN2_NORMAL);
5421 pin_data.type = TAPI_SIM_PTYPE_PIN2;
5422 pin_data.pw_len = strlen(init_pin_val);
5424 printf("pw_len[%d]", pin_data.pw_len);
5426 pin_data.pw = (char*)malloc(length);
5427 memcpy(pin_data.pw, init_pin_val, length);
5429 err_code = tel_verifiy_sim_pins(&pin_data, &request_id);
5430 if (err_code != TAPI_API_SUCCESS)
5432 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5434 // WAIT FOR EVENT FROM HERE
5437 // OPERATION REQUEST CHANGE PIN1 PART
5438 #define PIN1_ORG "0000" //Sample old PIN1 code
5439 #define PIN1_NEW "1111" //Sample new PIN1 code
5444 int length = TAPI_SIM_PIN_LENGTH+1;
5445 char init_old_pin_val[length] ;
5446 char init_new_pin_val[length];
5447 TelSimSecPw_t old_pin;
5448 TelSimSecPw_t new_pin;
5450 memset(&init_old_pin_val, 0, length);
5451 memset(&init_new_pin_val, 0, length);
5453 strcpy(init_old_pin_val, PIN1_ORG);
5455 old_pin.type = TAPI_SIM_PTYPE_PIN1;
5456 old_pin.pw_len = strlen(init_old_pin_val);
5457 printf("pw_len[%d]", old_pin.pw_len);
5458 old_pin.pw = (char*)malloc(length);
5459 memcpy(old_pin.pw, init_old_pin_val, length);
5461 strcpy(init_new_pin_val, PIN1_NEW);
5463 new_pin.type = TAPI_SIM_PTYPE_PIN1;
5464 new_pin.pw_len = strlen(init_new_pin_val);
5465 printf("pw_len[%d]", new_pin.pw_len);
5466 new_pin.pw = (char*)malloc(length);
5467 memcpy(new_pin.pw, init_new_pin_val, length);
5469 err_code = tel_change_sim_pins(&old_pin, &new_pin, &request_id);
5470 if (err_code != TAPI_API_SUCCESS)
5472 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5474 // WAIT EVENT RESPONSE FROM HERE
5477 // OPERATION REQUEST VERIFICATION PUK1 PART
5478 #define PUK1_NORMAL "00000000" //Sample PUK1 code
5479 #define PIN1_NORMAL "0000" //Sample PIN1 code
5485 int length = TAPI_SIM_PIN_LENGTH + 1;
5487 char init_pin_val[length];
5488 char init_puk_val[length];
5490 TelSimSecPw_t puk_data;
5491 TelSimSecPw_t new_pin_data;
5493 strcpy(init_pin_val, PIN1_NORMAL);
5494 strcpy(init_puk_val, PUK1_NORMAL);
5496 puk_data.type = TAPI_SIM_PTYPE_PUK1; // 0x00
5497 puk_data.pw_len = length;
5498 puk_data.pw_len = strlen(init_puk_val);
5499 printf("pw_len[%d]", puk_data.pw_len);
5500 memcpy(puk_data.pw, init_pin_val, length);
5502 new_pin_data.type = TAPI_SIM_PTYPE_PIN1; // 0x00
5503 new_pin_data.pw_len = strlen(init_pin_val);
5504 printf("pw_len[%d]", new_pin_data.pw_len);
5505 new_pin_data.pw = (char*)malloc(length);
5506 memcpy(new_pin_data.pw, init_pin_val, length);
5508 err_code = tel_verify_sim_puks(&puk_data, &new_pin_data, &request_id);
5509 if (err_code != TAPI_API_SUCCESS)
5511 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5513 // WAIT EVENT RESPONSE FROM HERE
5515 // OPERATION REQUEST SIM LOCK VERIFICATION PART
5516 #define SIM_NORMAL "0000" //Sample SIM Lock code
5521 int length = TAPI_SIM_PIN_LENGTH + 1;
5522 char init_pin_val[length] ;
5523 TelSimSecPw_t pin_data;
5525 strcpy(init_pin_val, SIM_NORMAL);
5527 pin_data.type = TAPI_SIM_PTYPE_SIM;
5528 pin_data.pw_len = strlen(init_pin_val);
5530 printf("pw_len[%d]", pin_data.pw_len);
5532 pin_data.pw = (char*)malloc(length);
5533 memcpy(pin_data.pw, init_pin_val, length);
5535 err_code = tel_verifiy_sim_pins(&pin_data, &request_id);
5536 if (err_code != TAPI_API_SUCCESS)
5538 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5540 // WAIT FOR EVENT FROM HERE
5543 // EVENT RESPONSE PART
5544 //CALLBACK FUNCTION TO BE USED
5546 static void app_callback(TelTapiEvent_t *event)
5552 void* EventData = NULL;
5554 TelTapiEvent_t *sim_event = (TelTapiEvent_t*)event;
5556 unsigned int temp_handle = -1;
5559 eventClass = event->EventClass;
5560 eventType = event->EventType;
5561 requestId = event->RequestId;
5562 status = event->Status;
5563 EventData = event->pData;
5565 printf("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
5569 case TAPI_EVENT_SIM_VERIFY_SEC_CNF:
5570 printf("********TAPI_EVENT_SIM_VERIFY_SEC_CNF**********");
5572 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*) EventData;
5574 if (status == TAPI_SIM_OPERATION_TIMEOUT )
5576 printf("TAPI SIM Operation Timeout!!");
5578 else if (sim_event->Status == TAPI_SIM_PIN_OPERATION_SUCCESS)
5580 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5582 printf("PIN1 Verification Success!");
5584 else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM)
5586 printf("SIM Lock Verification Success!");
5590 printf("PIN2 Vefication Success!");
5595 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5597 printf("PIN1 Verification Failed! - PIN Required ");
5598 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5600 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1)
5602 printf("PIN1 Verification Failed! - PUK Required ");
5603 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5605 else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
5607 printf("PIN2 Verification Failed! - PIN2 Required ");
5608 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5610 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2)
5612 printf("PIN2 Verification Failed! - PUK2 Required ");
5613 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5615 else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM)
5617 printf("SIM Lock Verification Failed! - SIM Lock code Required");
5618 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5621 printf("********************************************");
5624 case TAPI_EVENT_SIM_VERIFY_PUK_CNF:
5625 printf("**********TAPI_EVENT_SIM_VERIFY_PUK_CNF********");
5627 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*)EventData;
5629 if (status == TAPI_SIM_PIN_OPERATION_SUCCESS)
5631 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5633 printf("Unblock PIN1 Success!");
5635 else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
5637 printf("Unblock PIN2 Success!");
5642 if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1)
5644 printf("PIN1 Verification Failed! - PUK Required ");
5645 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5647 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2)
5649 printf("PIN2 Verification Failed! - PUK2 Required ");
5650 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5653 printf("********************************************");
5656 case TAPI_EVENT_SIM_CHANGE_PINS_CNF:
5657 printf("*********TAPI_EVENT_SIM_CHANGE_PINS_CNF*******************");
5659 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*)EventData;
5661 printf("PinType[%d]", pPinInfo->type);
5663 if (status == TAPI_SIM_PIN_OPERATION_SUCCESS)
5665 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5667 printf("Change PIN1 Success!");
5671 printf("Change PIN2 Success!");
5677 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5679 printf("Change PIN1 Failed! - PIN Required ");
5680 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5682 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1)
5684 printf("Change PIN1 Failed! - PUK Required ");
5685 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5687 else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
5689 printf("Change PIN2 Failed! - PIN2 Required ");
5690 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5692 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2)
5694 printf("Change PIN2 Failed! - PUK2 Required ");
5695 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5698 printf("********************************************");
5705 SAMPLE CODE: ENABLE/DISABLE PIN1 and SIM LOCK
5707 #include <ITapiSim.h>
5709 #include "TapiCommon.h"
5711 // OPERATION REQUEST DISABLING PIN1 PART
5712 #define PIN1_NORMAL "0000" //Sample PIN1 code
5717 int length = TAPI_SIM_PIN_LENGTH+1;
5718 char init_pin_val[length];
5720 strcpy(init_pin_val, PIN1_NORMAL);
5722 TelSimSecPw_t sec_data;
5723 sec_data.type = TAPI_SIM_PTYPE_PIN1; // 0x00
5724 sec_data.pw_len = strlen(init_pin_val);
5725 printf("pw_len[%d]", sec_data.pw_len);
5727 sec_data.pw = (char*)malloc(length);
5728 memcpy(sec_data.pw, init_pin_val, length);
5730 err_code = tel_disable_sim_security(&sec_data, &request_id);
5731 if (err_code != TAPI_API_SUCCESS)
5733 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5735 // WAIT EVENT RESPONSE FROM HERE
5738 // OPERATION REQUEST ENABLING PIN1 PART
5739 #define PIN1_NORMAL "0000" //Sample PIN1 code
5744 int length = TAPI_SIM_PIN_LENGTH+1;
5745 char init_pin_val[length];
5747 strcpy(init_pin_val, PIN1_NORMAL);
5749 TelSimSecPw_t sec_data;
5750 sec_data.type = TAPI_SIM_PTYPE_PIN1; // 0x00
5751 sec_data.pw_len = strlen(init_pin_val);
5752 printf("pw_len[%d]", sec_data.pw_len);
5754 sec_data.pw = (char*)malloc(length);
5755 memcpy(sec_data.pw, init_pin_val, length);
5757 err_code = tel_enable_sim_security(&sec_data, &request_id);
5758 if (err_code != TAPI_API_SUCCESS)
5760 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5762 //WAIT EVENT RESPONSE FROM HERE
5765 // OPERATION REQUEST DISABLING SIM LOCK PART
5766 #define SIM_NORMAL "0000" //Sample SIM LOCK code
5771 int length = TAPI_SIM_PIN_LENGTH+1;
5772 char init_pin_val[length];
5774 strcpy(init_pin_val, SIM_NORMAL);
5776 TelSimSecPw_t sec_data;
5777 sec_data.type = TAPI_SIM_PTYPE_SIM; // 0x00
5778 sec_data.pw_len = strlen(init_pin_val);
5779 printf("pw_len[%d]", sec_data.pw_len);
5781 sec_data.pw = (char*)malloc(length);
5782 memcpy(sec_data.pw, init_pin_val, length);
5784 err_code = tel_disable_sim_security(&sec_data, &request_id);
5785 if (err_code != TAPI_API_SUCCESS)
5787 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5789 //WAIT EVENT RESPONSE FROM HERE
5793 // OPERATION REQUEST ENABLING SIM LOCK PART
5794 #define SIM_NORMAL "0000" //Sample SIM LOCK code
5799 int length = TAPI_SIM_PIN_LENGTH+1;
5800 char init_pin_val[length];
5802 strcpy(init_pin_val, SIM_NORMAL);
5804 TelSimSecPw_t sec_data;
5805 sec_data.type = TAPI_SIM_PTYPE_SIM; // 0x00
5806 sec_data.pw_len = strlen(init_pin_val);
5807 printf("pw_len[%d]", sec_data.pw_len);
5809 sec_data.pw = (char*)malloc(length);
5810 memcpy(sec_data.pw, init_pin_val, length);
5812 err_code = tel_enable_sim_security(&sec_data, &request_id);
5813 if (err_code != TAPI_API_SUCCESS)
5815 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5817 //WAIT EVENT RESPONSE FROM HERE
5821 // EVENT RESPONSE PART
5822 //CALLBACK FUNCTION TO BE USED
5823 static void app_callback(TelTapiEvent_t *event)
5829 void* EventData = NULL;
5831 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event;
5833 unsigned int temp_handle = -1;
5836 eventClass = event->EventClass;
5837 eventType = event->EventType;
5838 requestId = event->RequestId;
5839 status = event->Status;
5840 EventData = event->pData;
5842 printf("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
5846 case TAPI_EVENT_SIM_DISABLE_SEC_CNF:
5847 printf("****************TAPI_EVENT_SIM_DISABLE_SEC_CNF****************");
5849 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*)EventData;
5851 if (status == TAPI_SIM_PIN_OPERATION_SUCCESS)
5853 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5855 printf("Disable PIN1 Success!");
5857 else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
5859 printf("Disable PIN2 Success!");
5861 else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM)
5863 printf("Disable SIM LOCK Success!");
5868 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5870 printf("Disable PIN1 Failed! - PIN1Required ");
5871 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5873 else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
5875 printf("Disable PIN2 Failed! - PIN2 Required ");
5876 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5878 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1)
5880 printf("Disable PIN1 Failed! - PUK1 Required ");
5881 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5883 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2)
5885 printf("Disable PIN2 Failed! - PUK2 Required ");
5886 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5888 else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM)
5890 printf("Disable SIM LOCK Failed! - SIM LOCK CODE Required ");
5893 printf("********************************************");
5896 case TAPI_EVENT_SIM_ENABLE_SEC_CNF:
5897 printf("*****************TAPI_EVENT_SIM_ENABLE_SEC_CNF****************");
5899 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*)EventData;
5901 if (status == TAPI_SIM_PIN_OPERATION_SUCCESS)
5903 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5905 printf("Enable PIN1 Success!");
5907 else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
5909 printf("Enable PIN2 Success!");
5911 else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM)
5913 printf("Enable SIM LOCK Success!");
5918 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5920 printf("Enable PIN1 Failed! - PIN1Required ");
5921 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5923 else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
5925 printf("Enable PIN2 Failed! - PIN2 Required ");
5926 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5928 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1)
5930 printf("Enable PIN1 Failed! - PUK1 Required ");
5931 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5933 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2)
5935 printf("Enable PIN2 Failed! - PUK2 Required ");
5936 printf("Remainint attempts [%d]", pPinInfo->retry_count);
5939 else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM)
5941 printf("Enable SIM LOCK Failed! - SIM LOCK CODE Required ");
5944 printf("********************************************");
5951 SAMPLE CODE: GET PIN1/PIN2/SIM LOCK STATUS
5953 #include <ITapiSim.h>
5955 #include "TapiCommon.h"
5957 // OPERATION REQUEST GET PIN1/PIN2/SIM LOCK STATUS PART
5958 void get_security_status()
5961 TelSimPinType_t type = TAPI_SIM_PTYPE_PIN1 // or TAPI_SIM_PTYPE_PIN2 or TAPI_SIM_PTYPE_SIM;
5962 TelSimPinStatus_t status = -1;
5963 printf("Get Security status");
5965 err_code = tel_get_sim_security_status(type, &status);
5966 if (err_code == TAPI_API_SUCCESS)
5968 printf(" *****************************************************");
5971 case TAPI_SIM_PIN_STATUS_DISABLED:
5972 printf("TAPI_SIM_PIN_STATUS_DISABLED ");
5975 case TAPI_SIM_PIN_STATUS_ENABLED:
5976 printf("TAPI_SIM_PIN_STATUS_ENABLED ");
5979 case TAPI_SIM_PIN_STATUS_BLOCKED:
5980 printf("TAPI_SIM_PIN_STATUS_BLOCKED ");
5983 case TAPI_SIM_PIN_STATUS_PUK_BLOCKED:
5984 printf("TAPI_SIM_PIN_STATUS_PUK_BLOCKED ");
5987 case TAPI_SIM_PIN_STATUS_UNKNOWN:
5988 printf("TAPI_SIM_PIN_STATUS_UNKNOWN ");
5992 printf(" Default case statment: sim_status(%d)", status);
5998 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6000 printf("*****************************************************");
6004 @defgroup Use_Cases5_13 Personalisation Lock
6005 @ingroup Use_Cases5_NETWORK
6009 <h3 class="pg">Personalisation Lock</h3>
6010 These APIs are used to enable/disable and get the status information about personalisation of network, network subset, corporate, service provider personalisation.
6013 int tel_enable_sim_personalization(TelSimPersPw_t *pers_data, int *req_id);
6014 int tel_disable_sim_personalization(TelSimPersPw_t *pers_data, int *req_id);
6015 int tel_get_sim_personalization_status(TelSimPersType_t type, int *req_id);
6018 SAMPLE CODE: GET PERSONALIZATION STATUS
6020 #include <ITapiSim.h>
6022 #include "TapiCommon.h"
6024 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
6025 // OPERATION REQUEST GET NETWORK PERSONALIZATION PART
6031 TelSimPersType_t type = TAPI_SIM_PERS_NET;
6033 err_code = tel_get_sim_personalization_status(type, &request_id);
6034 if (err_code != TAPI_API_SUCCESS)
6036 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6038 // WAIT EVENT RESPONSE FROM HERE
6041 // EVENT RESPONSE PART
6042 //CALLBACK FUNCTION TO BE USED
6043 static void app_callback (TelTapiEvent_t *event)
6049 void* EventData = NULL;
6051 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6053 unsigned int temp_handle = -1;
6055 eventClass = event->EventClass;
6056 eventType = event->EventType;
6057 requestId = event->RequestId;
6058 status = event->Status;
6059 EventData = event->pData;
6063 case TAPI_EVENT_SIM_PERS_STATUS_CNF:
6065 TelSimPersStatus_t* pers_status = (TelSimPersStatus_t*)EventData;
6067 printf("[SIM APP]*********** TAPI_EVENT_SIM_PERS_STATUS_CNF************\n");
6068 printf("[SIM APP]SIM lock personalisation event status = [%x]\n", status);
6069 printf("[SIM APP]SIM lock personalisation status - net0-ns1-sp2-cp3 = [%d]\n", pers_status->type);
6070 printf("[SIM APP]SIM lock personalisation status - unlock0-lock1 = [%d]\n", pers_status->mode);
6071 printf("[SIM APP]***************************************************\n");
6077 SAMPLE CODE: ENABLE/DISABLE PERSONALIZATION
6079 #include <ITapiSim.h>
6081 #include "TapiCommon.h"
6083 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
6084 // OPERATION REQUEST ENABLING NETWORK PERSONALIZATION PART
6085 #define NET_ENCODE "54500112345678" //Sample Network Personalization code
6086 void enable_net_pers()
6088 printf("Lock Personalisation MCC+MNC 5\n");
6089 printf("Plese input Network Lock CODE : length of MCC+MNC, MCC, MNC, NCK\n");
6090 printf("We need to use this for testing : length of MCC+MNC(5), MCC(450), MNC(01), NCK(12345678) => 54500112345678\n");
6095 char init_pin_val[length];
6097 strcpy(init_pin_val, NET_ENCODE);
6099 TelSimPersPw_t lock_pers = {0,};
6100 lock_pers.type = TAPI_SIM_PERS_NET;
6101 lock_pers.pw_len = 14;
6102 lock_pers.pw = (char*)malloc(length);
6103 memcpy(lock_pers.pw, init_password_val, length);
6105 err_code = tel_enable_sim_personalization(&lock_pers, &request_id);
6106 if (err_code != TAPI_API_SUCCESS)
6108 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6110 // WAIT EVENT RESPONSE FROM HERE
6113 // OPERATION REQUEST DISABLING NETWORK PERSONALIZATION PART
6114 #define NET_DISCODE "12345678" //Sample Network Personalization code
6115 void disable_net_pers()
6117 printf("de Personalisation key is 8 byte \n");
6118 printf("We need to use this for testing : 12345678\n");
6123 char init_pin_val[length];
6125 strcpy(init_pin_val, NET_DISCODE);
6127 TelSimPersPw_t lock_pers = {0,};
6128 lock_pers.pw_len = 8; //control key
6129 lock_pers.pw = (char*)malloc(length);
6130 memcpy(lock_pers.pw,init_password_val,length);
6132 err_code = tel_disable_sim_personalization(&lock_pers, &request_id);
6133 if (err_code != TAPI_API_SUCCESS)
6135 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6137 // WAIT EVENT RESPONSE FROM HERE
6140 // EVENT RESPONSE PART
6141 //CALLBACK FUNCTION TO BE USED
6142 static void app_callback (TelTapiEvent_t *event)
6148 void* EventData = NULL;
6150 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6152 unsigned int temp_handle = -1;
6154 eventClass = event->EventClass;
6155 eventType = event->EventType;
6156 requestId = event->RequestId;
6157 status = event->Status;
6158 EventData = event->pData;
6162 case TAPI_EVENT_SIM_DISABLE_PERS_CNF:
6163 TelSimPinOperationResult_t opResult = (TelSimPinOperationResult_t)status;
6165 printf("[SIM APP]**** *TAPI_EVENT_SIM_DISABLE_PERS_CNF********\n");
6166 printf("[SIM APP]Eable Personalization event status = [%x]\n", opResult);
6168 if (opResult == TAPI_SIM_PIN_OPERATION_SUCCESS)
6170 ("[SIM APP]Disable Personalization Success!\n");
6174 printf("[SIM APP]Verification Failed! - Correct Password Required\n");
6176 printf("\n***************************************************************\n");
6179 case TAPI_EVENT_SIM_ENABLE_PERS_CNF:
6180 TelSimPinOperationResult_t opResult = (TelSimPinOperationResult_t)status;
6182 printf("[SIM APP]****** *TAPI_EVENT_SIM_ENABLE_PERS_CNF*********\n");
6183 printf("[SIM APP]Eable Personalization event status = [%x]\n", opResult);
6185 if (opResult == TAPI_SIM_PIN_OPERATION_SUCCESS)
6187 printf("[SIM APP]Enable Personalization Success!\n");
6191 printf("[SIM APP]Verification Failed! - Correct Password Required\n");
6193 printf("\n***************************************************************\n");
6199 @defgroup Use_Cases5_14 FDN
6200 @ingroup Use_Cases5_NETWORK
6204 <h3 class="pg">FDN</h3>
6205 These APIs are used to enable/disable FDN and to retrieve the current FDN status.
6208 int tel_enable_sim_fdn(const unsigned char *pin2, int *pin2_len, int *req_id);
6209 int tel_disable_sim_fdn(const unsigned char *pin2, int *pin2_len, int *req_id);
6210 int tel_get_sim_fdn_status(int *fdn_status);
6215 #include <ITapiSim.h>
6217 #include "TapiCommon.h"
6219 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
6221 // OPERATION REQUEST ENABLE FDN MODE PART
6222 #define PIN2_NORMAL "0000" //Sample PIN2 code
6227 int length = TAPI_SIM_PIN_LENGTH+1;
6228 char init_pin_val[length] ;
6230 strcpy(init_pin_val, PIN2_NORMAL);
6232 TelSimSecPw_t pin_data = {0,};
6234 pin_data.type = TAPI_SIM_PTYPE_PIN2;
6235 pin_data.pw_len = strlen(init_pin_val);
6237 printf("pw_len[%d]", pin_data.pw_len);
6239 pin_data.pw = (char*)malloc(length);
6240 memcpy(pin_data.pw, init_pin_val, length);
6242 err_code = tel_enable_sim_fdn(pin_data.pw, &pin_data.pw_len, &request_id);
6243 if (err_code != TAPI_API_SUCCESS)
6245 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6247 // WAIT FOR EVENT FROM HERE
6251 // OPERATION REQUEST DISABLE FDN MODE PART
6252 #define PIN2_NORMAL "0000" //Sample PIN2 code
6257 int length = TAPI_SIM_PIN_LENGTH+1;
6258 char init_pin_val[length] ;
6260 strcpy(init_pin_val, PIN2_NORMAL);
6262 TelSimSecPw_t pin_data = {0,};
6264 pin_data.type = TAPI_SIM_PTYPE_PIN2;
6265 pin_data.pw_len = strlen(init_pin_val);
6267 printf("pw_len[%d]", pin_data.pw_len);
6269 pin_data.pw = (char*)malloc(length);
6270 memcpy(pin_data.pw, init_pin_val, length);
6272 err_code = tel_disable_sim_fdn(pin_data.pw, &pin_data.pw_len, &request_id);
6273 if (err_code != TAPI_API_SUCCESS)
6275 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6277 // WAIT FOR EVENT FROM HERE
6280 // EVENT RESPONSE PART
6281 //CALLBACK FUNCTION TO BE USED
6282 static void app_callback (TelTapiEvent_t *event)
6288 void* EventData = NULL;
6290 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event;
6292 unsigned int temp_handle = -1;
6294 eventClass = event->EventClass;
6295 eventType = event->EventType;
6296 requestId = event->RequestId;
6297 status = event->Status;
6298 EventData = event->pData;
6302 case TAPI_EVENT_SIM_DISABLE_FDNMODE_CNF:
6303 printf("**********TAPI_EVENT_SIM_DISABLE_FDNMODE_CNF***********");
6305 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*)EventData;
6307 if (status == TAPI_SIM_PIN_OPERATION_SUCCESS)
6309 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
6311 printf("Disable FDN Success!");
6315 printf("Unhandled type[%d]", pPinInfo->type);
6320 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
6322 printf("Disable FDN Failed! - PIN2 Required ");
6323 printf("Remainint attempts [%d]", pPinInfo->retry_count);
6325 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2)
6327 printf("Disable FDN Failed! - PUK2 Required ");
6328 printf("Remainint attempts [%d]", pPinInfo->retry_count);
6332 printf("Unhandled type[%d]", pPinInfo->type);
6335 printf("********************************************");
6338 case TAPI_EVENT_SIM_ENABLE_FDNMODE_CNF:
6339 printf("*******TAPI_EVENT_SIM_ENABLE_FDNMODE_CNF*******");
6341 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*)EventData;
6343 if (status == TAPI_SIM_PIN_OPERATION_SUCCESS)
6345 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
6347 printf("Enable FDN Success!");
6351 printf("Unhandled type[%d]", pPinInfo->type);
6356 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
6358 printf("Enable FDN Failed! - PIN2 Required ");
6359 printf("Remainint attempts [%d]", pPinInfo->retry_count);
6361 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2)
6363 printf("Enable FDN Failed! - PUK2 Required ");
6364 printf("Remainint attempts [%d]", pPinInfo->retry_count);
6368 printf("Unhandled type[%d]", pPinInfo->type);
6371 printf("********************************************");
6377 // OPERATION REQUEST GET FDN STATUS PART
6378 void get_fdn_status()
6380 printf("Get FDN status");
6381 int fdn_status = 0 ;
6383 err_code = tel_get_sim_fdn_status(&fdn_status);
6384 if (err_code == TAPI_API_SUCCESS)
6386 if (fdn_status == 0)
6388 printf("*************************");
6389 printf("FDN disabled ");
6390 printf("*************************");
6394 printf("*************************");
6395 printf("FDN enabled");
6396 printf("*************************");
6401 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6407 @defgroup Use_Cases5_15 IMSI Information
6408 @ingroup Use_Cases5_NETWORK
6412 <h3 class="pg">IMSI Information</h3>
6413 This API retrieves the IMSI (International Mobile Subscriber Identity) information.
6416 int tel_get_sim_imsi(TelSimImsiInfo_t* imsi);
6421 #include <ITapiSim.h>
6423 #include "TapiCommon.h"
6428 TelSimImsiInfo_t sim_imsi_info;
6430 err_code = tel_get_sim_imsi (&sim_imsi_info);
6431 if (err_code == TAPI_API_SUCCESS)
6433 printf("[SIM APP] IMSI [mcc,mnc,msin]= ");
6434 printf(" [%s]",sim_imsi_info.szMcc);
6435 printf(" [%s]",sim_imsi_info.szMnc);
6436 printf(" [%s]",sim_imsi_info.szMsin);
6440 printf("Error Code [%x]\n", err_code);
6445 @defgroup Use_Cases5_16 ECC Information
6446 @ingroup Use_Cases5_NETWORK
6450 <h3 class="pg">ECC Information</h3>
6451 This API retreieves the ECC (Emergency Call Codes) data.
6454 int tel_get_sim_ecc(TelSimEccData_t *ecc_data, int *ecc_count);
6459 #include <ITapiSim.h>
6461 #include "TapiCommon.h"
6466 int ecc_rec_count = 0;
6467 TelSimEccData_t ecc_info = {0,};
6469 err_code = tel_get_sim_ecc (&ecc_info, &ecc_rec_count);
6470 printf("The Retrun Status is %d", err_code);
6472 printf(" ECC count [%d]\n", ecc_rec_count);
6473 printf("ECC1 [%s]\n", ecc_info.EccInfo.szEcc1);
6474 printf("ECC2 [%s]\n", ecc_info.EccInfo.szEcc2);
6475 printf("ECC3 [%s]\n", ecc_info.EccInfo.szEcc3);
6476 printf("ECC4 [%s]\n", ecc_info.EccInfo.szEcc4);
6477 printf("ECC5 [%s]\n", ecc_info.EccInfo.szEcc5);
6484 int uecc_rec_count = 0;
6486 printf(" Get USIM ECC ");
6488 TelSimEccData_t uecc_info = {{{0,}}};
6490 err_code = tel_get_sim_ecc(&uecc_info, &uecc_rec_count);
6491 if (err_code == TAPI_API_SUCCESS)
6493 printf("ECC count [%d]",uecc_rec_count );
6495 for (i=0; i<uecc_rec_count; i++)
6497 printf("Loop(%d): ", i);
6498 printf(" ECC Used [%d]", uecc_info.UeccInfo[i].bUsed);
6499 printf(" ECC Len [%d]", uecc_info.UeccInfo[i].EccLen);
6501 if (NULL != uecc_info.UeccInfo[i].szEcc)
6503 printf("ECC string [%s]", uecc_info.UeccInfo[i].szEcc);
6507 printf("ECC string [null]");
6510 printf("ECC alphaID [%s]",uecc_info.UeccInfo[i].szEccAlphaIdentifier);
6515 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6520 @defgroup Use_Cases5_17 Language Preference Information
6521 @ingroup Use_Cases5_NETWORK
6525 <h3 class="pg">Language Preference Information</h3>
6526 These APIs are used to get and set the language preference information stored in SIM.
6529 int tel_get_sim_language(TelSimLanguageInfo_t *sim_language);
6530 int tel_set_sim_language(TelSimLanguagePreferenceCode_t language, int *req_id);
6533 SAMPLE CODE: GET SIM LANGUAGE
6535 #include <ITapiSim.h>
6537 #include "TapiCommon.h"
6539 void getlanguageprefinfo()
6542 TelSimLanguageInfo_t li_info;
6545 err_code = tel_get_sim_language (&li_info);
6546 printf("Error Code [%x]\n", err_code);
6548 for (i =0; i<li_info.LpCount; i++)
6549 printf(" LI[%d] --> Val [%d]\n", i, li_info.Lp[i]);
6553 SAMPLE CODE: UPDATE SIM LANGUAGE
6555 #include <ITapiSim.h>
6557 #include "TapiCommon.h"
6559 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
6560 // OPERATION REQUEST UPDATE SIM LANGUAGE PART
6565 TelSimLanguagePreferenceCode_t language = 0x00;
6567 language = TAPI_SIM_LP_ENGLISH; //0x01
6569 err_code = tel_set_sim_language(language, &request_id);
6570 if (err_code != TAPI_API_SUCCESS)
6572 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6574 // WAIT EVENT RESPONSE FROM HERE
6578 // EVENT RESPONSE PART
6579 //CALLBACK FUNCTION TO BE USED
6580 static void app_callback (TelTapiEvent_t *event)
6586 void* EventData = NULL;
6588 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event;
6590 unsigned int temp_handle = -1;
6592 eventClass = event->EventClass;
6593 eventType = event->EventType;
6594 requestId = event->RequestId;
6595 status = event->Status;
6596 EventData = event->pData;
6600 case TAPI_EVENT_SIM_SET_LANGUAGE_CNF:
6601 printf("*****TAPI_EVENT_SIM_SET_LANGUAGE_CNF*********");
6602 printf("update event status = [0x%x]", status);
6603 printf("*********************************************");
6610 @defgroup Use_Cases5_18 Getting Card Type
6611 @ingroup Use_Cases5_NETWORK
6615 <h3 class="pg">Getting Card Type</h3>
6616 This API is a synchronous API which gets the Card Type i.e. whether the SIM Card is a GSM SIM or a 3G SIM.
6619 int tel_get_sim_type(TelSimCardType_t *card_type);
6624 #include <ITapiSim.h>
6626 #include "TapiCommon.h"
6631 TelSimCardType_t cardInfo;
6633 printf("Get card type !!!\n");
6634 err_code = tel_get_sim_type (&cardInfo);
6635 printf("card type is %d\n", cardInfo);
6639 @defgroup Use_Cases5_19 Getting SIM Card Initialization Status
6640 @ingroup Use_Cases5_NETWORK
6644 <h3 class="pg">Getting SIM Card Initialization Status</h3>
6645 API is a synchronous API which gets the Card Init status and Identification.
6648 int tel_get_sim_init_info(TelSimCardStatus_t *sim_status, int *card_changed);
6653 #include <ITapiSim.h>
6655 #include "TapiCommon.h"
6657 // OPERATION REQUEST GET CARD INIT STATUS PART
6658 void get_sim_init_status()
6661 TelSimCardStatus_t status = 0x00;
6662 int b_card_changed = 0;
6664 err_code = tel_get_sim_init_info(&status, &b_card_changed);
6665 if (err_code == TAPI_API_SUCCESS)
6667 printf("**********************************************");
6668 printf("CardStatus:[0x%x]",status);
6669 printf("b_card_changed[%d]\n",b_card_changed);
6670 printf("**********************************************");
6674 printf("TAPI Fail: Error Code [%d]\n", err_code);
6679 @defgroup Use_Cases5_20 SIM ACCESS COMMANDS Interface
6680 @ingroup Use_Cases5_NETWORK
6684 <h3 class="pg">SIM ACCESS COMMANDS Interface</h3>
6685 This API is used to handle SIM EF data directly according to sim access command (select-file info, read, update command). Use_Cases is defined in the 3GPP or ETSI SIM specifications.
6688 int tel_req_sim_access(const TelSimRSimReq_t *rsim_data, int *req_id);
6691 SAMPLE CODE: EF HANDLING ( SELECT-FILE INFO)
6693 #include <ITapiSim.h>
6695 #include "TapiCommon.h"
6697 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
6698 // OPERATION REQUEST GET SIM FILE INFO PART
6699 void get_sim_file_info()
6704 TelRSimReq_t rsim_data;
6705 rsim_data.file_id = TAPI_SIM_EFILE_SPN; // rsim access : sim file id to access
6706 rsim_data.rsim_cmd = TAPI_SIM_GET_RESPONSE; // rsim access : get response, read, update available
6708 err_code = tel_req_sim_access(&rsim_data, &request_id);
6709 if (err_code != TAPI_API_SUCCESS)
6711 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6713 // WAIT EVENT RESPONSE FROM HERE
6716 // EVENT RESPONSE PART
6717 //CALLBACK FUNCTION TO BE USED
6718 static void app_callback (TelTapiEvent_t *event)
6726 void* EventData = NULL;
6728 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event;
6730 unsigned int temp_handle = -1;
6732 eventClass = event->EventClass;
6733 eventType = event->EventType;
6734 requestId = event->RequestId;
6735 status = event->Status;
6736 EventData = event->pData;
6740 case TAPI_EVENT_SIM_RSIM_ACCESS_CNF:
6741 TelSimReadFileRaw_t* rsim_resp = (TelSimReadFileRaw_t*)EventData;
6743 printf("*******TAPI_EVENT_SIM_RSIM_ACCESS_CNF**********");
6744 printf("Read event status = [0x%x]", status);
6746 if ((rsim_resp->sw1 == 0x90 && rsim_resp->sw2 == 0x00) ||rsim_resp->sw1 == 0x91)
6748 printf("**********GET FILE INFO************");
6749 printf("you should parse current data array value properly regarding 3GPP or ETSI TS 102 221 SPEC");
6751 printf("************************************************");
6757 @defgroup Use_Cases5_21 SIM Mailbox EF management
6758 @ingroup Use_Cases5_NETWORK
6762 <h3 class="pg">SIM Mailbox EF management</h3>
6763 These APIs are used to get and update the mailbox information stored in SIM.
6766 int tel_get_sim_mailbox_info(TelSimMsgWaitingGroup_t type, int *req_id);
6767 int tel_set_sim_mailbox_info(TelSimMsgWaitingGroup_t type, const TelSimDialingNumberInfo_t *update_data, int *req_id);
6770 SAMPLE CODE: READ / UPDATE MAILBOX INFO
6772 #include <ITapiSim.h>
6774 #include "TapiCommon.h"
6776 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
6778 void get_sim_mailbox()
6782 TelSimMsgWaitingGroup_t type = 0x00;
6784 type = TAPI_SIM_MWG_VOICE;
6786 err_code = tel_get_sim_mailbox_info(type, &request_id);
6787 if (err_code != TAPI_API_SUCCESS)
6789 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6791 // WAIT EVENT RESPONSE FROM HERE
6793 // OPERATION REQUEST UPDATE SIM MAILBOX INFO PART
6794 void update_sim_mailbox()
6799 TelSimMsgWaitingGroup_t type = 0x00;
6800 TelSimDialingNumberInfo_t update_data;
6802 type = TAPI_SIM_MWG_VOICE;
6804 memcpy(update_data.AlphaId, "TestUpdate", 10);
6805 update_data.AlphaIdLength = strlen(update_data.AlphaId);
6806 update_data.CapaConfigId = 1;
6807 memcpy(update_data.DiallingNum, "101020203030", 12);
6808 update_data.DiallingnumLength = strlen(update_data.DiallingNum);
6809 update_data.Ext1RecordId = 1;
6810 update_data.NumberingPlanIdent =2;
6811 update_data.TypeOfNumber = 2;
6813 err_code = tel_set_sim_mailbox_info(type, &update_data, &request_id);
6814 if (err_code != TAPI_API_SUCCESS)
6816 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6818 // WAIT EVENT RESPONSE FROM HERE
6821 // EVENT RESPONSE PART
6822 //CALLBACK FUNCTION TO BE USED
6823 static void app_callback (TelTapiEvent_t *event)
6829 void* EventData = NULL;
6831 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event;
6833 unsigned int temp_handle = -1;
6835 eventClass = event->EventClass;
6836 eventType = event->EventType;
6837 requestId = event->RequestId;
6838 status = event->Status;
6839 EventData = event->pData;
6843 case TAPI_EVENT_SIM_GET_MAILBOX_CNF:
6844 TelSimDialingNumberInfo_t* mailbox = (TelSimDialingNumberInfo_t*)EventData;
6846 printf("*******TAPI_EVENT_SIM_GET_MAILBOX_CNF*********");
6847 printf("Read event status = [0x%x]", status);
6848 printf("bUsed[%d]", mailbox->bUsed);
6849 printf("AlphaIDMaxLength[%d]", mailbox->AlphaIDMaxLength);
6850 printf("AlphaIdLength[%d]", mailbox->AlphaIdLength);
6851 printf("AlphaId[%s]", mailbox->AlphaId);
6852 printf("DiallingNumMaxLength[%d]", mailbox->DiallingNumMaxLength);
6853 printf("DiallingnumLength[%d]", mailbox->DiallingnumLength);
6854 printf("TypeOfNumber:0-unknown,1-international,2-national[%d]", mailbox->TypeOfNumber);
6855 printf("NumberingPlanIdent:0-unknown,1-isdn,3-data[%d]", mailbox->NumberingPlanIdent);
6856 printf("DiallingNum[%s]", mailbox->DiallingNum);
6857 printf("CapaConfigId[%c]", mailbox->CapaConfigId);
6858 printf("Ext1RecordId[%c]", mailbox->Ext1RecordId);
6859 printf("**********************************************************");
6862 case TAPI_EVENT_SIM_SET_MAILBOX_CNF:
6863 printf("*********NEW*TAPI_EVENT_SIM_SET_MAILBOX_CNF************");
6864 printf("update event status = [0x%x]", status);
6865 printf("**********************************************************");
6871 @defgroup Use_Cases5_22 SIM Indication Status EFs management
6872 @ingroup Use_Cases5_NETWORK
6876 <h3 class="pg">SIM Indication Status EFs management</h3>
6877 These APIs are used to get and set the message indication status stored in SIM.
6880 int tel_get_sim_indicator_info(TelSimIndicationStatusType_t type, int *req_id);
6881 int tel_set_sim_indicator_info(const TelSimIndicationStatusData_t *update_data, int *req_id);
6884 SAMPLE CODE: READ / UPDATE INDICATION STATUS DATA
6886 #include <ITapiSim.h>
6888 #include "TapiCommon.h"
6890 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
6892 // OPERATION REQUEST READ SIM MESSAGE WAITING INDICATION STATUS INFO PART
6893 void read_sim_mwis()
6898 TelSimIndicationStatusType_t type = 0x00;
6900 type = TAPI_SIM_INDICATION_MW;
6902 err_code = tel_get_sim_indicator_info(type, &request_id);
6903 if (err_code != TAPI_API_SUCCESS)
6905 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6907 // WAIT EVENT RESPONSE FROM HERE
6910 // OPERATION REQUEST UPDATE SIM MESSAGE WAITING INDICATION STATUS INFO PART
6911 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
6913 void update_sim_mwis()
6918 TelSimIndicationStatusType_t type = 0x00;
6919 TelSimIndicationStatusData_t update_data;
6920 memset(&update_data, 0x00, sizeof(TelSimIndicationStatusData_t));
6922 type = TAPI_SIM_INDICATION_MW;
6924 update_data.requested_type = type;
6925 update_data.data.Mwis.VoiceMailCount = 1; // VoiceMail Count
6926 update_data.data.Mwis.FaxCount = 2; // Fax Count
6927 update_data.data.Mwis.EmailCount = 3; // Email Count
6928 update_data.data.Mwis.OtherCount = 4; // Other Count
6929 update_data.data.Mwis.VideoMailCount = 5; // VideoMail Count
6931 err_code = tel_set_sim_indicator_info(&update_data, &request_id);
6932 if (err_code != TAPI_API_SUCCESS)
6934 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6936 // WAIT EVENT RESPONSE FROM HERE
6940 // EVENT RESPONSE PART
6941 //CALLBACK FUNCTION TO BE USED
6942 static void app_callback (TelTapiEvent_t *event)
6948 void* EventData = NULL;
6950 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event;
6952 unsigned int temp_handle = -1;
6954 eventClass = event->EventClass;
6955 eventType = event->EventType;
6956 requestId = event->RequestId;
6957 status = event->Status;
6958 EventData = event->pData;
6962 case TAPI_EVENT_SIM_GET_INDICATION_CNF:
6963 TelSimIndicationStatusData_t* indi_data = (TelSimIndicationStatusData_t*)EventData;
6965 printf("*******TAPI_EVENT_SIM_GET_INDICATION_CNF**********");
6966 printf("Read event status = [0x%x]", status);
6968 if (indi_data->requested_type == TAPI_SIM_INDICATION_MW)
6970 printf("**********MWIS************");
6971 printf("IndicatorType[%d]", indi_data->data.Mwis.IndicatorType);
6972 printf("VoiceMailCount[%d]", indi_data->data.Mwis.VoiceMailCount);
6973 printf("FaxCount[%d]", indi_data->data.Mwis.FaxCount);
6974 printf("EmailCount[%d]", indi_data->data.Mwis.EmailCount);
6975 printf("OtherCount[%d]", indi_data->data.Mwis.OtherCount);
6976 printf("VideoMailCount[%d]", indi_data->data.Mwis.VideoMailCount);
6978 else if (indi_data->requested_type == TAPI_SIM_INDICATION_CF)
6980 printf("**********CFIS************");
6981 printf("bUsed[%d]", indi_data->data.Cfis.bUsed);
6982 printf("MspNumber[%d]", indi_data->data.Cfis.MspNumber);
6983 printf("Status[%d]", indi_data->data.Cfis.Status);
6984 printf("DiallingnumLen[%d]", indi_data->data.Cfis.DiallingnumLen);
6985 printf("TypeOfNumber[%d]", indi_data->data.Cfis.TypeOfNumber);
6986 printf("NumberingPlanIdent[%d]", indi_data->data.Cfis.NumberingPlanIdent);
6987 printf("DiallingNum[%s]", indi_data->data.Cfis.DiallingNum);
6988 printf("CapaConfig2Id[%d]", indi_data->data.Cfis.CapaConfig2Id);
6989 printf("Ext7RecordId[%d]", indi_data->data.Cfis.Ext7RecordId);
6993 printf("Unhandled indication status type[%d]",indi_data->requested_type );
6995 printf("************************************************");
6998 case TAPI_EVENT_SIM_SET_INDICATION_CNF:
6999 printf("******TAPI_EVENT_SIM_SET_INDICATION_CNF*******");
7000 printf("update event status = [0x%x]", status);
7001 printf("**********************************************");
7007 @defgroup Use_Cases5_23 Phone Book
7008 @ingroup Use_Cases5_NETWORK
7012 <h3 class="pg">Phone Book</h3>
7013 <strong>[Note] Telephony Emulator does not support this feature.</strong>
7015 Telephony provides APIs for various phone book related features, such as getting total records in phone book, retrieving phone book entry information, reading, updating and deleting phone book information, getting first valid index.
7018 int tel_get_sim_pb_count(TelSimPbFileType_t pb_type, int* req_id);
7019 int tel_get_sim_pb_meta_info(TelSimPbFileType_t pb_type, int* req_id);
7020 int tel_read_sim_pb_record(TelSimPbFileType_t pb_type, unsigned short index, int *req_id );
7021 int tel_update_sim_pb_record(const TelSimPbRecordData_t *req_data, int *req_id );
7022 int tel_delete_sim_pb_record(TelSimPbFileType_t pb_type, unsigned short index, int *req_id );
7023 int tel_get_sim_pb_init_info(int *init_completed, TelSimPbList_t *pb_list, int *first_index );
7026 SAMPLE CODE FOR GETTING STORAGE COUNT
7028 #include <ITapiSim.h>
7030 #include "TapiCommon.h"
7032 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7033 void getstoragecount()
7036 TelSimPbFileType_t StorageFileType = TAPI_SIM_PB_LDN;
7039 ret_status = tel_get_sim_pb_count (StorageFileType, &pRequestId);
7040 if (ret_status == TAPI_API_SUCCESS)
7041 printf("successful\n");
7043 printf("error=%d\n", ret_status);
7045 //WAIT FOR EVENT HERE
7047 //CALLBACK FUNCTION TO BE USED
7048 static void app_callback (TelTapiEvent_t *event)
7054 void* EventData = NULL;
7056 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7058 unsigned int temp_handle = -1;
7060 eventClass = event->EventClass;
7061 eventType = event->EventType;
7062 requestId = event->RequestId;
7063 status = event->Status;
7064 EventData = event->pData;
7068 case TAPI_EVENT_SIM_PB_STORAGE_COUNT_CNF:
7069 printf("TAPI_EVENT_SIM_PB_STORAGE_COUNT_CNF");
7075 SAMPLE CODE TO GET PHONE BOOK ENTRY INFO
7077 #include <ITapiSim.h>
7079 #include "TapiCommon.h"
7081 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
7082 void getPBEntryInfo()
7085 TelSimPbFileType_t StorageFileType = TAPI_SIM_PB_FDN;
7088 ret_status = tel_get_sim_pb_meta_info (StorageFileType, &pRequestId);
7089 if (ret _status == TAPI_API_SUCCESS)
7090 printf(successful\n);
7092 printf(error=%d\n, ret_status);
7093 //WAIT FOR EVENT HERE
7095 //CALLBACK FUNCTION TO BE USED
7096 static void app_callback (TelTapiEvent_t *event)
7102 void* EventData = NULL;
7104 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event;
7106 unsigned int temp_handle = -1;
7107 eventClass = event->EventClass;
7108 eventType = event->EventType;
7109 requestId = event->RequestId;
7110 status = event->Status;
7111 EventData = event->pData;
7113 switch (EventType) {
7114 case TAPI_EVENT_SIM_PB_ENTRY_INFO_CNF:
7115 TelSimPbEntryInfo_t *entryInfo = (TelSimPbEntryInfo_t*)sim_event->pData ;
7116 printf("SIM PB entry info event status = [%x]\n", sim_event->Status);
7117 printf("[SIM APP]STORAGE TYPE [%d]\n", entryInfo->StorageFileType);
7118 printf("[SIM APP]PB_INDEX_MIN %d\n", entryInfo->PbIndexMin);
7119 printf("[SIM APP]PB_INDEX_MAX = %d\n", entryInfo->PbIndexMax);
7120 printf("[SIM APP]PB_NUM_LEN_MAX = %d\n", entryInfo->PbNumLenMax);
7121 printf("[SIM APP]PB_TEXT_LEN_MAX = %d\n", entryInfo->PbTextLenMax);
7122 printf("********************************************\n");
7128 SAMPLE CODE FOR READING RECORD
7130 #include <ITapiSim.h>
7132 #include "TapiCommon.h"
7134 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7135 void simreadrecord()
7138 TelSimPbFileType_t StorageFileType = TAPI_SIM_PB_FDN;
7139 unsigned short Index = 4;
7142 ret_status = tel_read_sim_pb_record (StorageFileType,Index, &pRequestId);
7143 if (ret_status == TAPI_API_SUCCESS)
7144 printf(successful\n);
7146 printf(error=%d\n, ret_status);
7148 //WAIT FOR EVENT HERE
7150 //CALLBACK FUNCTION TO BE USED
7151 static void app_callback (TelTapiEvent_t *event)
7157 void* EventData = NULL;
7159 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7161 unsigned int temp_handle = -1;
7162 eventClass = event->EventClass;
7163 eventType = event->EventType;
7164 requestId = event->RequestId;
7165 status = event->Status;
7166 EventData = event->pData;
7168 switch (eventType) {
7169 case TAPI TAPI_EVENT_SIM_PB_ACCESS_READ_CNF:
7170 printf("TAPI_EVENT_SIM_PB_ACCESS_READ_CNF");
7178 SAMPLE CODE FOR UPDATING RECORD
7180 #include <ITapiSim.h>
7182 #include "TapiCommon.h"
7184 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7185 void simupdaterecord()
7188 TelSimPbRecordData_t pb_add;
7189 pb_add.StorageFileType = TAPI_SIM_PB_GAS;
7194 ret_status = tel_update_sim_pb_record (&pb_add, &pRequestId);
7196 //WAIT FOR EVENT HERE
7198 //CALLBACK FUNCTION TO BE USED
7199 static void app_callback (TelTapiEvent_t *event)
7205 void* EventData = NULL;
7207 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7209 unsigned int temp_handle = -1;
7211 eventClass = event->EventClass;
7212 eventType = event->EventType;
7213 requestId = event->RequestId;
7214 status = event->Status;
7215 EventData = event->pData;
7219 case TAPI_EVENT_SIM_PB_UPDATE_CNF:
7220 printf("TAPI_EVENT_SIM_PB_UPDATE_CNF");
7227 SAMPLE CODE FOR DELETING RECORD
7229 #include <ITapiSim.h>
7231 #include "TapiCommon.h"
7233 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7234 void contactdelete()
7238 TelSimPbFileType_t StorageFileType = TAPI_SIM_PB_3GSIM;
7239 unsigned short RecordIndex = 1;
7242 ret_status = tel_delete_sim_pb_record (StorageFileType, RecordIndex, &pRequestId);
7243 }//WAIT FOR EVENT HERE
7245 //CALLBACK FUNCTION TO BE USED
7246 static void app_callback (TelTapiEvent_t *event)
7252 void* EventData = NULL;
7254 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7256 unsigned int temp_handle = -1;
7258 eventClass = event->EventClass;
7259 eventType = event->EventType;
7260 requestId = event->RequestId;
7261 status = event->Status;
7262 EventData = event->pData;
7266 case TAPI_EVENT_SIM_PB_DELETE_CNF:
7267 printf(TAPI_EVENT_SIM_PB_DELETE_CNF);
7274 SAMPLE CODE FOR GETTING PHONEBOOK INIT INFO
7276 #include <ITapiSim.h>
7278 #include "TapiCommon.h"
7280 // OPERATION REQUEST GET SIM PHONEBOOK INIT STATUS PART
7281 void get_sim_phonebook_init_status()
7283 int valid_index = 0;
7284 TelSimPbList_t pb_list;
7285 int pPbInitCompleted = 0;
7287 err_code = tel_get_sim_pb_init_info(&pPbInitCompleted, &pb_list, &valid_index);
7288 if (err_code == TAPI_API_SUCCESS)
7290 if (pPbInitCompleted == 0)
7292 printf(" SIM PB INIT NOT completed ");
7296 printf("SIM PB INIT completed");
7297 // if no sim records at all then valid_index = 0xFF
7298 printf ("ADN First index is [%d]",valid_index);
7299 printf ("SIM phone book storage list Information ");
7300 printf ("********************************************");
7301 printf ("pb_list.b_fdn[%d]",pb_list.b_fdn);
7302 printf ("pb_list.b_msisdn[%d]",pb_list.b_msisdn);
7303 printf ("pb_list.b_adn[%d]",pb_list.b_adn);
7304 printf ("pb_list.b_sdn[%d]",pb_list.b_sdn);
7305 printf ("pb_list.b_3g[%d]",pb_list.b_3g);
7306 printf ("pb_list.b_aas[%d]",pb_list.b_aas);
7307 printf ("pb_list.b_gas[%d]",pb_list.b_gas);
7312 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
7317 @defgroup Use_Cases5_24 Getting 3G Phone Book Information
7318 @ingroup Use_Cases5_NETWORK
7322 <h3 class="pg">Getting 3G Phone Book Information</h3>
7323 <strong>[Note] Telephony Emulator does not support this feature.</strong>
7325 Telephony provides APIs to retrieve SIM EFs supported by 3G phone , such as ANR, SNE, GRP, EMAIL etc and corresponding EFs max text length, number length and size.
7328 int tel_get_sim_pb_3g_meta_info(int *req_id);
7333 #include <ITapiSim.h>
7335 #include "TapiCommon.h"
7337 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7338 void get3gcapainfo()
7343 ret_status = tel_get_sim_pb_3g_meta_info (&req_id);
7345 //WAIT FOR EVENT HERE
7347 //CALLBACK FUNCTION TO BE USED
7348 static void app_callback (TelTapiEvent_t *event)
7354 void* EventData = NULL;
7356 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7358 unsigned int temp_handle = -1;
7360 eventClass = event->EventClass;
7361 eventType = event->EventType;
7362 requestId = event->RequestId;
7363 status = event->Status;
7364 EventData = event->pData;
7366 switch (eventType) {
7367 case TAPI_EVENT_SIM_PB_CAPABILITY_INFO_CNF:
7368 printf("[SIM APP]SIM PB Capability Info event status = [%x]\n", sim_event->Status);
7369 TelSimPbCapabilityInfo_t *sim_capability_info = (TelSimPbCapabilityInfo_t*)sim_event->pData;
7371 for (i=0; i<sim_capability_info->FileTypeCount; i++)
7373 printf(" [SIM APP]Filed tag type[%d]", sim_capability_info->FileTypeInfo[i].FileType3G);
7374 printf(" [SIM APP]max index [%d]\n", sim_capability_info->FileTypeInfo[i].PbIndexMax);
7375 printf(" [SIM APP]max text [%d]\n", sim_capability_info->FileTypeInfo[i].PbTextMax);
7376 printf(" [SIM APP]used count [%d]\n", sim_capability_info->FileTypeInfo[i].TotalRecordCount);
7385 @defgroup Use_Cases5_25 SAP (Sim access Profile) features
7386 @ingroup Use_Cases5_NETWORK
7389 <h3 class="pg">SAP (Sim access Profile) features</h3>
7390 <strong>[Note] Telephony Emulator does not support this feature.</strong>
7392 The SIM Access Profile defines the protocols and procedures that shall be used to access data and services of GSM SIM card, a UICC card or a R-UIM card via a Bluetooth link.
7394 The SIM Access Profile specifies the following features:
7395 - Connection Management
7399 - Transfer Card Reader Status
7400 - Set Transport Protocol
7402 <h4>Connection Management:</h4>
7403 An established SIM Access Profile connection is the prerequisite for all other features.
7404 Telephony exposes APIs to make a connection request to SIM and to get connection status information.
7407 int tel_req_sap_connection( TelSimSapConnect_t *req_data, int *req_id);
7408 int tel_req_sap_connection_status( int *req_id);
7413 #include <ITapiSim.h>
7415 #include "TapiCommon.h"
7416 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7417 void sapconnectreq()
7420 TelSimSapConnect_t pConnectionReq;
7423 pConnectionReq.MsgId = TAPI_SIM_SAP_CONNECT_REQ;
7424 pConnectionReq.MaxMsgSize = 10; //temp for testing only - not clear
7426 ret_status = tel_req_sap_connection (&pConnectionReq, &pRequestId);
7427 if (ret_status == TAPI_API_SUCCESS)
7428 printf("successful\n");
7430 printf("error=%d\n", ret_status);
7432 //WAIT FOR EVENT HERE
7434 //CALLBACK FUNCTION TO BE USED
7435 static void app_callback (TelTapiEvent_t *event)
7441 void* EventData = NULL;
7443 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7445 unsigned int temp_handle = -1;
7447 eventClass = event->EventClass;
7448 eventType = event->EventType;
7449 requestId = event->RequestId;
7450 status = event->Status;
7451 EventData = event->pData;
7455 case TAPI_SIM_EVENT_SAP_CONNECT_CNF:
7456 printf("TAPI_SIM_EVENT_SAP_CONNECT_CNF");
7463 void sapconnectstatusreq()
7466 int ret_status = tel_req_sap_connection_status (&request_id);
7467 if (ret_status == TAPI_API_SUCCESS)
7468 printf("successful\n");
7470 printf("error=%d\n", ret_status);
7472 //WAIT FOR EVENT HERE
7474 //CALLBACK FUNCTION TO BE USED
7476 static void app_callback (TelTapiEvent_t *event)
7482 void* EventData = NULL;
7484 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7486 unsigned int temp_handle = -1;
7487 eventClass = event->EventClass;
7488 eventType = event->EventType;
7489 requestId = event->RequestId;
7490 status = event->Status;
7491 EventData = event->pData;
7495 case TAPI_SIM_EVENT_SAP_CONNECT_STATUS_CNF:
7496 printf("TAPI_SIM_EVENT_SAP_CONNECT_STATUS_CNF");
7503 <h4>Transfer APDU:</h4>
7504 The ability to send APDUs (Application Protocol Data Units) over the Bluetooth link
7505 @n Telephony provides API to transfer APDU to sim.
7508 int tel_req_sap_transfer_apdu(TelSimSapApduData_t *apdu_data, int *req_id);
7513 #include <ITapiSim.h>
7515 #include "TapiCommon.h"
7517 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7518 void saptransferapdu()
7521 int file_id = TAPI_SIM_EFILE_ICCID;
7523 // for selecting EF ICCID
7524 TelSimSapApduData_t apdu_data;
7527 apdu_data.ApduLength = 7;
7528 apdu_data.Apdu[0] = 0xA0; // class
7529 apdu_data.Apdu[1] = 0xA4; // instruction
7530 apdu_data.Apdu[2] = 0; // p1 = parameter 1
7531 apdu_data.Apdu[3] = 0; // p2 = parameter 2
7532 apdu_data.Apdu[4] = 2; // p3 - parameter 3
7534 memcpy(&apdu_data.Apdu[5], &file_id, sizeof(unsigned short));
7535 err_code = tel_req_sap_transfer_apdu (&apdu_data, NULL);
7536 if (err_code == TAPI_API_SUCCESS)
7537 printf("successful\n");
7539 printf("error=%d\n", err_code);
7541 //WAIT FOR EVENT HERE
7542 //CALLBACK FUNCTION TO BE USED
7543 static void app_callback (TelTapiEvent_t *event)
7549 void* EventData = NULL;
7551 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7553 unsigned int temp_handle = -1;
7555 eventClass = event->EventClass;
7556 eventType = event->EventType;
7557 requestId = event->RequestId;
7558 status = event->Status;
7559 EventData = event->pData;
7563 case TAPI_SIM_EVENT_SAP_TRANSFER_APDU_CNF:
7564 printf("TAPI_SIM_EVENT_SAP_TRANSFER_APDU_CNF");
7570 <h4>Transfer ATR:</h4>
7571 The ability to send the content of the ATR (Answer to Reset) from the Server to the Client over the Bluetooth link. It contains information about the interface provided by the subscription module and the services on the GSM SIM, the UICC or the R-UIM.
7574 int tel_req_sap_transfer_atr( int *req_id);
7579 #include <ITapiSim.h>
7581 #include "TapiCommon.h"
7583 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7584 void saptransferatrreq()
7589 ret_status = tel_req_sap_transfer_atr (&pRequestId);
7590 if (ret_status == TAPI_API_SUCCESS)
7591 printf("successful\n");
7593 printf("error=%d\n", ret_status);
7595 //WAIT FOR EVENT HERE
7597 //CALLBACK FUNCTION TO BE USED
7598 static void app_callback (TelTapiEvent_t *event)
7604 void* EventData = NULL;
7606 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7608 unsigned int temp_handle = -1;
7610 eventClass = event->EventClass;
7611 eventType = event->EventType;
7612 requestId = event->RequestId;
7613 status = event->Status;
7614 EventData = event->pData;
7618 case TAPI_SIM_EVENT_SAP_TRANSFER_ATR_CNF:
7619 printf("TAPI_SIM_EVENT_SAP_TRANSFER_ATR_CNF");
7626 <h4>Power sim on/off:</h4>
7627 The ability to power the subscription module on/off remotely.
7630 int tel_req_sap_power_operation(TelSimSapMsgId_t req_data, int *req_id );
7635 #include <ITapiSim.h>
7637 #include "TapiCommon.h"
7639 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7643 TelSimSapMsgId_t MsgId = TAPI_SIM_SAP_CONNECT_REQ;
7646 ret_status = tel_req_sap_power_operation (MsgId, &pRequestId);
7647 if (ret_status == TAPI_API_SUCCESS)
7648 printf("successful\n");
7650 printf("error=%d\n", ret_status);
7652 //WAIT FOR EVENT HERE
7654 //CALLBACK FUNCTION TO BE USED
7655 static void app_callback (TelTapiEvent_t *event)
7661 void* EventData = NULL;
7663 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7665 unsigned int temp_handle = -1;
7667 eventClass = event->EventClass;
7668 eventType = event->EventType;
7669 requestId = event->RequestId;
7670 status = event->Status;
7671 EventData = event->pData;
7676 case TAPI_SIM_EVENT_SAP_SET_SIM_POWER_CNF:
7677 printf("TAPI_SIM_EVENT_SAP_SET_SIM_POWER_CNF");
7684 <h4>Transfer Card Reader Status:</h4>
7685 The card reader status contains some basic information about the Card Reader and the subscription module (e.g. the size of the SIM or if the SIM is removable).
7688 int tel_req_sap_cardreader_status(int *req_id);
7693 #include <ITapiSim.h>
7695 #include "TapiCommon.h"
7697 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7698 void simsapcardreaderstatus()
7703 ret_status = tel_req_sap_cardreader_status (&pRequestId);
7704 if (ret_status == TAPI_API_SUCCESS)
7705 printf("successful\n");
7707 printf("error=%d\n", ret_status);
7709 //WAIT FOR EVENT HERE
7711 //CALLBACK FUNCTION TO BE USED
7712 static void app_callback (TelTapiEvent_t *event)
7718 void* EventData = NULL;
7720 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7722 unsigned int temp_handle = -1;
7724 eventClass = event->EventClass;
7725 eventType = event->EventType;
7726 requestId = event->RequestId;
7727 status = event->Status;
7728 EventData = event->pData;
7733 case TAPI_SIM_EVENT_SAP_CARD_READER_STATUS_CNF:
7734 printf("TAPI_SIM_EVENT_SAP_CARD_READER_STATUS_CNF");
7741 <h4>Set Transport Protocol:</h4>
7742 The server shall reset the subscription module and switch to the desired protocol if supported by subscription module and Server.
7745 int tel_req_sap_transport_protocol(TelSimSapProtocol_t protocol, int *req_id);
7750 #include <ITapiSim.h>
7752 #include "TapiCommon.h"
7754 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7755 void sapsettransportprotocol()
7758 TelSimSapProtocol_t Protocol = TAPI_SIM_SAP_PROTOCOL_T0;
7761 ret_status = tel_req_sap_transport_protocol (Protocol, &pRequestId);
7762 if (ret_status == TAPI_API_SUCCESS)
7763 printf("successful\n");
7765 printf("error=%d\n", ret_status);
7767 //WAIT FOR EVENT HERE
7769 //CALLBACK FUNCTION TO BE USED
7770 static void app_callback (TelTapiEvent_t *event)
7776 void* EventData = NULL;
7778 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7780 unsigned int temp_handle = -1;
7782 eventClass = event->EventClass;
7783 eventType = event->EventType;
7784 requestId = event->RequestId;
7785 status = event->Status;
7786 EventData = event->pData;
7790 case TAPI_SIM_EVENT_SAP_SET_PROTOCOL_CNF:
7791 printf("TAPI_SIM_EVENT_SAP_SET_PROTOCOL_CNF");
7798 @defgroup Use_Cases5_26 ISIM Features
7799 @ingroup Use_Cases5_NETWORK
7803 <h3 class="pg">ISIM Features</h3>
7804 <strong>[Note] Telephony Emulator does not support this feature.</strong>
7807 int tel_req_sim_authentication( TelSimAuthenticationData_t *authentication_data, int *req_id);
7810 Application uses this API to send the ISIM authentication request to telephony.
7814 #include <ITapiSim.h>
7816 #include "TapiCommon.h"
7818 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7822 TelSimAuthenticationData_t authenticationData;
7823 authenticationData.rand_length = 100;
7824 authenticationData.rand_length = 100;
7825 authenticationData.rand_data = "test data";
7826 authenticationData.autn_data = "test data";
7829 ret_status = tel_req_sim_authentication (&authenticationData, &pRequestId);
7830 if (ret_status == TAPI_API_SUCCESS)
7831 printf("successful\n");
7833 printf("error=%d\n", ret_status);
7835 //WAIT FOR EVENT HERE
7837 //CALLBACK FUNCTION TO BE USED
7838 static void app_callback (TelTapiEvent_t *event)
7844 void* EventData = NULL;
7846 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7848 unsigned int temp_handle = -1;
7850 eventClass = event->EventClass;
7851 eventType = event->EventType;
7852 requestId = event->RequestId;
7853 status = event->Status;
7854 EventData = event->pData;
7858 case TAPI_EVENT_SIM_AUTHENTICATION_CNF:
7859 printf("TAPI_EVENT_SIM_AUTHENTICATION_CNF");
7866 @defgroup Use_Cases5_27 SIM NOTIFICATION MESSAGE
7867 @ingroup Use_Cases5_NETWORK
7871 <h3 class="pg">SIM NOTIFICATION MESSAGE </h3>
7872 These are not APIs, but EVENTs from the low layer. User can receive the following events:
7874 TAPI_EVENT_SIM_STATUS_IND
7875 TAPI_EVENT_SIM_FDN_STATUS_IND
7878 Application uses this event as follows.
7881 #include <ITapiSim.h>
7883 #include "TapiCommon.h"
7885 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7887 //CALLBACK FUNCTION TO BE USED
7888 static void app_callback (TelTapiEvent_t *event)
7894 void* EventData = NULL;
7896 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7898 unsigned int temp_handle = -1;
7900 eventClass = event->EventClass;
7901 eventType = event->EventType;
7902 requestId = event->RequestId;
7903 status = event->Status;
7904 EventData = event->pData;
7908 case TAPI_EVENT_SIM_STATUS_IND:
7909 printf("***********TAPI_EVENT_SIM_STATUS_IND**************");
7911 if (status == TAPI_SIM_STATUS_CARD_ERROR)
7913 printf("SIM CARD ERROR");
7915 else if (status == TAPI_SIM_STATUS_CARD_NOT_PRESENT)
7917 printf("SIM CARD NOT INSERTED");
7919 else if (status == TAPI_SIM_STATUS_SIM_INITIALIZING)
7921 printf("SIM INITITIALIZING");
7923 else if (status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED)
7925 printf("SIM INIT COMPLETED");
7927 else if (status == TAPI_SIM_STATUS_SIM_PIN_REQUIRED)
7929 printf("SIM PIN REQUIRED");
7931 else if (status == TAPI_SIM_STATUS_SIM_PUK_REQUIRED)
7933 printf("SIM PUK REQUIRED");
7935 else if (status == TAPI_SIM_STATUS_CARD_BLOCKED)
7937 printf("SIM CARD BLOCKED");
7939 printf("********************************************");
7942 case TAPI_EVENT_SIM_FDN_STATUS_IND:
7943 printf("*********TAPI_EVENT_SIM_FDN_STATUS_IND***********");
7944 printf("SIM FDN status event status = [0x%x]", status);
7945 printf("********************************************");
7953 <h2 class="pg">SOUND</h2>
7954 <strong>[Note] Telephony Emulator does not support this feature.</strong>
7955 These APIs provide the interface for configuring sound related parameters.
7957 @defgroup Use_Cases6_1 Event Register and Deregister
7958 @ingroup Use_Cases6_SOUND
7962 <h3 class="pg">Event Register and Deregister </h3>
7963 To receive asynchronous event notifications for the Sound APIs, the registration of related events with their associated call backs is required. When an asynchronous API is called, the confirmation is returned as an asynchronous event notification which invokes the callback function along with the event data.
7968 unsigned int subscription_id = 0;
7971 api_err = tel_init ();
7972 if (api_err != TAPI_API_SUCCESS)
7974 TEST_DEBUG("tel_init Failed - api_err = %d \n", api_err);
7977 api_err = tel_register_event (TAPI_EVENT_SOUND_VOLUMECTRL_CNF, &subscription_id, (TelAppCallback)&app_callback);
7978 printf("VSOUND Event registration is Done: sub id is %d, api_err is %d\n",subscription_id,api_err);
7980 tel_register_app_name("com.samsung.appname");
7983 api_err = tel_deregister_event (subscription_id);
7984 if (api_err != TAPI_API_SUCCESS)
7986 printf("Event Class Deregestration Fail\n");
7990 The main features provided by the Sound APIs include setting the volume,voice path and user configuration such as minute alert,Service change,Connet tone, Disconnect Tone...etc.
7992 @defgroup Use_Cases6_2 Voice path control
7993 @ingroup Use_Cases6_SOUND
7997 <h3 class="pg">Voice path control</h3>
7998 This API provides an interface for controlling voice path via application.
8001 int tel_set_sound_path (tapi_sound_audio_path_t vc_path, int *pRequestId);
8004 <strong>This API is permitted for Samsung in-house applications only</strong>
8006 @defgroup Use_Cases6_3 Volume control
8007 @ingroup Use_Cases6_SOUND
8011 <h3 class="pg">Volume control</h3>
8012 These APIs provide interfaces for controlling volume via application.
8015 int tel_set_sound_volume_info (tapi_sound_volume_control_t vol_control, int *pRequestId);
8016 int tel_get_sound_volume_info (tapi_sound_volume_type_t vol_control, int *pRequestId);
8019 <strong>This API is permitted for Samsung in-house applications only</strong>
8021 @defgroup Use_Cases6_4 Mic mute control
8022 @ingroup Use_Cases6_SOUND
8026 <h3 class="pg">Mic mute control</h3>
8027 This API provides an interface for mute/unmute mic via application.
8030 int tel_set_sound_mute_status(tapi_sound_mic_mute_t micmute_set, int * pRequestId);
8033 <strong>This API is permitted for Samsung in-house applications only</strong>
8038 #include <TapiCommon.h>
8039 #include <ITapiSound.h>
8041 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
8044 void vol_controlset()
8048 tapi_sound_volume_control_t vol_control;
8050 vol_control.volume = TAPI_SOUND_VOLUME_LEVEL_3;
8051 vol_control.vol_type = TAPI_SOUND_VOL_VOICE;
8053 ret_val = tel_set_sound_volume_info(vol_control, &requestId);
8054 if (ret_val == TAPI_API_SUCCESS)
8055 printf("successful\n");
8057 printf("error=%d\n", ret_val);
8058 //WAIT FOR EVENT HERE
8060 void vol_controlget()
8064 api_sound_volume_type_t vol_type;
8065 vol_type = TAPI_SOUND_VOL_VOICE;
8067 ret_val = tel_get_sound_volume_info (vol_type, &requestId);
8068 if (ret_val == TAPI_API_SUCCESS)
8069 printf("successful\n");
8071 printf("error=%d\n", ret_val);
8072 //WAIT FOR EVENT HERE
8075 //VOICE PATH AND USER CONFIGURATION
8081 tapi_sound_audio_path_t vc_path;
8083 vc_path = TAPI_SOUND_HANDSET;
8085 ret_val = tel_set_sound_path (vc_path, &requestId);
8086 if (ret_val == TAPI_API_SUCCESS)
8087 printf("successful\n");
8089 printf("error=%d\n", ret_status);
8090 //WAIT FOR EVENT HERE
8094 //USER CONFIGURATION
8095 void usr_configset()
8099 tapi_sound_user_sound_mask_t snd_mask;
8100 tapi_sound_user_sound_value_t snd_value;
8102 snd_mask = TAPI_SOUND_USER_MASK_ONE_MIN_ALERT;
8103 snd_value = TAPI_SOUND_ON;
8104 printf("tapi_sound_usr_configuration_set\n");
8105 ret_val = tapi_sound_usr_configuration_set(snd_mask,snd_value, &requestId);
8106 if (ret_val == TAPI_API_SUCCESS)
8107 printf("successful\n");
8109 printf("error=%d\n", ret_status);
8110 //WAIT FOR EVENT HERE
8113 void usr_configget()
8116 tapi_sound_user_sound_mask_t snd_mask;
8118 snd_mask = TAPI_SOUND_USER_MASK_SERVICE_CHANGE_ALERT;
8119 printf("tel_get_sound_mute_status \n");
8120 ret_val = tel_get_sound_mute_status(snd_mask, &requestId);
8121 if (ret_val == TAPI_API_SUCCESS)
8122 printf("successful\n");
8124 printf("error=%d\n", ret_status);
8125 //WAIT FOR EVENT HERE
8129 void micmute_controlset()
8132 tapi_sound_mic_mute_t set_micmute;
8134 set_micmute = TAPI_SOUND_MIC_MUTE;
8136 printf(" tel_set_sound_mute_status \n");
8137 ret_val = tel_set_sound_mute_status (set_micmute, &requestId);
8138 if (ret_val == TAPI_API_SUCCESS)
8139 printf("successful\n");
8141 printf("error=%d\n", ret_status);
8142 //WAIT FOR EVENT HERE
8146 //CALL BACK TO BE USED
8147 static void app_callback (TelTapiEvent_t *event)
8153 void* EventData = NULL;
8155 unsigned int temp_handle = -1;
8157 eventClass = event->EventClass;
8158 eventType = event->EventType;
8159 requestId = event->RequestId;
8160 status = event->Status;
8161 EventData = event->pData;
8163 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
8167 //TEST_DEBUG("******This is nonzero status. ******\n");
8174 case TAPI_EVENT_CLASS_SOUND:
8177 case TAPI_EVENT_SOUND_VOLUMECTRL_RSP :
8178 printf("*** TAPI_EVENT_SOUND_VOLUMECTRL_RSP received : %x ****\n", eventType);
8179 tapi_sound_volumn_ctrl_res vlm_ctrl_info;
8182 memcpy(&vlm_ctrl_info, event->pData,
8183 sizeof(tapi_sound_volumn_ctrl_res));
8186 case TAPI_EVENT_SOUND_AUDIOPATHCTRL_NOTI:
8187 tapi_sound_audio_path_t AudioPath = 0;
8188 int OldSndOutPath = MM_SOUND_PATH_NONE;
8189 AudioPath = *((tapi_sound_audio_path_t *)(event->pData));
8190 printf("*** TAPI_EVENT_SOUND_AUDIOPATHCTRL_NOTI received : %x ****\n", eventType);
8193 case TAPI_EVENT_SOUND_AUDIOSOURCECTRL_NOTI:
8194 tapi_sound_audio_source_type_t *pAudioSrcCtrl = NULL;
8195 pAudioSrcCtrl = (tapi_sound_audio_source_type_t*)(event->pData);
8196 printf("*** TAPI_EVENT_SOUND_AUDIOSOURCECTRL_NOTI received : %x ****\n", eventType);
8199 case TAPI_EVENT_SOUND_ERROR_IND:
8200 tapi_phone_err_t errorCause;
8201 errorCause = *(( tapi_phone_err_t *)(event->pData));
8202 printf("*** TAPI_EVENT_SOUND_ERROR_IND received : %x ****\n", eventType);
8205 case TAPI_EVENT_SOUND_MICMUTECTRL_RSP:
8206 tapi_sound_mic_mute_t *mute_status = NULL;
8207 mute_status = (tapi_sound_audio_source_type_t*)(event->pData);
8209 printf("*** TAPI_EVENT_SOUND_MICMUTECTRL_RSP received : %x ****\n", eventType);
8213 printf("*** Default Event %x ****\n", eventType);
8220 printf("*** Other TAPI EVENT received : class : %x ****\n", eventClass);
8228 <h2 class="pg">SAT (SIM Application Toolkit)</h2>
8229 @defgroup Use_Cases7_1 Event register and deregister
8230 @ingroup Use_Cases7_SAT
8233 <h3 class="pg">Event register and deregister</h3>
8234 To receive asynchronous event notifications for SAT APIs, the registration of related events with their associated call backs is required. When an asynchronous API is called, the confirmation is returned as an asynchronous event notification which invokes the callback function along with the event data.
8239 unsigned int subscription_id = 0;
8242 api_err = tel_init();
8243 if (api_err != TAPI_API_SUCCESS)
8245 TEST_DEBUG("tel_init Failed - api_err = %d \n", api_err);
8248 api_err = tel_register_event(TAPI_EVENT_SAT_MENU_SELECTION_CNF, &subscription_id, (TelAppCallback)&app_callback);
8249 printf("SAT Event registration is Done: sub id is %d, api_err is %d\n",subscription_id,api_err);
8251 tel_register_app_name("com.samsung.appname");
8254 api_err = tel_deregister_event(subscription_id);
8255 if (api_err != TAPI_API_SUCCESS)
8257 printf("Event Class Unregeration Fail\n");
8260 api_err = tel_deinit();
8261 if (api_err != TAPI_API_SUCCESS)
8263 printf("tel_deinit Fail\n");
8266 static void app_callback(TelTapiEvent_t *event)
8268 //CALL BACK FUNTION TO BE CALLED
8269 switch (event->EventType)
8271 case TAPI_EVENT_SAT_DISPLAY_TEXT_IND:
8272 TelSatDisplayTextInd_t *event_data;
8273 event_data = (TelSatDisplayTextInd_t*)event->pData;
8275 case TAPI_EVENT_SAT_GET_INKEY_IND:
8276 TelSatGetInkeyIndInfo_t *event_data;
8277 event_data = (TelSatGetInkeyIndInfo_t *)event->pData;
8279 case TAPI_EVENT_SAT_GET_INPUT_IND:
8280 TelSatGetInputInd_t *event_data;
8281 event_data = (TelSatGetInputInd_t *)event->pData;
8284 case TAPI_EVENT_SAT_UI_PLAY_TONE_IND:
8285 TelSatPlayToneInd_t *event_data;
8286 event_data = (TelSatPlayToneInd_t *)event->pData;
8289 case TAPI_EVENT_SAT_PLAY_TONE_IND:
8290 TelSatPlayToneInd_t *event_data;
8291 event_data = (TelSatPlayToneInd_t *)event->pData;
8294 case TAPI_EVENT_SAT_UI_REFRESH_IND:
8295 TelSatRefreshIndUiInfo_t *event_data;
8296 event_data = (TelSatRefreshIndUiInfo_t *)event->pData;
8299 case TAPI_EVENT_SAT_SETUP_MENU_IND:
8300 TelSatSetupMenuInfo_t *event_data;
8301 event_data = (TelSatSetupMenuInfo_t *)event->pData;
8304 case TAPI_EVENT_SAT_UI_SETUP_MENU_IND:
8305 TelSatSetupMenuInfo_t *event_data;
8306 event_data = (TelSatSetupMenuInfo_t *)event->pData;
8309 case TAPI_EVENT_SAT_SELECT_ITEM_IND:
8310 TelSatSelectItemInd_t *event_data;
8311 event_data = (TelSatSelectItemInd_t *)event->pData;
8314 case TAPI_EVENT_SAT_UI_SEND_SMS_IND:
8315 TelSatSendSmsIndUiInfo_t *event_data;
8316 event_data = (TelSatSendSmsIndUiInfo_t *)event->pData;
8319 case TAPI_EVENT_SAT_UI_SEND_SS_IND:
8320 TelSatSendSsIndUiInfo_t *event_data;
8321 event_data = (TelSatSendSsIndUiInfo_t *)event->pData;
8324 case TAPI_EVENT_SAT_UI_SEND_USSD_IND:
8325 TelSatSendUssdIndUiInfo_t *event_data;
8326 event_data = (TelSatSendUssdIndUiInfo_t *)event->pData;
8329 case TAPI_EVENT_SAT_UI_SETUP_CALL_IND:
8330 TelSatSetupCallIndUiInfo_t *event_data;
8331 event_data = (TelSatSetupCallIndUiInfo_t *)event->pData;
8334 case TAPI_EVENT_SAT_PROVIDE_LOCAL_INFO_IND:
8335 TelSatProvideLocalInfoInd_t *event_data;
8336 event_data = (TelSatProvideLocalInfoInd_t *)event->pData;
8339 case TAPI_EVENT_SAT_SETUP_IDLE_MODE_TEXT_IND:
8340 TelSatSetupIdleModeTextInd_t *event_data;
8341 event_data = (TelSatSetupIdleModeTextInd_t *)event->pData;
8344 case TAPI_EVENT_SAT_UI_SEND_DTMF_IND:
8345 TelSatSendDtmfIndUiInfo_t *event_data;
8346 event_data = (TelSatSendDtmfIndUiInfo_t *)event->pData;
8349 case TAPI_EVENT_SAT_LANGUAGE_NOTIFICATION_IND:
8350 TelSatLanguageNotiInfoInd_t *event_data;
8351 event_data = (TelSatLanguageNotiInfoInd_t *)event->pData;
8354 case TAPI_EVENT_SAT_UI_LAUNCH_BROWSER_IND:
8355 TelSatLaunchBrowserIndUiInfo_t *event_data;
8356 event_data = (TelSatLaunchBrowserIndUiInfo_t *)event->pData;
8359 case TAPI_EVENT_SAT_END_PROACTIVE_SESSION_IND:
8360 TelSatEndProactiveSessionIndInfo_t *event_data;
8361 event_data = (TelSatEndProactiveSessionIndInfo_t *)event->pData;
8364 case TAPI_EVENT_SAT_MENU_SELECTION_CNF:
8365 TelSatEnvelopeResp_t *event_data;
8366 event_data = (TelSatEnvelopeResp_t *)event->pData;
8369 case TAPI_EVENT_SAT_CALL_CONTROL_IND:
8370 TelSatCallCtrlIndData_t *event_data;
8371 event_data = (TelSatCallCtrlIndData_t *)event->pData;
8374 case TAPI_EVENT_SAT_MO_SMS_CONTROL_IND:
8375 TelSatMoSmCtrlIndData_t *event_data;
8376 event_data = (TelSatMoSmCtrlIndData_t *)event->pData;
8379 case TAPI_EVENT_SAT_EVENT_DOWNLOAD_CNF:
8380 TelSatEnvelopeResp_t *event_data;
8381 event_data = (TelSatEnvelopeResp_t *)event->pData;
8384 case TAPI_EVENT_SAT_SMS_REFRESH_IND:
8385 case TAPI_EVENT_SAT_PB_REFRESH_IND:
8386 case TAPI_EVENT_SAT_IDLE_REFRESH_IND:
8387 TelSatRefreshInd_t *event_data;
8388 event_data = (TelSatRefreshInd_t *)event->pData;
8391 case TAPI_EVENT_SAT_SEND_SMS_IND:
8392 TelSatSendSmsIndSmsData_t *event_data;
8393 event_data = (TelSatSendSmsIndSmsData_t *)event->pData;
8396 case TAPI_EVENT_SAT_SETUP_CALL_IND:
8397 TelSatSetupCallIndCallData_t *event_data;
8398 event_data = (TelSatSetupCallIndCallData_t *)event->pData;
8401 case TAPI_EVENT_SAT_SEND_SS_IND:
8402 TelSatSendSsIndSsData_t *event_data;
8403 event_data = (TelSatSendSsIndSsData_t *)event->pData;
8406 case TAPI_EVENT_SAT_SEND_USSD_IND:
8407 TelSatSendUssdIndUssdData_t *event_data;
8408 event_data = (TelSatSendUssdIndUssdData_t *)event->pData;
8411 case TAPI_EVENT_SAT_SEND_DTMF_IND:
8412 TelSatSendDtmfIndDtmfData_t *event_data;
8413 event_data = (TelSatSendDtmfIndDtmfData_t *)event->pData;
8416 case TAPI_EVENT_SAT_LAUNCH_BROWSER_IND:
8417 TelSatLaunchBrowserIndBrowserData_t *event_data;
8418 event_data = (TelSatLaunchBrowserIndBrowserData_t *)event->pData;
8421 case TAPI_EVENT_SAT_END_OF_APP_EXEC_IND:
8422 TelSatProactiveCmdEndIndInfo_t *event_data;
8423 event_data = (TelSatProactiveCmdEndIndInfo_t *)event->pData;
8432 @defgroup Use_Cases7_2 Main Menu Information
8433 @ingroup Use_Cases7_SAT
8437 <h3 class="pg">Main Menu Information</h3>
8438 <strong>[Note] Telephony Emulator does not support this feature.</strong>
8440 Telephony provides APIs for retreiving SAT Main Menu Information.
8442 <strong>This API is permitted for Samsung in-house applications only</strong>
8445 int tel_get_sat_main_menu_info(TelSatSetupMenuInfo_t* pMainMenu)
8450 //SAT MAIN MENU INFORMATION
8452 #include <TapiCommon.h>
8453 #include <ITapiSat.h>
8455 void mainmenuinformation()
8459 TelSatSetupMenuInfo_t SatMainMenuInfo;
8461 ReturnStatus = tel_get_sat_main_menu_info(&SatMainMenuInfo);
8462 if (ReturnStatus == TAPI_API_SUCCESS)
8464 printf(" SAT Main Menu Information \n");
8465 printf("Main Menu Title :%s\n", satMainMenuInfo.satMainTitle);
8466 printf("Number of SAT Menu Items :%d\n", satMainMenuNum);
8467 printf("Sat Menu Items are:\n");
8468 for (i=0; i<SatMainMenuInfo.satMainMenuNum; i++)
8469 printf(" %s \n", SatMainMenuInfo.satMainMenuItem[i]);
8472 printf("ReturnStatus =%d\n", ReturnStatus);
8476 @defgroup Use_Cases7_3 Envelope Commands
8477 @ingroup Use_Cases7_SAT
8481 <h3 class="pg">Envelope Commands</h3>
8482 <strong>[Note] Telephony Emulator does not support this feature.</strong>
8484 This API sends a USIM application toolkit command to the USIM, using the envelope mechanism of USIM application toolkit. (See GSM TS 31.111)
8486 <strong>These APIs are permitted for Samsung in-house applications only</strong>
8489 int tel_select_sat_menu(TelSatMenuSelectionReqInfo_t* pMenuSelect, int* pRequestId);
8490 int tel_download_sat_event(TelSatEventDownloadReqInfo_t* pEventData, int* pRequestId);
8495 //MENU SELECTION ENVELOPE
8497 #include <TapiCommon.h>
8498 #include <ITapiSat.h>
8501 //SUBSCRIBE TO SAT EVENT(TAPI_EVENT_SAT_MENU_SELECTION_CNF) AS MENTIONED IN //Event Register and Deregister
8503 void satmenuselectionenvelope()
8507 TelSatMenuSelectionReqInfo_t SatMenuSelect;
8509 SatMenuSelect.itemIdentifier = 1;
8510 SatMenuSelect.bIsHelpRequested = FALSE;
8512 ReturnStatus = tel_select_sat_menu(&SatMenuSelect, &RequestId);
8513 if (ReturnStatus != TAPI_API_SUCCESS)
8515 printf("ReturnStatus =%d\n", ReturnStatus);
8519 //WAIT FOR TAPI_EVENT_SAT_MENU_SELECTION_CNF EVENT HERE
8523 //CALLBACK FUNCTION TO BE USED
8524 static void SatAppCallback (TelTapiEvent_t *event)
8526 int EventClass = event->EventClass;
8527 int EventType = event->EventType;
8528 int RequestId = event->RequestId;
8529 void* EventData = event->pData;
8530 int Status = event->Status;
8532 if (EventType == TAPI_EVENT_SAT_MENU_SELECTION_CNF)
8534 printf(" TAPI_EVENT_SAT_MENU_SELECTION_CNF Event Received \n");
8540 //EVENT DOWNLOAD ENVELOPE
8542 #include <TapiCommon.h>
8543 #include <ITapiSat.h>
8547 //SUBSCRIBE TO SAT EVENT(TAPI_EVENT_SAT_EVENT_DOWNLOAD_CNF) AS MENTIONED IN //Event Register and Deregister
8548 void eventdownloadenvelope()
8552 TelSatEventDownloadReqInfo_t SatEventData;
8554 SatEventData.eventDownloadType = TAPI_EVENT_SAT_DW_TYPE_IDLE_SCREEN_AVAILABLE;
8556 SatEventData.u.bIdleScreenAvailable = TRUE;
8558 ReturnStatus = tel_download_sat_event(&SatEventData, &RequestId);
8559 if (ReturnStatus != TAPI_API_SUCCESS)
8561 printf("ReturnStatus =%d\n", ReturnStatus);
8565 //WAIT FOR TAPI_EVENT_SAT_EVENT_DOWNLOAD_CNF EVENT HERE
8569 //CALLBACK FUNCTION TO BE USED
8570 static void SatAppCallback (TelTapiEvent_t *event)
8572 int EventClass = event->EventClass;
8573 int EventType = event->EventType;
8574 int RequestId = event->RequestId;
8575 void* EventData = event->pData;
8576 int Status = event->Status;
8578 if (EventType == TAPI_EVENT_SAT_EVENT_DOWNLOAD_CNF)
8580 printf("TAPI_EVENT_SAT_EVENT_DOWNLOAD_CNF Event Received \n");
8581 //Extract Event Data here
8586 @defgroup Use_Cases7_4 Application Execution result
8587 @ingroup Use_Cases7_SAT
8591 <h3 class="pg">Application Execution result</h3>
8592 <strong>[Note] Telephony Emulator does not support this feature.</strong>
8594 Telephony provides this API to get the Application execution result.
8596 <strong>This API is permitted for Samsung in-house applications only</strong>
8599 Int tel_send_sat_app_exec_result(TelSatAppsRetInfo_t* pAppRetInfo);
8604 //SAT MAIN MENU TITLE
8606 #include <TapiCommon.h>
8607 #include <ITapiSat.h>
8609 void sendappexecutionresult()
8612 TelSatAppsRetInfo_t SatAppRetInfo;
8614 SatAppRetInfo.commandType = TAPI_SAT_CMD_TYPE_SETUP_IDLE_MODE_TEXT;
8615 SatAppRetInfo.appsRet.setupIdleModeText.resp = TAPI_SAT_R_SUCCESS;
8617 ReturnStatus = tel_send_sat_app_exec_result(&SatAppRetInfo);
8618 if (ReturnStatus == TAPI_API_SUCCESS)
8620 printf(" Sending Application Execution Result Successful \n");
8623 printf("ReturnStatus =%d\n", ReturnStatus);
8627 @defgroup Use_Cases7_5 UI /User Confirmation
8628 @ingroup Use_Cases7_SAT
8632 <h3 class="pg">UI /User Confirmation </h3>
8633 <strong>[Note] Telephony Emulator does not support this feature.</strong>
8635 Send user’s confirmation message to the USIM application
8637 <strong>These APIs are permitted for Samsung in-house applications only</strong>
8640 int tel_send_sat_ui_display_status(int commandId, TelSatUiDisplayStatusType_t status);
8641 int tel_send_sat_ui_user_confirm(TelSatUiUserConfirmInfo_t * pUserConfirmData) ;
8648 #include <TapiCommon.h>
8649 #include <ITapiSat.h>
8651 void senduidisplaystatus()
8654 TelSatUiDisplayStatusType_t DisplatStatus;
8657 DisplatStatus = TAPI_SAT_DISPLAY_SUCCESS;
8658 CommandId = commandId; //Command Id of the Proactive Command
8660 ReturnStatus = tel_send_ui_display_status(CommandId, DisplayStatus);
8661 if (ReturnStatus == TAPI_API_SUCCESS)
8662 printf(" Sending UI Display Status Successful \n");
8664 printf("ReturnStatus =%d\n", ReturnStatus);
8671 #include <TapiCommon.h>
8672 #include <ITapiSat.h>
8674 void senduiuserconfirm()
8677 TelSatUiUserConfirmInfo_t UserConfirmData;
8679 UserConfirmData.commandId = commandId ; //Command Id of the Proactive Command
8681 UserConfirmData.commandType = TAPI_SAT_CMD_TYPE_PLAY_TONE;
8682 UserConfirmData.keyType = TAPI_SAT_USER_CONFIRM_YES;
8684 UserConfirmData.pAdditionalData = NULL;
8685 UserConfirmData.dataLen = 0;
8687 ReturnStatus = tel_send_sat_ui_user_confirm(&UserConfirmData);
8688 if (ReturnStatus == TAPI_API_SUCCESS)
8689 printf(" Sending User Confirmation Data Successful \n");
8691 printf("ReturnStatus =%d\n", ReturnStatus);
8697 <h2 class="pg">GPRS</h2>
8698 @defgroup Use_Cases8_1 Event Register and Deregister
8699 @ingroup Use_Cases8_GPRS
8702 <h3 class="pg">Event Register and Deregister</h3>
8703 To receive asynchronous event notifications for GPRS APIs, the registration of related events with their associated call backs is required. When an asynchronous API is called, the confirmation is returned as an asynchronous event notification which invokes the callback function along with the event data.
8708 unsigned int subscription_id = 0;
8711 api_err = tel_init();
8714 printf ("tel_init Failed - api_err = %d \n", api_err);
8717 api_err = tel_register_event(TAPI_EVENT_PS_PDP_ACT_RSP, &subscription_id , (TelAppCallback)&app_callback);
8718 printf("Power Event registeration is Done: sub id is %d, api_err is %d\n", subscription_id, api_err);
8720 tel_register_app_name("com.samsung.appname");
8722 void app_callback(TelTapiEvent_t *event)
8724 //callback function to be called
8728 @defgroup Use_Cases8_2 Pdp Activation
8729 @ingroup Use_Cases8_GPRS
8733 <h3 class="pg">Pdp Activation</h3>
8734 This API is used to start a GPRS session successfully.
8737 int tel_activate_gprs_pdp (const tapi_ps_net_start_req_t *pNet_start_req_info,int * pRequestID);
8740 <strong>This API is restricted for direct use. Use the Data Network API instead.</strong>
8745 #include <TapiCommon.h>
8746 #include <ITapiPS.h>
8749 tapi_ps_net_start_req_t start_req;
8752 #define CONTEXT_ID 1
8753 #define APN_ADDRESS "nate.sktelecom.com"
8758 tapi_ps_net_start_req_t start_req;
8761 start_req.cont_id = CONTEXT_ID;
8762 strcpy(start_req.pdp_info.apn , APN_ADDRESS);
8764 ret_status = tel_activate_gprs_pdp (&start_req, &request_id);
8765 if (ret_status == TAPI_API_SUCCESS)
8767 printf("/n/ gprs mode Started successfully \\n");
8771 printf("/n/ gprs mode not started \\n");
8774 //WAIT FOR EVENT HERE
8776 //CALLBACK FUNCTION TO BE USED
8777 void ps_app_callback (TelTapiEvent_t *event)
8783 void *EventData = NULL;
8785 eventClass = event->EventClass;
8786 eventType = event->EventType;
8787 requestId = event->RequestId;
8788 status = event->Status;
8789 EventData = event->pData;
8790 printf(" app _callback is called \n");
8794 case TAPI_EVENT_CLASS_DATA:
8797 case TAPI_EVENT_PS_PDP_ACT_RSP:
8798 tapi_ps_net_activation_rsp_t pdp_ip_resp;
8799 memcpy(&pdp_ip_resp, psEvent->pData, sizeof(tapi_ps_net_activation_rsp_t));
8800 printf("TAPI_EVENT_PS_PDP_ACT_RSP\n");
8803 case TAPI_EVENT_PS_PDP_ACT_IPCONFIG_INFO:
8804 tapi_ps_net_start_rsp_t pdp_ip_resp;
8805 memcpy(&pdp_ip_resp, psEvent->pData, sizeof(tapi_ps_net_start_rsp_t));
8807 case TAPI_EVENT_PS_STATUS:
8808 tapi_ps_attach_response_t res;
8809 memcpy(&res, psEvent->pData, sizeof(tapi_ps_attach_response_t));
8815 @defgroup Use_Cases8_3 Check PDP Signal line On
8816 @ingroup Use_Cases8_GPRS
8820 <h3 class="pg">Check PDP Signal line On</h3>
8821 This API is used to check whether the PDP siganl line is on or not.
8824 @n GPRS session should be started before running this API.
8827 int tel_control_gprs_btdun_pin (tapi_ps_btdun_pincontrol pincontrol,int * pRequestID);
8830 <strong>This API is restricted for direct use. Use the Data Network API instead.</strong>
8835 #include <TapiCommon.h>
8836 #include <ITapiPS.h>
8838 void pdpbtduncontrolget()
8842 tapi_ps_btdun_pincontrol bt_control;
8844 bt_control.signal = GPRS_SIGNAL_DCD ;
8845 bt_control.status = GPRS_SIGNAL_STATUS_OFF;
8847 ret_status = tel_control_gprs_btdun_pin(bt_control, &request_id) ;
8848 if (ret_status == TAPI_API_SUCCESS)
8850 printf("/n/ Successful \\n");
8854 printf("/n/error:%d \n", ret_status);
8857 //WAIT FOR EVENT HERE
8859 //CALLBACK FUNCTION TO BE USED
8860 void ps_app_callback (TelTapiEvent_t *event)
8866 void *EventData = NULL;
8868 eventClass = event->EventClass;
8869 eventType = event->EventType;
8870 requestId = event->RequestId;
8871 status = event->Status;
8872 EventData = event->pData;
8873 printf(" app _callback is called \n");
8877 case TAPI_EVENT_CLASS_DATA:
8880 case TAPI_EVENT_PS_BTDUN_PINCONTROL_NOTI:
8881 tapi_ps_btdun_pincontrol pincontrol;
8882 memcpy(&pincontrol, psEvent->pData, sizeof(tapi_ps_btdun_pincontrol));
8883 printf("TAPI_EVENT_PS_BTDUN_PINCONTROL_NOTI\n");
8890 @defgroup Use_Cases8_4 Set PDP deactivation
8891 @ingroup Use_Cases8_GPRS
8895 <h3 class="pg">Set PDP deactivation</h3>
8896 This API is used to deactivate the PDP service.
8899 @n GPRS session must be started before executing this API.
8902 int tel_deactivate_gprs_pdp (const tapi_ps_net_stop_req_t *net_stop_req_info,int * pRequestID);
8905 <strong>This API is restricted for direct use. Use the Data Network API instead.</strong>
8910 #include <TapiCommon.h>
8911 #include <ITapiPS.h>
8913 #define CONTEXT_ID 1
8915 void setpdpdeactivation()
8918 tapi_ps_net_stop_req_t end_req;
8921 memset(&end_req, 0, sizeof(tapi_ps_net_stop_req_t));
8923 end_req.cont_id = CONTEXT_ID;
8925 ret_status = tel_deactivate_gprs_pdp (&end_req, &request_id);
8926 if (ret_status == TAPI_API_SUCCESS)
8928 printf("/n/ gprs active session ended successfully \\n");
8932 printf("/n/ gprs active session not ended \\n");
8935 //WAIT FOR EVENT HERE
8937 //CALLBACK FUNCTION TO BE USED
8938 void ps_app_callback (TelTapiEvent_t *event)
8944 void *EventData = NULL;
8946 eventClass = event->EventClass;
8947 eventType = event->EventType;
8948 requestId = event->RequestId;
8949 status = event->Status;
8950 EventData = event->pData;
8951 printf(" app _callback is called \n");
8955 case TAPI_EVENT_CLASS_DATA:
8958 case TAPI_EVENT_PS_PDP_DEACT_IND:
8959 tapi_ps_net_stop_rsp_t* pdp_stop_resp;
8960 memcpy(pdp_stop_resp, psEvent->pData, sizeof(tapi_ps_net_stop_rsp_t));
8961 printf("TAPI_EVENT_PS_PDP_DEACT_IND\n");
8964 case TAPI_EVENT_PS_CALL_STATISTICS:
8965 tapi_ps_call_statistics_t call_stats;
8966 memcpy(&call_stats, psEvent->pData,
8967 sizeof(tapi_ps_call_statistics_t));
8976 @defgroup Use_Cases8_5 DataEnterDormantState
8977 @ingroup Use_Cases8_GPRS
8981 <h3 class="pg">DataEnterDormantState</h3>
8982 This API is used to set the modem’s data channels to the dormant state for power saving when there is no data flowing for certain time.
8985 @n GPRS session must be started before executing this API.
8988 int tel_set_gprs_dormant (int * pRequestID);
8991 <strong>This API is restricted for direct use. Use the Data Network API instead.</strong>
8996 #include <TapiCommon.h>
8997 #include <ITapiPS.h>
8999 void enterdormantstate()
9004 ret_status = TelTapiDataEnterDormantState(&request_id);
9005 if (ret_status == TAPI_API_SUCCESS)
9007 printf("/n/ Entered Dormant State successfully \\n");
9011 printf("/nerror:%d \\n", ret_status);
9014 //WAIT FOR EVENT HERE
9016 //CALLBACK FUNCTION TO BE USED
9017 void ps_app_callback (TelTapiEvent_t *event)
9023 void *EventData = NULL;
9025 eventClass = event->EventClass;
9026 eventType = event->EventType;
9027 requestId = event->RequestId;
9028 status = event->Status;
9029 EventData = event->pData;
9030 printf(" app _callback is called \n");
9034 case TAPI_EVENT_CLASS_DATA:
9037 case TAPI_EVENT_PS_DATA_DORMANT_RESP:
9038 TelTapiGprsDataDormancy_t resp;
9039 memcpy(&resp, psEvent->pData, sizeof(TelTapiGprsDataDormancy_t));
9040 printf("TAPI_EVENT_PS_DATA_DORMANT_RESP\n");
9047 @defgroup Use_Cases8_6 SetPortlist
9048 @ingroup Use_Cases8_GPRS
9052 <h3 class="pg">SetPortlist</h3>
9053 This API is used to set white or black port list
9056 int tel_set_gprs_port_list(int *pRequestID);
9059 <strong>This API is restricted for direct use. Use the Data Network API instead.</strong>
9064 #include <TapiCommon.h>
9065 #include <ITapiPS.h>
9071 tapi_gprs_pdp_port_list_setting_info_t test;
9073 memset(&test, 0, sizeof(tapi_gprs_pdp_port_list_setting_info_t));
9074 test.tcp_list.type = TAPI_GPRS_PORT_LIST_NOT_USE;
9075 test.tcp_list.len = 1;
9076 test.tcp_list.list[0] = 1004;
9077 test.udp_list.type = TAPI_GPRS_PORT_LIST_NOT_USE;
9078 test.udp_list.len = 1;
9079 test.udp_list.list[i] = 1111;
9081 ret_val = tel_set_gprs_port_list(&test, &requestId);
9083 //CALLBACK FUNCTION TO BE USED
9084 void ps_app_callback (TelTapiEvent_t *event)
9090 void *EventData = NULL;
9092 eventClass = event->EventClass;
9093 eventType = event->EventType;
9094 requestId = event->RequestId;
9095 status = event->Status;
9096 EventData = event->pData;
9097 printf(" app _callback is called \n");
9101 case TAPI_EVENT_CLASS_DATA:
9104 case TAPI_EVENT_PS_DATA_DORMANT_RESP:
9105 printf("TAPI_EVENT_PS_DATA_DORMANT_RESP\n");
9112 @defgroup Use_Cases8_7 GetPortlist
9113 @ingroup Use_Cases8_GPRS
9117 <h3 class="pg">GetPortlist</h3>
9118 This function is used to get white or black port list from modem
9121 int tel_get_gprs_port_list(int *pRequestID);
9124 <strong>This API is restricted for direct use. Use the Data Network API instead.</strong>
9129 #include <TapiCommon.h>
9130 #include <ITapiPS.h>
9136 ret_val = tel_get_gprs_port_list(&requestId);
9139 //CALLBACK FUNCTION TO BE USED
9140 void ps_app_callback (TelTapiEvent_t *event)
9146 void *EventData = NULL;
9148 eventClass = event->EventClass;
9149 eventType = event->EventType;
9150 requestId = event->RequestId;
9151 status = event->Status;
9152 EventData = event->pData;
9153 printf(" app _callback is called \n");
9157 case TAPI_EVENT_CLASS_DATA:
9160 case TAPI_EVENT_PS_DATA_DORMANT_RESP:
9161 tapi_gprs_pdp_port_list_setting_info_t *info;
9162 memcpy(info, psEvent->pData, sizeof(tapi_gprs_pdp_port_list_setting_info_t));
9163 printf("TAPI_EVENT_PS_DATA_DORMANT_RESP\n");
9171 @defgroup Appendixes1 Appendix A. Sample Codes
9174 <h1 class="pg">Appendixes</h1>
9175 <h2 class="pg">Appendix A. Sample Codes</h2>
9176 Some reference sample code is attached to help the application developer understand the telephony Framework Module
9178 How to use supplementary service APIs and handle SS events
9180 #include <ITapiSs.h>
9181 #include <TapiEvent.h>
9182 #include <TapiCommon.h>
9183 #include <TelUtility.h>
9185 GMainLoop *nw_context_loop = NULL;
9195 static int SS_Callback(int eventClass, int eventType, void * param2)
9198 printf ("\n\n\n SS_Callback is called! eventClass : %d\n, eventType : %d\n", eventClass, eventType);
9202 case TAPI_EVENT_SS_REL_COMP_MSG_NOTIFY:
9203 if (param2 != NULL) {
9205 TelSsRelCompMsgInfo_t rel_comp_msg;
9206 memcpy(&rel_comp_msg, (TelSsRelCompMsgInfo_t *)param2,
9207 sizeof(TelSsRelCompMsgInfo_t));
9208 printf("Printing the Release Complete Message \n");
9210 for (x=0; x<rel_comp_msg.RelCompMsgLen; x++)
9212 printf("[%.2x]", rel_comp_msg.szRelCompMsg[x]);
9217 case TAPI_EVENT_SS_WAITING_CNF:
9218 printf("#### Received Event : TAPI_EVENT_SS_WAITING_CNF ##### \n");
9219 if (param2 == NULL) {
9220 printf("param2 is NULL\n");
9224 memcpy(&SsInfo, (TelSsInfo_t*)param2, sizeof(TelSsInfo_t));
9225 for (i=0; i<SsInfo.NumberOfRecords; i++)
9227 printf("Number of records %d \n", SsInfo.NumberOfRecords);
9228 printf("Record:%d Status:%d Teleservice:%d \n",
9230 sInfo.SsRecord.WaitingRecord.rec_class[i].Status,
9231 SsInfo.SsRecord.WaitingRecord.rec_class[i].TeleCommService);
9232 if (SsInfo.SsRecord.WaitingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
9233 printf("#### Status: Active #### \n");
9235 printf("#### Status: Not Active #### \n");
9240 case TAPI_EVENT_SS_WAITING_QUERYSTATUS_CNF:
9241 printf("#### Received vent :TAPI_EVENT_SS_WAITING_QUERYSTATUS_CNF ##### \n");
9242 if (param2 == NULL) {
9243 printf("\n paran 2 is NULL\n");
9247 memcpy(&SsInfo, (TelSsInfo_t*)param2, sizeof(TelSsInfo_t));
9248 for (i=0; i<SsInfo.NumberOfRecords; i++) {
9249 printf("Number of records %d \n",SsInfo.NumberOfRecords);
9250 printf("Record:%d Status:%d Teleservice:%d \n",
9252 SsInfo.SsRecord.WaitingRecord.rec_class[i].Status,
9253 SsInfo.SsRecord.WaitingRecord.rec_class[i].TeleCommService);
9255 if (SsInfo.SsRecord.WaitingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
9256 printf("#### Status: Active #### \n");
9258 printf("#### Status: Not Active #### \n");
9262 case TAPI_EVENT_SS_BARRING_QUERYSTATUS_CNF:
9263 printf("#### Received Event :TAPI_EVENT_SS_BARRING_QUERYSTATUS_CNF ##### \n");
9266 case TAPI_EVENT_SS_BARRING_CNF:
9267 printf("#### Received Event :TAPI_EVENT_SS_BARRING_CNF ##### \n");
9270 case TAPI_EVENT_SS_BARRING_CHANGEPASS_CNF:
9271 printf("#### Received Event : TAPI_EVENT_SS_BARRING_CHANGEPASS_CNF ##### \n");
9272 printf("Call barring Password Changed successfully\n");
9275 case TAPI_EVENT_SS_FORWARD_CNF:
9276 printf("#### Received Event :TAPI_EVENT_SS_FORWARD_CNF ##### \n");
9277 if (param2 != NULL) {
9279 memset(&SsInfo, 0, sizeof(TelSsInfo_t));
9280 memcpy(&SsInfo, (TelSsInfo_t*)param2, sizeof(TelSsInfo_t));
9281 printf("Number of records %d \n", SsInfo.NumberOfRecords);
9282 for (i=0; i<SsInfo.NumberOfRecords; i++)
9284 printf("Number of records %d\n", SsInfo.NumberOfRecords);
9285 printf("Record:%d Status:%d Teleservice:%d \n",
9287 SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status,
9288 SsInfo.SsRecord.ForwardingRecord.rec_class[i].TeleCommService);
9289 if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_REGISTERED)
9290 printf("#### Status: Registered #### \n");
9291 else if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
9292 printf("#### Status: Active #### \n");
9294 printf("#### Status: Not Registered /Not Active ####\n");
9299 printf("param2 is NULL\n");
9303 case TAPI_EVENT_SS_FORWARD_QUERYSTATUS_CNF:
9304 printf("#### Received Event : TAPI_EVENT_SS_FORWARD_QUERYSTATUS_CNF ##### \n");
9305 if (param2 != NULL) {
9307 memcpy(&SsInfo, (TelSsInfo_t*)param2, sizeof(TelSsInfo_t));
9308 for (i=0; i<SsInfo.NumberOfRecords; i++)
9310 printf("Number of records %d \n", SsInfo.NumberOfRecords);
9311 printf("Record:%d Status:%d Teleservice:%d \n",
9313 SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status,
9314 SsInfo.SsRecord.ForwardingRecord.rec_class[i].TeleCommService);
9315 if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_REGISTERED)
9316 printf("#### Status: Registered #### \n");
9317 else if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
9318 printf("#### Status: Active #### \n");
9320 printf("#### Status: Not Registered /Not Active #### \n");
9325 printf("param 2 is NULL\n");
9329 case TAPI_EVENT_SS_CLI_QUERYSTATUS_CNF:
9330 printf("#### Received Event : TAPI_EVENT_SS_IDENTIFY_IND #### \n");
9331 if (param2 != NULL) {
9333 memcpy(&SsInfo, (TelSsInfo_t*)param2, sizeof(TelSsInfo_t));
9334 printf("Status :%d CLI Service : %d \n",
9335 SsInfo.SsRecord.CliRecord.CliStatus,
9336 SsInfo.SsRecord.CliRecord.IdentificationType);
9337 if (SsInfo.SsRecord.CliRecord.CliStatus == 1)
9338 printf(" ##### Status : Not Provisioned #####\n");
9339 else if (SsInfo.SsRecord.CliRecord.CliStatus == 2)
9340 printf(" ##### Status : Provisioned but Deactivated #####\n");
9341 else if (SsInfo.SsRecord.CliRecord.CliStatus == 3)
9342 printf(" ##### Status : Provisioned and Activated #####\n");
9343 else if (SsInfo.SsRecord.CliRecord.CliStatus == 4)
9344 printf(" ##### Status : Unknown #####\n");
9345 else if (SsInfo.SsRecord.CliRecord.CliStatus == 5)
9346 printf(" ##### Status : Temporarily Restricted #####\n");
9347 else if (SsInfo.SsRecord.CliRecord.CliStatus == 6)
9348 printf(" ##### Status : Temporarily Allowed #####\n");
9352 printf("param 2 is NULL\n");
9357 printf("\n\nDID NOT GET THE EVENT\n");
9360 g_main_loop_quit(nw_context_loop);
9364 static void app_callback (TelTapiEvent_t *event)
9370 void* EventData = NULL;
9372 eventClass = event->EventClass;
9373 eventType = event->EventType;
9374 requestId = event->RequestId;
9375 status = event->Status;
9376 EventData = event->pData;
9377 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
9380 //TEST_DEBUG("******This is nonzero status. ******\n");
9383 SS_Callback((int)eventClass, (int)eventType, EventData);
9386 ss_test_subscribe_tapi_events()
9389 unsigned int subscription_id = 0;
9390 TapiResult_t api_err;
9392 api_err = TelTapiInit();
9393 if (api_err != TAPI_API_SUCCESS)
9395 printf("TelTapiInit Failed - api_err = %d \n", api_err);
9397 api_err = TelTapiRegisterEvent(TAPI_EVENT_SS_WAITING_CNF, &subscription_id, (TelAppCallback)&app_callback);
9398 printf("SS Class registeration is Done: sub id is %d, api_err is %d\n",subscription_id,api_err);
9405 unsigned int subscription_id = 0;
9406 TapiResult_t api_err;
9408 api_err = tel_deregister_event(subscription_id);
9409 if (api_err != TAPI_API_SUCCESS)
9411 printf("Event Class Unregeration Fail\n");
9417 TapiResult_t ret_status;
9418 TelSsCallBarringInfo_t pBarringInfo;
9420 char *bar_pwd = "0000";
9422 printf("Before copying ,,,length is %d\n", strlen(pBarringInfo.szPassword));
9423 printf("len initially is %d\n", strlen(bar_pwd));
9425 pBarringInfo.Mode = TAPI_SS_CALL_BAR_ACTIVATE;
9426 pBarringInfo.Type = TAPI_CALL_BARRING_ALL_OUTGOING_CALLS;//TAPI_CALL_BARRING_ALL_OUTGOING_INTERN_CALL;
9427 pBarringInfo.CallType = TAPI_CALL_TYPE_VOICE_EV;
9428 strcpy(pBarringInfo.szPassword, bar_pwd);
9429 printf("length is %d\n", strlen(pBarringInfo.szPassword));
9430 ret_status = tel_set_ss_barring(&pBarringInfo, &pRequestId);
9431 if (ret_status != TAPI_API_SUCCESS) {
9435 nw_context_loop = g_main_loop_new(NULL, FALSE);
9436 g_main_loop_run(nw_context_loop);
9439 //now , get the status
9440 TelSsCallBarType_t BarType = TAPI_CALL_BARRING_ALL_OUTGOING_INTERN_CALL;
9441 TelSsCallType_t CallType = TAPI_CALL_TYPE_VOICE_EV;
9442 ret_status = tel_get_ss_barring_status(BarType,CallType, &pRequestId);
9443 if (ret_status != TAPI_API_SUCCESS) {
9447 nw_context_loop = g_main_loop_new(NULL, FALSE);
9448 g_main_loop_run(nw_context_loop);
9453 TapiResult_t ret_status;
9454 TelSsForwardInfo_t pForwardInfo;
9457 char *cf_number = "9986529874";
9459 pForwardInfo.Mode = TAPI_CALL_FORWARD_MODE_ENABLE_EV;
9460 pForwardInfo.Type = TAPI_CS_FORWARD_TYPE_VOICE_EV;
9461 pForwardInfo.Condition = TAPI_SS_FORWARD_WHEN_UNCONDITIONAL_EV;
9462 pForwardInfo.NoReplyConditionTimer = 10;
9464 len = strlen(cf_number);
9465 printf("Length of CF number :%d \n", len);
9466 memcpy(&(pForwardInfo.szPhoneNumber), cf_number, len);
9467 ret_status = tel_set_ss_forward(&pForwardInfo, &pRequestId);
9468 if (ret_status != TAPI_API_SUCCESS) {
9472 nw_context_loop = g_main_loop_new(NULL, FALSE);
9473 g_main_loop_run(nw_context_loop);
9475 //now , get call forward status
9476 TelSsForwardType_t Type = TAPI_CS_FORWARD_TYPE_VOICE_EV;
9477 TelSsForwardWhen_t Condition = TAPI_SS_FORWARD_WHEN_UNCONDITIONAL_EV;
9479 // Calling TAPI SS Call Frwd Query Req Status Api
9480 ret_status = tel_get_ss_forward_status(Type,Condition, &pRequestId);
9481 if (ret_status != TAPI_API_SUCCESS) {
9485 nw_context_loop = g_main_loop_new(NULL, FALSE);
9486 g_main_loop_run(nw_context_loop);
9491 //set and get call waiting
9492 TapiResult_t ret_status;
9493 TelSsWaitingInfo_t waitInfo;
9496 waitInfo.Mode = TAPI_SS_CW_ACTIVATE;
9497 waitInfo.CallType = TAPI_CALL_TYPE_VOICE_EV;
9500 ret_status = tel_set_ss_waiting(&waitInfo, &RequestID);
9501 if (ret_status != TAPI_API_SUCCESS) {
9505 nw_context_loop = g_main_loop_new(NULL, FALSE);
9506 g_main_loop_run(nw_context_loop);
9511 TelSsCallType_t CallType = TAPI_CALL_TYPE_VOICE_EV;
9512 ret_status = tel_get_ss_waiting_status(CallType, &RequestID);
9513 if (ret_status != TAPI_API_SUCCESS) {
9516 nw_context_loop = g_main_loop_new(NULL, FALSE);
9517 g_main_loop_run(nw_context_loop);
9522 ss_test_subscribe_tapi_events();
9523 tapi_ss_call_barr();
9525 tapi_ss_call_wait();
9529 int main(int argc, char *argv[])
9536 @defgroup Appendixes2 Appendix B. Error Code
9540 <h2 class="pg">Appendix B. Error Code</h2>
9542 <tr><td>Error Num.</td>
9544 <td>Error Description</td></tr>
9546 <td>TAPI_API_SUCCESS</td>
9547 <td>No Error occurred</td></tr>
9549 <td>TAPI_API_INVALID_INPUT</td>
9550 <td>Input values are not correct in TAPI Library</td></tr>
9552 <td>TAPI_API_INVALID_PTR</td>
9553 <td>invalid pointer</td></tr>
9555 <td>TAPI_API_NOT_SUPPORTED</td>
9556 <td>The feature corresponding to requested API is not supported. This may be due to market/network/vendor reasons such as the feature is not available in the network.</td></tr>
9558 <td>TAPI_API_DEPRICATED </td>
9559 <td>This API is deprecated and will be so in future also </td></tr>
9561 <td>TAPI_API_SYSTEM_OUT_OF_MEM</td>
9562 <td>Out of memory</td></tr>
9564 <td>TAPI_API_SYSTEM_RPC_LINK_DOWN</td>
9565 <td>RPC link down</td></tr>
9567 <td>TAPI_API_SERVICE_NOT_READY </td>
9568 <td>Phone was powered on, but yet to receive the power up completed notification </td></tr>
9570 <td>TAPI_API_SERVER_FAILURE</td>
9571 <td>error occurred in Telephony server</td></tr>
9573 <td>TAPI_API_OEM_PLUGIN_FAILURE</td>
9574 <td>Plug-in layer failure</td></tr>
9576 <td>TAPI_API_TRANSPORT_LAYER_FAILURE</td>
9577 <td>Transport layer Failure</td></tr>
9579 <td>TAPI_API_INVALID_DATA_LEN</td>
9580 <td>Invalid data length</td></tr>
9585 * @defgroup TELEPHONY
9587 * @defgroup Appendix Reference
9588 * @defgroup TELEPHONY_USECASES Use Cases
9590 * @defgroup Use_Cases1_COMMON COMMON
9591 * @defgroup Use_Cases2_CALL CALL
9592 * @defgroup Use_Cases3_SUPPLEMENTARY_SERVICE SUPPLEMENTARY_SERVICE
9593 * @defgroup Use_Cases4_SMS SMS
9594 * @defgroup Use_Cases5_NETWORK NETWORK_Registration_and_Configuration
9595 * @defgroup Use_Cases6_SOUND SOUND
9596 * @defgroup Use_Cases7_SAT SAT
9597 * @defgroup Use_Cases8_GPRS GPRS