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_dial_call(TapiHandle *handle, const TelCallDial_t *pParams, tapi_response_cb callback, void *user_data);
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
589 TapiHandle *handle = menu_manager_ref_user_data(mm);
594 memset(&data, 0, sizeof(TelCallDial_t));
596 data.CallType = atoi(data_call_type);
597 len = strlen(data_call_number);
598 if (len > TAPI_CALL_DIALDIGIT_LEN_MAX) {
599 msg("number too long");
603 memcpy(data.szNumber, data_call_number, len);
605 msg("call tel_dail_call()");
607 result = tel_dial_call(handle, &data, on_dial_call, 0);
608 if (result != TAPI_API_SUCCESS) {
609 msg("failed. (result = %d)", result);
615 //CALLBACK FUNCTION TO BE USED
616 static void app_callback (TelTapiEvent_t *event)
621 void* EventData = NULL;
623 unsigned int temp_handle = 0;
625 eventClass = event->EventClass;
626 eventType = event->EventType;
627 requestId = event->RequestId;
628 status = event->Status;
629 EventData = event->pData;
633 //TEST_DEBUG("******This is nonzero status. ******\n");
639 case TAPI_EVENT_CALL_SETUP_CNF:
640 printf("TAPI_EVENT_CALL_SETUP_CNF");
641 memcpy(&temp_handle, EventData, sizeof(unsigned int));
642 TEST_DEBUG("Received setup cnf for call Handle [%d]", temp_handle);
646 case TAPI_EVENT_CALL_ALERT_IND:
648 TEST_DEBUG("TAPI_EVENT_CALL_ALERT_IND");
649 memcpy(&temp_handle, event->pData, sizeof(unsigned int));
650 TEST_DEBUG("Received Alert for call Handle [%d]", temp_handle);
653 case TAPI_EVENT_CALL_CONNECTED_IND:
655 TEST_DEBUG("TAPI_EVENT_CALL_CONNECTED_IND");
656 memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
657 TEST_DEBUG("Received Connected Event for call Handle [%d]", temp_handle);
664 @defgroup Use_Cases2_3 Call Answer
665 @ingroup Use_Cases2_CALL
668 <h3 class="pg">Call Answer</h3>
669 This API responds to an incoming call either by accepting or rejecting the call.
672 @n Call associated with the call handle should be in TAPI_CALL_STATE_INCOM state.
673 @n There should be no more than one existing call.
676 int tel_answer_call(TapiHandle *handle, unsigned int CallHandle, TelCallAnswerType_t AnsType, tapi_response_cb callback, void *user_data);
679 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
683 #include <ITapiCall.h>
685 #include "TapiCommon.h"
686 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
688 void callsetup(unsigned int CallHandle)
690 TapiHandle *handle = menu_manager_ref_user_data(mm);
692 unsigned int call_id;
693 TelCallAnswerType_t answer_type;
696 msg("call tel_answer_call()");
698 call_id = atoi(data_call_id);
699 answer_type = atoi(data_answer_type);
701 result = tel_answer_call(handle, call_id, answer_type, on_answer_call, 0);
702 if (result != TAPI_API_SUCCESS) {
703 msg("failed. (result = %d)", result);
709 //CALLBACK FUNCTION TO BE USED
710 static void app_callback (TelTapiEvent_t *event)
713 switch (eventType) //REFER Call Setup TO GET eventType
715 //GET CALL HANDLE FROM INCOMING CALL EVENT DATA
716 case TAPI_EVENT_CALL_INCOM_IND:
717 unsigned int CallHandle;
718 TelCallIncomingCallInfo_t IncomingInfo;
719 memcpy(&IncomingInfo, event->pData, sizeof(TelCallIncomingCallInfo_t));
720 CallHandle = IncomingInfo.CallHandle;
723 case TAPI_EVENT_CALL_ANSWER_CNF:
724 memcpy(&CallHandle, event->pData, sizeof(unsigned int));
725 printf("TAPI_EVENT_CALL_ANSWER_CNF\n");
732 @defgroup Use_Cases2_4 Call Release
733 @ingroup Use_Cases2_CALL
736 <h3 class="pg">Call Release</h3>
737 This API is used to release the call.
738 @n The call to be released can be a single call based on the call handle, or all active calls or all calls.
741 @n Call handle should be valid and there should be an existing call in Active/hold state.
744 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
748 #include <ITapiCall.h>
750 #include "TapiCommon.h"
752 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
754 void callrelease(unsigned int CallHandle)
756 TapiHandle *handle = menu_manager_ref_user_data(mm);
758 unsigned int call_id;
759 TelCallEndType_t end_type;
761 msg("call tel_end_call()");
763 call_id = atoi(data_call_id);
764 end_type = atoi(data_end_type);
766 result = tel_end_call(handle, call_id, end_type, on_end_call, 0);
767 if (result != TAPI_API_SUCCESS) {
768 msg("failed. (result = %d)", result);
772 } //WAIT FOR EVENT HERE
774 //CALLBACK FUNCTION TO BE USED
775 static void app_callback(TelTapiEvent_t *event)
778 switch (eventType) //REFER Call Setup TO GET eventType
780 //GET CALL HANDLE FROM INCOMING CALL EVENT DATA
781 case TAPI_EVENT_CALL_INCOM_IND:
782 TelCallIncomingCallInfo_t IncomingInfo;
783 memcpy(&IncomingInfo, event->pData, sizeof(TelCallIncomingCallInfo_t));
784 CallHandle = IncomingInfo.CallHandle;
787 case TAPI_EVENT_CALL_RELEASE_CNF:
788 case TAPI_EVENT_CALL_RELEASE_ALL_CNF:
789 case TAPI_EVENT_CALL_RELEASE_ALL_ACTIVE_CNF:
790 case TAPI_EVENT_CALL_RELEASE_ALL_HELD_CNF:
791 case TAPI_EVENT_CALL_END_IND_IND:
793 memcpy(&handle, event->pData, sizeof(unsigned int));
794 printf("TAPI_EVENT_CALL_RELEASE_CNF\n");
801 @defgroup Use_Cases2_5 Call Hold
802 @ingroup Use_Cases2_CALL
805 <h3 class="pg">Call Hold</h3>
806 This API puts the specified call on hold. The call identified by Call Handle should be in the active state.
809 int tel_hold_call(TapiHandle *handle, unsigned int CallHandle, tapi_response_cb callback, void *user_data);
812 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
816 #include <ITapiCall.h>
818 #include "TapiCommon.h"
820 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
821 void callhold(unsigned int CallHandle)
823 unsigned int call_handle = VC_TAPI_CALLHANDLE;
824 TapiResult_t tapi_err = TAPI_API_SUCCESS;
826 //Puts the given call on hold
827 tapi_err = tel_hold_call(tapi_handle, call_handle, _vc_core_engine_hold_call_resp_cb, NULL);
828 if (TAPI_API_SUCCESS != tapi_err) {
829 CALL_ENG_DEBUG(ENG_DEBUG, "tel_hold_call() Failed Error Code: %d", tapi_err);
834 } //WAIT FOR EVENT HERE
836 //CALLBACK FUNCTION TO BE USED
837 static void app_callback (TelTapiEvent_t *event)
840 switch (eventType) //REFER Call Setup TO GET eventType
842 case TAPI_EVENT_CALL_HOLD_CNF:
843 unsigned int CallHandle;
844 memcpy(&CallHandle, event->pData, sizeof(unsigned int));
845 printf("TAPI_EVENT_CALL_HOLD_CNF\n");
853 @defgroup Use_Cases2_6 Call Retrieve
854 @ingroup Use_Cases2_CALL
857 <h3 class="pg">Call Retrieve</h3>
858 This API can be used to retrieve a held call.
861 @n Call should be in held state in order to return to the active state, and no other call should be active.
864 int tel_active_call(TapiHandle *handle, unsigned int CallHandle, tapi_response_cb callback, void *user_data);
867 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
871 #include <ITapiCall.h>
873 #include "TapiCommon.h"
876 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
877 void callretrieve(unsigned int CallHandle)
879 unsigned int call_handle = VC_TAPI_CALLHANDLE;
880 TapiResult_t tapi_err = TAPI_API_SUCCESS;
882 tapi_err = tel_active_call(tapi_handle, call_handle, _vc_core_engine_active_call_resp_cb, NULL);
883 if (TAPI_API_SUCCESS != tapi_err) {
884 CALL_ENG_DEBUG(ENG_DEBUG, "tel_active_call() Failed Error Code: %d", tapi_err);
887 } //WAIT FOR EVENT HERE
889 //CALLBACK FUNCTION TO BE USED
890 static void app_callback(TelTapiEvent_t *event)
893 switch (eventType) //REFER Call Setup TO GET eventType
895 case TAPI_EVENT_CALL_HOLD_CNF:
896 unsigned int CallHandle;
897 memcpy(&CallHandle, event->pData, sizeof(unsigned int));
898 printf("TAPI_EVENT_CALL_HOLD_CNF\n");
901 case TAPI_EVENT_CALL_RETRIEVE_CNF:
902 unsigned int CallHandle;
903 memcpy(&CallHandle, event->pData, sizeof(unsigned int));
904 printf("TAPI_EVENT_CALL_RETRIEVE_CNF ");
912 @defgroup Use_Cases2_7 Call Swap
913 @ingroup Use_Cases2_CALL
916 <h3 class="pg">Call Swap</h3>
917 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.
920 @n Two calls should be present, one of them in the Active state and the other in the held state
923 int tel_swap_call(TapiHandle *handle, unsigned int CallHandle1, unsigned int CallHandle2, tapi_response_cb callback, void *user_data);
926 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
930 #include <ITapiCall.h>
932 #include "TapiCommon.h"
933 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
935 void callswap(unsigned int CallHandle1, unsigned int CallHandle2)
939 unsigned int CallHandle1;
940 unsigned int CallHandle2;
941 tapi_response_cb callback;
943 ret_status = tel_swap_call(handle, CallHandle1, CallHandle2, callback, user_data);
944 if (TAPI_API_SUCCESS != tapi_err) {
945 CALL_ENG_DEBUG(ENG_DEBUG, "tel_swap_call() Failed, Error Code: %d", tapi_err);
950 } //WAIT FOR EVENT HERE
952 //CALLBACK FUNCTION TO BE USED
953 static void app_callback (TelTapiEvent_t *event)
956 switch (eventType) //REFER Call Setup TO GET eventType
958 case TAPI_EVENT_CALL_SWAP_CNF:
959 printf("TAPI_EVENT_CALL_RETRIEVE_CNF\n");
967 @defgroup Use_Cases2_8 Send DTMF
968 @ingroup Use_Cases2_CALL
971 <h3 class="pg">Send DTMF</h3>
972 This API can be used for sending one or more DTMF digits during the call.
975 @n Active call should be present.
978 int tel_call_dtmf(TapiHandle *handle, const char *pDtmfString, tapi_response_cb callback, void *user_data);
981 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
985 #include <ITapiCall.h>
987 #include "TapiCommon.h"
989 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
994 unsigned int pCallHandle;
996 char DtmfString[10] = {0, };
997 strcpy(DtmfString, "123456789");//Sample DTMF digits that need to be sent
998 ret_status= tel_call_dtmf(handle, DtmfString, callback, user_data);
1000 if (TAPI_API_SUCCESS != tapi_err) {
1001 CALL_ENG_DEBUG(ENG_DEBUG, "tapi_call_dtmf Failed, Error Code: %d", tapi_err);
1005 CALL_ENG_DEBUG(ENG_DEBUG, " Ended...");
1009 //WAIT FOR EVENT HERE
1010 static void app_callback(TelTapiEvent_t *event)
1013 switch (eventType) //REFER Call Setup TO GET eventType
1015 case TAPI_EVENT_CALL_SEND_DTMF_CNF:
1016 printf("TAPI_EVENT_CALL_SEND_DTMF_CNF\n");
1023 @defgroup Use_Cases2_9 Call Join
1024 @ingroup Use_Cases2_CALL
1027 <h3 class="pg">Call Join</h3>
1028 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.
1031 @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.
1034 int tel_join_call(TapiHandle *handle, unsigned int CallHandle1, unsigned int CallHandle2, tapi_response_cb callback, void *user_data);
1037 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1041 #include <ITapiCall.h>
1043 #include "TapiCommon.h"
1045 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1046 void calljoin(unsigned int CallHandle1, unsigned int CallHandle2)
1050 unsigned int CallHandle1;
1051 unsigned int CallHandle2;
1052 tapi_response_cb callback;
1054 ret_status= tel_join_call(handle, CallHandle1, CallHandle2, callback, user_data); ;
1055 if (ret_status == TAPI_API_SUCCESS)
1056 printf("successful\n");
1058 printf("error=%d\n", ret_status);
1059 } //WAIT FOR EVENT HERE
1061 //CALLBACK FUNCTION TO BE USED
1062 static void app_callback (TelTapiEvent_t *event)
1065 switch (eventType) //REFER Call Setup TO GET eventType
1067 case TAPI_EVENT_CALL_SETUPCONFERENCE_CNF:
1068 unsigned int temp_handle;
1069 memcpy(&temp_handle, event->pData, sizeof(unsigned int));
1070 printf("TAPI_EVENT_CALL_SETUPCONFERENCE_CNF ");
1077 @defgroup Use_Cases2_10 Call Split
1078 @ingroup Use_Cases2_CALL
1081 <h3 class="pg">Call Split</h3>
1082 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.
1083 @n TAPI client application has to pass the call handle which should be split from the multiparty call.
1086 @n Call should be in multiparty conference call.
1089 @n Split call will be the active call and the conference will be held call.
1092 int tel_split_call(TapiHandle *handle, unsigned int CallHandle, tapi_response_cb callback, void *user_data);
1095 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1099 #include <ITapiCall.h>
1101 #include "TapiCommon.h"
1103 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1104 void callsplit(unsigned int CallHandle)
1108 unsigned int CallHandle;
1109 tapi_response_cb callback;
1111 ret_status= tel_split_call(handle, CallHandle, callback, user_data);
1112 if (ret_status == TAPI_API_SUCCESS)
1113 printf("successful\n");
1115 printf("error=%d\n", ret_status);
1116 }//WAIT FOR EVENT HERE
1118 //CALLBACK FUNCTION TO BE USED
1119 static void app_callback (TelTapiEvent_t *event)
1122 switch (eventType) //REFER Call Setup TO GET eventType
1124 case TAPI TAPI_EVENT_CALL_SPLITCONFERENCE_CNF:
1125 unsigned int temp_handle;
1126 memcpy(&temp_handle, event->pData, sizeof(unsigned int));
1127 printf("TAPI_EVENT_CALL_SPLITCONFERENCE_CNF ");
1134 @defgroup Use_Cases2_11 Active Line
1135 @ingroup Use_Cases2_CALL
1138 <h3 class="pg">Active Line </h3>
1139 <strong>[Note] Telephony Emulator does not support this feature.</strong>
1140 @n Telephony provides APIs for setting and getting the current calling line identification number.
1143 int tel_set_call_act_line(TapiHandle *handle, TelCallActiveLine_t active_line, tapi_response_cb callback, void *user_data);
1146 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1150 #include <ITapiCall.h>
1152 #include "TapiCommon.h"
1159 TelCallActiveLine_t active_line ;
1160 tapi_response_cb callback,;
1163 ret_status = tel_set_call_act_line (handle, active_line, callback, user_data);
1164 if (ret_status == TAPI_API_SUCCESS)
1165 printf("successful\n");
1167 printf("error=%d\n", ret_status);
1170 ret_status = tel_get_call_act_line(handle, callback, user_data);
1171 if (ret_status == TAPI_API_SUCCESS)
1172 printf("successful\n");
1174 printf("error=%d\n", ret_status);
1178 //CALLBACK FUNCTION TO BE USED
1179 static void app_callback (TelTapiEvent_t *event)
1182 switch (eventType) //REFER Call Setup TO GET eventType
1184 case TAPI_EVENT_CALL_SET_LINEID_CNF:
1185 //TEST_DEBUG("Received TAPI_EVENT_CALL_SET_LINEID_CNF");
1186 //AUTO_LOG("EVENT: SET_LINEID_CNF:");
1189 case TAPI_EVENT_CALL_GET_LINEID_CNF:
1190 TelCallActiveLine_t active_line;
1191 memcpy(&active_line, event->pData, sizeof(TelCallActiveLine_t));
1192 TEST_DEBUG("Received TAPI_EVENT_CALL_GET_LINEID_CNF");
1199 @defgroup Use_Cases2_12 Call transfer
1200 @ingroup Use_Cases2_CALL
1203 <h3 class="pg">Call transfer</h3>
1204 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.
1207 @n In order to call transfer, 2 calls should be present. One in the active state and the other in the Held state.
1210 @n When the request has been completed successfully, Call end indication will be sent to both the calls (active and held).
1213 int tel_transfer_call(TapiHandle *handle, unsigned int CallHandle, tapi_response_cb callback, void *user_data);
1216 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1220 #include <ITapiCall.h>
1222 #include "TapiCommon.h"
1224 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1225 void calltransfer(unsigned int CallHandle)
1229 unsigned int pCallHandle;//active call
1230 tapi_response_cb callback;
1232 ret_status= tel_transfer_call (handle, pCallHandle, callback, user_data);
1233 if (ret_status == TAPI_API_SUCCESS)
1234 printf("successful\n");
1236 printf("error=%d\n", ret_status);
1237 }//WAIT FOR EVENT HERE
1239 //CALLBACK FUNCTION TO BE USED
1240 static void app_callback (TelTapiEvent_t *event)
1243 switch (eventType) //REFER Call Setup TO GET eventType
1245 case TAPI_EVENT_CALL_TRANSFER_CNF:
1246 unsigned int temp_handle = 0;
1247 memcpy(&temp_handle, event->pData, sizeof(unsigned int));
1248 printf("TAPI_EVENT_CALL_TRANSFER_CNF. ");
1255 @defgroup Use_Cases2_13 Get Call Status
1256 @ingroup Use_Cases2_CALL
1259 <h3 class="pg">Get Call Status</h3>
1260 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.
1261 @n Call handle must be valid.
1264 int tel_get_call_status(TapiHandle *handle, int call_id, TelCallStatus_t *out );
1267 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1271 #include <ITapiCall.h>
1273 #include "TapiCommon.h"
1275 void getcallstatus(unsigned int CallHandle)
1280 TelCallStatus_t *out;
1281 ret_status= tel_get_call_status(handle, call_id, out);
1282 if (ret_status == TAPI_API_SUCCESS)
1284 printf("successful\n");
1285 printf("CallNumber: %s\n", callStatus.pNumber);
1286 printf("Is Mobile Originated:%d n\t CallType : %d \n\t CallActiveState: %d\n\t CallState : %d\n\t isConferenceState:%d \n",
1288 callStatus.CallType,
1289 callStatus.CallActiveState,
1290 callStatus.CallState,
1291 callStatus.bConferenceState);
1294 printf("error=%d\n", ret_status);
1299 @defgroup Use_Cases2_14 Get Call Duration
1300 @ingroup Use_Cases2_CALL
1303 <h3 class="pg">Get Call Duration</h3>
1304 This API gets the duration of the specified call.
1305 @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.
1308 int tel_get_call_duration(TapiHandle *handle, unsigned int CallHandle, unsigned int * pDurationInSecs) ;
1311 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1315 #include <ITapiCall.h>
1317 #include "TapiCommon.h"
1319 void getcallduration(unsigned int CallHandle)
1323 unsigned int CallHandle;
1324 unsigned int * pDurationInSecs;
1325 ret_status= tel_get_call_duration(handle, CallHandle, pDurationInSecs);
1326 if (ret_status == TAPI_API_SUCCESS)
1328 printf("successful\n");
1329 printf("Call Duration : %d Seconds\n", duration);
1332 printf("error=%d\n", ret_status);
1337 @defgroup Use_Cases2_15 Get Call Conference List
1338 @ingroup Use_Cases2_CALL
1341 <h3 class="pg">Get Call Conference List</h3>
1342 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.
1345 @n Call should be a multi-party conference call in order to return actual number of calls and call handles in the conference call.
1348 int tel_get_call_conf_list(TapiHandle *handle, unsigned int CallHandle, unsigned int *pCallList, int *pNoOfCalls);
1351 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1355 #include <ITapiCall.h>
1357 #include "TapiCommon.h"
1359 void getconferencelist(unsigned int CallHandle)
1363 unsigned int CallHandle;
1364 unsigned int callList[5];
1365 tapi_response_cb callback;
1368 ret_status= tel_get_call_conf_list(handle, CallHandle, callList, &noOfCalls, callback, user_data);
1369 if (ret_status == TAPI_API_SUCCESS)
1371 printf("successful\n");
1372 printf("\n No.of Calls %d, \n", noOfCalls);
1373 for (i = 0; i < noOfCalls; i++)
1375 printf("\n Call Handle in conference calls %d \n", callList[i]);
1379 printf("error=%d\n", ret_status);
1384 @defgroup Use_Cases2_16 Voice Privacy Mode
1385 @ingroup Use_Cases2_CALL
1388 <h3 class="pg">Voice Privacy Mode</h3>
1389 Telephony provides two APIs which can be used to set and get the CDMA voice privacy mode .
1392 int tel_get_call_privacy_mode(TapiHandle *handle, TelCallPrivacyType_t PrivacyType, tapi_response_cb callback, void *user_data);
1393 int tel_set_call_privacy_mode(TapiHandle *handle, TelCallVoicePrivacyInfo_t PrivacyInfo, tapi_response_cb callback, void *user_data);
1396 This API is restricted for direct use. Use the Voice call engine API instead.
1400 #include <ITapiCall.h>
1402 #include "TapiCommon.h"
1404 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1406 //SetVoicePrivacyMode
1407 void setvoiceprivacymode()
1410 int ret_status = -1;
1411 tapi_response_cb callback;
1413 TelCallPrivacyMode_t pPrivacyMode_info={0,};
1414 pPrivacyMode_info = TAPI_CALL_PRIVACY_MODE_STANDARD;
1415 ret_status = tel_set_call_privacy_mode (handle, pPrivacyMode_info, callback, user_data);
1416 if (ret_status == TAPI_API_SUCCESS)
1417 printf("Successful\n");
1419 printf("error:%d\n", ret_status);
1421 //WAIT FOR EVENT HERE
1423 //CALLBACK FUNCTION TO BE USED
1425 bool call_app_callback (TelTapiEvent_t *Event)
1428 int eventClass = Event->EventClass;
1429 int eventType = Event->EventType;
1430 int RequestId = Event->RequestId;
1431 int Status = Event->Status;
1433 if (eventClass == TAPI_EVENT_CLASS_CALL_VOICE)
1435 switch (eventType) {
1436 case TAPI_EVENT_CALL_SET_PRIVACYMODE_CNF:
1437 if (RequestId != reqId) {
1438 printf("Invalid RequestID received %d \n", reqId);
1442 if (Status != TAPI_CAUSE_SUCCESS) {
1443 printf("Invalid Status value received");
1451 //GetVoicePrivacyMode
1452 void getprivacymode()
1455 int ret_status = -1;
1456 tapi_response_cb callback;
1458 TelCallPrivacyMode_t pPrivacyMode_info={0,};
1459 pPrivacyMode_info = TAPI_CALL_PRIVACY_MODE_STANDARD;
1460 ret_status = tel_set_call_privacy_mode (handle, pPrivacyMode_info, callback, user_data);
1461 if (ret_status == TAPI_API_SUCCESS)
1462 printf("Successful\n");
1464 printf("error:%d\n", ret_status);
1467 //WAIT FOR EVENT HERE
1469 //CALLBACK FUNCTION TO BE USED
1471 bool call_app_callback (TelTapiEvent_t *Event)
1474 int eventClass = Event->EventClass;
1475 int eventType = Event->EventType;
1476 int RequestId = Event->RequestId;
1477 int Status = Event->Status;
1479 if (eventClass == TAPI_EVENT_CLASS_CALL_VOICE)
1481 switch (eventType) {
1482 case TAPI_EVENT_CALL_GET_PRIVACYMODE_CNF:
1483 TelCallVoicePrivacyInfo_t vp_info;
1484 memcpy(&vp_info, event->pData, sizeof(TelCallVoicePrivacyInfo_t));
1485 if (Status != TAPI_CAUSE_SUCCESS)
1487 printf("Invalid Status value received");
1496 @defgroup Use_Cases2_17 Call FlashInformation
1497 @ingroup Use_Cases2_CALL
1500 <h3 class="pg">Call FlashInformation</h3>
1501 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.
1504 int tel_exe_call_flash_info(TapiHandle *handle, const char *pDialNumber, tapi_response_cb callback, void *user_data);
1507 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1511 #include <ITapiCall.h>
1513 #include "TapiCommon.h"
1515 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1517 void callflashinfo()
1519 int ret_status = -1;
1521 tapi_response_cb callback;
1523 const char *pDialNumber = "9999900000";
1525 ret_status = tel_exe_call_flash_info(handle, pDialNumber, callback, user_data);
1526 if (ret_status == TAPI_API_SUCCESS)
1527 printf("Successful\n");
1529 printf("error:%d\n", ret_status);
1531 //WAIT FOR EVENT HERE
1533 //CALLBACK FUNCTION TO BE USED
1534 bool call_app_callback(TelTapiEvent_t *Event)
1537 int eventClass = Event->EventClass;
1538 int eventType = Event->EventType;
1539 int RequestId = Event->RequestId;
1540 int Status = Event->Status;
1542 if (eventClass == TAPI_EVENT_CLASS_CALL_VOICE)
1546 case TAPI_EVENT_CALL_FLASHINFO_CNF:
1547 if (RequestId != reqId)
1549 printf("Invalid RequestID received %d \n", reqId);
1553 if (Status != TAPI_CAUSE_SUCCESS)
1555 printf("Invalid Status value received");
1558 printf("\n Received TAPI_EVENT_CALL_FLASHINFO_CNF \n");
1567 @defgroup Use_Cases2_18 Getting Call Time
1568 @ingroup Use_Cases2_CALL
1571 <h3 class="pg">Getting Call Time</h3>
1572 This API is used to query information about a call time and call count.
1575 int tel_get_call_time(TapiHandle *handle, unsigned short req_mask, tapi_response_cb callback, void *user_data);
1578 <strong>This API is restricted for direct use. Use the Voice call engine API instead.</strong>
1582 #include <ITapiCall.h>
1584 #include "TapiCommon.h"
1588 int ret_status = -1;
1590 tapi_response_cb callback;
1592 TelCallTimeMaskType_t mask_byte1 = {0,};
1593 TelCallTimeMaskType_t mask_byte2 = {0,};
1594 unsigned short mask_type;
1595 mask_byte1 = TAPI_CALL_TIME_TYPE_TOTAL_CALL_CNT; //masking call type
1596 mask_byte2 = TAPI_CALL_TIME_TYPE_TOTAL_CALL_TIME;
1597 mask_type = mask_byte1;
1599 mask_type = mask_byte2;
1601 ret_status = tel_get_call_time(handle, mask_type, callback, user_data);
1602 if (ret_status == TAPI_API_SUCCESS)
1603 printf("Successful\n");
1605 printf("error:%d\n", ret_status);
1607 //WAIT FOR EVENT HERE
1609 bool call_app_callback(TelTapiEvent_t *Event)
1612 int eventClass = Event->EventClass;
1613 int eventType = Event->EventType;
1614 int RequestId = Event->RequestId;
1615 int Status = Event->Status;
1617 if (eventClass == TAPI_EVENT_CLASS_CALL_VOICE)
1621 case TAPI_EVENT_CALL_SET_PRIVACYMODE_CNF:
1622 if (RequestId != reqId)
1624 printf("Invalid RequestID received %d \n", reqId);
1628 if (Status != TAPI_CAUSE_SUCCESS)
1630 printf("Invalid Status value received");
1640 <h2 class="pg">SUPPLEMENTARY SERVICE </h2>
1641 @defgroup Use_Cases3_1 Event register and deregister
1642 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
1644 <h3 class="pg">Event register and deregister</h3>
1645 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.
1650 Tapi_handle *handle;
1651 char *noti_id = TAPI_NOTI_SS_FORWARD_STATUS; // We need to register for all events, like barring, waiting etc.
1652 tapi_response_cb callback;
1656 handle = tel_init();
1659 TEST_DEBUG("tel_init Failed");
1662 ret = tel_register_noti_event(handle,noti_id,callback,userdata);
1663 if(ret != TAPI_API_SUCCESS)
1665 TEST_DEBUG("SS Event registration failed");
1669 printf("SS Event registration is Done");
1672 tel_register_app_name("com.samsung.appname");
1675 ret = tel_deregister_event(handle,noti_id);
1676 if (ret != TAPI_API_SUCCESS)
1678 printf("Event Unregisteration Fail\n");
1682 @defgroup Use_Cases3_2 Call Barring
1683 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
1686 <h3 class="pg">Call Barring </h3>
1687 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.
1688 @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.
1689 @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 .
1692 int tel_set_ss_barring(TapiHandle *handle, TelSsBarringInfo_t *info, tapi_response_cb callback, void *user_data);
1693 int tel_get_ss_barring_status(TapiHandle *handle, TelSsClass_t class, TelSsBarringType_t type, tapi_response_cb callback, void *user_data);
1694 int tel_change_ss_barring_password(TapiHandle *handle,const char *old_password,const char *new_password,const char *new_password_again,tapi_response_cb callback, void *user_data);
1697 SAMPLE CODE FOR SET CALL BARRING
1700 #include <TapiCommon.h>
1701 #include <ITapiSS.h>
1703 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1706 int ret_status = -1;
1707 TelSsCallBarringInfo_t BarringInfo;
1708 char *bar_pwd = "0000";
1710 tapi_response_cb callback;
1713 BarringInfo.Mode = TAPI_SS_CALL_BAR_ACTIVATE;
1714 BarringInfo.Type = TAPI_CALL_BARRING_ALL_OUTGOING_CALLS;
1715 BarringInfo.CallType = TAPI_CALL_TYPE_VOICE_EV;
1716 strcpy(BarringInfo.szPassword, bar_pwd);
1718 ret_status = tel_set_ss_barring (handle,&BarringInfo,callback,user_data);
1719 if (ret_status == TAPI_API_SUCCESS) {
1720 printf("successful\n");
1723 printf("Error = %d \n", ret_status);
1726 //WAIT FOR THE EVENT HERE
1728 static void app_callback (TapiHandle *handle, int result, void *data, void *user_data)
1730 TelSsBarringResp_t *resp = data;
1734 msgb("tel_set_ss_barring() or tel_get_ss_barring_status() response receive");
1735 msg(" - result = 0x%x", result);
1740 msg(" - record_num = %d", resp->record_num);
1742 for (i = 0; i < resp->record_num; i++) {
1743 msg(" - [%d] Class=%d, Status=%d, Flavour=%d",
1745 resp->record[i].Class,
1746 resp->record[i].Status,
1747 resp->record[i].Flavour);
1752 SAMPLE CODE FOR GET BARRING STATUS
1755 #include <TapiCommon.h>
1756 #include <ITapiSS.h>
1758 void callbarringstatus()
1760 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1762 TelSsCallBarType_t BarType = TAPI_CALL_BARRING_ALL_OUTGOING_INTERN_CALL;
1763 TelSsCallType_t CallType = TAPI_CALL_TYPE_VOICE_EV;
1765 tapi_response_cb callback;
1768 ret_status = tel_get_ss_barring_status (handle,BarType, CallType,callback,user_data);
1769 if (ret_status == TAPI_API_SUCCESS)
1771 printf("successful\n");
1775 printf("Error = %d \n", ret_status);
1778 //WAIT FOR THE EVENT HERE
1780 static void app_callback (TapiHandle *handle, int result, void *data, void *user_data)
1782 TelSsBarringResp_t *resp = data;
1786 msgb("tel_set_ss_barring() or tel_get_ss_barring_status() response receive");
1787 msg(" - result = 0x%x", result);
1792 msg(" - record_num = %d", resp->record_num);
1794 for (i = 0; i < resp->record_num; i++) {
1795 msg(" - [%d] Class=%d, Status=%d, Flavour=%d",
1797 resp->record[i].Class,
1798 resp->record[i].Status,
1799 resp->record[i].Flavour);
1804 SAMPLE CODE FOR CHANGING BARRING PASSWORD
1807 #include <TapiCommon.h>
1808 #include <ITapiSS.h>
1810 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1815 tapi_response_cb callback;
1818 ret_status = tel_change_ss_barring_password ("0000", "0000", "0000", user_data);
1819 if (ret_status == TAPI_API_SUCCESS)
1821 printf("successful\n");
1825 printf("Error = %d \n", ret_status);
1829 //WAIT FOR THE EVENT HERE
1831 static void app_callback(TapiHandle *handle, int result, void *data, void *user_data)
1834 msgb("tel_change_ss_barring_password() response receive");
1835 msg(" - result = 0x%x", result);
1839 @defgroup Use_Cases3_3 Call Forward
1840 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
1844 <h3 class="pg">Call Forward</h3>
1845 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.
1846 @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.
1849 int tel_set_ss_forward(TapiHandle *handle, const TelSsForwardInfo_t *info, tapi_response_cb callback, void *user_data);
1850 int tel_get_ss_forward_status(TapiHandle *handle, TelSsClass_t class, TelSsForwardWhen_t condition, tapi_response_cb callback, void *user_data);
1853 SAMPLE CODE FOR SET CALL FORWARD
1856 #include <TapiCommon.h>
1857 #include <ITapiSS.h>
1859 //SUBSCRIBE FOR EVENTS AS MENTIONED INEvent Register and Deregister
1863 TelSsForwardInfo_t pForwardInfo;
1865 tapi_response_cb callback;
1868 pForwardInfo.Mode = TAPI_CALL_FORWARD_MODE_ENABLE_EV;
1869 pForwardInfo.Type = TAPI_CS_FORWARD_TYPE_VOICE_EV;
1870 pForwardInfo.Condition = TAPI_SS_FORWARD_WHEN_UNCONDITIONAL_EV;
1871 pForwardInfo.NoReplyConditionTimer = 10;
1874 char *cf_number = "9986529874"; //number to which calles need to be forwarded.
1876 len = strlen(cf_number);
1877 printf("Length of CF number :%d \n", len);
1878 memcpy(&(pForwardInfo.szPhoneNumber), cf_number, len);
1880 ret_status = tel_set_ss_forward(handle,&pForwardInfo,callback,user_data);
1881 if (ret_status == TAPI_API_SUCCESS)
1883 printf("successful\n");
1887 printf("Error = %d \n", ret_status);
1890 //WAIT FOR THE EVENT HERE
1892 static void app_callback(TapiHandle *handle, int result, void *data, void *user_data)
1894 TelSsForwardResp_t *resp = data;
1898 msgb("tel_set_ss_forward() or tel_get_ss_forward_status() response receive");
1899 msg(" - result = 0x%x", result);
1904 msg(" - record_num = %d", resp->record_num);
1906 for (i = 0; i < resp->record_num; i++) {
1907 msg(" - [%d] Class=%d, Status=%d, ForwardCondition=%d, NoReplyWaitTime=%d, bCallForwardingNumberPresend=%d, szCallForwardingNumber=[%s]",
1909 resp->record[i].Class,
1910 resp->record[i].Status,
1911 resp->record[i].ForwardCondition,
1912 resp->record[i].NoReplyWaitTime,
1913 resp->record[i].bCallForwardingNumberPresent,
1914 resp->record[i].szCallForwardingNumber);
1919 SAMPLE CODE FOR GET CALL FORWARD STATUS
1922 #include <TapiCommon.h>
1923 #include <ITapiSS.h>
1925 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1926 void callfwdstatus()
1929 TelSsForwardType_t Type = TAPI_CS_FORWARD_TYPE_VOICE_EV;
1930 TelSsForwardWhen_t Condition = TAPI_SS_FORWARD_WHEN_UNCONDITIONAL_EV;
1932 tapi_response_cb callback;
1935 ret_status = tel_get_ss_forward_status(handle,Type,Condition,callback,user_data);
1936 if (ret_status == TAPI_API_SUCCESS)
1938 printf("successful\n");
1942 printf("Error = %d \n", ret_status);
1946 //WAIT FOR THE EVENT HERE
1948 static void app_callback(TapiHandle *handle, int result, void *data, void *user_data)
1950 TelSsForwardResp_t *resp = data;
1954 msgb("tel_set_ss_forward() or tel_get_ss_forward_status() response receive");
1955 msg(" - result = 0x%x", result);
1960 msg(" - record_num = %d", resp->record_num);
1962 for (i = 0; i < resp->record_num; i++) {
1963 msg(" - [%d] Class=%d, Status=%d, ForwardCondition=%d, NoReplyWaitTime=%d, bCallForwardingNumberPresend=%d, szCallForwardingNumber=[%s]",
1965 resp->record[i].Class,
1966 resp->record[i].Status,
1967 resp->record[i].ForwardCondition,
1968 resp->record[i].NoReplyWaitTime,
1969 resp->record[i].bCallForwardingNumberPresent,
1970 resp->record[i].szCallForwardingNumber);
1976 @defgroup Use_Cases3_4 Call Waiting
1977 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
1981 <h3 class="pg">Call Waiting</h3>
1982 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.
1985 int tel_set_ss_waiting(TapiHandle *handle, const TelSsWaitingInfo_t *info, tapi_response_cb callback, void *user_data);
1986 int tel_get_ss_waiting_status(TapiHandle *handle, const TelSsClass_t class, tapi_response_cb callback, void *user_data);
1989 SAMPLE CODE FOR SET CALL WAITING
1992 #include <TapiCommon.h>
1993 #include <ITapiSS.h>
1995 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1999 TelSsWaitingInfo_t waitInfo;
2001 tapi_response_cb callback;
2004 waitInfo.Mode = TAPI_SS_CW_ACTIVATE;
2005 waitInfo.CallType = TAPI_CALL_TYPE_VOICE_EV;
2007 ret_status = tel_set_ss_waiting (handle,&waitInfo,callback,user_data);
2008 if (ret_status == TAPI_API_SUCCESS)
2010 printf("successful\n");
2014 printf("Error = %d \n", ret_status);
2017 //WAIT FOR THE EVENT HERE
2019 //CALLBACK FUNCTION TO BE USED
2020 static void app_callback(TapiHandle *handle, int result, void *data, void *user_data)
2022 TelSsWaitingResp_t *resp = data;
2026 msgb("tel_set_ss_waiting() or tel_get_ss_waiting_status() response receive");
2027 msg(" - result = 0x%x", result);
2032 msg(" - record_num = %d", resp->record_num);
2034 for (i = 0; i < resp->record_num; i++) {
2035 msg(" - [%d] Class=%d, Status=%d",
2037 resp->record[i].Class,
2038 resp->record[i].Status);
2043 SAMPLE CODE FOR GET CALL WAITING STATUS
2046 #include <TapiCommon.h>
2047 #include <ITapiSS.h>
2049 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2053 TelSsCallType_t CallType = TAPI_CALL_TYPE_VOICE_EV;
2055 tapi_response_cb callback;
2058 ret_status = tel_get_ss_waiting_status(handle,CallType,callback,user_data);
2059 if (ret_status == TAPI_API_SUCCESS)
2061 printf("successful\n");
2065 printf("Error = %d \n", ret_status);
2068 //WAIT FOR THE EVENT HERE
2070 //CALLBACK FUNCTION TO BE USED
2071 static void app_callback(TapiHandle *handle, int result, void *data, void *user_data)
2073 TelSsWaitingResp_t *resp = data;
2077 msgb("tel_set_ss_waiting() or tel_get_ss_waiting_status() response receive");
2078 msg(" - result = 0x%x", result);
2083 msg(" - record_num = %d", resp->record_num);
2085 for (i = 0; i < resp->record_num; i++) {
2086 msg(" - [%d] Class=%d, Status=%d",
2088 resp->record[i].Class,
2089 resp->record[i].Status);
2094 @defgroup Use_Cases3_5 CLI Service Status
2095 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2099 <h3 class="pg">CLI Service Status</h3>
2100 <strong>[Note] Telephony Emulator does not support this feature.</strong>
2102 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.
2105 int tel_set_ss_cli_status(TapiHandle *handle, TelSsCliType_t type, TelSsCliStatus_t status, tapi_response_cb callback, void *user_data);
2106 int int tel_get_ss_cli_status(TapiHandle *handle, TelSsCliType_t type, tapi_response_cb callback, void *user_data);
2109 SAMPLE CODE FOR SET CLI STATUS
2112 #include <TapiCommon.h>
2113 #include <ITapiSS.h>
2115 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2116 void cliservicestatus()
2119 TelSsCliType_t type = TAPI_SS_CLI_CLIP;;
2120 TelSsCliStatus_t status;
2122 tapi_response_cb callback;
2125 ret_status = tel_set_ss_cli_status(handle,type,status,callback,user_data);
2126 if (ret_status == TAPI_API_SUCCESS)
2128 printf("successful\n");
2132 printf("Error = %d \n", ret_status);
2135 //WAIT FOR THE EVENT HERE
2137 //CALLBACK FUNCTION TO BE USED
2138 static void app_callback(TapiHandle *handle, int result, void *data, void *user_data)
2140 TelSsCliResp_t *resp = data;
2143 msgb("tel_get_ss_cli_status() response receive");
2144 msg(" - result = 0x%x", result);
2149 msg(" - type = %d", resp->Type);
2150 msg(" - status = %d", resp->Status);
2154 SAMPLE CODE FOR GET CLI STATUS
2157 #include <TapiCommon.h
2158 #include <ITapiSS.h>
2160 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2161 void cliservicestatus()
2164 TelSsCliType_t CliType = TAPI_SS_CLI_CLIP;
2166 tapi_response_cb callback;
2169 ret_status = tel_get_ss_cli_status (handle,CliType,callback,user_data);
2170 if (ret_status == TAPI_API_SUCCESS)
2172 printf("successful\n");
2176 printf("Error = %d \n", ret_status);
2179 //WAIT FOR THE EVENT HERE
2181 //CALLBACK FUNCTION TO BE USED
2182 static void app_callback(TapiHandle *handle, int result, void *data, void *user_data)
2184 TelSsCliResp_t *resp = data;
2187 msgb("tel_get_ss_cli_status() response receive");
2188 msg(" - result = 0x%x", result);
2193 msg(" - type = %d", resp->Type);
2194 msg(" - status = %d", resp->Status);
2198 @defgroup Use_Cases3_6 Send USSD Request
2199 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2203 <h3 class="pg">Send USSD Request </h3>
2204 This API is used to send a USSD string to the Network. This is an Asynchronous API.
2207 @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)
2210 int tel_send_ss_ussd_request tel_send_ss_ussd_request(TapiHandle *handle, const TelSsUssdMsgInfo_t *info, tapi_response_cb callback, void *user_data);
2213 SAMPLE CODE FOR SEND USSD REQUEST
2216 #include <TapiCommon.h>
2217 #include <ITapiSS.h>
2219 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2222 char ussdString[TAPI_SS_USSD_DATA_SIZE_MAX];
2225 memset(ussdString, 0, TAPI_SS_USSD_DATA_SIZE_MAX);
2226 strcpy(ussdString, "*124#");
2228 tapi_response_cb callback;
2231 ret_status = tel_send_ss_ussd_request (handle,ussdString,callback,user_data);
2232 if (ret_status == TAPI_API_SUCCESS)
2234 printf("successful\n");
2238 printf("Error = %d \n", ret_status);
2240 //WAIT FOR THE EVENT HERE
2242 static void app_callback(TapiHandle *handle, int result, void *data, void *user_data)
2244 TelSsUssdResp_t *resp = data;
2247 msgb("tel_send_ss_ussd_request() response receive");
2248 msg(" - result = 0x%x", result);
2253 msg(" - type = %d", resp->Type);
2254 msg(" - status = %d", resp->Status);
2255 msg(" - length = %d", resp->Length);
2256 msg(" - string = [%s]", resp->szString);
2260 @defgroup Use_Cases3_7 AOC Info
2261 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2265 <h3 class="pg">AOC Info</h3>
2266 These APIs set and read AOC parameter values on the SIM.
2269 @n Advice of charge feature is dependent on the SIM for setting or reading aoc parameters. Setting of AOC requires PIN2 Verification
2272 int tel_set_ss_aoc_info(TapiHandle *handle, TelCallAocInfo_t *AocSetInfo, tapi_response_cb callback, void *user_data);
2273 int tel_get_ss_aoc_info(TapiHandle *handle, TelSsAocType_t AocType, tapi_response_cb callback, void *user_data);
2277 SAMPLE CODE FOR SET AOC INFO
2280 #include <TapiCommon.h>
2281 #include <ITapiSS.h>
2283 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2285 //Complete PIN2verification process as mentioned in SIM
2289 printf(" Resetting Total Cost \n");
2291 TelCallAocInfo_t *pAocSetInfo;
2295 tapi_response_cb callback;
2298 pAocSetInfo = (TelCallAocInfo_t *)calloc(1, sizeof(TelCallAocInfo_t));
2299 pAocSetInfo->AocType = TAPI_SS_AOC_TYPE_RESET;
2301 ret = tel_set_ss_aoc_info(handle,pAocSetInfo,callback,user_data);
2302 if (ret_status == TAPI_API_SUCCESS)
2304 printf("successful\n");
2308 printf("Error = %d \n", ret_status);
2312 //WAIT FOR THE EVENT HERE
2313 static void app_callback (TelTapiEvent_t *event)
2319 void* EventData = NULL;
2320 unsigned int temp_handle = -1;
2323 eventClass = event->EventClass;
2324 eventType = event->EventType;
2325 requestId = event->RequestId;
2326 status = event->Status;
2327 EventData = event->pData;
2329 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
2333 //TEST_DEBUG("******This is nonzero status. ******\n");
2338 case TAPI_EVENT_SS_SET_AOC_CNF:
2339 printf("Received Event : SS -- TAPI_EVENT_SS_SET_AOC_CNF\n");
2345 SAMPLE CODE FOR GET AOC INFO
2348 #include <TapiCommon.h
2349 #include <ITapiSS.h>
2351 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2355 TelSsAocType_t AocType = TAPI_SS_AOC_TYPE_ACM;
2357 tapi_response_cb callback;
2360 ret_status = tel_get_ss_aoc_info(handle,AocType,callback,user_data);
2361 if (ret_status == TAPI_API_SUCCESS)
2363 printf("successful\n");
2367 printf("Error = %d \n", ret_status);
2370 //WAIT FOR THE EVENT HERE
2372 static void app_callback (TelTapiEvent_t *event)
2378 void* EventData = NULL;
2379 unsigned int temp_handle = -1;
2381 eventClass = event->EventClass;
2382 eventType = event->EventType;
2383 requestId = event->RequestId;
2384 status = event->Status;
2385 EventData = event->pData;
2387 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
2391 //TEST_DEBUG("******This is nonzero status. ******\n");
2397 case TAPI_EVENT_SS_AOC_RSP:
2398 TelCallAocInfo_t aoc_info;
2399 memcpy(&aoc_info, (TelCallAocInfo_t*)EventData, sizeof(TelCallAocInfo_t));
2400 printf("Received Event : SS -- TAPI_EVENT_SS_AOC_RSP\n");
2401 printf(" AOC TYPE :%d\n", aoc_info.AocType);
2409 <h2 class="pg">SMS</h2>
2411 @defgroup Use_Cases4_1 Event register and deregister
2412 @ingroup Use_Cases4_SMS
2415 <h3 class="pg">Event register and deregister</h3>
2416 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.
2417 The telephony framework only provides an interface to the modem and doesnot 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.
2419 Notification Events are as follows.
2421 TAPI_EVENT_NETTEXT_INCOM_IND
2422 TAPI_EVENT_NETTEXT_CB_INCOM_IND
2423 TAPI_EVENT_NETTEXT_INCOM_EX_IND
2424 TAPI_EVENT_NETTEXT_CB_INCOM_EX_IND
2425 TAPI_EVENT_NETTEXT_MEMORY_STATUS_IND
2426 TAPI_EVENT_NETTEXT_DEVICE_READY_IND
2433 char *noti_id = TAPI_NOTI_SMS_INCOM_MSG;
2434 tapi_response_cb callback;
2438 handle = tel_init();
2441 TEST_DEBUG("tel_init Failed");
2443 api_err = tel_register_noti_event(handle, noti_id, callback, user_data);
2444 printf("Nettext Class registration is Done: noti_id is %d, handle is %d\n", noti_id, handle);
2447 api_err = tel_deregister_noti_event(handle, noti_id);
2450 printf("Event Unregistration Fail\n");
2453 // SMS notification callback function
2454 void notification_callback(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
2456 printf(" app _callback is called \n");
2460 case TAPI_NOTI_SMS_INCOM_MSG:
2461 TelSmsDatapackageInfo_t *ptrDataPackage;
2462 printf("SMS Incoming Message\n");
2463 ptrDataPackage = (TelSmsDatapackageInfo_t *)EventData;
2464 // Decoding Service Center Address
2465 // Decoding TPDU(SMS-DELIVER, SMS-STATUS)
2468 case TAPI_NOTI_SMS_CB_INCOM_MSG:
2469 TelSmsCbMsg_t *ptrCbMsgInfo;
2470 printf("SMS Cell Broadcasting Incoming Message\n");
2471 ptrCbMsgInfo = (TelSmsCbMsg_t *)data;
2472 // Decoding Cell broadcasting Message in szData [Refer to 3GPP TS23.041 9.4.1]
2475 case TAPI_NOTI_SMS_INCOM_EX_MSG:
2476 TelSmsMsgInfo_t *pMsgInfo;
2477 printf("CDMA SMS Incoming Message\n");
2478 pMsgInfo = (TelSmsMsgInfo_t *)data;
2479 // Decoding TPDU(SMS-DELIVER, SMS-STATUS)
2482 case TAPI_NOTI_SMS_CB_INCOM_EX_MSG:
2483 TelSmsMsgInfo_t *pMsgInfo = NULL;
2484 printf("CDMA SMS Incoming Message\n");
2485 pMsgInfo = (TelSmsMsgInfo_t *)EventData;
2486 // Decoding Cell broadcasting Message in szData
2489 case TAPI_NOTI_SMS_MEMORY_STATUS:
2491 printf("SIM Memory Status Notification\n");
2492 status = (TelSmsMemStatusType *)data;
2493 if (*status == TAPI_NETTEXT_PHONE_MEMORY_STATUS_AVAILABLE)
2494 printf("SIM Memory Available\n");
2495 else if (*status == TAPI_NETTEXT_PHONE_MEMORY_STATUS_FULL)
2496 printf("SIM Memory Full\n");
2498 printf("Unknown Type\n");
2501 case TAPI_NOTI_SMS_DEVICE_READY:
2502 int *pDeviceReady = NULL;
2503 printf("SMS Device Ready Status Notification\n");
2504 pDeviceReady = (int*)data;
2505 if (pDeviceReady->Result == 1)
2506 printf("Device Ready\n");
2508 printf("Unknown Type\n");
2515 @defgroup Use_Cases4_2 Send SMS
2516 @ingroup Use_Cases4_SMS
2520 <h3 class="pg">Send SMS</h3>
2521 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.
2522 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.
2523 This will ensure the lower layers do not release the dedicated connection if there are more messages expected.
2526 int tel_send_sms(TapiHandle *handle, const TelSmsDatapackageInfo_t *pDataPackage, int bMoreMsgToSend, tapi_response_cb callback, void* user_data)
2529 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
2535 #include <TapiCommon.h>
2536 #include <ITapiNetText.h>
2540 //Obtain Tapi Handle as mentioned in Event Register and Deregister
2541 TelSmsDatapackageInfo_t *pDataPackage;
2542 int ret_status = TAPI_API_SUCCESS;
2544 tapi_response_cb callback;
2548 pDataPackage = (TelSmsDatapackageInfo_t*) malloc(sizeof(TelSmsDatapackageInfo_t));
2550 pDataPackage /* fill the structure appropriately/
2551 Sca parameter is optional. If you don't provide Service center address, you should fi
2552 MsgLength is length of szData
2553 fill the szData in TelSmsDatapackageInfo_t with SMS-SUBMIT or SMS-COMMAND TPDU.
2555 ret_status = tel_send_sms(handle, pDataPackage, bMoreMsgToSend, on_resp_send_sms, user_data);
2556 if (ret_status == TAPI_API_SUCCESS)
2558 printf("successful\n");
2562 printf("error = %d\n", ret_status);
2564 //WAIT FOR THE EVENT HERE
2567 static void on_resp_send_sms(TapiHandle *handle, int result, void *data, void *user_data)
2569 printf("%d", result);
2572 //TEST_DEBUG("******This is nonzero status. ******\n");
2577 @defgroup Use_Cases4_3 Read SMS
2578 @ingroup Use_Cases4_SMS
2582 <h3 class="pg">Read SMS</h3>
2583 This API reads a message from SIM card storage. You should not access this API directly; instead use the Message Framework API.
2586 int tel_read_sms_in_sim(TapiHandle *handle, int index, tapi_response_cb callback, void* user_data);
2589 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
2595 #include <TapiCommon.h>
2596 #include <ITapiNetText.h>
2600 //Obtain Tapi Handle as mentioned in Event Register and Deregister
2605 int returnStatus = 0;
2607 memset (buf, 0, sizeof (buf));
2609 returnStatus = tel_get_sms_count (handle, on_resp_get_sms_count, user_data);
2610 //In the Response of get count tel_read_sms_in_sim will be called
2611 printf("tel_get_sms_count(): 0x%x", returnStatus)
2614 static void on_resp_read_msg(TapiHandle *handle, int result, void *data, void *user_data)
2616 TelSmsData_t * sim_data;
2617 int scaAddr_len = 0;
2620 char diallingNum[TAPI_NETTEXT_ADDRESS_LEN_MAX + 1] = { 0, };
2621 char scaAddr[TAPI_NETTEXT_SCADDRESS_LEN_MAX + 2] = { 0, }; //service center address
2622 int sca_ton, sca_npi;
2625 sim_data = (TelSmsData_t *) data;
2627 //find msg_status from sim data
2630 memset (diallingNum, 0, sizeof (diallingNum));
2631 SmsUtilDecodeAddrField (diallingNum, (char *) sim_data->SmsData.Sca,
2632 &sca_ton, &sca_npi);
2633 position += 2; //include Address-Length, Type of Address
2635 scaAddr_len = strlen ((char *) diallingNum);
2636 if (scaAddr_len > TAPI_NETTEXT_SCADDRESS_LEN_MAX - 1)
2637 scaAddr_len = TAPI_NETTEXT_SCADDRESS_LEN_MAX - 1;
2639 if (scaAddr_len % 2)
2640 position += scaAddr_len / 2 + 1;
2642 position += scaAddr_len / 2;
2644 if (sca_ton == SMS_TON_INTERNATIONAL) {
2646 memcpy (&scaAddr[1], diallingNum, scaAddr_len);
2649 memcpy (scaAddr, diallingNum, scaAddr_len);
2652 tpdu_len = sim_data->SmsData.MsgLength;
2654 printf("SCA Number : %s tpdu_len is %d", scaAddr, tpdu_len);
2656 pTPDU = malloc (sizeof(unsigned char) * tpdu_len);
2660 printf("bfor memcopy position is %d", position);
2661 memcpy (pTPDU, & (sim_data->SmsData.szData[0]), tpdu_len);
2662 printf("after memcpy");
2664 DecodeSmsDeliverTpdu (tpdu_len, pTPDU);
2669 @defgroup Use_Cases4_4 Write Sms
2670 @ingroup Use_Cases4_SMS
2674 <h3 class="pg">Write Sms</h3>
2675 This API writes a message to SIM storage area.
2676 @n The parameter of this API is changed into TelSmsData_t.
2677 @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.
2680 int tel_write_sms_in_sim(TapiHandle *handle, const TelSmsData_t *pWriteData, tapi_response_cb callback, void* user_data);@endcode
2682 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
2688 #include <TapiCommon.h>
2689 #include <ITapiNetText.h>
2693 //Obtain Tapi Handle as mentioned in Event Register and Deregister
2694 int ret_status = TAPI_API_SUCCESS;
2695 TapiHandle *handle;//Obtained from tel_init();
2696 tapi_response_cb callback;
2699 TelSmsData_t *pWriteData;
2700 char *msg = "This is an Test SMS";
2701 char *SCA = "821091";
2703 pWriteData =(TelSmsData_t *)malloc(sizeof(TelSmsData_t));
2705 conv_service_center_address(pWriteData->SmsData.Sca, SCA); //convert service center address
2706 conv_msg_into_tpdu(pWriteData->SmsData.szData, pWriteData->SmsData.MsgLength, msg); // convert message into TPDU
2707 pWrite->MsgStatus = TAPI_NETTEXT_STATUS_READ;
2708 pWrite->SimIndex = -1;
2710 ret_status = tel_write_sms_in_sim(handle, pWriteData, on_resp_write_sms, user_data);
2711 if (ret_status == TAPI_API_SUCCESS)
2713 printf("successful\n");
2717 printf("error = %d\n", ret_status);
2719 //WAIT FOR EVENT HERE
2721 static void on_resp_write_sms(TapiHandle *handle, int result, void *data, void *user_data)
2725 printf("tel_write_sms_in_sim() response receive");
2726 printf(" - result = 0x%x", result);
2727 printf(" - index = %d", *index);
2731 @defgroup Use_Cases4_5 Delete Sms
2732 @ingroup Use_Cases4_SMS
2736 <h3 class="pg">Delete Sms</h3>
2737 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.
2740 int tel_delete_sms_in_sim(TapiHandle *handle, int index, tapi_response_cb callback, void* user_data);
2743 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
2749 #include <TapiCommon.h>
2750 #include <ITapiNetText.h>
2754 //Obtain Tapi Handle as mentioned in Event Register and Deregister
2755 int ret_status = TAPI_API_SUCCESS;
2756 TapiHandle *handle;//Obtained from tel_init();
2757 tapi_response_cb callback;
2761 ret_status = tel_delete_sms_in_sim(handle, index, on_resp_delete_sms, user_data);
2762 if (ret_status == TAPI_API_SUCCESS)
2764 printf("successful\n");
2768 printf("error = %d\n", ret_status);
2770 //WAIT FOR EVENT HERE
2772 static void on_resp_delete_sms(TapiHandle *handle, int result, void *data, void *user_data)
2775 printf("tel_delete_sms_in_sim() response receive");
2776 printf(" - result = 0x%x", result);
2777 printf(" - index = %d", *index);
2781 @defgroup Use_Cases4_6 Getting Sms Count
2782 @ingroup Use_Cases4_SMS
2786 <h3 class="pg">Getting Sms Count</h3>
2787 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.
2790 int tel_get_sms_count(TapiHandle *handle, tapi_response_cb callback, void* user_data);
2793 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
2799 #include <TapiCommon.h>
2800 #include <ITapiNetText.h>
2804 //Obtain Tapi Handle as mentioned in Event Register and Deregister
2807 tapi_response_cb callback;
2810 ret_status = tel_get_sms_count(handle, on_resp_get_count, user_data);
2811 if (ret_status == TAPI_API_SUCCESS)
2813 printf("successful\n");
2817 printf("error = %d\n", ret_status);
2819 //WAIT FOR EVENT HERE
2821 static void on_resp_get_count(TapiHandle *handle, int result, void *data, void *user_data)
2823 static TelSmsStoredMsgCountInfo_t *countInfo;
2824 int loop_counter = 0;
2825 TapiResult_t returnStatus = TAPI_API_SUCCESS;
2827 countInfo = (TelSmsStoredMsgCountInfo_t*) data;
2829 printf("tel_get_sms_count() response receive");
2830 printf(" - result = 0x%x", result);
2832 if (countInfo->UsedCount != 0x00) //if used count is not zero
2834 printf("Index LIST..........");
2835 for (loop_counter = 0; loop_counter < countInfo->UsedCount;
2837 printf("[%02x]", countInfo->IndexList[loop_counter]);
2838 returnStatus = tel_read_sms_in_sim (handle, countInfo->IndexList[loop_counter], on_resp_read_msg, user_data);
2839 printf("After read msg: returnstatus %d", returnStatus);
2841 printf("In MsgCountNotification total cnt is %d, usedcnt is %dapi_err %d",
2842 countInfo->TotalCount, countInfo->UsedCount, returnStatus);
2845 printf("In MsgCountNotification total cnt is %d, usedcnt is %d",
2846 countInfo->TotalCount, countInfo->UsedCount);
2850 @defgroup Use_Cases4_7 Setting Sms CB message
2851 @ingroup Use_Cases4_SMS
2855 <h3 class="pg">Setting Sms CB message</h3>
2856 <strong>[Note] Telephony Emulator does not support this feature.</strong>
2857 @n This API is used to set the SMS CB Message Identifiers in the appropriate EF-CBMI/EF-CBMIR file in (U)SIM.
2858 This API also indicates the underlying provider to enable or disable CB Channel on which CB messages are received.
2859 You should not access this API directly; use the Message Framework API.
2862 int tel_set_sms_cb_config(handle, pCBConfig, callback, user_data);
2865 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
2871 #include <TapiCommon.h>
2872 #include <ITapiNetText.h>
2876 //Obtain Tapi Handle as mentioned in Event Register and Deregister
2878 tapi_response_cb callback;
2881 pCBConfig = calloc (1, sizeof(TelSmsCbConfig_t));
2885 msg("Enter CB ON/OFF (1: Enable, 0:Disable): ");
2886 pCBConfig->CBEnabled =;//fill appropriately
2888 msg("Enter Max ID Count: ");
2889 pCBConfig->MsgIdMaxCount =);//fill appropriately
2891 msg("Enter MsgIdRangeCount ( < 10 ): ");
2892 pCBConfig->MsgIdRangeCount =;//fill appropriately
2894 if (pCBConfig->MsgIdRangeCount <= 0
2895 || pCBConfig->MsgIdRangeCount >= TAPI_NETTEXT_GSM_SMS_CBMI_LIST_SIZE_MAX) {
2896 printf("Bad Range value");
2901 for (i = 0; i < pCBConfig->MsgIdRangeCount; i++) {
2902 printf("Enter %d FromMsgId : ", i + 1);
2903 pCBConfig->MsgIDs[i].Net3gpp.FromMsgId = _get_int();
2905 printf("Enter %d ToMsgId : ", i + 1);
2906 pCBConfig->MsgIDs[i].Net3gpp.ToMsgId = _get_int();
2908 printf("Enter %d Selected : ", i + 1);
2909 pCBConfig->MsgIDs[i].Net3gpp.Selected = _get_int();
2912 pCBConfig->Net3gppType = 0x01;
2914 returnStatus = tel_set_sms_cb_config(handle, pCBConfig, on_resp_set_sms_cb_config, user_data);
2915 if (ret_status == TAPI_API_SUCCESS)
2917 printf("successful\n");
2921 printf("error = %d\n", ret_status);
2923 //WAIT FOR EVENT HERE
2926 //CALLBACK FUNCTION TO BE USED
2927 static void on_resp_set_sms_cb_config (TapiHandle *handle, int result, void *data, void *user_data)
2930 printf("tel_set_sms_cb_config() response receive");
2931 printf(" - result = 0x%x", result);
2934 @defgroup Use_Cases4_8 Getting Sms CB configuration
2935 @ingroup Use_Cases4_SMS
2939 <h3 class="pg">Getting Sms CB configuration</h3>
2940 <strong>[Note] Telephony Emulator does not support this feature.</strong>
2941 @n This API is used to retrieve SMS CB configuration options from EFcbmi file in the SIM. You should not access this API directly.
2942 Use the Message Framework API.
2945 int tel_get_sms_cb_config(TapiHandle *handle, tapi_response_cb callback, void* user_data);
2948 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
2955 #include <TapiCommon.h>
2956 #include <ITapiNetText.h>
2961 //Obtain Tapi Handle as mentioned in Event Register and Deregister
2963 tapi_response_cb callback;
2965 ret_status = tel_get_sms_cb_config(handle, on_resp_get_cb_config, user_data);
2967 printf ("The return value is %d\n", ret_status);
2968 if (ret_status == TAPI_API_SUCCESS)
2970 printf("successful\n");
2974 printf("error = %d\n", ret_status);
2976 //WAIT FOR EVENT HERE
2978 static void on_resp_get_cb_config (TapiHandle *handle, int result, void *data, void *user_data)
2980 TelSmsCbConfig_t * CBConfig;
2983 CBConfig = (TelSmsCbConfig_t *) data;
2985 printf("tel_get_sms_cb_config() response receive");
2986 printf(" - result = 0x%x", result);
2989 if (CBConfig->CBEnabled == TRUE)
2990 msg("Cell Broadcast Msg Enabled...")
2992 msg("Cell Broadcast Msg Disabled...")
2995 if (CBConfig->Net3gppType == 0x01)
2996 msg("Network type is 3gpp ")
2997 else if (CBConfig->Net3gppType == 0x02)
2998 msg("Network type is CDMA");
3000 printf("CBMI Range Count: %d \n", CBConfig->MsgIdRangeCount);
3002 if (CBConfig->MsgIdRangeCount != 0) {
3003 msg("----- CBMI List -----");
3004 for (i = 0; i < CBConfig->MsgIdRangeCount; i++) {
3005 msg("From No.%d - [0x%04x]", i,
3006 CBConfig->MsgIDs[i].Net3gpp.FromMsgId);
3007 msg("To No.%d - [0x%04x]", i, CBConfig->MsgIDs[i].Net3gpp.ToMsgId);
3015 @defgroup Use_Cases4_9 Service Center Address
3016 @ingroup Use_Cases4_SMS
3020 <h3 class="pg">Service Center Address</h3>
3021 This API sets the SMS Service Centre Address information in order to send the SMS.
3022 @n It is also possible to get current SMS Service Centre Address information.
3023 Currently Only index 0 is supported in Aquila's Telephony OEM Plugin. You should not access this API directly; use the Message Framework API.
3026 int tel_set_sms_sca(TapiHandle *handle, const TelSmsAddressInfo_t *pSCA, int index, tapi_response_cb callback, void* user_data);
3027 int tel_get_sms_sca(TapiHandle *handle, int index, tapi_response_cb callback, void* user_data);
3030 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
3036 #include <TapiCommon.h>
3037 #include <ITapiNetText.h>
3042 //Obtain Tapi Handle as mentioned in Event Register and Deregister
3044 tapi_response_cb callback;
3046 TelSmsAddressInfo_t sca;
3048 memset (&sca, 0, sizeof(TelSmsAddressInfo_t));
3050 sca.DialNumLen = 0x5;
3051 sca.Npi = TAPI_SIM_NPI_ISDN_TEL;
3052 sca.Ton = TAPI_SIM_TON_INTERNATIONAL;
3053 sca.szDiallingNum[0] = 0x28;
3054 sca.szDiallingNum[1] = 0x01;
3055 sca.szDiallingNum[2] = 0x19;
3056 sca.szDiallingNum[3] = 0x11;
3057 sca.szDiallingNum[4] = 0x11;
3060 ret_status = int tel_set_sms_sca(handle, pSCA, index, on_resp_set_sms_sca, user_data);
3061 //[Note] Telephony Emulator Not Support
3063 printf("returnstatus after scaddr set is %d requestId:%d \n", ret_status, pRequestId);
3064 if (ret_status == TAPI_API_SUCCESS)
3066 printf("successful\n");
3070 printf("error = %d\n", ret_status);
3074 static void on_resp_set_sms_sca (TapiHandle *handle, int result, void *data, void *user_data)
3076 printf("tel_set_sms_sca() response receive");
3077 printf(" - result = 0x%x", result);
3085 #include <TapiCommon.h>
3086 #include <ITapiNetText.h>
3091 //Obtain Tapi Handle as mentioned in Event Register and Deregister
3093 tapi_response_cb callback;
3096 ret_status = int tel_get_sms_sca(handle, index, on_resp_get_sms_sca, user_data);
3097 if (ret_status == TAPI_API_SUCCESS)
3099 printf("successful\n");
3103 printf("error = %d\n", ret_status);
3107 static void on_resp_get_sms_sca (TapiHandle *handle, int result, void *data,
3110 TelSmsAddressInfo_t *scaInfo = data;
3113 printf("tel_get_sms_sca() response receive");
3114 printf(" - result = 0x%x", result);
3115 printf(" - TON = %d", scaInfo->Ton);
3116 printf(" - NPI = %d", scaInfo->Npi);
3117 printf(" - DialNumLen = %d", scaInfo->DialNumLen);
3118 printf(" - SCA Num");
3120 for (i = 0; i < scaInfo->DialNumLen; i++) {
3121 printf("[%02x]", scaInfo->szDiallingNum[i]);
3130 @defgroup Use_Cases4_10 Sms Preferred Bearer
3131 @ingroup Use_Cases4_SMS
3135 <h3 class="pg">Sms Preferred Bearer</h3>
3136 <strong>[Note] Telephony Emulator and Aquila’s Telephony OEM Plugin do not support this feature.</strong>
3137 @n Telephony provides APIs to set SMS preferred bearer on which SMS has to be transmitted.
3138 You should not access this API directly; use the Message Framework API.
3141 int tel_get_sms_preferred_bearer(TapiHandle *handle, tapi_response_cb callback, void* user_data);
3142 int tel_set_sms_preferred_bearer(TapiHandle *handle, TelSmsBearerType_t BearerType, tapi_response_cb callback, void* user_data);
3145 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
3151 #include <TapiCommon.h>
3152 #include <ITapiNetText.h>
3157 //Obtain Tapi Handle as mentioned in Event Register and Deregister
3159 tapi_response_cb callback;
3162 TelSmsBearerType_t BearerType = TAPI_NETTEXT_BEARER_PS_ONLY;
3164 ret_status = tel_get_sms_preferred_bearer(handle, on_resp_set_sms_preferred_bearer, user_data);
3165 if (ret_status == TAPI_API_SUCCESS)
3167 printf("successful\n");
3171 printf("error = %d\n", ret_status);
3174 static void on_resp_set_sms_preferred_bearer (TapiHandle *handle, int result, void *data, void *user_data)
3177 printf("tel_set_sms_preferred_bearer() response receive");
3178 printf(" - result = 0x%x", result);
3180 //get preferred bearer
3183 #include <TapiCommon.h>
3184 #include <ITapiNetText.h>
3188 //Obtain Tapi Handle as mentioned in Event Register and Deregister
3190 tapi_response_cb callback;
3192 ret_status = tel_get_sms_preferred_bearer(handle, callback, user_data);
3193 if (ret_status == TAPI_API_SUCCESS)
3195 printf("successful\n");
3199 printf("error = %d\n", ret_status);
3202 static void on_resp_get_pref_bearer (TapiHandle *handle, int result, void *data, void *user_data)
3205 printf("tel_get_sms_preferred_bearer() response receive");
3206 printf(" - result = 0x%x", result);
3210 @defgroup Use_Cases4_11 Sms Parameters
3211 @ingroup Use_Cases4_SMS
3215 <h3 class="pg">Sms Parameters</h3>
3216 <strong>[Note] Telephony Emulator does not support this feature.</strong>
3217 @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.
3220 int tel_get_sms_parameters(TapiHandle *handle, int index, tapi_response_cb callback, void* user_data);
3221 int tel_set_sms_parameters(TapiHandle *handle, const TelSmsParams_t *pSmsSetParameters, tapi_response_cb callback, void* user_data);
3224 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
3230 #include <TapiCommon.h>
3231 #include <ITapiNetText.h>
3235 //Obtain Tapi Handle as mentioned in Event Register and Deregister
3237 tapi_response_cb callback;
3241 TelSmsParams_t SmsSetParameters;
3243 SmsSetParameters.RecordIndex = 0x01;
3244 SmsSetParameters.RecordLen = 28;
3245 memcpy(SmsSetParameters.TpDestAddr.szDiallingNum, "9986529874", 10);
3246 printf("\ndial no is %s\n", SmsSetParameters.TpDestAddr.szDiallingNum);
3248 SmsSetParameters.TpDestAddr.DialNumLen = 10;
3249 SmsSetParameters.TpDestAddr.Ton = TAPI_SIM_TON_NATIONAL;//national no
3250 SmsSetParameters.TpDestAddr.Npi = TAPI_SIM_NPI_NATIONAL;
3252 ret_status = tel_set_sms_parameters(handle, pSmsSetParameters, on_resp_set_sms_params, user_data);
3253 if (ret_status == TAPI_API_SUCCESS)
3255 printf("successful\n");
3259 printf("error = %d\n", ret_status);
3262 static void on_resp_set_sms_params (TapiHandle *handle, int result, void *data, void *user_data)
3264 printf("tel_set_sms_params() response receive");
3265 printf(" - result = 0x%x", result);
3272 #include <TapiCommon.h>
3273 #include <ITapiNetText.h>
3278 //Obtain Tapi Handle as mentioned in Event Register and Deregister
3280 tapi_response_cb callback;
3283 ret_status = tel_get_sms_parameters(handle, index, on_resp_get_sms_parameters, user_data);
3284 if (ret_status == TAPI_API_SUCCESS)
3286 printf("successful\n");
3290 printf("error = %d\n", ret_status);
3293 static void on_resp_get_sms_parameters (TapiHandle *handle, int result, void *data, void *user_data)
3295 TelSmsParams_t *smsp_param;
3297 smsp_param = (TelSmsParams_t *) data;
3299 printf("tel_get_sms_parameters() response receive");
3300 printf(" - result = 0x%x", result);
3302 printf("record index is 0x%x", smsp_param->RecordIndex);
3303 printf("record len is 0x%x", smsp_param->RecordLen);
3304 printf("alpha_id len is 0x%x ", (int )smsp_param->AlphaIdLen);
3305 printf("alpha_id is %s ", smsp_param->szAlphaId);
3306 printf("param indicator is 0x%x", smsp_param->ParamIndicator);
3307 printf("dest dialling num is %s", smsp_param->TpDestAddr.szDiallingNum);
3308 printf("svcaddr dialling num is %s", smsp_param->TpSvcCntrAddr.szDiallingNum);
3309 printf("pid 0x%x", smsp_param->TpProtocolId);
3310 printf("dcs is 0x%x", smsp_param->TpDataCodingScheme);
3311 printf("validity is 0x%x", smsp_param->TpValidityPeriod);
3315 @defgroup Use_Cases4_12 Sending Delivery Report
3316 @ingroup Use_Cases4_SMS
3320 <h3 class="pg">Sending Delivery Report</h3>
3321 This API sends a SMS-deliver report to the network, after receiving an incoming SMS. You should not access this API directly.
3324 int tel_send_sms_deliver_report(TapiHandle *handle, const TelSmsDatapackageInfo_t *pDataPackage, TelSmsResponse_t RPCause, tapi_response_cb callback, void* user_data);
3327 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
3333 #include <TapiCommon.h>
3334 #include <ITapiNetText.h>
3335 void send_delivery()
3338 //Obtain Tapi Handle as mentioned in Event Register and Deregister
3340 tapi_response_cb callback;
3343 TelSmsResponse_t RPCause;
3344 TelSmsDatapackageInfo_t *del_report = NULL;
3346 del_report = malloc(sizeof(TelSmsDatapackageInfo_t));
3347 memset(del_report, 0, sizeof(TelSmsDatapackageInfo_t));
3348 //Encode Send Delivery Report here
3349 //EncodeSmsDeliveryReportTpdu();
3351 RPCause = TAPI_NETTEXT_SENDSMS_SUCCESS;
3352 printf("***receive message (Api:SendDeliverreport)****\n");
3354 ret_status = tel_send_sms_deliver_report(handle, pDataPackage, RPCause, callback, user_data);
3355 if (ret_status == TAPI_API_SUCCESS)
3357 printf("successful\n");
3361 printf("error = %d\n", ret_status);
3364 static void on_resp_DeliverReport_msg (TapiHandle *handle, int result, void *data, void *user_data)
3369 printf("tel_send_sms_deliver_report() response receive");
3370 printf(" - result = 0x%x", result);
3371 printf(" - index = %d", *index);
3375 @defgroup Use_Cases4_13 Setting Memory Status
3376 @ingroup Use_Cases4_SMS
3380 <h3 class="pg">Setting Memory Status</h3>
3381 <strong>[Note] Telephony Emulator does not support this feature.</strong>
3382 @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.
3385 int tel_set_sms_memory_status(TapiHandle *handle, int memoryStatus, tapi_response_cb callback, void* user_data);
3388 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
3394 #include <TapiCommon.h>
3395 #include <ITapiNetText.h>
3396 void set_memstatus()
3398 //Obtain Tapi Handle as mentioned in Event Register and Deregister
3400 tapi_response_cb callback;
3403 int MemoryStatus = TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE;
3405 ret_status = tel_set_sms_memory_status(handle, memoryStatus, on_resp_set_mem_status, user_data);
3406 if (ret_status == TAPI_API_SUCCESS)
3408 printf("successful\n");
3412 printf("error = %d\n", ret_status);
3415 static void on_resp_set_mem_status (TapiHandle *handle, int result, void *data, void *user_data)
3417 printf("tel_set_sms_mem_status() response receive");
3418 printf(" - result = 0x%x", result);
3422 @defgroup Use_Cases4_14 Setting Message Status
3423 @ingroup Use_Cases4_SMS
3427 <h3 class="pg">Setting Message Status</h3>
3428 <strong>[Note] Telephony Emulator does not support this feature.</strong>
3429 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.
3432 int tel_set_sms_message_status(TapiHandle *handle, int index, TelSmsMsgStatus_t msgStatus, tapi_response_cb callback, void* user_data);
3436 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
3442 #include <TapiCommon.h>
3443 #include <ITapiNetText.h>
3445 void set_msgstatus()
3447 //Obtain Tapi Handle as mentioned in Event Register and Deregister
3449 tapi_response_cb callback;
3453 TelSmsMsgStatus_t MsgStatus = TAPI_NETTEXT_STATUS_READ;
3455 ret_status = tel_set_sms_message_status(handle, index, msgStatus, on_resp_set_msg_status, user_data);
3456 printf ("The return value is %d\n", ret_status);
3458 returnStatus = tel_read_sms_in_sim (handle, index, on_resp_read_msg, user_data);
3459 printf("returnStatus after read is %d",returnStatus);
3460 if (ret_status == TAPI_API_SUCCESS)
3462 printf("successful\n");
3466 printf("error = %d\n", ret_status);
3469 static void on_resp_set_msg_status (TapiHandle *handle, int result, void *data, void *user_data)
3471 printf("tel_set_sms_msg_status() response receive");
3472 printf(" - result = 0x%x", result);
3476 @defgroup Use_Cases4_15 Getting SMS Parameter Count
3477 @ingroup Use_Cases4_SMS
3481 <h3 class="pg">Getting SMS Parameter Count</h3>
3482 <strong>[Note] Telephony Emulator does not support this feature.</strong>
3483 @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.
3486 int tel_get_sms_parameter_count(TapiHandle *handle, tapi_response_cb callback, void* user_data);
3489 <strong>This API is restricted for direct use. Use the Message Framework API instead.</strong>
3495 #include <TapiCommon.h>
3496 #include <ITapiNetText.h>
3498 void get_paramcount()
3500 //Obtain Tapi Handle as mentioned in Event Register and Deregister
3502 tapi_response_cb callback;
3506 ret_status = tel_get_sms_parameter_count(handle, on_resp_get_paramcnt, user_data);
3507 printf ("The return value is %d\n", ret_status);
3508 if (ret_status == TAPI_API_SUCCESS)
3510 printf("successful\n");
3514 printf("error = %d\n", ret_status);
3517 static void on_resp_get_paramcnt (TapiHandle *handle, int result, void *data, void *user_data)
3521 RecordCount = (int *) data;
3523 printf("tel_get_sms_parameter_count() response receive");
3524 printf(" - result = 0x%x", result);
3525 printf(" - In param_count_noti the record count is %d", *RecordCount);
3530 @defgroup Use_Cases5_1 Event register and deregister
3531 @ingroup Use_Cases5_NETWORK
3534 <h3 class="pg">Event register and deregister</h3>
3535 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.
3537 Network Notification Events
3539 TAPI_EVENT_NETWORK_LOCATIONCELLINFO_IND
3540 TAPI_EVENT_NETWORK_RADIO_INFO_IND
3541 TAPI_EVENT_NETWORK_SPN_INFO
3542 TAPI_EVENT_NETWORK_DISPLAYINFO_IND
3549 char *noti_id = TAPI_EVENT_NETWORK_LOCATIONCELLINFO_IND;
3550 tapi_response_cb callback;
3554 handle = tel_init();
3557 TEST_DEBUG("tel_init Failed");
3561 api_err = tel_register_noti_event(handle, noti_id, app_callback, user_data);
3562 if (api_err == TAPI_API_SUCCESS)
3564 printf("Network notification registration is Done: noti_id is %d, handle is %d\n", noti_id, handle);
3568 api_err = tel_deregister_noti_event(handle, noti_id);
3569 if (api_err != TAPI_API_SUCCESS)
3571 printf("Event Unregistration Fail\n");
3574 // Network notification callback function
3575 void app_callback(void)
3581 void *EventData = NULL;
3583 eventClass = event->EventClass;
3584 eventType = event->EventType;
3585 requestId = event->RequestId;
3586 status = event->Status;
3587 EventData = event->pData;
3588 printf(" app _callback is called \n");
3590 print_events((int)eventType);
3591 printf("\n event came in power_callback [%d] \n", eventType);
3592 printf("\n expected event is in callback [%d] \n", expected_event);
3596 case TAPI_EVENT_NETWORK_LOCATIONCELLINFO_IND:
3597 //process notification data
3600 case TAPI_EVENT_NETWORK_RADIO_INFO_IND:
3601 //process notification data
3604 case TAPI_EVENT_NETWORK_SPN_INFO:
3605 //process notification data
3608 case TAPI_EVENT_NETWORK_DISPLAYINFO_IND:
3609 //process notification data
3615 @defgroup Use_Cases5_2 Network Selection
3616 @ingroup Use_Cases5_NETWORK
3619 <h3 class="pg">Network Selection</h3>
3620 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.
3623 int tel_select_network_automatic(TapiHandle *handle, tapi_response_cb callback, void *user_data)
3624 int tel_select_network_manual(TapiHandle *handle, const char *plmn, int act, tapi_response_cb callback, void *user_data)
3629 #include <ITapiNetwork.h>
3631 #include "TapiCommon.h"
3633 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3638 tapi_response_cb callback;
3640 unsigned int plmn = 0;
3642 //CASE 1. MANUAL MODE
3645 ret_status = tel_select_network_manual(handle, plmn, act, callback, user_data);
3647 // CASE 2. AUTOMATIC MODE
3648 ret_status = tel_select_network_automatic(handle, callback, user_data);
3649 if (ret_status == TAPI_API_SUCCESS)
3650 printf("successful\n");
3652 printf("error=%d\n", ret_status);
3654 //WAIT FOR EVENT HERE
3657 //CALLBACK FUNCTION TO BE USED
3658 static void app_callback (TelTapiEvent_t *event)
3664 void* EventData = NULL;
3667 eventClass = event->EventClass;
3668 eventType = event->EventType;
3669 requestId = event->RequestId;
3670 status = event->Status;
3671 EventData = event->pData;
3673 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3677 //TEST_DEBUG("******This is nonzero status. ******\n");
3684 case TAPI_EVENT_NETWORK_SELECT_CNF:
3685 printf("\n$$$$$$ TAPI_EVENT_NETWORK_SELECT_CNF $$$$$$ \n");
3690 @defgroup Use_Cases5_3 Network Search
3691 @ingroup Use_Cases5_NETWORK
3694 <h3 class="pg">Network Search</h3>
3695 This API is used to search for the available networks, and to provide the Network List to the User/Application.
3698 int tel_search_network(TapiHandle *handle, tapi_response_cb callback, void *user_data);
3703 #include <ITapiNetwork.h>
3705 #include "TapiCommon.h"
3707 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3712 tapi_response_cb callback;
3715 ret_status = tel_search_network(handle, callback, user_data);
3716 if (ret_status == TAPI_API_SUCCESS)
3717 printf("successful\n");
3719 printf("error=%d\n", ret_status);
3720 //WAIT FOR EVENT HERE
3722 //CALLBACK FUNCTION TO BE USED
3723 static void app_callback (TelTapiEvent_t *event)
3729 void* EventData = NULL;
3730 unsigned int temp_handle = -1;
3733 eventClass = event->EventClass;
3734 eventType = event->EventType;
3735 requestId = event->RequestId;
3736 status = event->Status;
3737 EventData = event->pData;
3739 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3743 //TEST_DEBUG("******This is nonzero status. ******\n");
3748 switch (eventType) //REFER Network Selection TO GET eventType
3750 case TAPI_EVENT_NETWORK_SEARCH_CNF:
3751 int ui_entry_count = 0;
3752 TelNetworkPlmnList_t *pNetSearchCnf;
3753 pNetSearchCnf = (TelNetworkPlmnList_t *)EventData;
3754 while (ui_entry_count < pNetSearchCnf->networks_count)
3756 printf("Type_of_plmn[%d] 0:unkwon,1:home,2:available,3:forbidden, NetworkName[%s]",
3757 pNetSearchCnf->network_list[ui_entry_count].type_of_plmn,
3758 pNetSearchCnf->network_list[ui_entry_count].network_name);
3759 printf("ServiceProviderName[%s]", pNetSearchCnf->network_list[ui_entry_count].service_provider_name);
3760 printf("PLMN ID[%lu]", pNetSearchCnf->network_list[ui_entry_count].plmn_id);
3769 @defgroup Use_Cases5_4 Selection Mode
3770 @ingroup Use_Cases5_NETWORK
3773 <h3 class="pg">Selection Mode</h3>
3774 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.
3777 int tel_get_network_selection_mode(TapiHandle *handle, tapi_response_cb callback, void *user_data);
3782 #include <ITapiNetwork.h>
3784 #include "TapiCommon.h"
3786 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3791 tapi_response_cb callback;
3794 //GET THE SELECTION MODE
3796 ret_status = tel_get_network_selection_mode (handle, callback, user_data);
3797 if (ret_status == TAPI_API_SUCCESS)
3798 printf("successful\n");
3800 printf("error=%d\n", ret_status);
3801 //WAIT FOR EVENT HERE
3803 //CALLBACK FUNCTION TO BE USED
3804 static void app_callback (TelTapiEvent_t *event)
3810 void* EventData = NULL;
3813 eventClass = event->EventClass;
3814 eventType = event->EventType;
3815 requestId = event->RequestId;
3816 status = event->Status;
3817 EventData = event->pData;
3819 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3823 //TEST_DEBUG("******This is nonzero status. ******\n");
3828 switch (eventType) // REFER Network Selection TO GET eventType
3830 case TAPI_EVENT_NETWORK_GETSELECTIONMODE_CNF:
3831 printf("\n$$$$$$ TAPI_EVENT_NETWORK_GETSELECTIONMODE_CNF $$$$$$ \n");
3838 @defgroup Use_Cases5_5 Service Domain
3839 @ingroup Use_Cases5_NETWORK
3842 <h3 class="pg">Service Domain</h3>
3843 Telephony provides APIs so that User/application can configure the service domain and also retrieve the present network service domain.
3846 int tel_set_network_service_domain(TapiHandle *handle, TelNetworkServiceDomain_t domain, tapi_response_cb callback, void *user_data);
3847 int tel_get_network_service_domain(TapiHandle *handle, tapi_response_cb callback, void *user_data);
3853 #include <ITapiNetwork.h>
3855 #include "TapiCommon.h"
3857 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3858 void set_servicedomain()
3862 TelNetworkServiceDomain_t domain;
3863 tapi_response_cb callback;
3866 //SET NETWORK SERVICE DOMAIN
3867 domain = TAPI_NETWORK_SERVICE_DOMAIN_AUTOMATIC;
3869 ret_status = tel_set_network_service_domain (handle, domain, callback, user_data);
3870 if (ret_status == TAPI_API_SUCCESS)
3871 printf("successful\n");
3873 printf("error=%d\n", ret_status);
3874 //WAIT FOR EVENT HERE
3876 //CALLBACK FUNCTION TO BE USED
3877 static void app_callback (TelTapiEvent_t *event)
3883 void* EventData = NULL;
3884 unsigned int temp_handle = -1;
3887 eventClass = event->EventClass;
3888 eventType = event->EventType;
3889 requestId = event->RequestId;
3890 status = event->Status;
3891 EventData = event->pData;
3893 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3897 //TEST_DEBUG("******This is nonzero status. ******\n");
3902 switch (eventType) //REFER Network Selection TO GET eventType
3904 case TAPI_EVENT_NETWORK_SET_SVC_DOMAIN_CNF:
3905 printf("\n$$$$$$ TAPI_EVENT_NETWORK_SET_SVC_DOMAIN_CNF $$$$$$ \n");
3912 //GET NETWORK SERVICE DOMAIN
3913 #include <ITapiNetwork.h>
3915 #include "TapiCommon.h"
3916 void get_servicedomain()
3920 tapi_response_cb callback;
3923 ret_status = tel_get_network_service_domain (handle, callback, user_data);
3924 if (ret_status == TAPI_API_SUCCESS)
3925 printf("successful\n");
3927 printf("error=%d\n", ret_status);
3928 //WAIT FOR EVENT HERE
3930 //CALLBACK FUNCTION TO BE USED
3931 static void app_callback (TelTapiEvent_t *event)
3937 void* EventData = NULL;
3939 eventClass = event->EventClass;
3940 eventType = event->EventType;
3941 requestId = event->RequestId;
3942 status = event->Status;
3943 EventData = event->pData;
3945 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3949 //TEST_DEBUG("******This is nonzero status. ******\n");
3954 switch (eventType) //REFER Network Selection TO GET eventType
3956 case TAPI_EVENT_NETWORK_GET_SVC_DOMAIN_CNF:
3957 printf("\n$$$$$$ TAPI_EVENT_NETWORK_GET_SVC_DOMAIN_CNF $$$$$$ \n");
3964 @defgroup Use_Cases5_6 Network Mode
3965 @ingroup Use_Cases5_NETWORK
3968 <h3 class="pg">Network Mode</h3>
3969 <strong>[Note] Telephony Emulator does not support this feature.</strong>
3970 @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.
3973 int tel_set_network_mode(TapiHandle *handle, int mode, tapi_response_cb callback, void *user_data);
3974 int tel_get_network_mode(TapiHandle *handle, tapi_response_cb callback, void *user_data);
3979 #include <ITapiNetwork.h>
3981 #include "TapiCommon.h"
3983 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3989 tapi_response_cb callback;
3993 ret_status = tel_set_network_mode(handle, mode, callback, user_data);
3994 if (ret_status == TAPI_API_SUCCESS)
3995 printf("successful\n");
3997 printf("error=%d\n", ret_status);
3998 //WAIT FOR EVENT HERE
4000 //CALLBACK FUNCTION TO BE USED
4001 static void app_callback (TelTapiEvent_t *event)
4007 void* EventData = NULL;
4010 eventClass = event->EventClass;
4011 eventType = event->EventType;
4012 requestId = event->RequestId;
4013 status = event->Status;
4014 EventData = event->pData;
4016 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4020 //TEST_DEBUG("******This is nonzero status. ******\n");
4025 switch (eventType) //REFER Network Selection TO GET eventType
4027 case TAPI_EVENT_NETWORK_SETNWMODE_CNF:
4028 printf("\n$$$$$$ TAPI_EVENT_NETWORK_SETNWMODE_CNF $$$$$$ \n");
4035 #include <ITapiNetwork.h>
4037 #include "TapiCommon.h"
4043 tapi_response_cb callback;
4046 ret_status = tel_get_network_mode(handle, callback, user_data);
4047 if (ret_status == TAPI_API_SUCCESS)
4048 printf("successful\n");
4050 printf("error=%d\n", ret_status);
4051 //WAIT FOR EVENT HERE
4053 //CALLBACK FUNCTION TO BE USED
4054 static void app_callback (TelTapiEvent_t *event)
4060 void* EventData = NULL;
4063 eventClass = event->EventClass;
4064 eventType = event->EventType;
4065 requestId = event->RequestId;
4066 status = event->Status;
4067 EventData = event->pData;
4069 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4073 //TEST_DEBUG("******This is nonzero status. ******\n");
4078 switch (eventType) //REFER Network Selection TO GET eventType
4080 case TAPI_EVENT_NETWORK_GETNWMODE_CNF:
4081 printf("\n$$$$$$ TAPI_EVENT_NETWORK_GETNWMODE_CNF $$$$$$ \n");
4088 @defgroup Use_Cases5_7 Network Band
4089 @ingroup Use_Cases5_NETWORK
4092 <h3 class="pg">Network Band</h3>
4093 Telephony provides APIs to set and retrieve the network band and allows the underlying OEM provider to scan the set band.
4096 int tel_set_network_band(TapiHandle *handle, TelNetworkBandPreferred_t mode, TelNetworkBand_t band, tapi_response_cb callback, void *user_data);
4097 int tel_get_network_band(TapiHandle *handle, tapi_response_cb callback, void *user_data);
4102 #include <ITapiNetwork.h>
4104 #include "TapiCommon.h"
4106 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
4111 TelNetworkBandPreferred_t mode;
4112 TelNetworkBand_t band;
4113 tapi_response_cb callback;
4116 mode = TAPI_NETWORK_BAND_MODE_PREFERRED;
4117 band = TAPI_NETWORK_BAND_TYPE_GSM_900_1800;
4119 ret_status = tel_set_network_band (handle, mode, band, callback, user_data);
4120 if (ret_status == TAPI_API_SUCCESS)
4121 printf("successful\n");
4123 printf("error=%d\n", ret_status);
4124 //WAIT FOR EVENT HERE
4126 //CALLBACK FUNCTION TO BE USED
4127 static void app_callback (TelTapiEvent_t *event)
4133 void* EventData = NULL;
4136 eventClass = event->EventClass;
4137 eventType = event->EventType;
4138 requestId = event->RequestId;
4139 status = event->Status;
4140 EventData = event->pData;
4142 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4146 //TEST_DEBUG("******This is nonzero status. ******\n");
4151 switch (eventType) //REFER Network Selection TO GET eventType
4153 case TAPI_EVENT_NETWORK_SETNWBAND_CNF:
4154 printf("\n$$$$$$ TAPI_EVENT_NETWORK_SETNWBAND_CNF $$$$$$ \n");
4161 #include <ITapiNetwork.h>
4163 #include "TapiCommon.h"
4168 tapi_response_cb callback;
4171 ret_status = tel_get_network_band(handle, callback, user_data);
4172 if (ret_status == TAPI_API_SUCCESS)
4173 printf("successful\n");
4175 printf("error=%d\n", ret_status);
4176 //WAIT FOR EVENT HERE
4178 //CALLBACK FUNCTION TO BE USED
4179 static void app_callback (TelTapiEvent_t *event)
4185 void* EventData = NULL;
4188 eventClass = event->EventClass;
4189 eventType = event->EventType;
4190 requestId = event->RequestId;
4191 status = event->Status;
4192 EventData = event->pData;
4194 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4198 //TEST_DEBUG("******This is nonzero status. ******\n");
4203 switch (eventType) // REFER Network Selection TO GET eventType
4205 case TAPI_EVENT_NETWORK_GETNWBAND_CNF:
4206 printf("\n$$$$$$ TAPI_EVENT_NETWORK_GTNWBAND_CNF $$$$$$ \n");
4213 @defgroup Use_Cases5_8 Preferred PLMN
4214 @ingroup Use_Cases5_NETWORK
4217 <h3 class="pg">Preferred PLMN</h3>
4218 <strong>[Note] Telephony Emulator does not support this feature.</strong>
4219 @n Telephony provides APIs which can be used to set and retrieve the preferred plmn of network.
4222 int tel_set_network_preferred_plmn(TapiHandle *handle, TelNetworkPreferredPlmnOp_t operation, TelNetworkPreferredPlmnInfo_t *info, tapi_response_cb callback, void *user_data);
4223 int tel_get_network_preferred_plmn(TapiHandle *handle, tapi_response_cb callback, void *user_data);
4228 #include <ITapiNetwork.h>
4230 #include "TapiCommon.h"
4232 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
4233 void set_preferredplmn()
4237 TelNetworkPreferredPlmnOp_t operation;
4238 TelNetworkPreferredPlmnInfo_t info;
4239 tapi_response_cb callback;
4242 unsigned char *plmn = "45454";
4245 operation = TAPI_NETWORK_PREF_PLMN_ADD;
4246 memset(&info, 0, sizeof(TelNetworkPreferredPlmnInfo_t));
4248 info.SystemType = TAPI_NETWORK_SYSTEM_GSM;
4249 memcpy(info.Plmn, plmn, strlen(plmn));
4251 ret_status = tel_set_network_preferred_plmn(handle, operation, &info, callback, user_data);
4252 if (ret_status == TAPI_API_SUCCESS)
4253 printf("successful\n");
4255 printf("error=%d\n", ret_status);
4256 //WAIT FOR EVENT HERE
4258 //CALLBACK FUNCTION TO BE USED
4259 static void app_callback (TelTapiEvent_t *event)
4265 void* EventData = NULL;
4268 eventClass = event->EventClass;
4269 eventType = event->EventType;
4270 requestId = event->RequestId;
4271 status = event->Status;
4272 EventData = event->pData;
4274 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4278 //TEST_DEBUG("******This is nonzero status. ******\n");
4284 switch (eventType) //REFER Network Selection TO GET eventType
4286 case TAPI_EVENT_NETWORK_SETPREFFPLMN_CNF:
4287 printf("\n$$$$$$ TAPI TAPI_EVENT_NETWORK_SETPREFFPLMN_CNF $$$$$$ \n");
4296 #include <ITapiNetwork.h>
4298 #include "TapiCommon.h"
4299 void get_preferredplmn()
4303 tapi_response_cb callback;
4306 ret_status = tel_get_network_preferred_plmn(handle, callback, user_data);
4307 if (ret_status == TAPI_API_SUCCESS)
4308 printf("successful\n");
4310 printf("error=%d\n", ret_status); //WAIT FOR EVENT HERE
4311 //WAIT FOR EVENT HERE
4314 //CALLBACK FUNCTION TO BE USED
4315 static void app_callback (TelTapiEvent_t *event)
4321 void* EventData = NULL;
4324 eventClass = event->EventClass;
4325 eventType = event->EventType;
4326 requestId = event->RequestId;
4327 status = event->Status;
4328 EventData = event->pData;
4330 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4334 //TEST_DEBUG("******This is nonzero status. ******\n");
4339 switch (eventType) //REFER Network Selection TO GET eventType
4341 case TAPI_EVENT_NETWORK_GETPREFFPLMN_CNF:
4342 printf("\n$$$$$$ TAPI TAPI_EVENT_NETWORK_GETPREFFPLMN_CNF $$$$$$ \n");
4347 @defgroup Use_Cases6_1 SIM
4348 @ingroup Use_Cases6_SIM
4352 <h3 class="pg">SIM</h3>
4353 Event Register and Deregister
4354 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.
4359 unsigned int subscription_id = 0;
4360 TapiResult_t api_err;
4361 TapiHandle *handle; // Handle given by tel_init()
4362 char *noti_id; // Get Noti id
4363 tapi_notification_cb callback; //Initialized call-back function pointer in which notification data is returned
4364 void *user_data = NULL; // Set User data
4366 api_err = TelTapiInit();
4367 if (api_err != TAPI_API_SUCCESS)
4369 TEST_DEBUG("TelTapiInit Failed - api_err = %d \n", api_err);
4372 api_err = tel_register_noti_event(handle, noti_id, callback, user_data);
4373 printf("SIM Event registration is Done:");
4376 api_err = tel_deregister_noti_event(handle, noti_id);
4377 if (api_err != TAPI_API_SUCCESS)
4379 printf("Event Class Unregeration Fail\n");
4384 @defgroup Use_Cases6_2 PIN, SIM Lock operations
4385 @ingroup Use_Cases6_SIM
4389 <h3 class="pg">PIN, SIM Lock operations</h3>
4390 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.
4393 int tel_enable_sim_facility(TapiHandle *handle, TelSimFacilityPw_t *sec_data, tapi_response_cb callback, void *user_data);
4394 int tel_disable_sim_facility(TapiHandle *handle, TelSimFacilityPw_t *sec_data, tapi_response_cb callback, void *user_data);
4395 int tel_change_sim_pins(TapiHandle *handle, const TelSimSecPw_t *old_pin, const TelSimSecPw_t *new_pin, tapi_response_cb callback, void *user_data);
4396 int tel_verify_sim_puks(TapiHandle *handle, const TelSimSecPw_t *puk_data, const TelSimSecPw_t *new_pin_data, tapi_response_cb callback, void *user_data);
4397 int tel_verifiy_sim_pins(TapiHandle *handle, const TelSimSecPw_t *pin_data, tapi_response_cb callback, void *user_data);
4398 int tel_get_sim_facility(TapiHandle *handle, TelSimLockType_t type, tapi_response_cb callback, void *user_data);
4399 int tel_get_sim_lock_info(TapiHandle *handle, TelSimLockType_t type, tapi_response_cb callback, void *user_data);
4402 SAMPLE CODE: PIN1/PIN2/SIM LOCK/PUK1 VERIFICATION AND CHANGE PIN1
4404 #include <ITapiSim.h>
4406 #include "TapiCommon.h"
4408 // OPERATION REQUEST PIN1 VERIFICATION PART
4409 #define PIN1_NORMAL "0000" //Sample PIN1 code
4414 int length = TAPI_SIM_PIN_LENGTH + 1;
4415 char init_pin_val[length] ;
4416 TelSimSecPw_t pin_data;
4417 TapiHandle *handle; // Handle given by tel_init()
4418 tapi_response_cb callback; //Initialized call-back function pointer in which response is returned
4419 void *user_data = NULL; // Set User data
4421 strcpy(init_pin_val, PIN1_NORMAL);
4423 pin_data.type = TAPI_SIM_PTYPE_PIN1;
4424 pin_data.pw_len = strlen(init_pin_val);
4426 printf("pw_len[%d]", pin_data.pw_len);
4428 pin_data.pw = (char*)malloc(length);
4429 memcpy(pin_data.pw, init_pin_val, length);
4431 err_code = tel_verifiy_sim_pins(handle, &pin_data, on_resp_sim_sec_op, user_data);
4432 if (err_code != TAPI_API_SUCCESS)
4434 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4436 // WAIT FOR EVENT FROM HERE
4439 // OPERATION REQUEST PIN2 VERIFICATION PART
4440 #define PIN2_NORMAL "0000" //Sample PIN2 code
4445 int length = TAPI_SIM_PIN_LENGTH+1;
4446 char init_pin_val[length] ;
4447 TelSimSecPw_t pin_data;
4449 strcpy(init_pin_val, PIN2_NORMAL);
4451 pin_data.type = TAPI_SIM_PTYPE_PIN2;
4452 pin_data.pw_len = strlen(init_pin_val);
4454 printf("pw_len[%d]", pin_data.pw_len);
4456 pin_data.pw = (char*)malloc(length);
4457 memcpy(pin_data.pw, init_pin_val, length);
4459 err_code = tel_verifiy_sim_pins(&pin_data, &request_id);
4460 if (err_code != TAPI_API_SUCCESS)
4462 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4464 // WAIT FOR EVENT FROM HERE
4467 // OPERATION REQUEST CHANGE PIN1 PART
4468 #define PIN1_ORG "0000" //Sample old PIN1 code
4469 #define PIN1_NEW "1111" //Sample new PIN1 code
4473 int length = TAPI_SIM_PIN_LENGTH+1;
4474 char init_old_pin_val[length] ;
4475 char init_new_pin_val[length];
4476 TelSimSecPw_t old_pin;
4477 TelSimSecPw_t new_pin;
4478 TapiHandle *handle; // Handle given by tel_init()
4479 tapi_response_cb callback; //Initialized call-back function pointer in which response is returned
4480 void *user_data = NULL; // Set User data
4482 memset(&init_old_pin_val, 0, length);
4483 memset(&init_new_pin_val, 0, length);
4485 strcpy(init_old_pin_val, PIN1_ORG);
4487 old_pin.type = TAPI_SIM_PTYPE_PIN1;
4488 old_pin.pw_len = strlen(init_old_pin_val);
4489 printf("pw_len[%d]", old_pin.pw_len);
4490 old_pin.pw = (char*)malloc(length);
4491 memcpy(old_pin.pw, init_old_pin_val, length);
4493 strcpy(init_new_pin_val, PIN1_NEW);
4495 new_pin.type = TAPI_SIM_PTYPE_PIN1;
4496 new_pin.pw_len = strlen(init_new_pin_val);
4497 printf("pw_len[%d]", new_pin.pw_len);
4498 new_pin.pw = (char*)malloc(length);
4499 memcpy(new_pin.pw, init_new_pin_val, length);
4501 err_code = tel_change_sim_pins(handle, &old_pin, &new_pin, on_resp_sim_sec_op, user_data);
4502 if (err_code != TAPI_API_SUCCESS)
4504 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4506 // WAIT EVENT RESPONSE FROM HERE
4509 // OPERATION REQUEST VERIFICATION PUK1 PART
4510 #define PUK1_NORMAL "00000000" //Sample PUK1 code
4511 #define PIN1_NORMAL "0000" //Sample PIN1 code
4516 int length = TAPI_SIM_PIN_LENGTH + 1;
4518 char init_pin_val[length];
4519 char init_puk_val[length];
4521 TelSimSecPw_t puk_data;
4522 TelSimSecPw_t new_pin_data;
4523 TapiHandle *handle; // Handle given by tel_init()
4524 tapi_response_cb callback; //Initialized call-back function pointer in which response is returned
4525 void *user_data = NULL; // Set User data
4527 strcpy(init_pin_val, PIN1_NORMAL);
4528 strcpy(init_puk_val, PUK1_NORMAL);
4530 puk_data.type = TAPI_SIM_PTYPE_PUK1; // 0x00
4531 puk_data.pw_len = length;
4532 puk_data.pw_len = strlen(init_puk_val);
4533 printf("pw_len[%d]", puk_data.pw_len);
4534 memcpy(puk_data.pw, init_pin_val, length);
4536 new_pin_data.type = TAPI_SIM_PTYPE_PIN1; // 0x00
4537 new_pin_data.pw_len = strlen(init_pin_val);
4538 printf("pw_len[%d]", new_pin_data.pw_len);
4539 new_pin_data.pw = (char*)malloc(length);
4540 memcpy(new_pin_data.pw, init_pin_val, length);
4542 err_code = tel_verify_sim_puks(handle, &puk_data, &new_pin_data, on_resp_sim_sec_op, user_data);
4543 if (err_code != TAPI_API_SUCCESS)
4545 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4547 // WAIT EVENT RESPONSE FROM HERE
4549 // OPERATION REQUEST SIM LOCK VERIFICATION PART
4550 #define SIM_NORMAL "0000" //Sample SIM Lock code
4554 int length = TAPI_SIM_PIN_LENGTH + 1;
4555 char init_pin_val[length] ;
4556 TelSimSecPw_t pin_data;
4557 TapiHandle *handle; // Handle given by tel_init()
4558 tapi_response_cb callback; //Initialized call-back function pointer in which response is returned
4559 void *user_data = NULL; // Set User data
4561 strcpy(init_pin_val, SIM_NORMAL);
4563 pin_data.type = TAPI_SIM_PTYPE_SIM;
4564 pin_data.pw_len = strlen(init_pin_val);
4566 printf("pw_len[%d]", pin_data.pw_len);
4568 pin_data.pw = (char*)malloc(length);
4569 memcpy(pin_data.pw, init_pin_val, length);
4571 err_code = tel_verifiy_sim_pins(handle, &pin_data, on_resp_sim_sec_op, user_data);
4572 if (err_code != TAPI_API_SUCCESS)
4574 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4576 // WAIT FOR EVENT FROM HERE
4580 //CALLBACK FUNCTION TO BE USED
4581 static void on_resp_sim_sec_op(TapiHandle *handle, int result, void *data, void *user_data)
4583 TelSimPinOperationResult_t sec_rt = result;
4584 TelSimSecResult_t *rt = data;
4586 printf("sec_rt[%d]", sec_rt);
4587 printf("rt->type[%d]", rt->type);
4588 printf("rt->retry_count[%d]", rt->retry_count);
4592 SAMPLE CODE: ENABLE/DISABLE PIN1 and SIM LOCK
4594 #include <ITapiSim.h>
4596 #include "TapiCommon.h"
4598 // OPERATION REQUEST DISABLING PIN1 PART
4599 #define PIN1_NORMAL "0000" //Sample PIN1 code
4604 int length = TAPI_SIM_PIN_LENGTH+1;
4605 char init_pin_val[length];
4607 strcpy(init_pin_val, PIN1_NORMAL);
4609 TelSimFacilityPw_t sec_data;
4610 sec_data.lock_type = TAPI_SIM_PTYPE_PIN1; // 0x00
4611 sec_data.pw_len = strlen(init_pin_val);
4612 printf("pw_len[%d]", sec_data.pw_len);
4614 sec_data.pw = (char*)malloc(length);
4615 memcpy(sec_data.pw, init_pin_val, length);
4617 err_code = tel_disable_sim_facility(handle, sec_data, on_resp_sim_facility_op, user_data);
4618 if (err_code != TAPI_API_SUCCESS)
4620 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4622 // WAIT EVENT RESPONSE FROM HERE
4625 // OPERATION REQUEST ENABLING PIN1 PART
4626 #define PIN1_NORMAL "0000" //Sample PIN1 code
4631 int length = TAPI_SIM_PIN_LENGTH+1;
4632 char init_pin_val[length];
4634 strcpy(init_pin_val, PIN1_NORMAL);
4636 TelSimFacilityPw_t sec_data;
4637 sec_data.lock_type = TAPI_SIM_PTYPE_PIN1; // 0x00
4638 sec_data.pw_len = strlen(init_pin_val);
4639 printf("pw_len[%d]", sec_data.pw_len);
4641 sec_data.pw = (char*)malloc(length);
4642 memcpy(sec_data.pw, init_pin_val, length);
4644 err_code = tel_enable_sim_facility(handle, sec_data, on_resp_sim_facility_op, user_data);
4645 if (err_code != TAPI_API_SUCCESS)
4647 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4649 //WAIT EVENT RESPONSE FROM HERE
4652 // OPERATION REQUEST DISABLING SIM LOCK PART
4653 #define SIM_NORMAL "0000" //Sample SIM LOCK code
4657 int length = TAPI_SIM_PIN_LENGTH+1;
4658 char init_pin_val[length];
4660 strcpy(init_pin_val, SIM_NORMAL);
4662 TelSimFacilityPw_t sec_data;
4663 sec_data.lock_type = TAPI_SIM_PTYPE_SIM; // 0x00
4664 sec_data.pw_len = strlen(init_pin_val);
4665 printf("pw_len[%d]", sec_data.pw_len);
4667 sec_data.pw = (char*)malloc(length);
4668 memcpy(sec_data.pw, init_pin_val, length);
4670 err_code = tel_disable_sim_facility(handle, sec_data, on_resp_sim_facility_op, user_data);
4671 if (err_code != TAPI_API_SUCCESS)
4673 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4675 //WAIT EVENT RESPONSE FROM HERE
4679 // OPERATION REQUEST ENABLING SIM LOCK PART
4680 #define SIM_NORMAL "0000" //Sample SIM LOCK code
4685 int length = TAPI_SIM_PIN_LENGTH+1;
4686 char init_pin_val[length];
4688 strcpy(init_pin_val, SIM_NORMAL);
4690 TelSimFacilityPw_t sec_data;
4691 sec_data.lock_type = TAPI_SIM_PTYPE_SIM; // 0x00
4692 sec_data.pw_len = strlen(init_pin_val);
4693 printf("pw_len[%d]", sec_data.pw_len);
4695 sec_data.pw = (char*)malloc(length);
4696 memcpy(sec_data.pw, init_pin_val, length);
4698 err_code = tel_enable_sim_facility(handle, sec_data, on_resp_sim_facility_op, user_data);
4699 if (err_code != TAPI_API_SUCCESS)
4701 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4703 //WAIT EVENT RESPONSE FROM HERE
4708 SAMPLE CODE: GET PIN1/PIN2/SIM LOCK STATUS
4710 #include <ITapiSim.h>
4712 #include "TapiCommon.h"
4714 // OPERATION REQUEST GET PIN1/PIN2/SIM LOCK STATUS PART
4715 void get_facility_status()
4718 TelSimLockType_t type = TAPI_SIM_PTYPE_PIN1 // or TAPI_SIM_PTYPE_PIN2 or TAPI_SIM_PTYPE_SIM;
4720 err_code = tel_get_sim_facility(handle, type, callback, user_data);
4721 if (err_code != TAPI_API_SUCCESS)
4723 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4725 printf("*****************************************************");
4728 void get_lock_status()
4731 TelSimLockType_t type = TAPI_SIM_PTYPE_PIN1 // or TAPI_SIM_PTYPE_PIN2 or TAPI_SIM_PTYPE_SIM;
4733 err_code = tel_get_sim_lock_info(handle, type, callback, user_data);
4734 if (err_code != TAPI_API_SUCCESS)
4736 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4738 printf("*****************************************************");
4743 @defgroup Use_Cases6_3 Personalisation Lock
4744 @ingroup Use_Cases6_SIM
4748 <h3 class="pg">Personalisation Lock</h3>
4749 These APIs are used to enable/disable and get the status information about personalisation of network, network subset, corporate, service provider personalisation.
4752 int tel_enable_sim_facility(TapiHandle *handle, TelSimFacilityPw_t *pw, tapi_response_cb callback, void *user_data);
4753 int tel_disable_sim_facility(TapiHandle *handle, TelSimFacilityPw_t *pw, tapi_response_cb callback, void *user_data);
4754 int tel_get_sim_facility(TapiHandle *handle, TelSimLockType_t type, tapi_response_cb callback, void *user_data);
4757 SAMPLE CODE: GET PERSONALIZATION STATUS
4759 #include <ITapiSim.h>
4761 #include "TapiCommon.h"
4763 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
4764 // OPERATION REQUEST GET NETWORK PERSONALIZATION PART
4768 TelSimLockType_t type = TAPI_SIM_LOCK_PN; // Set locktype for which facility should be disabled;
4770 err_code = tel_get_sim_facility(handle, type, on_resp_get_sim_facility, user_data);
4771 if (err_code != TAPI_API_SUCCESS)
4773 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4775 // WAIT EVENT RESPONSE FROM HERE
4779 //CALLBACK FUNCTION TO BE USED
4780 static void on_resp_get_sim_facility(TapiHandle *handle, int result, void *data, void *user_data)
4782 TelSimPinOperationResult_t sec_rt = result;
4783 TelSimFacilityInfo_t *fi = data;
4785 printf("sec_rt[%d]", sec_rt);
4786 printf("fi->type[%d]", fi->type);
4787 printf("fi->f_status[%d]", fi->f_status);
4791 SAMPLE CODE: ENABLE/DISABLE PERSONALIZATION
4793 #include <ITapiSim.h>
4795 #include "TapiCommon.h"
4797 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
4798 // OPERATION REQUEST ENABLING NETWORK PERSONALIZATION PART
4799 #define NET_ENCODE "54500112345678" //Sample Network Personalization code
4800 void enable_net_pers()
4802 printf("Lock Personalisation MCC+MNC 5\n");
4803 printf("Plese input Network Lock CODE : length of MCC+MNC, MCC, MNC, NCK\n");
4804 printf("We need to use this for testing : length of MCC+MNC(5), MCC(450), MNC(01), NCK(12345678) => 54500112345678\n");
4807 TelSimFacilityPw_t *fc_pw;
4808 int length = TAPI_SIM_PIN_LENGTH+1;
4809 char init_pin_val[length] ;
4811 strcpy(init_pin_val, PIN1_NORMAL);
4813 fc_pw.lock_type = TAPI_SIM_LOCK_PN; // Set locktype for which facility should be disabled;
4814 fc_pw.pw_len = strlen(init_pin_val);
4816 printf("pw_len[%d]", fc_pw.pw_len);
4818 fc_pw.pw = (char*)malloc(length);
4819 memcpy(fc_pw.pw,init_pin_val,length);
4821 err_code = tel_enable_sim_facility(handle, fc_pw, on_resp_sim_facility_op, user_data);
4823 if (err_code != TAPI_API_SUCCESS)
4825 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4827 // WAIT EVENT RESPONSE FROM HERE
4830 // OPERATION REQUEST DISABLING NETWORK PERSONALIZATION PART
4831 #define NET_DISCODE "12345678" //Sample Network Personalization code
4832 void disable_net_pers()
4834 printf("de Personalisation key is 8 byte \n");
4835 printf("We need to use this for testing : 12345678\n");
4838 TelSimFacilityPw_t *fc_pw;
4839 int length = TAPI_SIM_PIN_LENGTH+1;
4840 char init_pin_val[length] ;
4842 strcpy(init_pin_val, PIN1_NORMAL);
4844 fc_pw.lock_type = TAPI_SIM_LOCK_PN; // Set locktype for which facility should be disabled;
4845 fc_pw.pw_len = strlen(init_pin_val);
4847 printf("pw_len[%d]", fc_pw.pw_len);
4849 fc_pw.pw = (char*)malloc(length);
4850 memcpy(fc_pw.pw,init_pin_val,length);
4852 err_code = tel_disable_sim_facility(handle, fc_pw, on_resp_sim_facility_op, user_data);
4853 if (err_code != TAPI_API_SUCCESS)
4855 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4857 // WAIT EVENT RESPONSE FROM HERE
4861 //CALLBACK FUNCTION TO BE USED
4862 static void on_resp_sim_facility_op(TapiHandle *handle, int result, void *data, void *user_data)
4864 TelSimPinOperationResult_t sec_rt = result;
4865 TelSimFacilityResult_t *f_rt = data;
4867 printf("sec_rt[%d]", sec_rt);
4868 printf("f_rt->type[%d]", f_rt->type);
4869 printf("f_rt->retry_count[%d]", f_rt->retry_count);
4874 @defgroup Use_Cases6_4 FDN
4875 @ingroup Use_Cases6_SIM
4879 <h3 class="pg">FDN</h3>
4880 These APIs are used to enable/disable FDN and to retrieve the current FDN status.
4883 int tel_enable_sim_facility(TapiHandle *handle, TelSimFacilityPw_t *pw, tapi_response_cb callback, void *user_data);
4884 int tel_disable_sim_facility(TapiHandle *handle, TelSimFacilityPw_t *pw, tapi_response_cb callback, void *user_data);
4885 int tel_get_sim_facility(TapiHandle *handle, TelSimLockType_t type, tapi_response_cb callback, void *user_data);
4891 #include <ITapiSim.h>
4893 #include "TapiCommon.h"
4895 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
4897 // OPERATION REQUEST ENABLE FDN MODE PART
4898 #define PIN2_NORMAL "0000" //Sample PIN2 code
4902 TelSimFacilityPw_t *fc_pw;
4903 int length = TAPI_SIM_PIN_LENGTH+1;
4904 char init_pin_val[length] ;
4906 strcpy(init_pin_val, PIN1_NORMAL);
4908 fc_pw.lock_type = TAPI_SIM_PTYPE_PIN2; // Set locktype for which facility should be disabled;
4909 fc_pw.pw_len = strlen(init_pin_val);
4911 printf("pw_len[%d]", fc_pw.pw_len);
4913 fc_pw.pw = (char*)malloc(length);
4914 memcpy(fc_pw.pw,init_pin_val,length);
4916 err_code = tel_enable_sim_facility(handle, fc_pw, on_resp_sim_facility_op, user_data);
4917 if (err_code != TAPI_API_SUCCESS)
4919 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4921 // WAIT FOR EVENT FROM HERE
4925 // OPERATION REQUEST DISABLE FDN MODE PART
4926 #define PIN2_NORMAL "0000" //Sample PIN2 code
4930 TelSimFacilityPw_t *fc_pw;
4931 int length = TAPI_SIM_PIN_LENGTH+1;
4932 char init_pin_val[length] ;
4934 strcpy(init_pin_val, PIN1_NORMAL);
4936 fc_pw.lock_type = TAPI_SIM_PTYPE_PIN2; // Set locktype for which facility should be disabled;
4937 fc_pw.pw_len = strlen(init_pin_val);
4939 printf("pw_len[%d]", fc_pw.pw_len);
4941 fc_pw.pw = (char*)malloc(length);
4942 memcpy(fc_pw.pw,init_pin_val,length);
4944 err_code = tel_disable_sim_facility(handle, fc_pw, on_resp_sim_facility_op, user_data);
4946 if (err_code != TAPI_API_SUCCESS)
4948 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4950 // WAIT FOR EVENT FROM HERE
4954 //CALLBACK FUNCTION TO BE USED
4955 static void on_resp_disable_sim_facility(TapiHandle *handle, int result, void *data, void *user_data)
4957 TelSimPinOperationResult_t sec_rt = result;
4958 TelSimFacilityResult_t *f_rt = data;
4960 printf("sec_rt[%d]", sec_rt);
4961 printf("f_rt->type[%d]", f_rt->type);
4962 printf("f_rt->retry_count[%d]", f_rt->retry_count);
4965 // OPERATION REQUEST GET FDN STATUS PART
4966 void get_fdn_status()
4968 printf("Get FDN status");
4969 TelSimLockType_t type = TAPI_SIM_LOCK_SC; // Set locktype for which facility should be disabled;
4971 err_code = tel_get_sim_facility(handle, type, on_resp_get_sim_facility, user_data);
4973 err_code = tel_get_sim_facility(handle, type, on_resp_get_sim_facility, user_data);
4974 if (err_code == TAPI_API_SUCCESS)
4976 if (fdn_status == 0)
4978 printf("*************************");
4979 printf("FDN disabled ");
4980 printf("*************************");
4984 printf("*************************");
4985 printf("FDN enabled");
4986 printf("*************************");
4991 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4997 @defgroup Use_Cases6_5 IMSI Information
4998 @ingroup Use_Cases6_SIM
5002 <h3 class="pg">IMSI Information</h3>
5003 This API retrieves the IMSI (International Mobile Subscriber Identity) information.
5006 int tel_get_sim_imsi(TelSimImsiInfo_t* imsi);
5011 #include <ITapiSim.h>
5013 #include "TapiCommon.h"
5018 TelSimImsiInfo_t sim_imsi_info;
5020 err_code = tel_get_sim_imsi(handle, &sim_imsi_info);
5021 if (err_code == TAPI_API_SUCCESS)
5023 // printf("[SIM APP] IMSI [mcc,mnc,msin]= ");
5024 // printf(" [%s]",sim_imsi_info.szMcc);
5025 // printf(" [%s]",sim_imsi_info.szMnc);
5026 // printf(" [%s]",sim_imsi_info.szMsin);
5030 // printf("Error Code [%x]\n", err_code);
5035 @defgroup Use_Cases6_6 ECC Information
5036 @ingroup Use_Cases6_SIM
5040 <h3 class="pg">ECC Information</h3>
5041 This API retreieves the ECC (Emergency Call Codes) data.
5044 int tel_get_sim_ecc(TelSimEccData_t *ecc_data, int *ecc_count);
5049 #include <ITapiSim.h>
5051 #include "TapiCommon.h"
5056 TelSimEccList_t ecc_info = {0}; // Get ECC list info and ecc_count
5057 err_code = tel_get_sim_ecc(handle, &ecc_info);
5059 printf("The Retrun Status is %d", err_code);
5061 printf(" ECC count [%d]\n", ecc_info.ecc_rec_count);
5069 printf(" Get USIM ECC ");
5071 TelSimEccList_t uecc_info = {{{0,}}};
5073 err_code = tel_get_sim_ecc(handle, &uecc_info);
5074 if (err_code == TAPI_API_SUCCESS)
5076 printf("ECC count [%d]", uecc_info.uecc_rec_count );
5078 for (i=0; i<uecc_info.uecc_rec_count; i++)
5080 printf("Loop(%d): ", i);
5081 printf(" ECC Used [%d]", uecc_info.UeccInfo[i].bUsed);
5082 printf(" ECC Len [%d]", uecc_info.UeccInfo[i].EccLen);
5084 if (NULL != uecc_info.UeccInfo[i].szEcc)
5086 printf("ECC string [%s]", uecc_info.UeccInfo[i].szEcc);
5090 printf("ECC string [null]");
5093 printf("ECC alphaID [%s]",uecc_info.UeccInfo[i].szEccAlphaIdentifier);
5098 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5103 @defgroup Use_Cases6_7 Language Preference Information
5104 @ingroup Use_Cases6_SIM
5108 <h3 class="pg">Language Preference Information</h3>
5109 These APIs are used to get and set the language preference information stored in SIM.
5112 int tel_get_sim_language(TapiHandle *handle, tapi_response_cb callback, void *user_data);
5113 int tel_set_sim_language(TapiHandle *handle, TelSimLanguagePreferenceCode_t language, tapi_response_cb callback, void *user_data);
5116 SAMPLE CODE: GET SIM LANGUAGE
5118 #include <ITapiSim.h>
5120 #include "TapiCommon.h"
5122 void getlanguageprefinfo()
5125 TapiHandle *handle; // Handle given by tel_init()
5126 tapi_response_cb callback; //Initialized call-back function pointer in which response is returned
5127 void *user_data; // Set User data
5129 err_code = tel_get_sim_language(handle, on_resp_getlanguage, user_data);
5130 printf("Error Code [%x]\n", err_code);
5132 for (i =0; i<li_info.LpCount; i++)
5133 printf(" LI[%d] --> Val [%d]\n", i, li_info.Lp[i]);
5137 SAMPLE CODE: UPDATE SIM LANGUAGE
5139 #include <ITapiSim.h>
5141 #include "TapiCommon.h"
5143 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
5144 // OPERATION REQUEST UPDATE SIM LANGUAGE PART
5145 void setlanguageprefinfo()
5148 TelSimLanguagePreferenceCode_t language = 0x00; //init
5149 language = TAPI_SIM_LP_ENGLISH; //language value
5150 TapiHandle *handle; // Handle given by tel_init()
5151 tapi_response_cb callback; //Initialized call-back function pointer in which response is returned
5152 void *user_data; // Set User data
5153 err_code = tel_set_sim_language(handle, language, on_resp_setlanguage, user_data);
5155 if (err_code != TAPI_API_SUCCESS)
5157 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5159 // WAIT EVENT RESPONSE FROM HERE
5164 //CALLBACK FUNCTION TO BE USED
5165 static void on_resp_getlanguage(TapiHandle *handle, int result, void *data, void *user_data)
5167 TelSimLanguagePreferenceCode_t *language = data;
5168 TelSimAccessResult_t access_rt = result;
5170 printf("access rt[%d]", access_rt);
5171 printf("language[%d]", *language);
5173 static void on_resp_setlanguage(TapiHandle *handle, int result, void *data, void *user_data)
5175 TelSimAccessResult_t access_rt = result;
5177 printf("access_rt[%d]", access_rt);
5181 @defgroup Use_Cases6_8 Getting Card Type
5182 @ingroup Use_Cases6_SIM
5186 <h3 class="pg">Getting Card Type</h3>
5187 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.
5190 int tel_get_sim_type(TelSimCardType_t *card_type);
5195 #include <ITapiSim.h>
5197 #include "TapiCommon.h"
5202 TelSimCardType_t cardInfo; //unkwon, sim(normally gsm), usim(normally umts)
5203 TapiHandle *handle; // Handle given by tel_init()
5205 err_code = tel_get_sim_type(handle, &cardInfo);
5207 printf("card type is %d\n", cardInfo);
5211 @defgroup Use_Cases6_9 Getting SIM Card Initialization Status
5212 @ingroup Use_Cases6_SIM
5216 <h3 class="pg">Getting SIM Card Initialization Status</h3>
5217 API is a synchronous API which gets the Card Init status and Identification.
5220 int tel_get_sim_init_info(TelSimCardStatus_t *sim_status, int *card_changed);
5225 #include <ITapiSim.h>
5227 #include "TapiCommon.h"
5229 // OPERATION REQUEST GET CARD INIT STATUS PART
5230 void get_sim_init_status()
5232 int err_code = TAPI_API_SUCCESS;
5233 TelSimCardStatus_t status = 0x00;
5234 int b_card_changed = 0;
5235 TapiHandle *handle; // Handle given by tel_init()
5237 // GET SIM INIT INFORMATION
5238 err_code = tel_get_sim_init_info(handle, &status, &b_card_changed);
5240 if (err_code == TAPI_API_SUCCESS)
5242 printf("**********************************************");
5243 printf("CardStatus:[0x%x]",status);
5244 printf("b_card_changed[%d]\n",b_card_changed);
5245 printf("**********************************************");
5249 printf("TAPI Fail: Error Code [%d]\n", err_code);
5254 @defgroup Use_Cases6_10 SIM ACCESS COMMANDS Interface
5255 @ingroup Use_Cases6_SIM
5259 <h3 class="pg">SIM ACCESS COMMANDS Interface</h3>
5260 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.
5263 int tel_req_sim_access(const TelSimRSimReq_t *rsim_data, int *req_id);
5266 SAMPLE CODE: EF HANDLING ( SELECT-FILE INFO)
5268 #include <ITapiSim.h>
5270 #include "TapiCommon.h"
5272 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
5273 // OPERATION REQUEST GET SIM FILE INFO PART
5274 void get_sim_file_info()
5277 void *user_data = NULL; // Set User data
5279 TelRSimReq_t rsim_data;
5280 rsim_data.file_id = TAPI_SIM_EFILE_SPN; // rsim access : sim file id to access
5281 rsim_data.rsim_cmd = TAPI_SIM_GET_RESPONSE; // rsim access : get response, read, update available
5283 err_code = tel_req_sim_access(handle, &rsim_data, user_data);
5284 if (err_code != TAPI_API_SUCCESS)
5286 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5288 // WAIT EVENT RESPONSE FROM HERE
5292 @defgroup Use_Cases6_11 SIM Mailbox EF management
5293 @ingroup Use_Cases6_SIM
5297 <h3 class="pg">SIM Mailbox EF management</h3>
5298 These APIs are used to get and update the mailbox information stored in SIM.
5301 int tel_get_sim_mailbox_info(TapiHandle *handle, tapi_response_cb callback, void *user_data);
5302 int tel_set_sim_mailbox_info(TapiHandle *handle, TelSimMailBoxNumber_t *req_mb, tapi_response_cb callback, void *user_data);
5305 SAMPLE CODE: READ / UPDATE MAILBOX INFO
5307 #include <ITapiSim.h>
5309 #include "TapiCommon.h"
5311 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
5313 void get_sim_mailbox()
5316 TapiHandle *handle; // Handle given by tel_init()
5317 tapi_response_cb callback; //Initialized call-back function pointer in which response is returned
5318 void *user_data; // Set User data
5319 err_code = tel_get_sim_mailbox_info(handle, on_resp_get_sim_mailbox, user_data);
5320 if(err_code == TAPI_API_SUCCESS) {
5321 if(mbox.b_cphs) { //b_cphs means current SIM is for CPHS or not.
5322 printf("Current SIM is CPHS");
5324 printf("Current SIM is not CPHS but 3GPP");
5327 printf("TAPI API FAIL: Error Code [0x%x]",err_code);
5331 // OPERATION REQUEST UPDATE SIM MAILBOX INFO PART
5332 void update_sim_mailbox()
5335 TelSimMailBoxNumber_t *req_mb; // Get SIM mail box number info
5336 TapiHandle *handle; // Handle given by tel_init()
5337 tapi_response_cb callback; //Initialized call-back function pointer in which response is returned
5338 void *user_data; // Set User data
5339 err_code = tel_set_sim_mailbox_info(handle, &req_mb, on_resp_set_sim_mailbox, user_data);
5341 if (err_code != TAPI_API_SUCCESS)
5343 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5345 // WAIT EVENT RESPONSE FROM HERE
5349 //CALLBACK FUNCTION TO BE USED
5350 static void on_resp_get_sim_mailbox(TapiHandle *handle, int result, void *data, void *user_data)
5352 TelSimAccessResult_t access_rt = result;
5353 TelSimMailboxList_t *list = data;
5356 printf("access_rt[%d]", access_rt);
5357 printf("count[%d]", list->count);
5359 for (i = 0; i < list->count; i++) {
5360 printf("list->list[%d].b_cphs[%d]", i, list->list[i].b_cphs);
5361 printf("list->list[%d].rec_index[%d]", i, list->list[i].rec_index);
5362 printf("list->list[%d].profile_num[%d]", i, list->list[i].profile_num);
5363 printf("list->list[%d].mb_type[%d]", i, list->list[i].mb_type);
5364 printf("list->list[%d].alpha_id_max_len[%d]", i,
5365 list->list[i].alpha_id_max_len);
5366 printf("list->list[%d].alpha_id[%s]", i, list->list[i].alpha_id);
5367 printf("list->list[%d].ton[0x%x]", i, list->list[i].ton);
5368 printf("list->list[%d].npi[0x%x]", i, list->list[i].npi);
5369 printf("list->list[%d].num[%s]", i, list->list[i].num);
5370 printf("list->list[%d].cc_id[0x%x]", i, list->list[i].cc_id);
5371 printf("list->list[%d].ext1_id[0x%x]", i, list->list[i].ext1_id);
5375 static void on_resp_set_sim_mailbox(TapiHandle *handle, int result, void *data, void *user_data)
5377 TelSimAccessResult_t access_rt = result;
5379 printf("access_rt[%d]", access_rt);
5383 @defgroup Use_Cases6_12 SIM Indication Status EFs management
5384 @ingroup Use_Cases6_SIM
5388 <h3 class="pg">SIM Indication Status EFs management</h3>
5389 These APIs are used to get and set the message indication status stored in SIM.
5392 int tel_get_sim_messagewaiting_info(TapiHandle *handle, tapi_response_cb callback, void *user_data);
5393 int tel_set_sim_messagewaiting_info(TapiHandle *handle, TelSimMessageWaitingReq_t *req_mw, tapi_response_cb callback, void *user_data);
5396 SAMPLE CODE: READ / UPDATE INDICATION STATUS DATA
5398 #include <ITapiSim.h>
5400 #include "TapiCommon.h"
5402 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
5404 // OPERATION REQUEST READ SIM MESSAGE WAITING INDICATION STATUS INFO PART
5405 void read_sim_mwis()
5408 TapiHandle *handle; // Handle given by tel_init()
5409 tapi_response_cb callback; //Initialized call-back function pointer in which response is returned
5410 void *user_data; // Set User data
5411 err_code = tel_get_sim_messagewaiting_info(handle, on_resp_get_sim_mwis, user_data);
5412 if(err_code == TAPI_API_SUCCESS) {
5413 if(mw_data.b_cphs) { //b_cphs means current SIM is for CPHS or not.
5414 printf("Current SIM is CPHS");
5416 printf("Current SIM is not CPHS but 3GPP");
5419 printf("TAPI API FAIL: Error Code [0x%x]",err_code);
5424 // OPERATION REQUEST UPDATE SIM MESSAGE WAITING INDICATION STATUS INFO PART
5425 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
5427 void update_sim_mwis()
5429 TelSimMessageWaiting_s mw_data;
5431 TelSimMessageWaitingReq_t *req_mw; // Get message waiting info
5432 TapiHandle *handle; // Handle given by tel_init()
5433 tapi_response_cb callback; //Initialized call-back function pointer in which response is returned
5434 void *user_data; // Set User data
5435 err_code = tel_set_sim_messagewaiting_info(handle, &req_mw, on_resp_set_sim_mwis, user_data);
5437 if (err_code != TAPI_API_SUCCESS)
5439 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5441 // WAIT EVENT RESPONSE FROM HERE
5446 //CALLBACK FUNCTION TO BE USED
5447 static void on_resp_get_sim_mwis(TapiHandle *handle, int result, void *data, void *user_data)
5449 TelSimAccessResult_t access_rt = result;
5450 TelSimMessageWaitingResp_t *mw = data;
5453 printf("access_rt[%d]", access_rt);
5454 printf("mw->b_cphs[%d]", mw->b_cphs);
5457 printf("mw->cphs_mw.b_voice1[%d]", mw->cphs_mw.b_voice1);
5458 printf("mw->cphs_mw.b_voice2[%d]", mw->cphs_mw.b_voice2);
5459 printf("mw->cphs_mw.b_fax[%d]", mw->cphs_mw.b_fax);
5460 printf("mw->cphs_mw.b_data[%d]", mw->cphs_mw.b_data);
5463 for (i = 0; i < mw->mw_list.profile_count; i++) {
5464 printf("mw->mw_list.mw[%d].rec_index[%d]", i,
5465 mw->mw_list.mw[i].rec_index);
5466 printf("mw->mw_list.mw[%d].indicator_status[0x%x]", i,
5467 mw->mw_list.mw[i].indicator_status);
5468 printf("mw->mw_list.mw[%d].voice_count[%d]", i,
5469 mw->mw_list.mw[i].voice_count);
5470 printf("mw->mw_list.mw[%d].fax_count[%d]", i,
5471 mw->mw_list.mw[i].fax_count);
5472 printf("mw->mw_list.mw[%d].email_count[%d]", i,
5473 mw->mw_list.mw[i].email_count);
5474 printf("mw->mw_list.mw[%d].other_count[%d]", i,
5475 mw->mw_list.mw[i].other_count);
5476 printf("mw->mw_list.mw[%d].video_count[%d]", i,
5477 mw->mw_list.mw[i].video_count);
5483 static void on_resp_set_sim_mwis(TapiHandle *handle, int result, void *data, void *user_data)
5485 TelSimAccessResult_t access_rt = result;
5486 printf("access_rt[%d]", access_rt);
5491 @defgroup Use_Cases6_13 Phone Book
5492 @ingroup Use_Cases6_SIM
5496 <h3 class="pg">Phone Book</h3>
5497 <strong>[Note] Telephony Emulator does not support this feature.</strong>
5499 Telephony provides APIs for various phonebook related features such as getting SIM initialization status, supported phonebook types, first valid index, total records and used records in phonebook, phonebook entry information and reading, updating, deleting of SIM phonebook records.
5502 int tel_get_sim_pb_count(TapiHandle *handle, TelSimPbType_t pb_type, tapi_response_cb callback, void *user_data);
5503 int tel_get_sim_pb_meta_info(TapiHandle *handle, TelSimPbType_t pb_type, tapi_response_cb callback, void *user_data);
5504 int tel_get_sim_pb_usim_meta_info(TapiHandle *handle, tapi_response_cb callback, void *user_data);
5505 int tel_read_sim_pb_record(TapiHandle *handle, TelSimPbType_t pb_type, unsigned short index, tapi_response_cb callback, void *user_data);
5506 int tel_update_sim_pb_record(TapiHandle *handle, const TelSimPbRecord_t *req_data, tapi_response_cb callback, void *user_data);
5507 int tel_delete_sim_pb_record(TapiHandle *handle, TelSimPbType_t pb_type, unsigned short index, tapi_response_cb callback, void *user_data);
5508 int tel_get_sim_pb_init_info(TapiHandle *handle, int *init_completed, TelSimPbList_t *pb_list);
5511 SAMPLE CODE FOR GETTING STORAGE COUNT
5513 #include <ITapiSim.h>
5515 #include "TapiCommon.h"
5517 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
5518 void getstoragecount()
5521 TelSimPbType_t StorageFileType = TAPI_SIM_PB_3GSIM;
5525 ret_status = tel_get_sim_pb_count(handle, StorageFileType, on_resp_get_sim_pb_count, &pRequestId);
5526 if (ret_status == TAPI_API_SUCCESS)
5527 printf("successful\n");
5529 printf("error=%d\n", ret_status);
5531 //WAIT FOR EVENT HERE
5533 //CALLBACK FUNCTION TO BE USED
5534 static void on_resp_get_sim_pb_count (TapiHandle *handle, int result, void *data, void *user_data)
5536 TelSimPbAccessResult_t access_rt = result;
5537 TelSimPbStorageInfo_t *ps = data;
5539 printf("on_pb_get_sim_pb_count received");
5540 printf("access_rt[%d]", access_rt);
5541 if (access_rt == TAPI_SIM_PB_SUCCESS) {
5542 if (ps->StorageFileType <= TAPI_SIM_PB_GAS) {
5543 printf("StorageFileType[%d][%s]", ps->StorageFileType, dbg_pb_type_name[ps->StorageFileType]);
5545 printf("StorageFileType[%d]", ps->StorageFileType);
5547 printf("TotalRecordCount[%d]", ps->TotalRecordCount);
5548 printf("UsedRecordCount[%d]", ps->UsedRecordCount);
5553 SAMPLE CODE TO GET PHONE BOOK ENTRY INFO
5555 #include <ITapiSim.h>
5557 #include "TapiCommon.h"
5559 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
5560 void getPBEntryInfo()
5563 TelSimPbType_t StorageFileType = TAPI_SIM_PB_FDN;
5567 ret_status = tel_get_sim_pb_meta_info (handle, StorageFileType, on_resp_get_sim_pb_meta_info, &pRequestId);
5568 if (ret_status == TAPI_API_SUCCESS)
5569 printf(successful\n);
5571 printf(error=%d\n, ret_status);
5572 //WAIT FOR EVENT HERE
5575 //CALLBACK FUNCTION TO BE USED
5576 static void on_resp_get_sim_pb_meta_info(TapiHandle *handle, int result, void *data, void *user_data)
5578 TelSimPbAccessResult_t access_rt = result;
5579 TelSimPbEntryInfo_t *pe = data;
5581 printf("on_pb_get_sim_pb_meta_info received");
5582 printf("access_rt[%d]", access_rt);
5583 if (access_rt == TAPI_SIM_PB_SUCCESS) {
5584 if (pe->StorageFileType <= TAPI_SIM_PB_GAS) {
5585 printf("StorageFileType[%d][%s]", pe->StorageFileType, dbg_pb_type_name[pe->StorageFileType]);
5587 printf("StorageFileType[%d]", pe->StorageFileType);
5589 printf("PbIndexMin[%d]",pe->PbIndexMin);
5590 printf("PbIndexMax[%d]",pe->PbIndexMax);
5591 printf("PbNumLenMax[%d]",pe->PbNumLenMax);
5592 printf("PbTextLenMax[%d]",pe->PbTextLenMax);
5593 printf("PbUsedCount[%d]",pe->PbUsedCount);
5599 SAMPLE CODE TO GET USIM ENTRY INFO AND CAPABILITY INFO
5601 #include <ITapiSim.h>
5603 #include "TapiCommon.h"
5605 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
5606 void getPBCapabilityInfo()
5612 ret_status = tel_get_sim_pb_usim_meta_info(handle, on_resp_get_sim_pb_usim_meta_info, &pRequestId);
5613 if (ret_status == TAPI_API_SUCCESS)
5614 printf(successful\n);
5616 printf(error=%d\n, ret_status);
5617 //WAIT FOR EVENT HERE
5620 //CALLBACK FUNCTION TO BE USED
5621 static void on_resp_get_sim_pb_usim_meta_info(TapiHandle *handle, int result, void *data, void *user_data)
5623 TelSimPbAccessResult_t access_rt = result;
5624 TelSimPbCapabilityInfo_t *capa = data;
5627 printf("on_pb_get_sim_pb_3g_meta_info received");
5628 printf("access_rt[%d]", access_rt);
5629 if (access_rt == TAPI_SIM_PB_SUCCESS) {
5630 for (i = 0; i < capa->FileTypeCount; i++) {
5631 if(capa->FileTypeInfo[i].field_type <=TAPI_PB_3G_PBC ) {
5632 printf("capa->FileTypeInfo[%d].field_type[%d][%s]", i, capa->FileTypeInfo[i].field_type, dbg_pb_adf_field_name[capa->FileTypeInfo[i].field_type]);
5634 printf("capa->FileTypeInfo[%d].field_type[%d]", i, capa->FileTypeInfo[i].field_type);
5636 printf("capa->FileTypeInfo[%d].index_max[%d]", i, capa->FileTypeInfo[i].index_max);
5637 printf("capa->FileTypeInfo[%d].text_max[%d]", i, capa->FileTypeInfo[i].text_max);
5638 printf("capa->FileTypeInfo[%d].used_count[%d]", i, capa->FileTypeInfo[i].used_count);
5645 SAMPLE CODE FOR READING RECORD
5647 #include <ITapiSim.h>
5649 #include "TapiCommon.h"
5651 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
5652 void simreadrecord()
5655 TelSimPbType_t StorageFileType = TAPI_SIM_PB_FDN;
5656 unsigned short Index = 4;
5660 ret_status = tel_read_sim_pb_record (handle, StorageFileType,Index, on_resp_read_sim_pb_record, &pRequestId);
5661 if (ret_status == TAPI_API_SUCCESS)
5662 printf(successful\n);
5664 printf(error=%d\n, ret_status);
5666 //WAIT FOR EVENT HERE
5668 //CALLBACK FUNCTION TO BE USED
5669 static void on_resp_read_sim_pb_record (TapiHandle *handle, int result, void *data, void *user_data)
5671 TelSimPbAccessResult_t access_rt = result;
5672 TelSimPbRecord_t *pr = data;
5674 printf("on_pb_read_sim_pb_record received");
5675 printf("access_rt[%d]", access_rt);
5676 if(access_rt == TAPI_SIM_PB_SUCCESS) {
5677 if( pr->phonebook_type <= TAPI_SIM_PB_GAS){
5678 printf("phonebook_type[%d][%s]", pr->phonebook_type, dbg_pb_type_name[pr->phonebook_type]);
5680 printf("phonebook_type[%d]", pr->phonebook_type);
5682 printf("index[%d]", pr->index);
5683 printf("next_index[%d]", pr->next_index);
5684 printf("name[%s]", pr->name);
5685 if(pr->dcs <= TAPI_SIM_TEXT_ENC_HEX) {
5686 printf("dcs[%d][%s]", pr->dcs, dbg_pb_dcs_name[pr->dcs]);
5688 printf("dcs[%d]", pr->dcs);
5690 printf("number[%s]", pr->number);
5692 if(pr->ton <= TAPI_SIM_TON_RESERVED_FOR_EXT) {
5693 printf("ton[%d][%s]", pr->ton, dbg_pb_ton_name[pr->ton]);
5695 printf("ton[%d]", pr->ton);
5698 if (pr->phonebook_type == TAPI_SIM_PB_3GSIM) {
5699 printf("anr1[%s]", pr->anr1);
5700 if(pr->anr1_ton <= TAPI_SIM_TON_RESERVED_FOR_EXT) {
5701 printf("anr1_ton[%d][%s]", pr->anr1_ton, dbg_pb_ton_name[pr->anr1_ton]);
5703 printf("anr1_ton[%d]", pr->anr1_ton);
5705 printf("anr2[%s]", pr->anr2);
5706 if(pr->anr2_ton <= TAPI_SIM_TON_RESERVED_FOR_EXT) {
5707 printf("anr2_ton[%d][%s]", pr->anr2_ton, dbg_pb_ton_name[pr->anr2_ton]);
5709 printf("anr2_ton[%d]", pr->anr2_ton);
5711 printf("anr3[%s]", pr->anr3);
5712 if(pr->anr3_ton <= TAPI_SIM_TON_RESERVED_FOR_EXT) {
5713 printf("anr3_ton[%d][%s]", pr->anr3_ton, dbg_pb_ton_name[pr->anr3_ton]);
5715 printf("anr3_ton[%d]", pr->anr3_ton);
5717 printf("email1[%s]", pr->email1);
5718 printf("email2[%s]", pr->email2);
5719 printf("email3[%s]", pr->email3);
5720 printf("email4[%s]", pr->email4);
5721 printf("group_index[%d]", pr->group_index);
5722 printf("pb_control[%d]", pr->pb_control);
5729 SAMPLE CODE FOR UPDATING RECORD
5731 #include <ITapiSim.h>
5733 #include "TapiCommon.h"
5735 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
5736 void simupdaterecord()
5739 TelSimPbRecord_t pb_add;
5743 pb_add.StorageFileType = TAPI_SIM_PB_3GSIM;
5745 pb_add.NextIndex = 0;
5747 ret_status = tel_update_sim_pb_record(handle, &pb_add, on_resp_update_sim_pb_record, &pRequestId);
5748 if (ret_status == TAPI_API_SUCCESS)
5749 printf(successful\n);
5751 printf(error=%d\n, ret_status);
5753 //WAIT FOR EVENT HERE
5755 //CALLBACK FUNCTION TO BE USED
5756 static void on_resp_update_sim_pb_record(TapiHandle *handle, int result, void *data, void *user_data)
5758 TelSimPbAccessResult_t access_rt = result;
5760 printf("on_pb_update_sim_pb_record received");
5761 printf("access_rt[%d]", access_rt);
5765 SAMPLE CODE FOR DELETING RECORD
5767 #include <ITapiSim.h>
5769 #include "TapiCommon.h"
5771 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
5772 void contactdelete()
5776 TelSimPbType_t StorageFileType = TAPI_SIM_PB_3GSIM;
5777 unsigned short RecordIndex = 1;
5780 ret_status = tel_delete_sim_pb_record (handle, StorageFileType, RecordIndex, on_resp_delete_sim_pb_record, &pRequestId);
5781 if (ret_status == TAPI_API_SUCCESS)
5782 printf(successful\n);
5784 printf(error=%d\n, ret_status);
5785 //WAIT FOR EVENT HERE
5788 //CALLBACK FUNCTION TO BE USED
5789 static void on_resp_delete_sim_pb_record(TapiHandle *handle, int result, void *data, void *user_data)
5791 TelSimPbAccessResult_t access_rt = result;
5793 printf("on_pb_delete_sim_pb_record received");
5794 printf("access_rt[%d]", access_rt);
5799 SAMPLE CODE FOR GETTING PHONEBOOK INIT INFO
5801 #include <ITapiSim.h>
5803 #include "TapiCommon.h"
5805 // OPERATION REQUEST GET SIM PHONEBOOK INIT STATUS PART
5806 void get_sim_phonebook_init_status()
5809 TelSimPbList_t pb_list;
5810 int pPbInitCompleted = 0;
5812 err_code = tel_get_sim_pb_init_info(handle, &pPbInitCompleted, &pb_list);
5813 if (err_code == TAPI_API_SUCCESS)
5815 if (pPbInitCompleted == 0)
5817 printf(" SIM PB INIT NOT completed ");
5821 printf("SIM PB INIT completed");
5822 // if no sim records at all then valid_index = 0xFF
5823 printf ("ADN First index is [%d]",valid_index);
5824 printf ("SIM phone book storage list Information ");
5825 printf ("********************************************");
5826 printf ("pb_list.b_fdn[%d]",pb_list.b_fdn);
5827 printf ("pb_list.b_msisdn[%d]",pb_list.b_msisdn);
5828 printf ("pb_list.b_adn[%d]",pb_list.b_adn);
5829 printf ("pb_list.b_sdn[%d]",pb_list.b_sdn);
5830 printf ("pb_list.b_3g[%d]",pb_list.b_3g);
5831 printf ("pb_list.b_aas[%d]",pb_list.b_aas);
5832 printf ("pb_list.b_gas[%d]",pb_list.b_gas);
5837 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5842 @defgroup Use_Cases6_14 Getting 3G Phone Book Information
5843 @ingroup Use_Cases6_SIM
5847 <h3 class="pg">Getting 3G Phone Book Information</h3>
5848 <strong>[Note] Telephony Emulator does not support this feature.</strong>
5850 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.
5853 int tel_get_sim_pb_3g_meta_info(int *req_id);
5858 #include <ITapiSim.h>
5860 #include "TapiCommon.h"
5862 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
5863 void get3gcapainfo()
5868 ret_status = tel_get_sim_pb_3g_meta_info (&req_id);
5870 //WAIT FOR EVENT HERE
5872 //CALLBACK FUNCTION TO BE USED
5873 static void app_callback (TelTapiEvent_t *event)
5879 void* EventData = NULL;
5881 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
5883 unsigned int temp_handle = -1;
5885 eventClass = event->EventClass;
5886 eventType = event->EventType;
5887 requestId = event->RequestId;
5888 status = event->Status;
5889 EventData = event->pData;
5891 switch (eventType) {
5892 case TAPI_EVENT_SIM_PB_CAPABILITY_INFO_CNF:
5893 printf("[SIM APP]SIM PB Capability Info event status = [%x]\n", sim_event->Status);
5894 TelSimPbCapabilityInfo_t *sim_capability_info = (TelSimPbCapabilityInfo_t*)sim_event->pData;
5896 for (i=0; i<sim_capability_info->FileTypeCount; i++)
5898 printf(" [SIM APP]Filed tag type[%d]", sim_capability_info->FileTypeInfo[i].FileType3G);
5899 printf(" [SIM APP]max index [%d]\n", sim_capability_info->FileTypeInfo[i].PbIndexMax);
5900 printf(" [SIM APP]max text [%d]\n", sim_capability_info->FileTypeInfo[i].PbTextMax);
5901 printf(" [SIM APP]used count [%d]\n", sim_capability_info->FileTypeInfo[i].TotalRecordCount);
5910 @defgroup Use_Cases6_15 SAP (Sim access Profile) features
5911 @ingroup Use_Cases6_SIM
5914 <h3 class="pg">SAP (Sim access Profile) features</h3>
5915 <strong>[Note] Telephony Emulator does not support this feature.</strong>
5917 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.
5919 The SIM Access Profile specifies the following features:
5920 - Connection Management
5924 - Transfer Card Reader Status
5925 - Set Transport Protocol
5927 <h4>Connection Management:</h4>
5928 An established SIM Access Profile connection is the prerequisite for all other features.
5929 Telephony exposes APIs to make a connection request to SIM and to get connection status information.
5932 int tel_req_sap_connection( TelSimSapConnect_t *req_data, int *req_id);
5933 int tel_req_sap_connection_status( int *req_id);
5938 #include <ITapiSim.h>
5940 #include "TapiCommon.h"
5941 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
5942 void sapconnectreq()
5945 TelSimSapConnect_t pConnectionReq;
5948 pConnectionReq.MsgId = TAPI_SIM_SAP_CONNECT_REQ;
5949 pConnectionReq.MaxMsgSize = 10; //temp for testing only - not clear
5951 ret_status = tel_req_sap_connection (&pConnectionReq, &pRequestId);
5952 if (ret_status == TAPI_API_SUCCESS)
5953 printf("successful\n");
5955 printf("error=%d\n", ret_status);
5957 //WAIT FOR EVENT HERE
5959 //CALLBACK FUNCTION TO BE USED
5960 static void app_callback (TelTapiEvent_t *event)
5966 void* EventData = NULL;
5968 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
5970 unsigned int temp_handle = -1;
5972 eventClass = event->EventClass;
5973 eventType = event->EventType;
5974 requestId = event->RequestId;
5975 status = event->Status;
5976 EventData = event->pData;
5980 case TAPI_SIM_EVENT_SAP_CONNECT_CNF:
5981 printf("TAPI_SIM_EVENT_SAP_CONNECT_CNF");
5988 void sapconnectstatusreq()
5991 int ret_status = tel_req_sap_connection_status (&request_id);
5992 if (ret_status == TAPI_API_SUCCESS)
5993 printf("successful\n");
5995 printf("error=%d\n", ret_status);
5997 //WAIT FOR EVENT HERE
5999 //CALLBACK FUNCTION TO BE USED
6001 static void app_callback (TelTapiEvent_t *event)
6007 void* EventData = NULL;
6009 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6011 unsigned int temp_handle = -1;
6012 eventClass = event->EventClass;
6013 eventType = event->EventType;
6014 requestId = event->RequestId;
6015 status = event->Status;
6016 EventData = event->pData;
6020 case TAPI_SIM_EVENT_SAP_CONNECT_STATUS_CNF:
6021 printf("TAPI_SIM_EVENT_SAP_CONNECT_STATUS_CNF");
6028 <h4>Transfer APDU:</h4>
6029 The ability to send APDUs (Application Protocol Data Units) over the Bluetooth link
6030 @n Telephony provides API to transfer APDU to sim.
6033 int tel_req_sap_transfer_apdu(TelSimSapApduData_t *apdu_data, int *req_id);
6038 #include <ITapiSim.h>
6040 #include "TapiCommon.h"
6042 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
6043 void saptransferapdu()
6046 int file_id = TAPI_SIM_EFILE_ICCID;
6048 // for selecting EF ICCID
6049 TelSimSapApduData_t apdu_data;
6052 apdu_data.ApduLength = 7;
6053 apdu_data.Apdu[0] = 0xA0; // class
6054 apdu_data.Apdu[1] = 0xA4; // instruction
6055 apdu_data.Apdu[2] = 0; // p1 = parameter 1
6056 apdu_data.Apdu[3] = 0; // p2 = parameter 2
6057 apdu_data.Apdu[4] = 2; // p3 - parameter 3
6059 memcpy(&apdu_data.Apdu[5], &file_id, sizeof(unsigned short));
6060 err_code = tel_req_sap_transfer_apdu (&apdu_data, NULL);
6061 if (err_code == TAPI_API_SUCCESS)
6062 printf("successful\n");
6064 printf("error=%d\n", err_code);
6066 //WAIT FOR EVENT HERE
6067 //CALLBACK FUNCTION TO BE USED
6068 static void app_callback (TelTapiEvent_t *event)
6074 void* EventData = NULL;
6076 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6078 unsigned int temp_handle = -1;
6080 eventClass = event->EventClass;
6081 eventType = event->EventType;
6082 requestId = event->RequestId;
6083 status = event->Status;
6084 EventData = event->pData;
6088 case TAPI_SIM_EVENT_SAP_TRANSFER_APDU_CNF:
6089 printf("TAPI_SIM_EVENT_SAP_TRANSFER_APDU_CNF");
6095 <h4>Transfer ATR:</h4>
6096 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.
6099 int tel_req_sap_transfer_atr( int *req_id);
6104 #include <ITapiSim.h>
6106 #include "TapiCommon.h"
6108 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
6109 void saptransferatrreq()
6114 ret_status = tel_req_sap_transfer_atr (&pRequestId);
6115 if (ret_status == TAPI_API_SUCCESS)
6116 printf("successful\n");
6118 printf("error=%d\n", ret_status);
6120 //WAIT FOR EVENT HERE
6122 //CALLBACK FUNCTION TO BE USED
6123 static void app_callback (TelTapiEvent_t *event)
6129 void* EventData = NULL;
6131 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6133 unsigned int temp_handle = -1;
6135 eventClass = event->EventClass;
6136 eventType = event->EventType;
6137 requestId = event->RequestId;
6138 status = event->Status;
6139 EventData = event->pData;
6143 case TAPI_SIM_EVENT_SAP_TRANSFER_ATR_CNF:
6144 printf("TAPI_SIM_EVENT_SAP_TRANSFER_ATR_CNF");
6151 <h4>Power sim on/off:</h4>
6152 The ability to power the subscription module on/off remotely.
6155 int tel_req_sap_power_operation(TelSimSapMsgId_t req_data, int *req_id );
6160 #include <ITapiSim.h>
6162 #include "TapiCommon.h"
6164 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
6168 TelSimSapMsgId_t MsgId = TAPI_SIM_SAP_CONNECT_REQ;
6171 ret_status = tel_req_sap_power_operation (MsgId, &pRequestId);
6172 if (ret_status == TAPI_API_SUCCESS)
6173 printf("successful\n");
6175 printf("error=%d\n", ret_status);
6177 //WAIT FOR EVENT HERE
6179 //CALLBACK FUNCTION TO BE USED
6180 static void app_callback (TelTapiEvent_t *event)
6186 void* EventData = NULL;
6188 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6190 unsigned int temp_handle = -1;
6192 eventClass = event->EventClass;
6193 eventType = event->EventType;
6194 requestId = event->RequestId;
6195 status = event->Status;
6196 EventData = event->pData;
6201 case TAPI_SIM_EVENT_SAP_SET_SIM_POWER_CNF:
6202 printf("TAPI_SIM_EVENT_SAP_SET_SIM_POWER_CNF");
6209 <h4>Transfer Card Reader Status:</h4>
6210 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).
6213 int tel_req_sap_cardreader_status(int *req_id);
6218 #include <ITapiSim.h>
6220 #include "TapiCommon.h"
6222 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
6223 void simsapcardreaderstatus()
6228 ret_status = tel_req_sap_cardreader_status (&pRequestId);
6229 if (ret_status == TAPI_API_SUCCESS)
6230 printf("successful\n");
6232 printf("error=%d\n", ret_status);
6234 //WAIT FOR EVENT HERE
6236 //CALLBACK FUNCTION TO BE USED
6237 static void app_callback (TelTapiEvent_t *event)
6243 void* EventData = NULL;
6245 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6247 unsigned int temp_handle = -1;
6249 eventClass = event->EventClass;
6250 eventType = event->EventType;
6251 requestId = event->RequestId;
6252 status = event->Status;
6253 EventData = event->pData;
6258 case TAPI_SIM_EVENT_SAP_CARD_READER_STATUS_CNF:
6259 printf("TAPI_SIM_EVENT_SAP_CARD_READER_STATUS_CNF");
6266 <h4>Set Transport Protocol:</h4>
6267 The server shall reset the subscription module and switch to the desired protocol if supported by subscription module and Server.
6270 int tel_req_sap_transport_protocol(TelSimSapProtocol_t protocol, int *req_id);
6275 #include <ITapiSim.h>
6277 #include "TapiCommon.h"
6279 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
6280 void sapsettransportprotocol()
6283 TelSimSapProtocol_t Protocol = TAPI_SIM_SAP_PROTOCOL_T0;
6286 ret_status = tel_req_sap_transport_protocol (Protocol, &pRequestId);
6287 if (ret_status == TAPI_API_SUCCESS)
6288 printf("successful\n");
6290 printf("error=%d\n", ret_status);
6292 //WAIT FOR EVENT HERE
6294 //CALLBACK FUNCTION TO BE USED
6295 static void app_callback (TelTapiEvent_t *event)
6301 void* EventData = NULL;
6303 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6305 unsigned int temp_handle = -1;
6307 eventClass = event->EventClass;
6308 eventType = event->EventType;
6309 requestId = event->RequestId;
6310 status = event->Status;
6311 EventData = event->pData;
6315 case TAPI_SIM_EVENT_SAP_SET_PROTOCOL_CNF:
6316 printf("TAPI_SIM_EVENT_SAP_SET_PROTOCOL_CNF");
6323 @defgroup Use_Cases6_16 ISIM Features
6324 @ingroup Use_Cases6_SIM
6328 <h3 class="pg">ISIM Features</h3>
6329 <strong>[Note] Telephony Emulator does not support this feature.</strong>
6332 int tel_req_sim_authentication( TelSimAuthenticationData_t *authentication_data, int *req_id);
6335 Application uses this API to send the ISIM authentication request to telephony.
6339 #include <ITapiSim.h>
6341 #include "TapiCommon.h"
6343 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
6347 TelSimAuthenticationData_t authenticationData;
6348 authenticationData.rand_length = 100;
6349 authenticationData.rand_length = 100;
6350 authenticationData.rand_data = "test data";
6351 authenticationData.autn_data = "test data";
6354 ret_status = tel_req_sim_authentication (&authenticationData, &pRequestId);
6355 if (ret_status == TAPI_API_SUCCESS)
6356 printf("successful\n");
6358 printf("error=%d\n", ret_status);
6360 //WAIT FOR EVENT HERE
6362 //CALLBACK FUNCTION TO BE USED
6363 static void app_callback (TelTapiEvent_t *event)
6369 void* EventData = NULL;
6371 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6373 unsigned int temp_handle = -1;
6375 eventClass = event->EventClass;
6376 eventType = event->EventType;
6377 requestId = event->RequestId;
6378 status = event->Status;
6379 EventData = event->pData;
6383 case TAPI_EVENT_SIM_AUTHENTICATION_CNF:
6384 printf("TAPI_EVENT_SIM_AUTHENTICATION_CNF");
6391 @defgroup Use_Cases6_17 SIM NOTIFICATION MESSAGE
6392 @ingroup Use_Cases6_SIM
6396 <h3 class="pg">SIM NOTIFICATION MESSAGE </h3>
6397 These are not APIs, but EVENTs from the low layer. User can receive the following events:
6399 TAPI_EVENT_SIM_STATUS_IND
6400 TAPI_EVENT_SIM_FDN_STATUS_IND
6403 Application uses this event as follows.
6406 #include <ITapiSim.h>
6408 #include "TapiCommon.h"
6410 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
6412 //CALLBACK FUNCTION TO BE USED
6413 static void app_callback (TelTapiEvent_t *event)
6419 void* EventData = NULL;
6421 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6423 unsigned int temp_handle = -1;
6425 eventClass = event->EventClass;
6426 eventType = event->EventType;
6427 requestId = event->RequestId;
6428 status = event->Status;
6429 EventData = event->pData;
6433 case TAPI_EVENT_SIM_STATUS_IND:
6434 printf("***********TAPI_EVENT_SIM_STATUS_IND**************");
6436 if (status == TAPI_SIM_STATUS_CARD_ERROR)
6438 printf("SIM CARD ERROR");
6440 else if (status == TAPI_SIM_STATUS_CARD_NOT_PRESENT)
6442 printf("SIM CARD NOT INSERTED");
6444 else if (status == TAPI_SIM_STATUS_SIM_INITIALIZING)
6446 printf("SIM INITITIALIZING");
6448 else if (status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED)
6450 printf("SIM INIT COMPLETED");
6452 else if (status == TAPI_SIM_STATUS_SIM_PIN_REQUIRED)
6454 printf("SIM PIN REQUIRED");
6456 else if (status == TAPI_SIM_STATUS_SIM_PUK_REQUIRED)
6458 printf("SIM PUK REQUIRED");
6460 else if (status == TAPI_SIM_STATUS_CARD_BLOCKED)
6462 printf("SIM CARD BLOCKED");
6464 printf("********************************************");
6467 case TAPI_EVENT_SIM_FDN_STATUS_IND:
6468 printf("*********TAPI_EVENT_SIM_FDN_STATUS_IND***********");
6469 printf("SIM FDN status event status = [0x%x]", status);
6470 printf("********************************************");
6478 <h2 class="pg">SOUND</h2>
6479 <strong>[Note] Telephony Emulator does not support this feature.</strong>
6480 These APIs provide the interface for configuring sound related parameters.
6482 @defgroup Use_Cases7_1 Event Register and Deregister
6483 @ingroup Use_Cases7_SOUND
6487 <h3 class="pg">Event Register and Deregister </h3>
6488 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.
6493 unsigned int subscription_id = 0;
6496 api_err = tel_init ();
6497 if (api_err != TAPI_API_SUCCESS)
6499 TEST_DEBUG("tel_init Failed - api_err = %d \n", api_err);
6502 api_err = tel_register_event (TAPI_EVENT_SOUND_VOLUMECTRL_CNF, &subscription_id, (TelAppCallback)&app_callback);
6503 printf("VSOUND Event registration is Done: sub id is %d, api_err is %d\n",subscription_id,api_err);
6505 tel_register_app_name("com.samsung.appname");
6508 api_err = tel_deregister_event (subscription_id);
6509 if (api_err != TAPI_API_SUCCESS)
6511 printf("Event Class Deregestration Fail\n");
6515 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.
6517 @defgroup Use_Cases7_2 Voice path control
6518 @ingroup Use_Cases7_SOUND
6522 <h3 class="pg">Voice path control</h3>
6523 This API provides an interface for controlling voice path via application.
6526 int tel_set_sound_path (tapi_sound_audio_path_t vc_path, int *pRequestId);
6529 <strong>This API is permitted for Samsung in-house applications only</strong>
6531 @defgroup Use_Cases7_3 Volume control
6532 @ingroup Use_Cases7_SOUND
6536 <h3 class="pg">Volume control</h3>
6537 These APIs provide interfaces for controlling volume via application.
6540 int tel_set_sound_volume_info (tapi_sound_volume_control_t vol_control, int *pRequestId);
6541 int tel_get_sound_volume_info (tapi_sound_volume_type_t vol_control, int *pRequestId);
6544 <strong>This API is permitted for Samsung in-house applications only</strong>
6546 @defgroup Use_Cases7_4 Mic mute control
6547 @ingroup Use_Cases7_SOUND
6551 <h3 class="pg">Mic mute control</h3>
6552 This API provides an interface for mute/unmute mic via application.
6555 int tel_set_sound_mute_status(tapi_sound_mic_mute_t micmute_set, int * pRequestId);
6558 <strong>This API is permitted for Samsung in-house applications only</strong>
6563 #include <TapiCommon.h>
6564 #include <ITapiSound.h>
6566 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
6569 void vol_controlset()
6573 tapi_sound_volume_control_t vol_control;
6575 vol_control.volume = TAPI_SOUND_VOLUME_LEVEL_3;
6576 vol_control.vol_type = TAPI_SOUND_VOL_VOICE;
6578 ret_val = tel_set_sound_volume_info(vol_control, &requestId);
6579 if (ret_val == TAPI_API_SUCCESS)
6580 printf("successful\n");
6582 printf("error=%d\n", ret_val);
6583 //WAIT FOR EVENT HERE
6585 void vol_controlget()
6589 api_sound_volume_type_t vol_type;
6590 vol_type = TAPI_SOUND_VOL_VOICE;
6592 ret_val = tel_get_sound_volume_info (vol_type, &requestId);
6593 if (ret_val == TAPI_API_SUCCESS)
6594 printf("successful\n");
6596 printf("error=%d\n", ret_val);
6597 //WAIT FOR EVENT HERE
6600 //VOICE PATH AND USER CONFIGURATION
6606 tapi_sound_audio_path_t vc_path;
6608 vc_path = TAPI_SOUND_HANDSET;
6610 ret_val = tel_set_sound_path (vc_path, &requestId);
6611 if (ret_val == TAPI_API_SUCCESS)
6612 printf("successful\n");
6614 printf("error=%d\n", ret_status);
6615 //WAIT FOR EVENT HERE
6619 //USER CONFIGURATION
6620 void usr_configset()
6624 tapi_sound_user_sound_mask_t snd_mask;
6625 tapi_sound_user_sound_value_t snd_value;
6627 snd_mask = TAPI_SOUND_USER_MASK_ONE_MIN_ALERT;
6628 snd_value = TAPI_SOUND_ON;
6629 printf("tapi_sound_usr_configuration_set\n");
6630 ret_val = tapi_sound_usr_configuration_set(snd_mask,snd_value, &requestId);
6631 if (ret_val == TAPI_API_SUCCESS)
6632 printf("successful\n");
6634 printf("error=%d\n", ret_status);
6635 //WAIT FOR EVENT HERE
6638 void usr_configget()
6641 tapi_sound_user_sound_mask_t snd_mask;
6643 snd_mask = TAPI_SOUND_USER_MASK_SERVICE_CHANGE_ALERT;
6644 printf("tel_get_sound_mute_status \n");
6645 ret_val = tel_get_sound_mute_status(snd_mask, &requestId);
6646 if (ret_val == TAPI_API_SUCCESS)
6647 printf("successful\n");
6649 printf("error=%d\n", ret_status);
6650 //WAIT FOR EVENT HERE
6654 void micmute_controlset()
6657 tapi_sound_mic_mute_t set_micmute;
6659 set_micmute = TAPI_SOUND_MIC_MUTE;
6661 printf(" tel_set_sound_mute_status \n");
6662 ret_val = tel_set_sound_mute_status (set_micmute, &requestId);
6663 if (ret_val == TAPI_API_SUCCESS)
6664 printf("successful\n");
6666 printf("error=%d\n", ret_status);
6667 //WAIT FOR EVENT HERE
6671 //CALL BACK TO BE USED
6672 static void app_callback (TelTapiEvent_t *event)
6678 void* EventData = NULL;
6680 unsigned int temp_handle = -1;
6682 eventClass = event->EventClass;
6683 eventType = event->EventType;
6684 requestId = event->RequestId;
6685 status = event->Status;
6686 EventData = event->pData;
6688 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
6692 //TEST_DEBUG("******This is nonzero status. ******\n");
6699 case TAPI_EVENT_CLASS_SOUND:
6702 case TAPI_EVENT_SOUND_VOLUMECTRL_RSP :
6703 printf("*** TAPI_EVENT_SOUND_VOLUMECTRL_RSP received : %x ****\n", eventType);
6704 tapi_sound_volumn_ctrl_res vlm_ctrl_info;
6707 memcpy(&vlm_ctrl_info, event->pData,
6708 sizeof(tapi_sound_volumn_ctrl_res));
6711 case TAPI_EVENT_SOUND_AUDIOPATHCTRL_NOTI:
6712 tapi_sound_audio_path_t AudioPath = 0;
6713 int OldSndOutPath = MM_SOUND_PATH_NONE;
6714 AudioPath = *((tapi_sound_audio_path_t *)(event->pData));
6715 printf("*** TAPI_EVENT_SOUND_AUDIOPATHCTRL_NOTI received : %x ****\n", eventType);
6718 case TAPI_EVENT_SOUND_AUDIOSOURCECTRL_NOTI:
6719 tapi_sound_audio_source_type_t *pAudioSrcCtrl = NULL;
6720 pAudioSrcCtrl = (tapi_sound_audio_source_type_t*)(event->pData);
6721 printf("*** TAPI_EVENT_SOUND_AUDIOSOURCECTRL_NOTI received : %x ****\n", eventType);
6724 case TAPI_EVENT_SOUND_ERROR_IND:
6725 tapi_phone_err_t errorCause;
6726 errorCause = *(( tapi_phone_err_t *)(event->pData));
6727 printf("*** TAPI_EVENT_SOUND_ERROR_IND received : %x ****\n", eventType);
6730 case TAPI_EVENT_SOUND_MICMUTECTRL_RSP:
6731 tapi_sound_mic_mute_t *mute_status = NULL;
6732 mute_status = (tapi_sound_audio_source_type_t*)(event->pData);
6734 printf("*** TAPI_EVENT_SOUND_MICMUTECTRL_RSP received : %x ****\n", eventType);
6738 printf("*** Default Event %x ****\n", eventType);
6745 printf("*** Other TAPI EVENT received : class : %x ****\n", eventClass);
6753 <h2 class="pg">SAT (SIM Application Toolkit)</h2>
6754 @defgroup Use_Cases8_1 Event register and deregister
6755 @ingroup Use_Cases8_SAT
6758 <h3 class="pg">Event register and deregister</h3>
6759 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.
6764 unsigned int subscription_id = 0;
6766 TapiHandle *handle; // Handle given by tel_init()
6767 char *noti_id; // Get Noti id
6768 tapi_notification_cb callback; //Initialized call-back function pointer in which notification data is returned
6769 void *user_data = NULL; // Set User data
6771 api_err = tel_init();
6772 if (api_err != TAPI_API_SUCCESS)
6774 TEST_DEBUG("tel_init Failed - api_err = %d \n", api_err);
6777 api_err = tel_register_noti_event(handle, noti_id, on_noti_sat, user_data);
6778 printf("SAT Event registration is Done: sub id is %d, api_err is %d\n",subscription_id,api_err);
6780 tel_register_app_name("com.samsung.appname");
6783 api_err = tel_deregister_noti_event(handle, noti_id);
6784 if (api_err != TAPI_API_SUCCESS)
6786 printf("Event Class Unregeration Fail\n");
6789 api_err = tel_deinit();
6790 if (api_err != TAPI_API_SUCCESS)
6792 printf("tel_deinit Fail\n");
6795 static void on_noti_sat(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
6797 //CALL BACK FUNTION TO BE CALLED
6800 case TAPI_EVENT_SAT_DISPLAY_TEXT_IND:
6801 TelSatDisplayTextInd_t *event_data;
6802 event_data = (TelSatDisplayTextInd_t*)event->pData;
6804 case TAPI_EVENT_SAT_GET_INKEY_IND:
6805 TelSatGetInkeyIndInfo_t *event_data;
6806 event_data = (TelSatGetInkeyIndInfo_t *)event->pData;
6808 case TAPI_EVENT_SAT_GET_INPUT_IND:
6809 TelSatGetInputInd_t *event_data;
6810 event_data = (TelSatGetInputInd_t *)event->pData;
6813 case TAPI_EVENT_SAT_UI_PLAY_TONE_IND:
6814 TelSatPlayToneInd_t *event_data;
6815 event_data = (TelSatPlayToneInd_t *)event->pData;
6818 case TAPI_EVENT_SAT_PLAY_TONE_IND:
6819 TelSatPlayToneInd_t *event_data;
6820 event_data = (TelSatPlayToneInd_t *)event->pData;
6823 case TAPI_EVENT_SAT_UI_REFRESH_IND:
6824 TelSatRefreshIndUiInfo_t *event_data;
6825 event_data = (TelSatRefreshIndUiInfo_t *)event->pData;
6828 case TAPI_EVENT_SAT_SETUP_MENU_IND:
6829 TelSatSetupMenuInfo_t *event_data;
6830 event_data = (TelSatSetupMenuInfo_t *)event->pData;
6833 case TAPI_EVENT_SAT_UI_SETUP_MENU_IND:
6834 TelSatSetupMenuInfo_t *event_data;
6835 event_data = (TelSatSetupMenuInfo_t *)event->pData;
6838 case TAPI_EVENT_SAT_SELECT_ITEM_IND:
6839 TelSatSelectItemInd_t *event_data;
6840 event_data = (TelSatSelectItemInd_t *)event->pData;
6843 case TAPI_EVENT_SAT_UI_SEND_SMS_IND:
6844 TelSatSendSmsIndUiInfo_t *event_data;
6845 event_data = (TelSatSendSmsIndUiInfo_t *)event->pData;
6848 case TAPI_EVENT_SAT_UI_SEND_SS_IND:
6849 TelSatSendSsIndUiInfo_t *event_data;
6850 event_data = (TelSatSendSsIndUiInfo_t *)event->pData;
6853 case TAPI_EVENT_SAT_UI_SEND_USSD_IND:
6854 TelSatSendUssdIndUiInfo_t *event_data;
6855 event_data = (TelSatSendUssdIndUiInfo_t *)event->pData;
6858 case TAPI_EVENT_SAT_UI_SETUP_CALL_IND:
6859 TelSatSetupCallIndUiInfo_t *event_data;
6860 event_data = (TelSatSetupCallIndUiInfo_t *)event->pData;
6863 case TAPI_EVENT_SAT_PROVIDE_LOCAL_INFO_IND:
6864 TelSatProvideLocalInfoInd_t *event_data;
6865 event_data = (TelSatProvideLocalInfoInd_t *)event->pData;
6868 case TAPI_EVENT_SAT_SETUP_IDLE_MODE_TEXT_IND:
6869 TelSatSetupIdleModeTextInd_t *event_data;
6870 event_data = (TelSatSetupIdleModeTextInd_t *)event->pData;
6873 case TAPI_EVENT_SAT_UI_SEND_DTMF_IND:
6874 TelSatSendDtmfIndUiInfo_t *event_data;
6875 event_data = (TelSatSendDtmfIndUiInfo_t *)event->pData;
6878 case TAPI_EVENT_SAT_LANGUAGE_NOTIFICATION_IND:
6879 TelSatLanguageNotiInfoInd_t *event_data;
6880 event_data = (TelSatLanguageNotiInfoInd_t *)event->pData;
6883 case TAPI_EVENT_SAT_UI_LAUNCH_BROWSER_IND:
6884 TelSatLaunchBrowserIndUiInfo_t *event_data;
6885 event_data = (TelSatLaunchBrowserIndUiInfo_t *)event->pData;
6888 case TAPI_EVENT_SAT_END_PROACTIVE_SESSION_IND:
6889 TelSatEndProactiveSessionIndInfo_t *event_data;
6890 event_data = (TelSatEndProactiveSessionIndInfo_t *)event->pData;
6893 case TAPI_EVENT_SAT_MENU_SELECTION_CNF:
6894 TelSatEnvelopeResp_t *event_data;
6895 event_data = (TelSatEnvelopeResp_t *)event->pData;
6898 case TAPI_EVENT_SAT_CALL_CONTROL_IND:
6899 TelSatCallCtrlIndData_t *event_data;
6900 event_data = (TelSatCallCtrlIndData_t *)event->pData;
6903 case TAPI_EVENT_SAT_MO_SMS_CONTROL_IND:
6904 TelSatMoSmCtrlIndData_t *event_data;
6905 event_data = (TelSatMoSmCtrlIndData_t *)event->pData;
6908 case TAPI_EVENT_SAT_EVENT_DOWNLOAD_CNF:
6909 TelSatEnvelopeResp_t *event_data;
6910 event_data = (TelSatEnvelopeResp_t *)event->pData;
6913 case TAPI_EVENT_SAT_SMS_REFRESH_IND:
6914 case TAPI_EVENT_SAT_PB_REFRESH_IND:
6915 case TAPI_EVENT_SAT_IDLE_REFRESH_IND:
6916 TelSatRefreshInd_t *event_data;
6917 event_data = (TelSatRefreshInd_t *)event->pData;
6920 case TAPI_EVENT_SAT_SEND_SMS_IND:
6921 TelSatSendSmsIndSmsData_t *event_data;
6922 event_data = (TelSatSendSmsIndSmsData_t *)event->pData;
6925 case TAPI_EVENT_SAT_SETUP_CALL_IND:
6926 TelSatSetupCallIndCallData_t *event_data;
6927 event_data = (TelSatSetupCallIndCallData_t *)event->pData;
6930 case TAPI_EVENT_SAT_SEND_SS_IND:
6931 TelSatSendSsIndSsData_t *event_data;
6932 event_data = (TelSatSendSsIndSsData_t *)event->pData;
6935 case TAPI_EVENT_SAT_SEND_USSD_IND:
6936 TelSatSendUssdIndUssdData_t *event_data;
6937 event_data = (TelSatSendUssdIndUssdData_t *)event->pData;
6940 case TAPI_EVENT_SAT_SEND_DTMF_IND:
6941 TelSatSendDtmfIndDtmfData_t *event_data;
6942 event_data = (TelSatSendDtmfIndDtmfData_t *)event->pData;
6945 case TAPI_EVENT_SAT_LAUNCH_BROWSER_IND:
6946 TelSatLaunchBrowserIndBrowserData_t *event_data;
6947 event_data = (TelSatLaunchBrowserIndBrowserData_t *)event->pData;
6950 case TAPI_EVENT_SAT_END_OF_APP_EXEC_IND:
6951 TelSatProactiveCmdEndIndInfo_t *event_data;
6952 event_data = (TelSatProactiveCmdEndIndInfo_t *)event->pData;
6961 @defgroup Use_Cases8_2 Main Menu Information
6962 @ingroup Use_Cases8_SAT
6966 <h3 class="pg">Main Menu Information</h3>
6967 <strong>[Note] Telephony Emulator does not support this feature.</strong>
6969 Telephony provides APIs for retreiving SAT Main Menu Information.
6971 <strong>This API is permitted for Samsung in-house applications only</strong>
6974 int tel_get_sat_main_menu_info(TelSatSetupMenuInfo_t* pMainMenu)
6979 //SAT MAIN MENU INFORMATION
6981 #include <TapiCommon.h>
6982 #include <ITapiSat.h>
6984 void mainmenuinformation()
6988 TapiHandle *handle; // Handle given by tel_init()
6989 TelSatSetupMenuInfo_t SatMainMenuInfo;
6991 ReturnStatus = tel_get_sat_main_menu_info(handle, &SatMainMenuInfo);
6992 if (ReturnStatus == TAPI_API_SUCCESS)
6994 printf(" SAT Main Menu Information \n");
6995 printf("Main Menu Title :%s\n", satMainMenuInfo.satMainTitle);
6996 printf("Number of SAT Menu Items :%d\n", satMainMenuNum);
6997 printf("Sat Menu Items are:\n");
6998 for (i=0; i<SatMainMenuInfo.satMainMenuNum; i++)
6999 printf(" %s \n", SatMainMenuInfo.satMainMenuItem[i]);
7002 printf("ReturnStatus =%d\n", ReturnStatus);
7006 @defgroup Use_Cases8_3 Envelope Commands
7007 @ingroup Use_Cases8_SAT
7011 <h3 class="pg">Envelope Commands</h3>
7012 <strong>[Note] Telephony Emulator does not support this feature.</strong>
7014 This API sends a USIM application toolkit command to the USIM, using the envelope mechanism of USIM application toolkit. (See GSM TS 31.111)
7016 <strong>These APIs are permitted for Samsung in-house applications only</strong>
7019 int tel_select_sat_menu(TelSatMenuSelectionReqInfo_t* pMenuSelect, int* pRequestId);
7020 int tel_download_sat_event(TelSatEventDownloadReqInfo_t* pEventData, int* pRequestId);
7025 //MENU SELECTION ENVELOPE
7027 #include <TapiCommon.h>
7028 #include <ITapiSat.h>
7031 //SUBSCRIBE TO SAT EVENT(TAPI_EVENT_SAT_MENU_SELECTION_CNF) AS MENTIONED IN //Event Register and Deregister
7033 void satmenuselectionenvelope()
7036 TapiHandle *handle; // Handle given by tel_init()
7037 tapi_response_cb callback; //Initialized call-back function pointer in which response is returned
7038 TelSatMenuSelectionReqInfo_t SatMenuSelect;
7039 void *user_data = NULL; // Set User data
7041 SatMenuSelect.itemIdentifier = 1;
7042 SatMenuSelect.bIsHelpRequested = FALSE;
7044 ReturnStatus = tel_select_sat_menu(handle, &SatMenuSelect, on_resp_sat_select_menu, user_data);
7045 if (ReturnStatus != TAPI_API_SUCCESS)
7047 printf("ReturnStatus =%d\n", ReturnStatus);
7051 //WAIT FOR TAPI_EVENT_SAT_MENU_SELECTION_CNF EVENT HERE
7055 //CALLBACK FUNCTION TO BE USED
7056 static void on_resp_sat_select_menu(TapiHandle *handle, int result, void *data, void *user_data)
7058 printf("select menu item result(%d)", result);
7064 //EVENT DOWNLOAD ENVELOPE
7066 #include <TapiCommon.h>
7067 #include <ITapiSat.h>
7071 //SUBSCRIBE TO SAT EVENT(TAPI_EVENT_SAT_EVENT_DOWNLOAD_CNF) AS MENTIONED IN //Event Register and Deregister
7072 void eventdownloadenvelope()
7075 TapiHandle *handle; // Handle given by tel_init()
7076 tapi_response_cb callback; //Initialized call-back function pointer in which response is returned
7077 TelSatEventDownloadReqInfo_t SatEventData;
7078 void *user_data = NULL; // Set User data
7080 SatEventData.eventDownloadType = TAPI_EVENT_SAT_DW_TYPE_IDLE_SCREEN_AVAILABLE;
7082 SatEventData.u.bIdleScreenAvailable = TRUE;
7084 ReturnStatus = tel_download_sat_event(handle, &SatEventData, on_resp_sat_download_event, user_data);
7085 if (ReturnStatus != TAPI_API_SUCCESS)
7087 printf("ReturnStatus =%d\n", ReturnStatus);
7091 //WAIT FOR TAPI_EVENT_SAT_EVENT_DOWNLOAD_CNF EVENT HERE
7095 //CALLBACK FUNCTION TO BE USED
7096 static void on_resp_sat_download_event(TapiHandle *handle, int result, void *data, void *user_data)
7098 printf("select menu item result(%d)", result);
7102 @defgroup Use_Cases8_4 Application Execution result
7103 @ingroup Use_Cases8_SAT
7107 <h3 class="pg">Application Execution result</h3>
7108 <strong>[Note] Telephony Emulator does not support this feature.</strong>
7110 Telephony provides this API to get the Application execution result.
7112 <strong>This API is permitted for Samsung in-house applications only</strong>
7115 Int tel_send_sat_app_exec_result(TelSatAppsRetInfo_t* pAppRetInfo);
7120 //SAT MAIN MENU TITLE
7122 #include <TapiCommon.h>
7123 #include <ITapiSat.h>
7125 void sendappexecutionresult()
7128 TapiHandle *handle; // Handle given by tel_init()
7129 TelSatAppsRetInfo_t SatAppRetInfo;
7131 SatAppRetInfo.commandType = TAPI_SAT_CMD_TYPE_SETUP_IDLE_MODE_TEXT;
7132 SatAppRetInfo.appsRet.setupIdleModeText.resp = TAPI_SAT_R_SUCCESS;
7134 ReturnStatus = tel_send_sat_app_exec_result(handle, &SatAppRetInfo);
7135 if (ReturnStatus == TAPI_API_SUCCESS)
7137 printf(" Sending Application Execution Result Successful \n");
7140 printf("ReturnStatus =%d\n", ReturnStatus);
7144 @defgroup Use_Cases8_5 UI /User Confirmation
7145 @ingroup Use_Cases8_SAT
7149 <h3 class="pg">UI /User Confirmation </h3>
7150 <strong>[Note] Telephony Emulator does not support this feature.</strong>
7152 Send user's confirmation message to the USIM application
7154 <strong>These APIs are permitted for Samsung in-house applications only</strong>
7157 int tel_send_sat_ui_display_status(int commandId, TelSatUiDisplayStatusType_t status);
7158 int tel_send_sat_ui_user_confirm(TelSatUiUserConfirmInfo_t * pUserConfirmData) ;
7165 #include <TapiCommon.h>
7166 #include <ITapiSat.h>
7168 void senduidisplaystatus()
7172 TelSatUiDisplayStatusType_t DisplatStatus;
7175 DisplatStatus = TAPI_SAT_DISPLAY_SUCCESS;
7176 CommandId = commandId; //Command Id of the Proactive Command
7178 ReturnStatus = tel_send_sat_ui_display_status(handle, CommandId, DisplayStatus);
7179 if (ReturnStatus == TAPI_API_SUCCESS)
7180 printf(" Sending UI Display Status Successful \n");
7182 printf("ReturnStatus =%d\n", ReturnStatus);
7189 #include <TapiCommon.h>
7190 #include <ITapiSat.h>
7192 void senduiuserconfirm()
7195 TapiHandle *handle; // Handle given by tel_init()
7196 TelSatUiUserConfirmInfo_t UserConfirmData;
7198 UserConfirmData.commandId = commandId ; //Command Id of the Proactive Command
7200 UserConfirmData.commandType = TAPI_SAT_CMD_TYPE_PLAY_TONE;
7201 UserConfirmData.keyType = TAPI_SAT_USER_CONFIRM_YES;
7203 UserConfirmData.pAdditionalData = NULL;
7204 UserConfirmData.dataLen = 0;
7206 ReturnStatus = tel_send_sat_ui_user_confirm(handle, &UserConfirmData);
7207 if (ReturnStatus == TAPI_API_SUCCESS)
7208 printf(" Sending User Confirmation Data Successful \n");
7210 printf("ReturnStatus =%d\n", ReturnStatus);
7215 @defgroup Appendixes1 Appendix A. Sample Codes
7218 <h1 class="pg">Appendixes</h1>
7219 <h2 class="pg">Appendix A. Sample Codes</h2>
7220 Some reference sample code is attached to help the application developer understand the telephony Framework Module
7222 How to use supplementary service APIs and handle SS events
7224 #include <ITapiSs.h>
7225 #include <TapiEvent.h>
7226 #include <TapiCommon.h>
7227 #include <TelUtility.h>
7229 GMainLoop *nw_context_loop = NULL;
7239 static int SS_Callback(int eventClass, int eventType, void * param2)
7242 printf ("\n\n\n SS_Callback is called! eventClass : %d\n, eventType : %d\n", eventClass, eventType);
7246 case TAPI_EVENT_SS_REL_COMP_MSG_NOTIFY:
7247 if (param2 != NULL) {
7249 TelSsRelCompMsgInfo_t rel_comp_msg;
7250 memcpy(&rel_comp_msg, (TelSsRelCompMsgInfo_t *)param2,
7251 sizeof(TelSsRelCompMsgInfo_t));
7252 printf("Printing the Release Complete Message \n");
7254 for (x=0; x<rel_comp_msg.RelCompMsgLen; x++)
7256 printf("[%.2x]", rel_comp_msg.szRelCompMsg[x]);
7261 case TAPI_EVENT_SS_WAITING_CNF:
7262 printf("#### Received Event : TAPI_EVENT_SS_WAITING_CNF ##### \n");
7263 if (param2 == NULL) {
7264 printf("param2 is NULL\n");
7268 memcpy(&SsInfo, (TelSsInfo_t*)param2, sizeof(TelSsInfo_t));
7269 for (i=0; i<SsInfo.NumberOfRecords; i++)
7271 printf("Number of records %d \n", SsInfo.NumberOfRecords);
7272 printf("Record:%d Status:%d Teleservice:%d \n",
7274 sInfo.SsRecord.WaitingRecord.rec_class[i].Status,
7275 SsInfo.SsRecord.WaitingRecord.rec_class[i].TeleCommService);
7276 if (SsInfo.SsRecord.WaitingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
7277 printf("#### Status: Active #### \n");
7279 printf("#### Status: Not Active #### \n");
7284 case TAPI_EVENT_SS_WAITING_QUERYSTATUS_CNF:
7285 printf("#### Received vent :TAPI_EVENT_SS_WAITING_QUERYSTATUS_CNF ##### \n");
7286 if (param2 == NULL) {
7287 printf("\n paran 2 is NULL\n");
7291 memcpy(&SsInfo, (TelSsInfo_t*)param2, sizeof(TelSsInfo_t));
7292 for (i=0; i<SsInfo.NumberOfRecords; i++) {
7293 printf("Number of records %d \n",SsInfo.NumberOfRecords);
7294 printf("Record:%d Status:%d Teleservice:%d \n",
7296 SsInfo.SsRecord.WaitingRecord.rec_class[i].Status,
7297 SsInfo.SsRecord.WaitingRecord.rec_class[i].TeleCommService);
7299 if (SsInfo.SsRecord.WaitingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
7300 printf("#### Status: Active #### \n");
7302 printf("#### Status: Not Active #### \n");
7306 case TAPI_EVENT_SS_BARRING_QUERYSTATUS_CNF:
7307 printf("#### Received Event :TAPI_EVENT_SS_BARRING_QUERYSTATUS_CNF ##### \n");
7310 case TAPI_EVENT_SS_BARRING_CNF:
7311 printf("#### Received Event :TAPI_EVENT_SS_BARRING_CNF ##### \n");
7314 case TAPI_EVENT_SS_BARRING_CHANGEPASS_CNF:
7315 printf("#### Received Event : TAPI_EVENT_SS_BARRING_CHANGEPASS_CNF ##### \n");
7316 printf("Call barring Password Changed successfully\n");
7319 case TAPI_EVENT_SS_FORWARD_CNF:
7320 printf("#### Received Event :TAPI_EVENT_SS_FORWARD_CNF ##### \n");
7321 if (param2 != NULL) {
7323 memset(&SsInfo, 0, sizeof(TelSsInfo_t));
7324 memcpy(&SsInfo, (TelSsInfo_t*)param2, sizeof(TelSsInfo_t));
7325 printf("Number of records %d \n", SsInfo.NumberOfRecords);
7326 for (i=0; i<SsInfo.NumberOfRecords; i++)
7328 printf("Number of records %d\n", SsInfo.NumberOfRecords);
7329 printf("Record:%d Status:%d Teleservice:%d \n",
7331 SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status,
7332 SsInfo.SsRecord.ForwardingRecord.rec_class[i].TeleCommService);
7333 if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_REGISTERED)
7334 printf("#### Status: Registered #### \n");
7335 else if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
7336 printf("#### Status: Active #### \n");
7338 printf("#### Status: Not Registered /Not Active ####\n");
7343 printf("param2 is NULL\n");
7347 case TAPI_EVENT_SS_FORWARD_QUERYSTATUS_CNF:
7348 printf("#### Received Event : TAPI_EVENT_SS_FORWARD_QUERYSTATUS_CNF ##### \n");
7349 if (param2 != NULL) {
7351 memcpy(&SsInfo, (TelSsInfo_t*)param2, sizeof(TelSsInfo_t));
7352 for (i=0; i<SsInfo.NumberOfRecords; i++)
7354 printf("Number of records %d \n", SsInfo.NumberOfRecords);
7355 printf("Record:%d Status:%d Teleservice:%d \n",
7357 SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status,
7358 SsInfo.SsRecord.ForwardingRecord.rec_class[i].TeleCommService);
7359 if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_REGISTERED)
7360 printf("#### Status: Registered #### \n");
7361 else if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
7362 printf("#### Status: Active #### \n");
7364 printf("#### Status: Not Registered /Not Active #### \n");
7369 printf("param 2 is NULL\n");
7373 case TAPI_EVENT_SS_CLI_QUERYSTATUS_CNF:
7374 printf("#### Received Event : TAPI_EVENT_SS_IDENTIFY_IND #### \n");
7375 if (param2 != NULL) {
7377 memcpy(&SsInfo, (TelSsInfo_t*)param2, sizeof(TelSsInfo_t));
7378 printf("Status :%d CLI Service : %d \n",
7379 SsInfo.SsRecord.CliRecord.CliStatus,
7380 SsInfo.SsRecord.CliRecord.IdentificationType);
7381 if (SsInfo.SsRecord.CliRecord.CliStatus == 1)
7382 printf(" ##### Status : Not Provisioned #####\n");
7383 else if (SsInfo.SsRecord.CliRecord.CliStatus == 2)
7384 printf(" ##### Status : Provisioned but Deactivated #####\n");
7385 else if (SsInfo.SsRecord.CliRecord.CliStatus == 3)
7386 printf(" ##### Status : Provisioned and Activated #####\n");
7387 else if (SsInfo.SsRecord.CliRecord.CliStatus == 4)
7388 printf(" ##### Status : Unknown #####\n");
7389 else if (SsInfo.SsRecord.CliRecord.CliStatus == 5)
7390 printf(" ##### Status : Temporarily Restricted #####\n");
7391 else if (SsInfo.SsRecord.CliRecord.CliStatus == 6)
7392 printf(" ##### Status : Temporarily Allowed #####\n");
7396 printf("param 2 is NULL\n");
7401 printf("\n\nDID NOT GET THE EVENT\n");
7404 g_main_loop_quit(nw_context_loop);
7408 static void app_callback (TelTapiEvent_t *event)
7414 void* EventData = NULL;
7416 eventClass = event->EventClass;
7417 eventType = event->EventType;
7418 requestId = event->RequestId;
7419 status = event->Status;
7420 EventData = event->pData;
7421 //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
7424 //TEST_DEBUG("******This is nonzero status. ******\n");
7427 SS_Callback((int)eventClass, (int)eventType, EventData);
7430 ss_test_subscribe_tapi_events()
7433 unsigned int subscription_id = 0;
7434 TapiResult_t api_err;
7436 api_err = TelTapiInit();
7437 if (api_err != TAPI_API_SUCCESS)
7439 printf("TelTapiInit Failed - api_err = %d \n", api_err);
7441 api_err = TelTapiRegisterEvent(TAPI_EVENT_SS_WAITING_CNF, &subscription_id, (TelAppCallback)&app_callback);
7442 printf("SS Class registeration is Done: sub id is %d, api_err is %d\n",subscription_id,api_err);
7449 unsigned int subscription_id = 0;
7450 TapiResult_t api_err;
7452 api_err = tel_deregister_event(subscription_id);
7453 if (api_err != TAPI_API_SUCCESS)
7455 printf("Event Class Unregeration Fail\n");
7461 TapiResult_t ret_status;
7462 TelSsCallBarringInfo_t pBarringInfo;
7464 char *bar_pwd = "0000";
7466 printf("Before copying ,,,length is %d\n", strlen(pBarringInfo.szPassword));
7467 printf("len initially is %d\n", strlen(bar_pwd));
7469 pBarringInfo.Mode = TAPI_SS_CALL_BAR_ACTIVATE;
7470 pBarringInfo.Type = TAPI_CALL_BARRING_ALL_OUTGOING_CALLS;//TAPI_CALL_BARRING_ALL_OUTGOING_INTERN_CALL;
7471 pBarringInfo.CallType = TAPI_CALL_TYPE_VOICE_EV;
7472 strcpy(pBarringInfo.szPassword, bar_pwd);
7473 printf("length is %d\n", strlen(pBarringInfo.szPassword));
7474 ret_status = tel_set_ss_barring(&pBarringInfo, &pRequestId);
7475 if (ret_status != TAPI_API_SUCCESS) {
7479 nw_context_loop = g_main_loop_new(NULL, FALSE);
7480 g_main_loop_run(nw_context_loop);
7483 //now , get the status
7484 TelSsCallBarType_t BarType = TAPI_CALL_BARRING_ALL_OUTGOING_INTERN_CALL;
7485 TelSsCallType_t CallType = TAPI_CALL_TYPE_VOICE_EV;
7486 ret_status = tel_get_ss_barring_status(BarType,CallType, &pRequestId);
7487 if (ret_status != TAPI_API_SUCCESS) {
7491 nw_context_loop = g_main_loop_new(NULL, FALSE);
7492 g_main_loop_run(nw_context_loop);
7497 TapiResult_t ret_status;
7498 TelSsForwardInfo_t pForwardInfo;
7501 char *cf_number = "9986529874";
7503 pForwardInfo.Mode = TAPI_CALL_FORWARD_MODE_ENABLE_EV;
7504 pForwardInfo.Type = TAPI_CS_FORWARD_TYPE_VOICE_EV;
7505 pForwardInfo.Condition = TAPI_SS_FORWARD_WHEN_UNCONDITIONAL_EV;
7506 pForwardInfo.NoReplyConditionTimer = 10;
7508 len = strlen(cf_number);
7509 printf("Length of CF number :%d \n", len);
7510 memcpy(&(pForwardInfo.szPhoneNumber), cf_number, len);
7511 ret_status = tel_set_ss_forward(&pForwardInfo, &pRequestId);
7512 if (ret_status != TAPI_API_SUCCESS) {
7516 nw_context_loop = g_main_loop_new(NULL, FALSE);
7517 g_main_loop_run(nw_context_loop);
7519 //now , get call forward status
7520 TelSsForwardType_t Type = TAPI_CS_FORWARD_TYPE_VOICE_EV;
7521 TelSsForwardWhen_t Condition = TAPI_SS_FORWARD_WHEN_UNCONDITIONAL_EV;
7523 // Calling TAPI SS Call Frwd Query Req Status Api
7524 ret_status = tel_get_ss_forward_status(Type,Condition, &pRequestId);
7525 if (ret_status != TAPI_API_SUCCESS) {
7529 nw_context_loop = g_main_loop_new(NULL, FALSE);
7530 g_main_loop_run(nw_context_loop);
7535 //set and get call waiting
7536 TapiResult_t ret_status;
7537 TelSsWaitingInfo_t waitInfo;
7540 waitInfo.Mode = TAPI_SS_CW_ACTIVATE;
7541 waitInfo.CallType = TAPI_CALL_TYPE_VOICE_EV;
7544 ret_status = tel_set_ss_waiting(&waitInfo, &RequestID);
7545 if (ret_status != TAPI_API_SUCCESS) {
7549 nw_context_loop = g_main_loop_new(NULL, FALSE);
7550 g_main_loop_run(nw_context_loop);
7555 TelSsCallType_t CallType = TAPI_CALL_TYPE_VOICE_EV;
7556 ret_status = tel_get_ss_waiting_status(CallType, &RequestID);
7557 if (ret_status != TAPI_API_SUCCESS) {
7560 nw_context_loop = g_main_loop_new(NULL, FALSE);
7561 g_main_loop_run(nw_context_loop);
7566 ss_test_subscribe_tapi_events();
7567 tapi_ss_call_barr();
7569 tapi_ss_call_wait();
7573 int main(int argc, char *argv[])
7580 @defgroup Appendixes2 Appendix B. Error Code
7584 <h2 class="pg">Appendix B. Error Code</h2>
7586 <tr><td>Error Num.</td>
7588 <td>Error Description</td></tr>
7590 <td>TAPI_API_SUCCESS</td>
7591 <td>No Error occurred</td></tr>
7593 <td>TAPI_API_INVALID_INPUT</td>
7594 <td>Input values are not correct in TAPI Library</td></tr>
7596 <td>TAPI_API_INVALID_PTR</td>
7597 <td>invalid pointer</td></tr>
7599 <td>TAPI_API_NOT_SUPPORTED</td>
7600 <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>
7602 <td>TAPI_API_DEPRICATED </td>
7603 <td>This API is deprecated and will be so in future also </td></tr>
7605 <td>TAPI_API_SYSTEM_OUT_OF_MEM</td>
7606 <td>Out of memory</td></tr>
7608 <td>TAPI_API_SYSTEM_RPC_LINK_DOWN</td>
7609 <td>RPC link down</td></tr>
7611 <td>TAPI_API_SERVICE_NOT_READY </td>
7612 <td>Phone was powered on, but yet to receive the power up completed notification </td></tr>
7614 <td>TAPI_API_SERVER_FAILURE</td>
7615 <td>error occurred in Telephony server</td></tr>
7617 <td>TAPI_API_OEM_PLUGIN_FAILURE</td>
7618 <td>Plug-in layer failure</td></tr>
7620 <td>TAPI_API_TRANSPORT_LAYER_FAILURE</td>
7621 <td>Transport layer Failure</td></tr>
7623 <td>TAPI_API_INVALID_DATA_LEN</td>
7624 <td>Invalid data length</td></tr>
7629 * @defgroup TELEPHONY
7631 * @defgroup Appendix Reference
7632 * @defgroup TELEPHONY_USECASES Use Cases
7634 * @defgroup Use_Cases1_COMMON COMMON
7635 * @defgroup Use_Cases2_CALL CALL
7636 * @defgroup Use_Cases3_SUPPLEMENTARY_SERVICE SUPPLEMENTARY_SERVICE
7637 * @defgroup Use_Cases4_SMS SMS
7638 * @defgroup Use_Cases5_NETWORK NETWORK_Registration_and_Configuration
7639 * @defgroup Use_Cases6_SIM SIM
7640 * @defgroup Use_Cases7_SOUND SOUND
7641 * @defgroup Use_Cases8_SAT SAT