8e76296bf6076a08284a04a2be2790021e942ba4
[framework/telephony/libslp-tapi.git] / wearable / include / SLP_TelephonyFW_PG.h
1 /*
2  * libslp-tapi
3  *
4  * Copyright (c) 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Ja-young Gu <jygu@samsung.com>
7  *
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
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  */
20
21 /**
22  * @ingroup   SLP_PG
23  * @defgroup   TELEPHONY Telephony
24 @{
25
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.
29
30         <h2 class="pg">Scope</h2>
31 The scope of this document is limited to Samsung Linux platform Telephony Framework API usage.
32
33         <h2 class="pg">Abbreviations</h2>
34 <table>
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>
43 </table>
44
45         <h2 class="pg">Restriction Modules</h2>
46 CALL, SMS, GPRS, SAT have the permission. Refer to each module API description
47 @}
48 @defgroup Telephony_Architecture 1.Architecture
49 @ingroup TELEPHONY
50 @{
51 <h1 class="pg">Telephony Framework Architecture</h1>
52 @image html SLP_TelephonyFW_PG_image001.png
53
54 @image html SLP_TelephonyFW_PG_image002.png System Architecture of Telephony Framework
55
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)
63 @}
64 @defgroup Telephony_Feature 2.SubModules & Services
65 @ingroup TELEPHONY
66 @{
67
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.
76 - For CDMA
77         - Call Flash Information
78         - Get and Set voice privacy mode
79
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
88
89         <h2 class="pg">Supplementary Service</h2>
90 - Interrogation and activation for Call Barring, forwarding and waiting.
91 - USSD services, AOC Services.
92
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.
97 - For CDMA
98         - Get and Set CDMA Hybrid Mode
99         - Get and Set Roaming Mode, Preferred PLMN
100
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
107 - SAP
108
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
114
115         <h2 class="pg">Sound</h2>
116 Sound that is related with voice call is used to control modem configuration
117 - Sound user configuration
118 - Voice path control
119 - Volume control
120 - Mic mute control
121
122         <h2 class="pg">Common</h2>
123
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
129
130 @}
131
132 <h1 class="pg">Feature Description</h1>
133 <h2 class="pg">COMMON</h2>
134
135 @defgroup Use_Cases1_1 TAPI Initialization
136 @ingroup Use_Cases1_COMMON
137 @{
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.
141
142 @code
143 int tel_init (void);
144 @endcode
145
146 SAMPLE CODE
147 @code
148 #include <stdio.h>
149 #include <stdlib.h>
150 #include <TapiCommon.h>
151
152 void tapiinit()
153 {
154         int api_err;
155
156         api_err = tel_init();
157         if (api_err != TAPI_API_SUCCESS)
158         {
159                 printf ("tel_init Failed - api_err = %d\n", api_err);
160         }
161 }
162 @endcode
163 @}
164 @defgroup Use_Cases1_2 TAPI De-initialization
165 @ingroup Use_Cases1_COMMON
166 @{
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.
171
172 @code
173 int tel_deinit (void);
174 @endcode
175
176 SAMPLE CODE
177 @code
178 #include <stdio.h>
179 #include <stdlib.h>
180 #include <TapiCommon.h>
181
182 void tapideinit()
183 {
184         int api_err;
185
186         api_err = tel_deinit();
187         if (api_err != TAPI_API_SUCCESS)
188         {
189                 printf ("tel_deinit Failed - api_err = %d\n", api_err);
190         }
191 }
192 @endcode
193 @}
194 @defgroup Use_Cases1_3 Register Event
195 @ingroup Use_Cases1_COMMON
196 @{
197
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.
200
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.
203
204 @code
205 int tel_register_event (int EventType , unsigned int * SubscriptionId, TelAppCallback AppCallBack);
206 @endcode
207
208 SAMPLE CODE
209 @code
210 #include <stdio.h>
211 #include <stdlib.h>
212 #include <TapiCommon.h>
213
214 void app_callback(TelTapiEvent_t *event);
215
216 // REGISTER EVENT
217 void registerevent()
218 {
219         unsigned int subscription_id = 0;
220         int api_err;
221
222         api_err = tel_init();
223         if (api_err != TAPI_API_SUCCESS)
224         {
225                 printf ("tel_init Failed - api_err = %d\n", api_err);
226         }
227
228         api_err = tel_register_event (TAPI_EVENT_CALL_SETUP_CNF, &subscription_id, (TelAppCallback)&app_callback);
229
230         printf("MISC Event registeration is Done: sub id is %d, api_err is %d\n", subscription_id, api_err);
231
232         tel_register_app_name("com.samsung.appname");
233 }
234
235 void app_callback(TelTapiEvent_t *event)
236 {
237         //Callback function to be called
238 }
239 @endcode
240 @}
241
242 @defgroup Use_Cases1_4 Deregister Event
243 @ingroup Use_Cases1_COMMON
244 @{
245
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.
250
251 @code
252 int tel_deregister_event ( unsigned int  SubscriptionId);
253 @endcode
254
255 SAMPLE CODE
256 @code
257 #include <stdio.h>
258 #include <stdlib.h>
259 #include <TapiCommon.h>
260
261 void app_callback(TelTapiEvent_t *event);
262
263 void registerevent()
264 {
265         unsigned int subscription_id = 0;
266         int api_err;
267
268         api_err = tel_init();
269         if (api_err != TAPI_API_SUCCESS)
270         {
271                 printf ("tel_deregister_event Failed - api_err = %d\n", api_err);
272         }
273
274         // REGISTER EVENT
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);
277
278         tel_register_app_name("com.samsung.appname");
279
280         // DEREGISTER EVENT
281         api_err = tel_deregister_event (subscription_id);
282         if (api_err != TAPI_API_SUCCESS)
283         {
284                 printf("Event Deregistration Failed\n");
285         }
286 }
287
288 void app_callback(TelTapiEvent_t *event)
289 {
290         // callback function to be called
291 }
292 @endcode
293 @}
294
295
296 @defgroup Use_Cases1_5 TAPI Ecore Initialization
297 @ingroup Use_Cases1_COMMON
298 @{
299
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.
303
304 @code
305 int tel_init_ecore_loop (void);
306 @endcode
307
308 SAMPLE CODE
309 @code
310 #include <stdio.h>
311 #include <stdlib.h>
312 #include <TapiCommon.h>
313
314 void tapiinitecore()
315 {
316         int api_err;
317
318         api_err = tel_init_ecore_loop();
319         if (api_err != TAPI_API_SUCCESS)
320         {
321                 printf("tel_init_ecore_loop Failed - api_err = %d\n", api_err);
322         }
323 }
324 @endcode
325
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.
329
330 @code
331 int tel_deinit_ecore_loop (void);
332 @endcode
333
334 SAMPLE CODE
335 @code
336 #include <stdio.h>
337 #include <stdlib.h>
338 #include <TapiCommon.h>
339
340 void tapideinitecore()
341 {
342         int api_err;
343
344         api_err = tel_deinit_ecore_loop();
345         if (api_err != TAPI_API_SUCCESS)
346         {
347                 printf("tel_deinit_ecore_loop Failed - api_err = %d\n", api_err);
348         }
349 }
350 @endcode
351 @}
352
353 @defgroup Use_Cases1_6 TAPI RegisterEvent Ecore
354 @ingroup Use_Cases1_COMMON
355 @{
356
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.
362
363 @code
364 int tel_register_event_at_ecore_loop(int EventType, unsigned int * SubscriptionId, TelAppCallback AppCallBack);
365 @endcode
366
367 SAMPLE CODE
368 @code
369 #include <stdio.h>
370 #include <stdlib.h>
371 #include <TapiCommon.h>
372
373 void app_callback(TelTapiEvent_t *event);
374
375 void registereventecore()
376 {
377         int api_err;
378         unsigned int subscription_id = 0;
379
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)
382         {
383                 printf ("tel_register_event_at_ecore_loop Failed - api_err = %d \n", api_err);
384         }
385         printf("RegisterEventEcore done with subscription_id:%d and return Status:%d\n", subscription_id, api_err);
386
387         tel_register_app_name("com.samsung.appname");
388 }
389
390 void app_callback(TelTapiEvent_t *event)
391 {
392         //Callback function to be called
393 }
394 @endcode
395 @}
396
397
398 @defgroup Use_Cases1_7 TAPI DeRegisterEvent Ecore
399 @ingroup Use_Cases1_COMMON
400 @{
401
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.
407
408 @code
409 int tel_deregister_event_at_ecore_loop (unsigned int SubscriptionId);
410 @endcode
411
412 SAMPLE CODE
413 @code
414 #include <stdio.h>
415 #include <stdlib.h>
416 #include <TapiCommon.h>
417
418 Void deregistereventecore()
419 {
420         int api_err;
421         unsigned int subscription_id = 0;
422
423         // REGISTER EVENT
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);
426
427         tel_register_app_name("com.samsung.appname");
428
429         // DEREGISTER EVENT
430         api_err = tel_deregister_event_at_ecore_loop (subscription_id);
431         if (api_err != TAPI_API_SUCCESS)
432         {
433                 printf("tel_deregister_event_at_ecore_loop Failed - api_err = %d\n", api_err);
434         }
435 }
436 @endcode
437 @}
438
439 @defgroup Use_Cases1_8 Register Application Name
440 @ingroup Use_Cases1_COMMON
441 @{
442
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.
445
446 @code
447 int tel_register_app_name(char *name)
448 @endcode
449
450 SAMPLE CODE
451 @code
452 #include <stdio.h>
453 #include <stdlib.h>
454 #include <TapiCommon.h>
455
456 Void register_app_name()
457 {
458         tel_init();
459         //register telephony event
460         tel_register_event(...);
461         //...
462         tel_register_app_name("com.samsung.appname");
463         GMainLoop *loop = g_main_loop_new(NULL, false);
464         g_main_loop_run(loop);
465 }
466 @endcode
467 @}
468
469 @defgroup Use_Cases1_9 Get Application Name
470 @ingroup Use_Cases1_COMMON
471 @{
472
473                 <h3 class="pg">Get Application Name</h3>
474 This function get the application name which was registered with #tel_register_application_name.
475
476 @code
477 int tel_get_app_name(tapi_dbus_connection_name *app_name)
478 @endcode
479
480 SAMPLE CODE
481 @code
482 #include <stdio.h>
483 #include <TapiCommon.h>
484
485 void get_app_name()
486 {
487         tapi_dbus_connection_name app_name;
488         tel_get_app_name(&app_name);
489         // printf("app_name = %s\n", app_name.name);
490 }
491 @endcode
492 @}
493 @defgroup Use_Cases1_10 TAPI Check service ready
494 @ingroup Use_Cases1_COMMON
495 @{
496
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.
499
500 @code
501 int tel_check_service_ready (int* bStatus)
502 @endcode
503
504 SAMPLE CODE:
505 @code
506 #include <stdio.h>
507 #include <TapiCommon.h>
508
509 void getmodemstatus()
510 {
511         int bStatus = 0;
512         int err_code;
513
514         err_code = tel_check_service_ready(&bStatus);
515         if (err_code != TAPI_API_SUCCESS) {
516                 printf("Error Code [%x]\n", err_code);
517         }
518         else {
519                 if (bStatus == 0)
520                         printf("Telephony Service Not Ready";
521                 else if (bStatus == 1)
522                         printf("Telephony Service Ready";
523         }
524 }
525 @endcode
526 @}
527
528
529 <h2 class="pg">CALL</h2>
530
531 @defgroup Use_Cases2_1 Event Register and Deregister
532 @ingroup Use_Cases2_CALL
533 @{
534
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.
537
538 SAMPLE CODE:
539 @code
540 // REGISTER EVENT
541 int api_err;
542 unsigned int subscription_id = 0;
543
544 api_err = tel_init();
545 if (api_err != TAPI_API_SUCCESS)
546 {
547         printf("tel_init Failed - api_err = %d \n", api_err);
548 }
549
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);
552
553 tel_register_app_name("com.samsung.appname");
554
555 // DEREGISTER EVENT
556 api_err = tel_deregister_event (subscription_id);
557 if (api_err != TAPI_API_SUCCESS)
558 {
559         printf("Event Class Unregistration Fail\n");
560 }
561 @endcode
562 @}
563
564 @defgroup Use_Cases2_2 Call Setup
565 @ingroup Use_Cases2_CALL
566 @{
567
568 <h3 class="pg">Call Setup</h3>
569 This API originates an MO call setup.
570
571 @code
572 int tel_dial_call(TapiHandle *handle, const TelCallDial_t *pParams, tapi_response_cb callback, void *user_data);
573 @endcode
574
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.
577
578 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
579
580 SAMPLE CODE:
581 @code
582 #include <ITapiCall.h>
583 #include <stdio.h>
584 #include "TapiCommon.h"
585
586 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
587 void callsetup()
588 {
589         TapiHandle *handle = menu_manager_ref_user_data(mm);
590         TelCallDial_t data;
591         int result;
592         int len;
593
594         memset(&data, 0, sizeof(TelCallDial_t));
595
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");
600                 return 0;
601         }
602
603         memcpy(data.szNumber, data_call_number, len);
604
605         msg("call tel_dail_call()");
606
607         result = tel_dial_call(handle, &data, on_dial_call, 0);
608         if (result != TAPI_API_SUCCESS) {
609                 msg("failed. (result = %d)", result);
610         }
611
612         return 0;
613 }
614
615 //CALLBACK FUNCTION TO BE USED
616 static void app_callback (TelTapiEvent_t *event)
617 {
618         int eventClass;
619         int eventType;
620         int status;
621         void* EventData = NULL;
622
623         unsigned int temp_handle = 0;
624
625         eventClass = event->EventClass;
626         eventType = event->EventType;
627         requestId = event->RequestId;
628         status = event->Status;
629         EventData = event->pData;
630
631         if (status != 0)
632         {
633                 //TEST_DEBUG("******This is nonzero status. ******\n");
634                 return;
635         }
636
637         switch (eventType)
638         {
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);
643
644                         break;
645
646                 case TAPI_EVENT_CALL_ALERT_IND:
647                         int index;
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);
651                         break;
652
653                 case TAPI_EVENT_CALL_CONNECTED_IND:
654                         int index;
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);
658                         break;
659         }
660         //...
661 }
662 @endcode
663 @}
664 @defgroup Use_Cases2_3 Call Answer
665 @ingroup Use_Cases2_CALL
666 @{
667
668                 <h3 class="pg">Call Answer</h3>
669 This API responds to an incoming call either by accepting or rejecting the call.
670
671 Pre Conditions:
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.
674
675 @code
676 int tel_answer_call(TapiHandle *handle, unsigned int CallHandle, TelCallAnswerType_t AnsType, tapi_response_cb callback, void *user_data);
677 @endcode
678
679 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
680
681 SAMPLE CODE:
682 @code
683 #include <ITapiCall.h>
684 #include <stdio.h>
685 #include "TapiCommon.h"
686 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
687
688 void callsetup(unsigned int CallHandle)
689 {
690         TapiHandle *handle = menu_manager_ref_user_data(mm);
691         int result;
692         unsigned int call_id;
693         TelCallAnswerType_t answer_type;
694
695
696         msg("call tel_answer_call()");
697
698         call_id = atoi(data_call_id);
699         answer_type = atoi(data_answer_type);
700
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);
704         }
705
706         return 0;
707 }
708
709 //CALLBACK FUNCTION TO BE USED
710 static void app_callback (TelTapiEvent_t *event)
711 {
712         //..
713         switch (eventType) //REFER Call Setup TO GET eventType
714         {
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;
721                         break;
722
723                 case TAPI_EVENT_CALL_ANSWER_CNF:
724                         memcpy(&CallHandle, event->pData, sizeof(unsigned int));
725                         printf("TAPI_EVENT_CALL_ANSWER_CNF\n");
726                         break;
727         }
728         //..
729 }
730 @endcode
731 @}
732 @defgroup Use_Cases2_4 Call Release
733 @ingroup Use_Cases2_CALL
734 @{
735
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.
739
740 Pre Conditions:
741 @n Call handle should be valid and there should be an existing call in Active/hold state.
742
743 @code
744 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
745
746 SAMPLE CODE:
747 @code
748 #include <ITapiCall.h>
749 #include <stdio.h>
750 #include "TapiCommon.h"
751
752 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
753
754 void callrelease(unsigned int CallHandle)
755 {
756         TapiHandle *handle = menu_manager_ref_user_data(mm);
757         int result;
758         unsigned int call_id;
759         TelCallEndType_t end_type;
760
761         msg("call tel_end_call()");
762
763         call_id = atoi(data_call_id);
764         end_type = atoi(data_end_type);
765
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);
769         }
770
771         return 0;
772 } //WAIT FOR EVENT HERE
773
774 //CALLBACK FUNCTION TO BE USED
775 static void app_callback(TelTapiEvent_t *event)
776 {
777         //...
778         switch (eventType) //REFER Call Setup TO GET eventType
779         {
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;
785                         break;
786
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:
792                         unsigned int handle;
793                         memcpy(&handle, event->pData, sizeof(unsigned int));
794                         printf("TAPI_EVENT_CALL_RELEASE_CNF\n");
795                         break;
796                         //...
797         }
798 }
799 @endcode
800 @}
801 @defgroup Use_Cases2_5 Call Hold
802 @ingroup Use_Cases2_CALL
803 @{
804
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.
807
808 @code
809  int tel_hold_call(TapiHandle *handle, unsigned int CallHandle, tapi_response_cb callback, void *user_data);
810 @endcode
811
812 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
813
814 SAMPLE CODE
815 @code
816 #include <ITapiCall.h>
817 #include <stdio.h>
818 #include "TapiCommon.h"
819
820 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
821 void callhold(unsigned int CallHandle)
822 {
823         unsigned int call_handle = VC_TAPI_CALLHANDLE;
824         TapiResult_t tapi_err = TAPI_API_SUCCESS;
825         // Hold the call
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);
830                 return FALSE;
831         }
832
833         return;
834 } //WAIT FOR EVENT HERE
835
836 //CALLBACK FUNCTION TO BE USED
837 static void app_callback (TelTapiEvent_t *event)
838 {
839         //..
840         switch (eventType) //REFER Call Setup TO GET eventType
841         {
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");
846                         break;
847                 //...
848         }
849         //...
850 }
851 @endcode
852 @}
853 @defgroup Use_Cases2_6  Call Retrieve
854 @ingroup Use_Cases2_CALL
855 @{
856
857                 <h3 class="pg">Call Retrieve</h3>
858 This API can be used to retrieve a held call.
859
860 Pre Conditions:
861 @n Call should be in held state in order to return to the active state, and no other call should be active.
862
863 @code
864 int tel_active_call(TapiHandle *handle, unsigned int CallHandle, tapi_response_cb callback, void *user_data);
865 @endcode
866
867 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
868
869 SAMPLE CODE:
870 @code
871 #include <ITapiCall.h>
872 #include <stdio.h>
873 #include "TapiCommon.h"
874
875
876 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
877 void callretrieve(unsigned int CallHandle)
878 {
879         unsigned int call_handle = VC_TAPI_CALLHANDLE;
880         TapiResult_t tapi_err = TAPI_API_SUCCESS;
881
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);
885                 return FALSE;
886         }
887 } //WAIT FOR EVENT HERE
888
889 //CALLBACK FUNCTION TO BE USED
890 static void app_callback(TelTapiEvent_t *event)
891 {
892         //..
893         switch (eventType) //REFER Call Setup TO GET eventType
894         {
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");
899                         break;
900
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 ");
905                         break;
906         }
907         //...
908 }
909 //...
910 @endcode
911 @}
912 @defgroup Use_Cases2_7  Call Swap
913 @ingroup Use_Cases2_CALL
914 @{
915
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.
918
919 Pre Conditions:
920 @n Two calls should be present, one of them in the Active state and the other in the held state
921
922 @code
923 int tel_swap_call(TapiHandle *handle, unsigned int CallHandle1, unsigned int CallHandle2, tapi_response_cb callback, void *user_data);
924 @endcode
925
926 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
927
928 SAMPLE CODE:
929 @code
930 #include <ITapiCall.h>
931 #include <stdio.h>
932 #include "TapiCommon.h"
933 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
934
935 void callswap(unsigned int CallHandle1, unsigned int CallHandle2)
936 {
937         int ret_status ;
938         TapiHandle *handle;
939         unsigned int CallHandle1;
940         unsigned int CallHandle2;
941         tapi_response_cb callback;
942         void *user_data;
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);
946                 return FALSE;
947         }
948
949         return TRUE;
950 } //WAIT FOR EVENT HERE
951
952 //CALLBACK FUNCTION TO BE USED
953 static void app_callback (TelTapiEvent_t *event)
954 {
955         //..
956         switch (eventType) //REFER Call Setup TO GET eventType
957         {
958                 case TAPI_EVENT_CALL_SWAP_CNF:
959                         printf("TAPI_EVENT_CALL_RETRIEVE_CNF\n");
960                         break;
961         }
962         //..
963 }
964 //..
965 @endcode
966 @}
967 @defgroup Use_Cases2_8 Send DTMF
968 @ingroup Use_Cases2_CALL
969 @{
970
971                 <h3 class="pg">Send DTMF</h3>
972 This API can be used for sending one or more DTMF digits during the call.
973
974 Pre Conditions:
975 @n Active call should be present.
976
977 @code
978  int tel_call_dtmf(TapiHandle *handle, const char *pDtmfString, tapi_response_cb callback, void *user_data);
979 @endcode
980
981 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
982
983 SAMPLE CODE:
984 @code
985 #include <ITapiCall.h>
986 #include <stdio.h>
987 #include "TapiCommon.h"
988
989 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
990 void senddtmf()
991 {
992         int ret_status ;
993         TapiHandle *handle;
994         unsigned int pCallHandle;
995         void *user_data;
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);
999
1000         if (TAPI_API_SUCCESS != tapi_err) {
1001                 CALL_ENG_DEBUG(ENG_DEBUG, "tapi_call_dtmf Failed, Error Code: %d", tapi_err);
1002                 return FALSE;
1003         }
1004
1005         CALL_ENG_DEBUG(ENG_DEBUG, " Ended...");
1006
1007         return TRUE;
1008 }
1009 //WAIT FOR EVENT HERE
1010 static void app_callback(TelTapiEvent_t *event)
1011 {
1012         //..
1013         switch (eventType) //REFER Call Setup TO GET eventType
1014         {
1015                 case TAPI_EVENT_CALL_SEND_DTMF_CNF:
1016                         printf("TAPI_EVENT_CALL_SEND_DTMF_CNF\n");
1017                         break;
1018         }
1019         //..
1020 }
1021 @endcode
1022 @}
1023 @defgroup Use_Cases2_9 Call Join
1024 @ingroup Use_Cases2_CALL
1025 @{
1026
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.
1029
1030 Pre Conditions:
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.
1032
1033 @code
1034  int tel_join_call(TapiHandle *handle, unsigned int CallHandle1, unsigned int CallHandle2, tapi_response_cb callback, void *user_data);
1035 @endcode
1036
1037 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1038
1039 SAMPLE CODE
1040 @code
1041 #include <ITapiCall.h>
1042 #include <stdio.h>
1043 #include "TapiCommon.h"
1044
1045 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1046 void calljoin(unsigned int CallHandle1, unsigned int CallHandle2)
1047 {
1048         int ret_status ;
1049         TapiHandle *handle
1050         unsigned int CallHandle1;
1051         unsigned int CallHandle2;
1052         tapi_response_cb callback;
1053         void *user_data;
1054         ret_status= tel_join_call(handle, CallHandle1, CallHandle2, callback, user_data); ;
1055         if (ret_status == TAPI_API_SUCCESS)
1056                 printf("successful\n");
1057         else
1058                 printf("error=%d\n", ret_status);
1059 } //WAIT FOR EVENT HERE
1060
1061 //CALLBACK FUNCTION TO BE USED
1062 static void app_callback (TelTapiEvent_t *event)
1063 {
1064         //..
1065         switch (eventType) //REFER Call Setup TO GET eventType
1066         {
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 ");
1071                         break;
1072         }
1073         //..
1074 }
1075 @endcode
1076 @}
1077 @defgroup Use_Cases2_10 Call Split
1078 @ingroup Use_Cases2_CALL
1079 @{
1080
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.
1084
1085 Pre Conditions:
1086 @n Call should be in multiparty conference call.
1087
1088 Post Conditions:
1089 @n Split call will be the active call and the conference will be held call.
1090
1091 @code
1092  int tel_split_call(TapiHandle *handle, unsigned int CallHandle, tapi_response_cb callback, void *user_data);
1093 @endcode
1094
1095 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1096
1097 SAMPLE CODE
1098 @code
1099 #include <ITapiCall.h>
1100 #include <stdio.h>
1101 #include "TapiCommon.h"
1102
1103 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1104 void callsplit(unsigned int CallHandle)
1105 {
1106          int ret_status ;
1107         TapiHandle *handle;
1108         unsigned int CallHandle;
1109         tapi_response_cb callback;
1110         void *user_data;
1111         ret_status= tel_split_call(handle, CallHandle, callback, user_data);
1112         if (ret_status == TAPI_API_SUCCESS)
1113                 printf("successful\n");
1114         else
1115                 printf("error=%d\n", ret_status);
1116 }//WAIT FOR EVENT HERE
1117
1118 //CALLBACK FUNCTION TO BE USED
1119 static void app_callback (TelTapiEvent_t *event)
1120 {
1121         //..
1122         switch (eventType) //REFER Call Setup TO GET eventType
1123         {
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 ");
1128                         break;
1129         }
1130         //..
1131 }
1132 @endcode
1133 @}
1134 @defgroup Use_Cases2_11 Active Line
1135 @ingroup Use_Cases2_CALL
1136 @{
1137
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.
1141
1142 @code
1143 int tel_set_call_act_line(TapiHandle *handle, TelCallActiveLine_t active_line, tapi_response_cb callback, void *user_data);
1144 @endcode
1145
1146 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1147
1148 SAMPLE CODE
1149 @code
1150 #include <ITapiCall.h>
1151 #include <stdio.h>
1152 #include "TapiCommon.h"
1153
1154 //SET ACTIVE LINE
1155 void activeline()
1156 {
1157         int ret_status ;
1158         TapiHandle *handle;
1159         TelCallActiveLine_t active_line ;
1160         tapi_response_cb callback,;
1161         void *user_data;
1162
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");
1166         else
1167                 printf("error=%d\n", ret_status);
1168
1169         //GET ACTIVE LINE
1170         ret_status = tel_get_call_act_line(handle, callback, user_data);
1171         if (ret_status == TAPI_API_SUCCESS)
1172                 printf("successful\n");
1173         else
1174                 printf("error=%d\n", ret_status);
1175         //..
1176 }
1177
1178 //CALLBACK FUNCTION TO BE USED
1179 static void app_callback (TelTapiEvent_t *event)
1180 {
1181         //..
1182         switch (eventType) //REFER Call Setup TO GET eventType
1183         {
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:");
1187                         break;
1188
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");
1193                         break;
1194         }
1195         //..
1196 }
1197 @endcode
1198 @}
1199 @defgroup Use_Cases2_12  Call transfer
1200 @ingroup Use_Cases2_CALL
1201 @{
1202
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.
1205
1206 Pre Conditions:
1207 @n In order to call transfer, 2 calls should be present. One in the active state and the other in the Held state.
1208
1209 Post Conditions:
1210 @n When the request has been completed successfully, Call end indication will be sent to both the calls (active and held).
1211
1212 @code
1213 int tel_transfer_call(TapiHandle *handle, unsigned int CallHandle, tapi_response_cb callback, void *user_data);
1214 @endcode
1215
1216 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1217
1218 SAMPLE CODE:
1219 @code
1220 #include <ITapiCall.h>
1221 #include <stdio.h>
1222 #include "TapiCommon.h"
1223
1224 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1225 void calltransfer(unsigned int CallHandle)
1226 {
1227         int ret_status ;
1228         TapiHandle *handle;
1229         unsigned int pCallHandle;//active call
1230         tapi_response_cb callback;
1231         void *user_data;
1232         ret_status= tel_transfer_call (handle, pCallHandle, callback, user_data);
1233         if (ret_status == TAPI_API_SUCCESS)
1234                 printf("successful\n");
1235         else
1236                 printf("error=%d\n", ret_status);
1237 }//WAIT FOR EVENT HERE
1238
1239 //CALLBACK FUNCTION TO BE USED
1240 static void app_callback (TelTapiEvent_t *event)
1241 {
1242         //..
1243         switch (eventType) //REFER Call Setup TO GET eventType
1244         {
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. ");
1249                         break;
1250         }
1251         //..
1252 }
1253 @endcode
1254 @}
1255 @defgroup Use_Cases2_13 Get Call Status
1256 @ingroup Use_Cases2_CALL
1257 @{
1258
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.
1262
1263 @code
1264 int tel_get_call_status(TapiHandle *handle, int call_id, TelCallStatus_t *out );
1265 @endcode
1266
1267 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1268
1269 SAMPLE CODE
1270 @code
1271 #include <ITapiCall.h>
1272 #include <stdio.h>
1273 #include "TapiCommon.h"
1274
1275 void getcallstatus(unsigned int CallHandle)
1276 {
1277         int ret_status ;
1278         int call_id;
1279         TapiHandle *handle;
1280         TelCallStatus_t *out;
1281          ret_status= tel_get_call_status(handle, call_id, out);
1282         if (ret_status == TAPI_API_SUCCESS)
1283         {
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",
1287                                 callStatus.bMoCall,
1288                                 callStatus.CallType,
1289                                 callStatus.CallActiveState,
1290                                 callStatus.CallState,
1291                                 callStatus.bConferenceState);
1292         }
1293         else {
1294                 printf("error=%d\n", ret_status);
1295         }
1296 }
1297 @endcode
1298 @}
1299 @defgroup Use_Cases2_14  Get Call Duration
1300 @ingroup Use_Cases2_CALL
1301 @{
1302
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.
1306
1307 @code
1308  int tel_get_call_duration(TapiHandle *handle, unsigned int CallHandle, unsigned int * pDurationInSecs) ;
1309 @endcode
1310
1311 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1312
1313 SAMPLE CODE
1314 @code
1315 #include <ITapiCall.h>
1316 #include <stdio.h>
1317 #include "TapiCommon.h"
1318
1319 void getcallduration(unsigned int CallHandle)
1320 {
1321         int ret_status ;
1322         TapiHandle *handle
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)
1327         {
1328                 printf("successful\n");
1329                 printf("Call Duration : %d Seconds\n", duration);
1330         }
1331         else {
1332                 printf("error=%d\n", ret_status);
1333         }
1334 }
1335 @endcode
1336 @}
1337 @defgroup Use_Cases2_15 Get Call Conference List
1338 @ingroup Use_Cases2_CALL
1339 @{
1340
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.
1343
1344 Pre Conditions:
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.
1346
1347 @code
1348 int tel_get_call_conf_list(TapiHandle *handle, unsigned int CallHandle, unsigned int *pCallList, int *pNoOfCalls);
1349 @endcode
1350
1351 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1352
1353 SAMPLE CODE
1354 @code
1355 #include <ITapiCall.h>
1356 #include <stdio.h>
1357 #include "TapiCommon.h"
1358
1359 void getconferencelist(unsigned int CallHandle)
1360 {
1361         int ret_status ;
1362         TapiHandle *handle;
1363         unsigned int CallHandle;
1364         unsigned int callList[5];
1365         tapi_response_cb callback;
1366         int noOfCalls;
1367         void *user_data;
1368          ret_status= tel_get_call_conf_list(handle, CallHandle, callList, &noOfCalls, callback, user_data);
1369         if (ret_status == TAPI_API_SUCCESS)
1370         {
1371                 printf("successful\n");
1372                 printf("\n No.of Calls %d, \n", noOfCalls);
1373                 for (i = 0; i < noOfCalls; i++)
1374                 {
1375                         printf("\n Call Handle in conference calls %d \n", callList[i]);
1376                 }
1377         }
1378         else {
1379                 printf("error=%d\n", ret_status);
1380         }
1381 }
1382 @endcode
1383 @}
1384 @defgroup Use_Cases2_16 Voice Privacy Mode
1385 @ingroup Use_Cases2_CALL
1386 @{
1387
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 .
1390
1391 @code
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);
1394 @endcode
1395
1396 This API is restricted for direct use.  Use the Voice call engine API instead.
1397
1398 SAMPLE CODE
1399 @code
1400 #include <ITapiCall.h>
1401 #include <stdio.h>
1402 #include "TapiCommon.h"
1403
1404 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1405
1406 //SetVoicePrivacyMode
1407 void setvoiceprivacymode()
1408 {
1409         TapiHandle *handle;
1410         int ret_status = -1;
1411         tapi_response_cb callback;
1412         void *user_data;
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");
1418         else
1419                 printf("error:%d\n", ret_status);
1420 }
1421 //WAIT FOR EVENT HERE
1422
1423 //CALLBACK FUNCTION TO BE USED
1424
1425 bool call_app_callback (TelTapiEvent_t *Event)
1426 {
1427         int ret = -1;
1428         int eventClass = Event->EventClass;
1429         int eventType = Event->EventType;
1430         int RequestId = Event->RequestId;
1431         int Status = Event->Status;
1432
1433         if (eventClass == TAPI_EVENT_CLASS_CALL_VOICE)
1434         {
1435                 switch (eventType) {
1436                         case TAPI_EVENT_CALL_SET_PRIVACYMODE_CNF:
1437                                 if (RequestId != reqId) {
1438                                         printf("Invalid RequestID received %d \n", reqId);
1439                                         return false;
1440                                 }
1441
1442                                 if (Status != TAPI_CAUSE_SUCCESS) {
1443                                         printf("Invalid Status value received");
1444                                         return false;
1445                                 }
1446                                 break;
1447                 }
1448         }
1449 }
1450
1451 //GetVoicePrivacyMode
1452 void getprivacymode()
1453 {
1454          TapiHandle *handle;
1455         int ret_status = -1;
1456         tapi_response_cb callback;
1457         void *user_data;
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");
1463         else
1464                 printf("error:%d\n", ret_status);
1465 }
1466
1467 //WAIT FOR EVENT HERE
1468
1469 //CALLBACK FUNCTION TO BE USED
1470
1471 bool call_app_callback (TelTapiEvent_t *Event)
1472 {
1473         int ret = -1;
1474         int eventClass = Event->EventClass;
1475         int eventType = Event->EventType;
1476         int RequestId = Event->RequestId;
1477         int Status = Event->Status;
1478
1479         if (eventClass == TAPI_EVENT_CLASS_CALL_VOICE)
1480         {
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)
1486                                 {
1487                                         printf("Invalid Status value received");
1488                                         return false;
1489                                 }
1490                                 break;
1491                 }
1492         }
1493 }
1494 @endcode
1495 @}
1496 @defgroup Use_Cases2_17 Call FlashInformation
1497 @ingroup Use_Cases2_CALL
1498 @{
1499
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.
1502
1503 @code
1504 int tel_exe_call_flash_info(TapiHandle *handle, const char *pDialNumber, tapi_response_cb callback, void *user_data);
1505 @endcode
1506
1507 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1508
1509 SAMPLE CODE
1510 @code
1511 #include <ITapiCall.h>
1512 #include <stdio.h>
1513 #include "TapiCommon.h"
1514
1515 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1516 //CallFlashInfo
1517 void callflashinfo()
1518 {
1519         int ret_status = -1;
1520         int api_err;
1521         tapi_response_cb callback;
1522         void *user_data;
1523         const char *pDialNumber = "9999900000";
1524
1525         ret_status = tel_exe_call_flash_info(handle, pDialNumber, callback, user_data);
1526         if (ret_status == TAPI_API_SUCCESS)
1527                 printf("Successful\n");
1528         else
1529                 printf("error:%d\n", ret_status);
1530 }
1531 //WAIT FOR EVENT HERE
1532
1533 //CALLBACK FUNCTION TO BE USED
1534 bool call_app_callback(TelTapiEvent_t *Event)
1535 {
1536         int ret = -1;
1537         int eventClass = Event->EventClass;
1538         int eventType = Event->EventType;
1539         int RequestId = Event->RequestId;
1540         int Status = Event->Status;
1541
1542         if (eventClass == TAPI_EVENT_CLASS_CALL_VOICE)
1543         {
1544                 switch (eventType)
1545                 {
1546                         case TAPI_EVENT_CALL_FLASHINFO_CNF:
1547                                 if (RequestId != reqId)
1548                                 {
1549                                         printf("Invalid RequestID received %d \n", reqId);
1550                                         return false;
1551                                 }
1552
1553                                 if (Status != TAPI_CAUSE_SUCCESS)
1554                                 {
1555                                         printf("Invalid Status value received");
1556                                         return false;
1557                                 }
1558                                 printf("\n Received TAPI_EVENT_CALL_FLASHINFO_CNF \n");
1559                                 break;
1560
1561                 }
1562         }
1563         return true;
1564 }
1565 @endcode
1566 @}
1567 @defgroup Use_Cases2_18 Getting Call Time
1568 @ingroup Use_Cases2_CALL
1569 @{
1570
1571                 <h3 class="pg">Getting Call Time</h3>
1572 This API is used to query information about a call time and call count.
1573
1574 @code
1575 int tel_get_call_time(TapiHandle *handle, unsigned short req_mask, tapi_response_cb callback, void *user_data);
1576 @endcode
1577
1578 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1579
1580 SAMPLE CODE
1581 @code
1582 #include <ITapiCall.h>
1583 #include <stdio.h>
1584 #include "TapiCommon.h"
1585
1586 void getcalltime()
1587 {
1588           int ret_status = -1;
1589          TapiHandle *handle;
1590          tapi_response_cb callback;
1591          void *user_data;
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;
1598          mask_type << 8;
1599          mask_type = mask_byte2;
1600
1601          ret_status = tel_get_call_time(handle, mask_type, callback, user_data);
1602         if (ret_status == TAPI_API_SUCCESS)
1603                 printf("Successful\n");
1604         else
1605                 printf("error:%d\n", ret_status);
1606 }
1607 //WAIT FOR EVENT HERE
1608
1609 bool call_app_callback(TelTapiEvent_t *Event)
1610 {
1611         int ret = -1;
1612         int eventClass = Event->EventClass;
1613         int eventType = Event->EventType;
1614         int RequestId = Event->RequestId;
1615         int Status = Event->Status;
1616
1617         if (eventClass == TAPI_EVENT_CLASS_CALL_VOICE)
1618         {
1619                 switch (eventType)
1620                 {
1621                         case TAPI_EVENT_CALL_SET_PRIVACYMODE_CNF:
1622                                 if (RequestId != reqId)
1623                                 {
1624                                         printf("Invalid RequestID received %d \n", reqId);
1625                                         return false;
1626                                 }
1627
1628                                 if (Status != TAPI_CAUSE_SUCCESS)
1629                                 {
1630                                         printf("Invalid Status value received");
1631                                         return false;
1632                                 }
1633                                 break;
1634                 }
1635         }
1636 }
1637 @endcode
1638 @}
1639
1640 <h2 class="pg">SUPPLEMENTARY SERVICE </h2>
1641 @defgroup Use_Cases3_1 Event register and deregister
1642 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
1643 @{
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.
1646
1647 SAMPLE CODE
1648 @code
1649 // REGISTER EVENT
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;
1653 void *user_data;
1654 int ret;
1655
1656 handle = tel_init();
1657 if (!handle)
1658 {
1659         TEST_DEBUG("tel_init Failed");
1660 }
1661
1662 ret = tel_register_noti_event(handle,noti_id,callback,userdata);
1663 if(ret != TAPI_API_SUCCESS)
1664 {
1665         TEST_DEBUG("SS Event registration failed");
1666 }
1667 else
1668 {
1669         printf("SS Event registration is Done");
1670 }
1671
1672 tel_register_app_name("com.samsung.appname");
1673
1674 // DEREGISTER EVENT
1675 ret = tel_deregister_event(handle,noti_id);
1676 if (ret != TAPI_API_SUCCESS)
1677 {
1678         printf("Event Unregisteration Fail\n");
1679 }
1680 @endcode
1681 @}
1682 @defgroup Use_Cases3_2 Call Barring
1683 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
1684 @{
1685
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 .
1690
1691 @code
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);
1695 @endcode
1696
1697 SAMPLE CODE FOR SET CALL BARRING
1698 @code
1699 #include <stdio.h>
1700 #include <TapiCommon.h>
1701 #include <ITapiSS.h>
1702
1703 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1704 void callbarring()
1705 {
1706         int ret_status = -1;
1707         TelSsCallBarringInfo_t BarringInfo;
1708         char *bar_pwd = "0000";
1709         Tapi_handle handle;
1710         tapi_response_cb callback;
1711         void *user_data;
1712
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);
1717
1718         ret_status = tel_set_ss_barring (handle,&BarringInfo,callback,user_data);
1719         if (ret_status == TAPI_API_SUCCESS) {
1720                 printf("successful\n");
1721         }
1722         else {
1723                 printf("Error  = %d \n", ret_status);
1724         }
1725 }
1726 //WAIT FOR THE EVENT  HERE
1727
1728 static void app_callback (TapiHandle *handle, int result, void *data, void *user_data)
1729 {
1730         TelSsBarringResp_t *resp = data;
1731         int i = 0;
1732
1733         msg("");
1734         msgb("tel_set_ss_barring() or tel_get_ss_barring_status() response receive");
1735         msg(" - result = 0x%x", result);
1736
1737         if (!resp)
1738                 return;
1739
1740         msg(" - record_num = %d", resp->record_num);
1741
1742         for (i = 0; i < resp->record_num; i++) {
1743                 msg(" - [%d] Class=%d, Status=%d, Flavour=%d",
1744                                 i,
1745                                 resp->record[i].Class,
1746                                 resp->record[i].Status,
1747                                 resp->record[i].Flavour);
1748         }
1749 }
1750 @endcode
1751
1752 SAMPLE CODE FOR GET BARRING STATUS
1753 @code
1754 #include <stdio.h>
1755 #include <TapiCommon.h>
1756 #include <ITapiSS.h>
1757
1758 void callbarringstatus()
1759 {
1760         //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1761         int ret_status;
1762         TelSsCallBarType_t BarType = TAPI_CALL_BARRING_ALL_OUTGOING_INTERN_CALL;
1763         TelSsCallType_t CallType = TAPI_CALL_TYPE_VOICE_EV;
1764         Tapi_handle handle;
1765         tapi_response_cb callback;
1766         void *user_data;
1767
1768         ret_status = tel_get_ss_barring_status (handle,BarType, CallType,callback,user_data);
1769         if (ret_status == TAPI_API_SUCCESS)
1770         {
1771                 printf("successful\n");
1772         }
1773         else
1774         {
1775                 printf("Error  = %d \n", ret_status);
1776         }
1777 }
1778 //WAIT FOR THE EVENT  HERE
1779
1780 static void app_callback (TapiHandle *handle, int result, void *data, void *user_data)
1781 {
1782         TelSsBarringResp_t *resp = data;
1783         int i = 0;
1784
1785         msg("");
1786         msgb("tel_set_ss_barring() or tel_get_ss_barring_status() response receive");
1787         msg(" - result = 0x%x", result);
1788
1789         if (!resp)
1790                 return;
1791
1792         msg(" - record_num = %d", resp->record_num);
1793
1794         for (i = 0; i < resp->record_num; i++) {
1795                 msg(" - [%d] Class=%d, Status=%d, Flavour=%d",
1796                                 i,
1797                                 resp->record[i].Class,
1798                                 resp->record[i].Status,
1799                                 resp->record[i].Flavour);
1800         }
1801 }
1802 @endcode
1803
1804 SAMPLE CODE FOR CHANGING BARRING PASSWORD
1805 @code
1806 #include <stdio.h>
1807 #include <TapiCommon.h>
1808 #include <ITapiSS.h>
1809
1810 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1811 void changebarpwd()
1812 {
1813         int ret_status;
1814         Tapi_handle handle;
1815         tapi_response_cb callback;
1816         void *user_data;
1817
1818         ret_status = tel_change_ss_barring_password ("0000", "0000", "0000", user_data);
1819         if (ret_status == TAPI_API_SUCCESS)
1820         {
1821                 printf("successful\n");
1822         }
1823         else
1824         {
1825                 printf("Error  = %d \n", ret_status);
1826         }
1827 }
1828
1829 //WAIT FOR THE EVENT  HERE
1830
1831 static void app_callback(TapiHandle *handle, int result, void *data, void *user_data)
1832 {
1833         msg("");
1834         msgb("tel_change_ss_barring_password() response receive");
1835         msg(" - result = 0x%x", result);
1836 }
1837 @endcode
1838 @}
1839 @defgroup Use_Cases3_3 Call Forward
1840 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
1841 @{
1842
1843
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.
1847
1848 @code
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);
1851 @endcode
1852
1853 SAMPLE CODE FOR SET CALL FORWARD
1854 @code
1855 #include <stdio.h>
1856 #include <TapiCommon.h>
1857 #include <ITapiSS.h>
1858
1859 //SUBSCRIBE FOR EVENTS AS MENTIONED INEvent Register and Deregister
1860 void callfwd()
1861 {
1862         int ret_status = 0;
1863         TelSsForwardInfo_t pForwardInfo;
1864         Tapi_handle handle;
1865         tapi_response_cb callback;
1866         void *user_data;
1867
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;
1872
1873         int len;
1874         char *cf_number = "9986529874"; //number to which calles need to be forwarded.
1875
1876         len = strlen(cf_number);
1877         printf("Length of CF number :%d \n", len);
1878         memcpy(&(pForwardInfo.szPhoneNumber), cf_number, len);
1879
1880         ret_status = tel_set_ss_forward(handle,&pForwardInfo,callback,user_data);
1881         if (ret_status == TAPI_API_SUCCESS)
1882         {
1883                 printf("successful\n");
1884         }
1885         else
1886         {
1887                 printf("Error  = %d \n", ret_status);
1888         }
1889 }
1890 //WAIT FOR THE EVENT  HERE
1891
1892 static void app_callback(TapiHandle *handle, int result, void *data, void *user_data)
1893 {
1894         TelSsForwardResp_t *resp = data;
1895         int i;
1896
1897         msg("");
1898         msgb("tel_set_ss_forward() or tel_get_ss_forward_status() response receive");
1899         msg(" - result = 0x%x", result);
1900
1901         if (!resp)
1902                 return;
1903
1904         msg(" - record_num = %d", resp->record_num);
1905
1906         for (i = 0; i < resp->record_num; i++) {
1907                 msg(" - [%d] Class=%d, Status=%d, ForwardCondition=%d, NoReplyWaitTime=%d, bCallForwardingNumberPresend=%d, szCallForwardingNumber=[%s]",
1908                                 i,
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);
1915         }
1916 }
1917 @endcode
1918
1919 SAMPLE CODE FOR GET CALL FORWARD STATUS
1920 @code
1921 #include <stdio.h>
1922 #include <TapiCommon.h>
1923 #include <ITapiSS.h>
1924
1925 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1926 void callfwdstatus()
1927 {
1928         int ret_status = 0;
1929         TelSsForwardType_t Type = TAPI_CS_FORWARD_TYPE_VOICE_EV;
1930         TelSsForwardWhen_t Condition = TAPI_SS_FORWARD_WHEN_UNCONDITIONAL_EV;
1931         Tapi_handle handle;
1932         tapi_response_cb callback;
1933         void *user_data;
1934
1935         ret_status = tel_get_ss_forward_status(handle,Type,Condition,callback,user_data);
1936         if (ret_status == TAPI_API_SUCCESS)
1937         {
1938                 printf("successful\n");
1939         }
1940         else
1941         {
1942                 printf("Error  = %d \n", ret_status);
1943         }
1944 }
1945
1946 //WAIT FOR THE EVENT  HERE
1947
1948 static void app_callback(TapiHandle *handle, int result, void *data, void *user_data)
1949 {
1950         TelSsForwardResp_t *resp = data;
1951         int i;
1952
1953         msg("");
1954         msgb("tel_set_ss_forward() or tel_get_ss_forward_status() response receive");
1955         msg(" - result = 0x%x", result);
1956
1957         if (!resp)
1958                 return;
1959
1960         msg(" - record_num = %d", resp->record_num);
1961
1962         for (i = 0; i < resp->record_num; i++) {
1963                 msg(" - [%d] Class=%d, Status=%d, ForwardCondition=%d, NoReplyWaitTime=%d, bCallForwardingNumberPresend=%d, szCallForwardingNumber=[%s]",
1964                                 i,
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);
1971         }
1972 }
1973 //...
1974 @endcode
1975 @}
1976 @defgroup Use_Cases3_4 Call Waiting
1977 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
1978 @{
1979
1980
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.
1983
1984 @code
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);
1987 @endcode
1988
1989 SAMPLE CODE FOR SET CALL WAITING
1990 @code
1991 #include <stdio.h>
1992 #include <TapiCommon.h>
1993 #include <ITapiSS.h>
1994
1995 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1996 void callwaiting()
1997 {
1998         int ret_status;
1999         TelSsWaitingInfo_t waitInfo;
2000         Tapi_handle handle;
2001         tapi_response_cb callback;
2002         void *user_data;
2003
2004         waitInfo.Mode = TAPI_SS_CW_ACTIVATE;
2005         waitInfo.CallType = TAPI_CALL_TYPE_VOICE_EV;
2006
2007         ret_status = tel_set_ss_waiting (handle,&waitInfo,callback,user_data);
2008         if (ret_status == TAPI_API_SUCCESS)
2009         {
2010                 printf("successful\n");
2011         }
2012         else
2013         {
2014                 printf("Error  = %d \n", ret_status);
2015         }
2016 }
2017 //WAIT FOR THE EVENT  HERE
2018
2019 //CALLBACK FUNCTION TO BE USED
2020 static void app_callback(TapiHandle *handle, int result, void *data, void *user_data)
2021 {
2022         TelSsWaitingResp_t *resp = data;
2023         int i;
2024
2025         msg("");
2026         msgb("tel_set_ss_waiting() or tel_get_ss_waiting_status() response receive");
2027         msg(" - result = 0x%x", result);
2028
2029         if (!resp)
2030                 return;
2031
2032         msg(" - record_num = %d", resp->record_num);
2033
2034         for (i = 0; i < resp->record_num; i++) {
2035                 msg(" - [%d] Class=%d, Status=%d",
2036                                 i,
2037                                 resp->record[i].Class,
2038                                 resp->record[i].Status);
2039         }
2040 }
2041 @endcode
2042
2043 SAMPLE CODE FOR GET CALL WAITING STATUS
2044 @code
2045 #include <stdio.h>
2046 #include <TapiCommon.h>
2047 #include <ITapiSS.h>
2048
2049 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2050 void callwaiting()
2051 {
2052         int ret_status;
2053         TelSsCallType_t CallType = TAPI_CALL_TYPE_VOICE_EV;
2054         Tapi_handle handle;
2055         tapi_response_cb callback;
2056         void *user_data;
2057
2058         ret_status = tel_get_ss_waiting_status(handle,CallType,callback,user_data);
2059         if (ret_status == TAPI_API_SUCCESS)
2060         {
2061                 printf("successful\n");
2062         }
2063         else
2064         {
2065                 printf("Error  = %d \n", ret_status);
2066         }
2067 }
2068 //WAIT FOR THE EVENT  HERE
2069
2070 //CALLBACK FUNCTION TO BE USED
2071 static void app_callback(TapiHandle *handle, int result, void *data, void *user_data)
2072 {
2073         TelSsWaitingResp_t *resp = data;
2074         int i;
2075
2076         msg("");
2077         msgb("tel_set_ss_waiting() or tel_get_ss_waiting_status() response receive");
2078         msg(" - result = 0x%x", result);
2079
2080         if (!resp)
2081                 return;
2082
2083         msg(" - record_num = %d", resp->record_num);
2084
2085         for (i = 0; i < resp->record_num; i++) {
2086                 msg(" - [%d] Class=%d, Status=%d",
2087                                 i,
2088                                 resp->record[i].Class,
2089                                 resp->record[i].Status);
2090         }
2091 }
2092 @endcode
2093 @}
2094 @defgroup Use_Cases3_5 CLI Service Status
2095 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2096 @{
2097
2098
2099                 <h3 class="pg">CLI Service Status</h3>
2100 <strong>[Note] Telephony Emulator does not support this feature.</strong>
2101
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.
2103
2104 @code
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);
2107 @endcode
2108
2109 SAMPLE CODE FOR SET CLI STATUS
2110 @code
2111 #include <stdio.h>
2112 #include <TapiCommon.h>
2113 #include <ITapiSS.h>
2114
2115 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2116 void cliservicestatus()
2117 {
2118         int ret_status;
2119         TelSsCliType_t type = TAPI_SS_CLI_CLIP;;
2120         TelSsCliStatus_t status;
2121         Tapi_handle handle;
2122         tapi_response_cb callback;
2123         void *user_data;
2124
2125         ret_status = tel_set_ss_cli_status(handle,type,status,callback,user_data);
2126         if (ret_status == TAPI_API_SUCCESS)
2127         {
2128                 printf("successful\n");
2129         }
2130         else
2131         {
2132                 printf("Error  = %d \n", ret_status);
2133         }
2134 }
2135 //WAIT FOR THE EVENT  HERE
2136
2137 //CALLBACK FUNCTION TO BE USED
2138 static void app_callback(TapiHandle *handle, int result, void *data, void *user_data)
2139 {
2140         TelSsCliResp_t *resp = data;
2141
2142         msg("");
2143         msgb("tel_get_ss_cli_status() response receive");
2144         msg(" - result = 0x%x", result);
2145
2146         if (!resp)
2147                 return;
2148
2149         msg(" - type = %d", resp->Type);
2150         msg(" - status = %d", resp->Status);
2151 }
2152 @endcode
2153
2154 SAMPLE CODE FOR GET CLI STATUS
2155 @code
2156 #include <stdio.h>
2157 #include <TapiCommon.h
2158 #include <ITapiSS.h>
2159
2160 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2161 void cliservicestatus()
2162 {
2163         int ret_status;
2164         TelSsCliType_t CliType = TAPI_SS_CLI_CLIP;
2165         Tapi_handle handle;
2166         tapi_response_cb callback;
2167         void *user_data;
2168
2169         ret_status = tel_get_ss_cli_status (handle,CliType,callback,user_data);
2170         if (ret_status == TAPI_API_SUCCESS)
2171         {
2172                 printf("successful\n");
2173         }
2174         else
2175         {
2176                 printf("Error  = %d \n", ret_status);
2177         }
2178 }
2179 //WAIT FOR THE EVENT  HERE
2180
2181 //CALLBACK FUNCTION TO BE USED
2182 static void app_callback(TapiHandle *handle, int result, void *data, void *user_data)
2183 {
2184         TelSsCliResp_t *resp = data;
2185
2186         msg("");
2187         msgb("tel_get_ss_cli_status() response receive");
2188         msg(" - result = 0x%x", result);
2189
2190         if (!resp)
2191                 return;
2192
2193         msg(" - type = %d", resp->Type);
2194         msg(" - status = %d", resp->Status);
2195 }
2196 @endcode
2197 @}
2198 @defgroup Use_Cases3_6 Send USSD Request
2199 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2200 @{
2201
2202
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.
2205
2206 Pre Conditions:
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)
2208
2209 @code
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);
2211 @endcode
2212
2213 SAMPLE CODE FOR SEND USSD REQUEST
2214 @code
2215 #include <stdio.h>
2216 #include <TapiCommon.h>
2217 #include <ITapiSS.h>
2218
2219 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2220 void sendussdreq()
2221 {
2222         char ussdString[TAPI_SS_USSD_DATA_SIZE_MAX];
2223         int ret_status;
2224
2225         memset(ussdString, 0, TAPI_SS_USSD_DATA_SIZE_MAX);
2226         strcpy(ussdString, "*124#");
2227         Tapi_handle handle;
2228         tapi_response_cb callback;
2229         void *user_data;
2230
2231         ret_status = tel_send_ss_ussd_request (handle,ussdString,callback,user_data);
2232         if (ret_status == TAPI_API_SUCCESS)
2233         {
2234                 printf("successful\n");
2235         }
2236         else
2237         {
2238                 printf("Error  = %d \n", ret_status);
2239 }
2240 //WAIT FOR THE EVENT  HERE
2241
2242 static void app_callback(TapiHandle *handle, int result, void *data, void *user_data)
2243 {
2244         TelSsUssdResp_t *resp = data;
2245
2246         msg("");
2247         msgb("tel_send_ss_ussd_request() response receive");
2248         msg(" - result = 0x%x", result);
2249
2250         if (!resp)
2251                 return;
2252
2253         msg(" - type = %d", resp->Type);
2254         msg(" - status = %d", resp->Status);
2255         msg(" - length = %d", resp->Length);
2256         msg(" - string = [%s]", resp->szString);
2257 }
2258 @endcode
2259 @}
2260 @defgroup Use_Cases3_7 AOC Info
2261 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2262 @{
2263
2264
2265                 <h3 class="pg">AOC Info</h3>
2266 These APIs set and read AOC parameter values on the SIM.
2267
2268 Pre Conditions:
2269 @n Advice of charge feature is dependent on the SIM for setting or reading aoc parameters. Setting of AOC requires PIN2 Verification
2270
2271 @code
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);
2274 {
2275 @endcode
2276
2277 SAMPLE CODE FOR SET AOC INFO
2278 @code
2279 #include <stdio.h>
2280 #include <TapiCommon.h>
2281 #include <ITapiSS.h>
2282
2283 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2284
2285 //Complete PIN2verification process as mentioned in SIM
2286 void aocinforeq()
2287 {
2288         //set aoc
2289         printf(" Resetting Total Cost  \n");
2290
2291         TelCallAocInfo_t *pAocSetInfo;
2292         int request_id;
2293         int ret_status = 0;
2294         Tapi_handle handle;
2295         tapi_response_cb callback;
2296         void *user_data;
2297
2298         pAocSetInfo = (TelCallAocInfo_t *)calloc(1, sizeof(TelCallAocInfo_t));
2299         pAocSetInfo->AocType = TAPI_SS_AOC_TYPE_RESET;
2300
2301         ret = tel_set_ss_aoc_info(handle,pAocSetInfo,callback,user_data);
2302         if (ret_status == TAPI_API_SUCCESS)
2303         {
2304                 printf("successful\n");
2305         }
2306         else
2307         {
2308                 printf("Error  = %d \n", ret_status);
2309         }
2310 }
2311
2312 //WAIT FOR THE EVENT  HERE
2313 static void app_callback (TelTapiEvent_t *event)
2314 {
2315         int eventClass;
2316         int eventType;
2317         int requestId;
2318         int status;
2319         void* EventData = NULL;
2320         unsigned int temp_handle = -1;
2321
2322         //
2323         eventClass = event->EventClass;
2324         eventType = event->EventType;
2325         requestId = event->RequestId;
2326         status = event->Status;
2327         EventData = event->pData;
2328
2329         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
2330
2331         if (status != 0)
2332         {
2333                 //TEST_DEBUG("******This is nonzero status. ******\n");
2334                 return;
2335         }
2336         switch (eventType)
2337         {
2338                 case TAPI_EVENT_SS_SET_AOC_CNF:
2339                         printf("Received Event : SS -- TAPI_EVENT_SS_SET_AOC_CNF\n");
2340                         break;
2341         }//...
2342 }
2343 @endcode
2344
2345 SAMPLE CODE FOR GET AOC INFO
2346 @code
2347 #include <stdio.h>
2348 #include <TapiCommon.h
2349 #include <ITapiSS.h>
2350
2351 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2352
2353 void aocinforeq()
2354 {
2355         TelSsAocType_t AocType = TAPI_SS_AOC_TYPE_ACM;
2356         Tapi_handle handle;
2357         tapi_response_cb callback;
2358         void *user_data;
2359
2360         ret_status = tel_get_ss_aoc_info(handle,AocType,callback,user_data);
2361         if (ret_status == TAPI_API_SUCCESS)
2362         {
2363                 printf("successful\n");
2364         }
2365         else
2366         {
2367                 printf("Error  = %d \n", ret_status);
2368         }
2369 }
2370 //WAIT FOR THE EVENT  HERE
2371
2372 static void app_callback (TelTapiEvent_t *event)
2373 {
2374         int eventClass;
2375         int eventType;
2376         int requestId;
2377         int status;
2378         void* EventData = NULL;
2379         unsigned int temp_handle = -1;
2380
2381         eventClass = event->EventClass;
2382         eventType = event->EventType;
2383         requestId = event->RequestId;
2384         status = event->Status;
2385         EventData = event->pData;
2386
2387         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
2388
2389         if (status != 0)
2390         {
2391                 //TEST_DEBUG("******This is nonzero status. ******\n");
2392                 return;
2393         }
2394
2395         switch (eventType)
2396         {
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);
2402                         break;
2403         }
2404
2405 }//...
2406 @endcode
2407 @}
2408
2409         <h2 class="pg">SMS</h2>
2410
2411 @defgroup Use_Cases4_1 Event register and deregister
2412 @ingroup Use_Cases4_SMS
2413 @{
2414
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.
2418
2419 Notification Events are as follows.
2420 @code
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
2427 @endcode
2428
2429 SAMPLE CODE
2430 @code
2431 // REGISTER EVENT
2432 TapiHandle *handle;
2433 char *noti_id = TAPI_NOTI_SMS_INCOM_MSG;
2434 tapi_response_cb callback;
2435 void* user_data;
2436 int api_err;
2437
2438 handle = tel_init();
2439 if (handle)
2440 {
2441         TEST_DEBUG("tel_init Failed");
2442 }
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);
2445
2446 // DEREGISTER EVENT
2447 api_err = tel_deregister_noti_event(handle, noti_id);
2448 if (handle)
2449 {
2450         printf("Event Unregistration Fail\n");
2451 }
2452
2453 // SMS notification callback function
2454 void notification_callback(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
2455 {
2456         printf(" app _callback is called \n");
2457
2458         switch (noti_id)
2459         {
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)
2466                         break;
2467
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]
2473                         break;
2474
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)
2480                         break;
2481
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
2487                         break;
2488
2489                 case TAPI_NOTI_SMS_MEMORY_STATUS:
2490                         int *status = NULL;
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");
2497                         else
2498                                 printf("Unknown Type\n");
2499                         break;
2500
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");
2507                         else
2508                                 printf("Unknown Type\n");
2509                         break;
2510         }
2511         return;
2512 }
2513 @endcode
2514 @}
2515 @defgroup Use_Cases4_2 Send SMS
2516 @ingroup Use_Cases4_SMS
2517 @{
2518
2519
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.
2524
2525 @code
2526 int tel_send_sms(TapiHandle *handle, const TelSmsDatapackageInfo_t *pDataPackage, int bMoreMsgToSend, tapi_response_cb callback, void* user_data)
2527 @endcode
2528
2529 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
2530
2531 SAMPLE CODE
2532 @code
2533 #include <stdio.h>
2534 #include <stdlib.h>
2535 #include <TapiCommon.h>
2536 #include <ITapiNetText.h>
2537
2538 void send_sms()
2539 {
2540         //Obtain Tapi Handle as mentioned in Event Register and Deregister
2541         TelSmsDatapackageInfo_t *pDataPackage;
2542         int ret_status = TAPI_API_SUCCESS;
2543         TapiHandle *handle;
2544         tapi_response_cb callback;
2545         void* user_data;
2546
2547
2548         pDataPackage = (TelSmsDatapackageInfo_t*) malloc(sizeof(TelSmsDatapackageInfo_t));
2549
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.
2554
2555         ret_status = tel_send_sms(handle, pDataPackage, bMoreMsgToSend, on_resp_send_sms, user_data);
2556         if  (ret_status == TAPI_API_SUCCESS)
2557         {
2558                 printf("successful\n");
2559         }
2560         else
2561         {
2562                 printf("error = %d\n", ret_status);
2563         }
2564         //WAIT FOR THE EVENT  HERE
2565 }
2566
2567 static void on_resp_send_sms(TapiHandle *handle, int result, void *data, void *user_data)
2568 {
2569         printf("%d", result);
2570         if (result != 0)
2571         {
2572                 //TEST_DEBUG("******This is nonzero status. ******\n");
2573                 return;
2574         }
2575 }@endcode
2576 @}
2577 @defgroup Use_Cases4_3 Read SMS
2578 @ingroup Use_Cases4_SMS
2579 @{
2580
2581
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.
2584
2585 @code
2586 int tel_read_sms_in_sim(TapiHandle *handle, int index, tapi_response_cb callback, void* user_data);
2587 @endcode
2588
2589 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
2590
2591 SAMPLE CODE
2592 @code
2593 #include <stdio.h>
2594 #include <stdlib.h>
2595 #include <TapiCommon.h>
2596 #include <ITapiNetText.h>
2597
2598 void read_sms()
2599 {
2600         //Obtain Tapi Handle as mentioned in Event Register and Deregister
2601         TapiHandle *handle;
2602         int selectedNo;
2603         int ret;
2604         char buf[100];
2605         int returnStatus = 0;
2606
2607         memset (buf, 0, sizeof (buf));
2608
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)
2612 }
2613
2614 static void on_resp_read_msg(TapiHandle *handle, int result, void *data, void *user_data)
2615 {
2616         TelSmsData_t * sim_data;
2617         int scaAddr_len = 0;
2618         char * pTPDU;
2619         int tpdu_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;
2623         int position;
2624
2625         sim_data = (TelSmsData_t *) data;
2626
2627         //find msg_status from sim data
2628
2629         position = 0;
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
2634
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;
2638
2639         if (scaAddr_len % 2)
2640                 position += scaAddr_len / 2 + 1;
2641         else
2642                 position += scaAddr_len / 2;
2643
2644         if (sca_ton == SMS_TON_INTERNATIONAL) {
2645                 scaAddr[0] = '+';
2646                 memcpy (&scaAddr[1], diallingNum, scaAddr_len);
2647         }
2648         else {
2649                 memcpy (scaAddr, diallingNum, scaAddr_len);
2650         }
2651
2652         tpdu_len = sim_data->SmsData.MsgLength;
2653
2654         printf("SCA Number : %s tpdu_len is %d", scaAddr, tpdu_len);
2655
2656         pTPDU = malloc (sizeof(unsigned char) * tpdu_len);
2657         if (!pTPDU)
2658                 return;
2659
2660         printf("bfor memcopy position is %d", position);
2661         memcpy (pTPDU, & (sim_data->SmsData.szData[0]), tpdu_len);
2662         printf("after memcpy");
2663
2664         DecodeSmsDeliverTpdu (tpdu_len, pTPDU);
2665 }
2666 //...
2667 @endcode
2668 @}
2669 @defgroup Use_Cases4_4 Write Sms
2670 @ingroup Use_Cases4_SMS
2671 @{
2672
2673
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.
2678
2679 @code
2680 int tel_write_sms_in_sim(TapiHandle *handle, const TelSmsData_t *pWriteData, tapi_response_cb callback, void* user_data);@endcode
2681
2682 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
2683
2684 SAMPLE CODE
2685 @code
2686 #include <stdio.h>
2687 #include <stdlib.h>
2688 #include <TapiCommon.h>
2689 #include <ITapiNetText.h>
2690
2691 void write_sms()
2692 {
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;
2697         void* user_data;
2698
2699         TelSmsData_t *pWriteData;
2700         char *msg = "This is an Test SMS";
2701         char *SCA = "821091";
2702
2703         pWriteData =(TelSmsData_t *)malloc(sizeof(TelSmsData_t));
2704
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;
2709
2710         ret_status = tel_write_sms_in_sim(handle, pWriteData, on_resp_write_sms, user_data);
2711         if (ret_status == TAPI_API_SUCCESS)
2712         {
2713                 printf("successful\n");
2714         }
2715         else
2716         {
2717                 printf("error = %d\n", ret_status);
2718         }
2719         //WAIT FOR EVENT HERE
2720 }
2721 static void on_resp_write_sms(TapiHandle *handle, int result, void *data, void *user_data)
2722 {
2723         int *index = data;
2724
2725         printf("tel_write_sms_in_sim() response receive");
2726         printf(" - result = 0x%x", result);
2727         printf(" - index = %d", *index);
2728 }
2729 @endcode
2730 @}
2731 @defgroup Use_Cases4_5 Delete Sms
2732 @ingroup Use_Cases4_SMS
2733 @{
2734
2735
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.
2738
2739 @code
2740 int tel_delete_sms_in_sim(TapiHandle *handle, int index, tapi_response_cb callback, void* user_data);
2741 @endcode
2742
2743 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
2744
2745 SAMPLE CODE:
2746 @code
2747 #include <stdio.h>
2748 #include <stdlib.h>
2749 #include <TapiCommon.h>
2750 #include <ITapiNetText.h>
2751
2752 void delete_sms()
2753 {
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;
2758         void* user_data;
2759         int index;
2760
2761         ret_status = tel_delete_sms_in_sim(handle, index, on_resp_delete_sms, user_data);
2762         if (ret_status == TAPI_API_SUCCESS)
2763         {
2764                 printf("successful\n");
2765         }
2766         else
2767         {
2768                 printf("error = %d\n", ret_status);
2769         }
2770         //WAIT FOR EVENT HERE
2771 }
2772 static void on_resp_delete_sms(TapiHandle *handle, int result, void *data, void *user_data)
2773 {
2774         int *index = data;
2775         printf("tel_delete_sms_in_sim() response receive");
2776         printf(" - result = 0x%x", result);
2777         printf(" - index = %d", *index);
2778 }
2779 @endcode
2780 @}
2781 @defgroup Use_Cases4_6 Getting Sms Count
2782 @ingroup Use_Cases4_SMS
2783 @{
2784
2785
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.
2788
2789 @code
2790 int tel_get_sms_count(TapiHandle *handle, tapi_response_cb callback, void* user_data);
2791 @endcode
2792
2793 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
2794
2795 SAMPLE CODE
2796 @code
2797 #include <stdio.h>
2798 #include <stdlib.h>
2799 #include <TapiCommon.h>
2800 #include <ITapiNetText.h>
2801
2802 void get_count()
2803 {
2804         //Obtain Tapi Handle as mentioned in Event Register and Deregister
2805         int ret_status;
2806         TapiHandle *handle;
2807         tapi_response_cb callback;
2808         void* user_data;
2809
2810         ret_status = tel_get_sms_count(handle, on_resp_get_count, user_data);
2811         if  (ret_status == TAPI_API_SUCCESS)
2812         {
2813                 printf("successful\n");
2814         }
2815         else
2816         {
2817                 printf("error = %d\n", ret_status);
2818         }
2819         //WAIT FOR EVENT HERE
2820 }
2821 static void on_resp_get_count(TapiHandle *handle, int result, void *data, void *user_data)
2822 {
2823         static TelSmsStoredMsgCountInfo_t *countInfo;
2824         int loop_counter = 0;
2825         TapiResult_t returnStatus = TAPI_API_SUCCESS;
2826
2827         countInfo = (TelSmsStoredMsgCountInfo_t*) data;
2828
2829         printf("tel_get_sms_count() response receive");
2830         printf(" - result = 0x%x", result);
2831
2832         if (countInfo->UsedCount != 0x00)       //if used count is not zero
2833                         {
2834                 printf("Index LIST..........");
2835                 for (loop_counter = 0; loop_counter < countInfo->UsedCount;
2836                                 loop_counter++) {
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);
2840                 }
2841                 printf("In MsgCountNotification total cnt is %d, usedcnt is %dapi_err %d",
2842                                 countInfo->TotalCount, countInfo->UsedCount, returnStatus);
2843         }
2844
2845         printf("In MsgCountNotification total cnt is %d, usedcnt is %d",
2846                         countInfo->TotalCount, countInfo->UsedCount);
2847 }
2848 @endcode
2849 @}
2850 @defgroup Use_Cases4_7 Setting Sms CB message
2851 @ingroup Use_Cases4_SMS
2852 @{
2853
2854
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.
2860
2861 @code
2862 int  tel_set_sms_cb_config(handle, pCBConfig, callback, user_data);
2863 @endcode
2864
2865 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
2866
2867 SAMPLE CODE
2868 @code
2869 #include <stdio.h>
2870 #include <stdlib.h>
2871 #include <TapiCommon.h>
2872 #include <ITapiNetText.h>
2873
2874 void set_cbconfig()
2875 {
2876         //Obtain Tapi Handle as mentioned in Event Register and Deregister
2877         TapiHandle *handle;
2878         tapi_response_cb callback;
2879         void* user_data;
2880
2881         pCBConfig = calloc (1, sizeof(TelSmsCbConfig_t));
2882         if (!pCBConfig)
2883                 return -1;
2884
2885         msg("Enter CB ON/OFF (1: Enable, 0:Disable): ");
2886         pCBConfig->CBEnabled =;//fill appropriately
2887
2888         msg("Enter Max ID Count: ");
2889         pCBConfig->MsgIdMaxCount =);//fill appropriately
2890
2891         msg("Enter MsgIdRangeCount ( < 10 ): ");
2892         pCBConfig->MsgIdRangeCount =;//fill appropriately
2893
2894         if (pCBConfig->MsgIdRangeCount <= 0
2895                         || pCBConfig->MsgIdRangeCount >= TAPI_NETTEXT_GSM_SMS_CBMI_LIST_SIZE_MAX) {
2896                 printf("Bad Range value");
2897                 free (pCBConfig);
2898                 return -1;
2899         }
2900
2901         for (i = 0; i < pCBConfig->MsgIdRangeCount; i++) {
2902                 printf("Enter %d FromMsgId : ", i + 1);
2903                 pCBConfig->MsgIDs[i].Net3gpp.FromMsgId = _get_int();
2904
2905                 printf("Enter %d ToMsgId : ", i + 1);
2906                 pCBConfig->MsgIDs[i].Net3gpp.ToMsgId = _get_int();
2907
2908                 printf("Enter %d Selected : ", i + 1);
2909                 pCBConfig->MsgIDs[i].Net3gpp.Selected = _get_int();
2910         }
2911
2912         pCBConfig->Net3gppType = 0x01;
2913
2914         returnStatus = tel_set_sms_cb_config(handle, pCBConfig, on_resp_set_sms_cb_config, user_data);
2915         if (ret_status == TAPI_API_SUCCESS)
2916         {
2917                 printf("successful\n");
2918         }
2919         else
2920         {
2921                 printf("error = %d\n", ret_status);
2922         }
2923         //WAIT FOR EVENT HERE
2924 }
2925
2926 //CALLBACK FUNCTION TO BE USED
2927 static void on_resp_set_sms_cb_config (TapiHandle *handle, int result, void *data, void *user_data)
2928 {
2929         printf("");
2930         printf("tel_set_sms_cb_config() response receive");
2931         printf(" - result = 0x%x", result);
2932 }@endcode
2933 @}
2934 @defgroup Use_Cases4_8 Getting Sms CB configuration
2935 @ingroup Use_Cases4_SMS
2936 @{
2937
2938
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.
2943
2944 @code
2945 int tel_get_sms_cb_config(TapiHandle *handle, tapi_response_cb callback, void* user_data);
2946 @endcode
2947
2948 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
2949
2950 SAMPLE CODE:
2951
2952 @code
2953 #include <stdio.h>
2954 #include <stdlib.h>
2955 #include <TapiCommon.h>
2956 #include <ITapiNetText.h>
2957
2958 void get_cbconfig()
2959 {
2960         int ret_status;
2961         //Obtain Tapi Handle as mentioned in Event Register and Deregister
2962         TapiHandle *handle;
2963         tapi_response_cb callback;
2964         void* user_data;
2965         ret_status = tel_get_sms_cb_config(handle, on_resp_get_cb_config, user_data);
2966
2967         printf ("The return value is %d\n", ret_status);
2968         if (ret_status == TAPI_API_SUCCESS)
2969         {
2970                 printf("successful\n");
2971         }
2972         else
2973         {
2974                 printf("error = %d\n", ret_status);
2975         }
2976         //WAIT FOR EVENT HERE
2977 }
2978 static void on_resp_get_cb_config (TapiHandle *handle, int result, void *data, void *user_data)
2979 {
2980         TelSmsCbConfig_t * CBConfig;
2981         int i = 0;
2982
2983         CBConfig = (TelSmsCbConfig_t *) data;
2984
2985         printf("tel_get_sms_cb_config() response receive");
2986         printf(" - result = 0x%x", result);
2987
2988
2989         if (CBConfig->CBEnabled == TRUE)
2990                 msg("Cell Broadcast Msg Enabled...")
2991         else
2992                 msg("Cell Broadcast Msg Disabled...")
2993
2994
2995         if (CBConfig->Net3gppType == 0x01)
2996                 msg("Network type is 3gpp ")
2997         else if (CBConfig->Net3gppType == 0x02)
2998                 msg("Network type is CDMA");
2999
3000         printf("CBMI Range Count: %d \n", CBConfig->MsgIdRangeCount);
3001
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);
3008                 }
3009         }
3010 }
3011
3012 //...
3013 @endcode
3014 @}
3015 @defgroup Use_Cases4_9 Service Center Address
3016 @ingroup Use_Cases4_SMS
3017 @{
3018
3019
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.
3024
3025 @code
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);
3028 @endcode
3029
3030 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
3031
3032 SAMPLE CODE
3033 @code
3034 #include <stdio.h>
3035 #include <stdlib.h>
3036 #include <TapiCommon.h>
3037 #include <ITapiNetText.h>
3038
3039 void set_sca()
3040 {
3041         int ret_status;
3042         //Obtain Tapi Handle as mentioned in Event Register and Deregister
3043         TapiHandle *handle;
3044         tapi_response_cb callback;
3045         void* user_data;
3046         TelSmsAddressInfo_t sca;
3047
3048         memset (&sca, 0, sizeof(TelSmsAddressInfo_t));
3049
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;
3058
3059
3060         ret_status = int tel_set_sms_sca(handle, pSCA, index, on_resp_set_sms_sca, user_data);
3061         //[Note] Telephony Emulator Not Support
3062
3063         printf("returnstatus after scaddr set is %d requestId:%d \n", ret_status, pRequestId);
3064         if (ret_status == TAPI_API_SUCCESS)
3065         {
3066                 printf("successful\n");
3067         }
3068         else
3069         {
3070                 printf("error = %d\n", ret_status);
3071         }
3072 }
3073
3074 static void on_resp_set_sms_sca (TapiHandle *handle, int result, void *data, void *user_data)
3075 {
3076         printf("tel_set_sms_sca() response receive");
3077         printf(" - result = 0x%x", result);
3078 }
3079
3080 //..
3081
3082 //get SCA
3083 #include <stdio.h>
3084 #include <stdlib.h>
3085 #include <TapiCommon.h>
3086 #include <ITapiNetText.h>
3087
3088 void get_sca()
3089 {
3090         int ret_status;
3091         //Obtain Tapi Handle as mentioned in Event Register and Deregister
3092         TapiHandle *handle;
3093         tapi_response_cb callback;
3094         void* user_data;
3095
3096         ret_status = int tel_get_sms_sca(handle, index, on_resp_get_sms_sca, user_data);
3097         if (ret_status == TAPI_API_SUCCESS)
3098         {
3099                 printf("successful\n");
3100         }
3101         else
3102         {
3103                 printf("error = %d\n", ret_status);
3104         }
3105 }
3106
3107 static void on_resp_get_sms_sca (TapiHandle *handle, int result, void *data,
3108                 void *user_data)
3109 {
3110         TelSmsAddressInfo_t *scaInfo = data;
3111         unsigned int i = 0;
3112
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");
3119
3120         for (i = 0; i < scaInfo->DialNumLen; i++) {
3121                 printf("[%02x]", scaInfo->szDiallingNum[i]);
3122                 if (i % 10 == 9)
3123                         printf("\n");
3124         }
3125 }
3126
3127
3128 @endcode
3129 @}
3130 @defgroup Use_Cases4_10 Sms Preferred Bearer
3131 @ingroup Use_Cases4_SMS
3132 @{
3133
3134
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.
3139
3140 @code
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);
3143 @endcode
3144
3145 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
3146
3147 SAMPLE CODE:
3148 @code
3149 #include <stdio.h>
3150 #include <stdlib.h>
3151 #include <TapiCommon.h>
3152 #include <ITapiNetText.h>
3153
3154 void set_pb()
3155 {
3156         int ret_status;
3157         //Obtain Tapi Handle as mentioned in Event Register and Deregister
3158         TapiHandle *handle;
3159         tapi_response_cb callback;
3160         void* user_data;
3161
3162         TelSmsBearerType_t BearerType = TAPI_NETTEXT_BEARER_PS_ONLY;
3163
3164         ret_status = tel_get_sms_preferred_bearer(handle, on_resp_set_sms_preferred_bearer, user_data);
3165         if (ret_status == TAPI_API_SUCCESS)
3166         {
3167                 printf("successful\n");
3168         }
3169         else
3170         {
3171                 printf("error = %d\n", ret_status);
3172         }
3173 }
3174 static void on_resp_set_sms_preferred_bearer (TapiHandle *handle, int result, void *data, void *user_data)
3175 {
3176         printf("");
3177         printf("tel_set_sms_preferred_bearer() response receive");
3178         printf(" - result = 0x%x", result);
3179 }
3180 //get preferred bearer
3181 #include <stdio.h>
3182 #include <stdlib.h>
3183 #include <TapiCommon.h>
3184 #include <ITapiNetText.h>
3185 void get_pb()
3186 {
3187         int ret_status;
3188         //Obtain Tapi Handle as mentioned in Event Register and Deregister
3189         TapiHandle *handle;
3190         tapi_response_cb callback;
3191         void* user_data;
3192         ret_status = tel_get_sms_preferred_bearer(handle, callback, user_data);
3193         if (ret_status == TAPI_API_SUCCESS)
3194         {
3195                 printf("successful\n");
3196         }
3197         else
3198         {
3199                 printf("error = %d\n", ret_status);
3200         }
3201 }
3202 static void on_resp_get_pref_bearer (TapiHandle *handle, int result, void *data, void *user_data)
3203 {
3204         printf("");
3205         printf("tel_get_sms_preferred_bearer() response receive");
3206         printf(" - result = 0x%x", result);
3207 }
3208 @endcode
3209 @}
3210 @defgroup Use_Cases4_11 Sms Parameters
3211 @ingroup Use_Cases4_SMS
3212 @{
3213
3214
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.
3218
3219 @code
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);
3222 @endcode
3223
3224 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
3225
3226 SAMPLE CODE:
3227 @code
3228 #include <stdio.h>
3229 #include <stdlib.h>
3230 #include <TapiCommon.h>
3231 #include <ITapiNetText.h>
3232
3233 void set_param()
3234 {
3235         //Obtain Tapi Handle as mentioned in Event Register and Deregister
3236         TapiHandle *handle;
3237         tapi_response_cb callback;
3238         void* user_data;
3239         int ret_status;
3240
3241         TelSmsParams_t SmsSetParameters;
3242
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);
3247
3248         SmsSetParameters.TpDestAddr.DialNumLen = 10;
3249         SmsSetParameters.TpDestAddr.Ton = TAPI_SIM_TON_NATIONAL;//national no
3250         SmsSetParameters.TpDestAddr.Npi = TAPI_SIM_NPI_NATIONAL;
3251
3252         ret_status = tel_set_sms_parameters(handle, pSmsSetParameters, on_resp_set_sms_params, user_data);
3253         if (ret_status == TAPI_API_SUCCESS)
3254         {
3255                 printf("successful\n");
3256         }
3257         else
3258         {
3259                 printf("error = %d\n", ret_status);
3260         }
3261 }
3262 static void on_resp_set_sms_params (TapiHandle *handle, int result, void *data, void *user_data)
3263 {
3264         printf("tel_set_sms_params() response receive");
3265         printf(" - result = 0x%x", result);
3266 }
3267 //...
3268
3269 //get params
3270 #include <stdio.h>
3271 #include <stdlib.h>
3272 #include <TapiCommon.h>
3273 #include <ITapiNetText.h>
3274
3275 void get_params()
3276 {
3277         int ret_status;
3278         //Obtain Tapi Handle as mentioned in Event Register and Deregister
3279         TapiHandle *handle;
3280         tapi_response_cb callback;
3281         void* user_data;
3282
3283         ret_status = tel_get_sms_parameters(handle, index, on_resp_get_sms_parameters, user_data);
3284         if (ret_status == TAPI_API_SUCCESS)
3285         {
3286                 printf("successful\n");
3287         }
3288         else
3289         {
3290                 printf("error = %d\n", ret_status);
3291         }
3292 }
3293 static void on_resp_get_sms_parameters (TapiHandle *handle, int result, void *data, void *user_data)
3294 {
3295         TelSmsParams_t *smsp_param;
3296
3297         smsp_param = (TelSmsParams_t *) data;
3298
3299         printf("tel_get_sms_parameters() response receive");
3300         printf(" - result = 0x%x", result);
3301
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);
3312 }
3313 @endcode
3314 @}
3315 @defgroup Use_Cases4_12 Sending Delivery Report
3316 @ingroup Use_Cases4_SMS
3317 @{
3318
3319
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.
3322
3323 @code
3324 int tel_send_sms_deliver_report(TapiHandle *handle, const TelSmsDatapackageInfo_t *pDataPackage, TelSmsResponse_t RPCause, tapi_response_cb callback, void* user_data);
3325 @endcode
3326
3327 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
3328
3329 SAMPLE CODE
3330 @code
3331 #include <stdio.h>
3332 #include <stdlib.h>
3333 #include <TapiCommon.h>
3334 #include <ITapiNetText.h>
3335 void send_delivery()
3336 {
3337         int ret_status;
3338         //Obtain Tapi Handle as mentioned in Event Register and Deregister
3339         TapiHandle *handle;
3340         tapi_response_cb callback;
3341         void* user_data;
3342
3343         TelSmsResponse_t RPCause;
3344         TelSmsDatapackageInfo_t *del_report = NULL;
3345
3346         del_report = malloc(sizeof(TelSmsDatapackageInfo_t));
3347         memset(del_report, 0, sizeof(TelSmsDatapackageInfo_t));
3348         //Encode Send Delivery Report here
3349         //EncodeSmsDeliveryReportTpdu();
3350
3351         RPCause = TAPI_NETTEXT_SENDSMS_SUCCESS;
3352         printf("***receive message (Api:SendDeliverreport)****\n");
3353
3354         ret_status = tel_send_sms_deliver_report(handle, pDataPackage, RPCause, callback, user_data);
3355         if (ret_status == TAPI_API_SUCCESS)
3356         {
3357                 printf("successful\n");
3358         }
3359         else
3360         {
3361                 printf("error = %d\n", ret_status);
3362         }
3363 }
3364 static void on_resp_DeliverReport_msg (TapiHandle *handle, int result, void *data, void *user_data)
3365 {
3366         int *index = data;
3367
3368         printf("");
3369         printf("tel_send_sms_deliver_report() response receive");
3370         printf(" - result = 0x%x", result);
3371         printf(" - index = %d", *index);
3372 }
3373 @endcode
3374 @}
3375 @defgroup Use_Cases4_13 Setting Memory Status
3376 @ingroup Use_Cases4_SMS
3377 @{
3378
3379
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.
3383
3384 @code
3385 int tel_set_sms_memory_status(TapiHandle *handle, int memoryStatus, tapi_response_cb callback, void* user_data);
3386 @endcode
3387
3388 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
3389
3390 SAMPLE CODE:
3391 @code
3392 #include <stdio.h>
3393 #include <stdlib.h>
3394 #include <TapiCommon.h>
3395 #include <ITapiNetText.h>
3396 void set_memstatus()
3397 {
3398         //Obtain Tapi Handle as mentioned in Event Register and Deregister
3399         TapiHandle *handle;
3400         tapi_response_cb callback;
3401         void* user_data;
3402         int ret_status;
3403         int MemoryStatus = TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE;
3404
3405         ret_status = tel_set_sms_memory_status(handle, memoryStatus, on_resp_set_mem_status, user_data);
3406         if (ret_status == TAPI_API_SUCCESS)
3407         {
3408                 printf("successful\n");
3409         }
3410         else
3411         {
3412                 printf("error = %d\n", ret_status);
3413         }
3414 }
3415 static void on_resp_set_mem_status (TapiHandle *handle, int result, void *data, void *user_data)
3416 {
3417         printf("tel_set_sms_mem_status() response receive");
3418         printf(" - result = 0x%x", result);
3419 }
3420 @endcode
3421 @}
3422 @defgroup Use_Cases4_14 Setting Message Status
3423 @ingroup Use_Cases4_SMS
3424 @{
3425
3426
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.
3430
3431 @code
3432 int tel_set_sms_message_status(TapiHandle *handle, int index, TelSmsMsgStatus_t msgStatus, tapi_response_cb callback, void* user_data);
3433
3434 @endcode
3435
3436 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
3437
3438 SAMPLE CODE:
3439 @code
3440 #include <stdio.h>
3441 #include <stdlib.h>
3442 #include <TapiCommon.h>
3443 #include <ITapiNetText.h>
3444
3445 void set_msgstatus()
3446 {
3447         //Obtain Tapi Handle as mentioned in Event Register and Deregister
3448         TapiHandle *handle;
3449         tapi_response_cb callback;
3450         void* user_data;
3451         int ret_status;
3452         int Index = 2;
3453         TelSmsMsgStatus_t MsgStatus = TAPI_NETTEXT_STATUS_READ;
3454
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);
3457
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)
3461         {
3462                 printf("successful\n");
3463         }
3464         else
3465         {
3466                 printf("error = %d\n", ret_status);
3467         }
3468 }
3469 static void on_resp_set_msg_status (TapiHandle *handle, int result, void *data, void *user_data)
3470 {
3471         printf("tel_set_sms_msg_status() response receive");
3472         printf(" - result = 0x%x", result);
3473 }
3474 @endcode
3475 @}
3476 @defgroup Use_Cases4_15 Getting SMS Parameter Count
3477 @ingroup Use_Cases4_SMS
3478 @{
3479
3480
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.
3484
3485 @code
3486 int tel_get_sms_parameter_count(TapiHandle *handle, tapi_response_cb callback, void* user_data);
3487 @endcode
3488
3489 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
3490
3491 SAMPLE CODE:
3492 @code
3493 #include <stdio.h>
3494 #include <stdlib.h>
3495 #include <TapiCommon.h>
3496 #include <ITapiNetText.h>
3497
3498 void get_paramcount()
3499 {
3500         //Obtain Tapi Handle as mentioned in Event Register and Deregister
3501         TapiHandle *handle;
3502         tapi_response_cb callback;
3503         void* user_data;
3504         int ret_status;
3505
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)
3509         {
3510                 printf("successful\n");
3511         }
3512         else
3513         {
3514                 printf("error = %d\n", ret_status);
3515         }
3516 }
3517 static void on_resp_get_paramcnt (TapiHandle *handle, int result, void *data, void *user_data)
3518 {
3519         int * RecordCount;
3520
3521         RecordCount = (int *) data;
3522
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);
3526 }
3527 @endcode
3528 @}
3529
3530 @defgroup Use_Cases5_1 Event register and deregister
3531 @ingroup Use_Cases5_NETWORK
3532 @{
3533
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.
3536
3537 Network Notification Events
3538 @code
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
3543 @endcode
3544
3545 SAMPLE CODE:
3546 @code
3547
3548 TapiHandle *handle;
3549 char *noti_id = TAPI_EVENT_NETWORK_LOCATIONCELLINFO_IND;
3550 tapi_response_cb callback;
3551 void* user_data;
3552 int api_err;
3553
3554 handle = tel_init();
3555 if (handle)
3556 {
3557         TEST_DEBUG("tel_init Failed");
3558 }
3559
3560 // REGISTER EVENT
3561 api_err = tel_register_noti_event(handle, noti_id, app_callback, user_data);
3562 if (api_err == TAPI_API_SUCCESS)
3563 {
3564         printf("Network notification registration is Done: noti_id is %d, handle is %d\n", noti_id, handle);
3565 }
3566
3567 // DEREGISTER EVENT
3568 api_err = tel_deregister_noti_event(handle, noti_id);
3569 if (api_err != TAPI_API_SUCCESS)
3570 {
3571         printf("Event Unregistration Fail\n");
3572 }
3573
3574 // Network notification callback function
3575 void app_callback(void)
3576 {
3577         int eventClass;
3578         int eventType;
3579         int requestId;
3580         int status;
3581         void *EventData = NULL;
3582
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");
3589
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);
3593
3594         switch (eventType)
3595         {
3596                 case TAPI_EVENT_NETWORK_LOCATIONCELLINFO_IND:
3597                         //process notification data
3598                         break;
3599
3600                 case TAPI_EVENT_NETWORK_RADIO_INFO_IND:
3601                         //process notification data
3602                         break;
3603
3604                 case TAPI_EVENT_NETWORK_SPN_INFO:
3605                         //process notification data
3606                         break;
3607
3608                 case TAPI_EVENT_NETWORK_DISPLAYINFO_IND:
3609                         //process notification data
3610                         break;
3611         }
3612 }
3613 @endcode
3614 @}
3615 @defgroup Use_Cases5_2 Network Selection
3616 @ingroup Use_Cases5_NETWORK
3617 @{
3618
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.
3621
3622 @code
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)
3625 @endcode
3626
3627 SAMPLE CODE:
3628 @code
3629 #include <ITapiNetwork.h>
3630 #include <stdio.h>
3631 #include "TapiCommon.h"
3632
3633 //SUBSCRIBE FOR EVENTS AS MENTIONED IN  Event Register and Deregister
3634 void select_nw()
3635 {
3636         int ret_status;
3637         TapiHandle *handle;
3638         tapi_response_cb callback;
3639         void *user_data;
3640         unsigned int plmn = 0;
3641
3642         //CASE 1. MANUAL MODE
3643         plmn = 45454;
3644         act = 0x1;
3645         ret_status = tel_select_network_manual(handle, plmn, act, callback, user_data);
3646
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");
3651         else
3652                 printf("error=%d\n", ret_status);
3653
3654         //WAIT FOR EVENT HERE
3655 }
3656
3657 //CALLBACK FUNCTION TO BE USED
3658 static void app_callback (TelTapiEvent_t *event)
3659 {
3660         int eventClass;
3661         int eventType;
3662         int requestId;
3663         int status;
3664         void* EventData = NULL;
3665
3666         //...
3667         eventClass = event->EventClass;
3668         eventType = event->EventType;
3669         requestId = event->RequestId;
3670         status = event->Status;
3671         EventData = event->pData;
3672
3673         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3674
3675         if (status != 0)
3676         {
3677                 //TEST_DEBUG("******This is nonzero status. ******\n");
3678                 return;
3679         }
3680         //...
3681         //...
3682         switch (eventType)
3683         {
3684                 case TAPI_EVENT_NETWORK_SELECT_CNF:
3685                         printf("\n$$$$$$ TAPI_EVENT_NETWORK_SELECT_CNF $$$$$$ \n");
3686         }
3687 }
3688 @endcode
3689 @}
3690 @defgroup Use_Cases5_3 Network Search
3691 @ingroup Use_Cases5_NETWORK
3692 @{
3693
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.
3696
3697 @code
3698 int tel_search_network(TapiHandle *handle, tapi_response_cb callback, void *user_data);
3699 @endcode
3700
3701 SAMPLE CODE:
3702 @code
3703 #include <ITapiNetwork.h>
3704 #include <stdio.h>
3705 #include "TapiCommon.h"
3706
3707 //SUBSCRIBE FOR EVENTS AS MENTIONED IN  Event Register and Deregister
3708 void searchnw()
3709 {
3710         int ret_status;
3711         TapiHandle *handle;
3712         tapi_response_cb callback;
3713         void *user_data;
3714
3715         ret_status = tel_search_network(handle, callback, user_data);
3716         if (ret_status == TAPI_API_SUCCESS)
3717                 printf("successful\n");
3718         else
3719                 printf("error=%d\n", ret_status);
3720         //WAIT FOR EVENT HERE
3721 }
3722 //CALLBACK FUNCTION TO BE USED
3723 static void app_callback (TelTapiEvent_t *event)
3724 {
3725         int eventClass;
3726         int eventType;
3727         int requestId;
3728         int status;
3729         void* EventData = NULL;
3730         unsigned int temp_handle = -1;
3731
3732         //...
3733         eventClass = event->EventClass;
3734         eventType = event->EventType;
3735         requestId = event->RequestId;
3736         status = event->Status;
3737         EventData = event->pData;
3738
3739         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3740
3741         if (status != 0)
3742         {
3743                 //TEST_DEBUG("******This is nonzero status. ******\n");
3744                 return;
3745         }
3746         //...
3747         //...
3748         switch (eventType)   //REFER Network Selection TO GET eventType
3749         {
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)
3755                         {
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);
3761                                 ui_entry_count++;
3762                         }
3763                         break;
3764         }
3765         //...
3766 }
3767 @endcode
3768 @}
3769 @defgroup Use_Cases5_4 Selection Mode
3770 @ingroup Use_Cases5_NETWORK
3771 @{
3772
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.
3775
3776 @code
3777 int tel_get_network_selection_mode(TapiHandle *handle, tapi_response_cb callback, void *user_data);
3778 @endcode
3779
3780 SAMPLE CODE
3781 @code
3782 #include <ITapiNetwork.h>
3783 #include <stdio.h>
3784 #include "TapiCommon.h"
3785
3786 //SUBSCRIBE FOR EVENTS AS MENTIONED IN  Event Register and Deregister
3787 void get_selmode()
3788 {
3789         int ret_status;
3790         TapiHandle *handle;
3791         tapi_response_cb callback;
3792         void *user_data;
3793
3794         //GET THE SELECTION MODE
3795
3796         ret_status = tel_get_network_selection_mode (handle, callback, user_data);
3797         if (ret_status == TAPI_API_SUCCESS)
3798                 printf("successful\n");
3799         else
3800                 printf("error=%d\n", ret_status);
3801         //WAIT FOR EVENT HERE
3802 }
3803 //CALLBACK FUNCTION TO BE USED
3804 static void app_callback (TelTapiEvent_t *event)
3805 {
3806         int eventClass;
3807         int eventType;
3808         int requestId;
3809         int status;
3810         void* EventData = NULL;
3811
3812         //...
3813         eventClass = event->EventClass;
3814         eventType = event->EventType;
3815         requestId = event->RequestId;
3816         status = event->Status;
3817         EventData = event->pData;
3818
3819         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3820
3821         if (status != 0)
3822         {
3823                 //TEST_DEBUG("******This is nonzero status. ******\n");
3824                 return;
3825         }
3826         //...
3827         //...
3828         switch (eventType) // REFER Network Selection TO GET eventType
3829         {
3830                 case TAPI_EVENT_NETWORK_GETSELECTIONMODE_CNF:
3831                         printf("\n$$$$$$ TAPI_EVENT_NETWORK_GETSELECTIONMODE_CNF $$$$$$ \n");
3832                         break;
3833         }
3834         //...
3835 }
3836 @endcode
3837 @}
3838 @defgroup Use_Cases5_5 Service Domain
3839 @ingroup Use_Cases5_NETWORK
3840 @{
3841
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.
3844
3845 @code
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);
3848 @endcode
3849
3850 SAMPLE CODE
3851 @code
3852 #include <stdio.h>
3853 #include <ITapiNetwork.h>
3854 #include <stdio.h>
3855 #include "TapiCommon.h"
3856
3857 //SUBSCRIBE FOR EVENTS AS MENTIONED IN  Event Register and Deregister
3858 void set_servicedomain()
3859 {
3860         int ret_status;
3861         TapiHandle *handle;
3862         TelNetworkServiceDomain_t domain;
3863         tapi_response_cb callback;
3864         void *user_data;
3865
3866         //SET NETWORK SERVICE DOMAIN
3867         domain = TAPI_NETWORK_SERVICE_DOMAIN_AUTOMATIC;
3868
3869         ret_status = tel_set_network_service_domain (handle, domain, callback, user_data);
3870         if (ret_status == TAPI_API_SUCCESS)
3871                 printf("successful\n");
3872         else
3873                 printf("error=%d\n", ret_status);
3874         //WAIT FOR EVENT HERE
3875 }
3876 //CALLBACK FUNCTION TO BE USED
3877 static void app_callback (TelTapiEvent_t *event)
3878 {
3879         int eventClass;
3880         int eventType;
3881         int requestId;
3882         int status;
3883         void* EventData = NULL;
3884         unsigned int temp_handle = -1;
3885
3886         //...
3887         eventClass = event->EventClass;
3888         eventType = event->EventType;
3889         requestId = event->RequestId;
3890         status = event->Status;
3891         EventData = event->pData;
3892
3893         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3894
3895         if (status != 0)
3896         {
3897                 //TEST_DEBUG("******This is nonzero status. ******\n");
3898                 return;
3899         }
3900         //...
3901         //...
3902         switch (eventType) //REFER Network Selection TO GET eventType
3903         {
3904                 case TAPI_EVENT_NETWORK_SET_SVC_DOMAIN_CNF:
3905                         printf("\n$$$$$$ TAPI_EVENT_NETWORK_SET_SVC_DOMAIN_CNF $$$$$$ \n");
3906                         break;
3907         }
3908
3909         //...
3910 }
3911
3912 //GET NETWORK SERVICE DOMAIN
3913 #include <ITapiNetwork.h>
3914 #include <stdio.h>
3915 #include "TapiCommon.h"
3916 void get_servicedomain()
3917 {
3918         int ret_status;
3919         TapiHandle *handle;
3920         tapi_response_cb callback;
3921         void *user_data;
3922
3923         ret_status = tel_get_network_service_domain (handle, callback, user_data);
3924         if (ret_status == TAPI_API_SUCCESS)
3925                 printf("successful\n");
3926         else
3927                 printf("error=%d\n", ret_status);
3928         //WAIT FOR EVENT HERE
3929 }
3930 //CALLBACK FUNCTION TO BE USED
3931 static void app_callback (TelTapiEvent_t *event)
3932 {
3933         int eventClass;
3934         int eventType;
3935         int requestId;
3936         int status;
3937         void* EventData = NULL;
3938         //...
3939         eventClass = event->EventClass;
3940         eventType = event->EventType;
3941         requestId = event->RequestId;
3942         status = event->Status;
3943         EventData = event->pData;
3944
3945         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3946
3947         if (status != 0)
3948         {
3949                 //TEST_DEBUG("******This is nonzero status. ******\n");
3950                 return;
3951         }
3952         //...
3953         //...
3954         switch (eventType) //REFER Network Selection TO GET eventType
3955         {
3956                 case TAPI_EVENT_NETWORK_GET_SVC_DOMAIN_CNF:
3957                         printf("\n$$$$$$ TAPI_EVENT_NETWORK_GET_SVC_DOMAIN_CNF $$$$$$ \n");
3958                         break;
3959                         //...
3960         }
3961 }
3962 @endcode
3963 @}
3964 @defgroup Use_Cases5_6 Network Mode
3965 @ingroup Use_Cases5_NETWORK
3966 @{
3967
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.
3971
3972 @code
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);
3975 @endcode
3976
3977 SAMPLE CODE
3978 @code
3979 #include <ITapiNetwork.h>
3980 #include <stdio.h>
3981 #include "TapiCommon.h"
3982
3983 //SUBSCRIBE FOR EVENTS AS MENTIONED IN  Event Register and Deregister
3984 void setnwmode()
3985 {
3986         int ret_status;
3987         TapiHandle *handle;
3988         int mode;
3989         tapi_response_cb callback;
3990         void *user_data;
3991
3992         mode = 0x01;
3993         ret_status = tel_set_network_mode(handle, mode, callback, user_data);
3994         if (ret_status == TAPI_API_SUCCESS)
3995                 printf("successful\n");
3996         else
3997                 printf("error=%d\n", ret_status);
3998         //WAIT FOR EVENT HERE
3999 }
4000 //CALLBACK FUNCTION TO BE USED
4001 static void app_callback (TelTapiEvent_t *event)
4002 {
4003         int eventClass;
4004         int eventType;
4005         int requestId;
4006         int status;
4007         void* EventData = NULL;
4008
4009         //...
4010         eventClass = event->EventClass;
4011         eventType = event->EventType;
4012         requestId = event->RequestId;
4013         status = event->Status;
4014         EventData = event->pData;
4015
4016         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4017
4018         if (status != 0)
4019         {
4020                 //TEST_DEBUG("******This is nonzero status. ******\n");
4021                 return;
4022         }
4023         //...
4024         //...
4025         switch (eventType) //REFER Network Selection TO GET eventType
4026         {
4027                 case TAPI_EVENT_NETWORK_SETNWMODE_CNF:
4028                         printf("\n$$$$$$ TAPI_EVENT_NETWORK_SETNWMODE_CNF $$$$$$ \n");
4029                         break;
4030                         //...
4031         }
4032 }
4033
4034 //GET NETWORK MODE
4035 #include <ITapiNetwork.h>
4036 #include <stdio.h>
4037 #include "TapiCommon.h"
4038
4039 void getnwmode()
4040 {
4041         int ret_status;
4042         TapiHandle *handle;
4043         tapi_response_cb callback;
4044         void *user_data;
4045
4046         ret_status = tel_get_network_mode(handle, callback, user_data);
4047         if (ret_status == TAPI_API_SUCCESS)
4048                 printf("successful\n");
4049         else
4050                 printf("error=%d\n", ret_status);
4051         //WAIT FOR EVENT HERE
4052 }
4053 //CALLBACK FUNCTION TO BE USED
4054 static void app_callback (TelTapiEvent_t *event)
4055 {
4056         int eventClass;
4057         int eventType;
4058         int requestId;
4059         int status;
4060         void* EventData = NULL;
4061
4062         //...
4063         eventClass = event->EventClass;
4064         eventType = event->EventType;
4065         requestId = event->RequestId;
4066         status = event->Status;
4067         EventData = event->pData;
4068
4069         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4070
4071         if (status != 0)
4072         {
4073                 //TEST_DEBUG("******This is nonzero status. ******\n");
4074                 return;
4075         }
4076         //...
4077         //...
4078         switch (eventType) //REFER Network Selection TO GET eventType
4079         {
4080                 case TAPI_EVENT_NETWORK_GETNWMODE_CNF:
4081                         printf("\n$$$$$$ TAPI_EVENT_NETWORK_GETNWMODE_CNF $$$$$$ \n");
4082                         break;
4083                         //...
4084         }
4085 }
4086 @endcode
4087 @}
4088 @defgroup Use_Cases5_7 Network Band
4089 @ingroup Use_Cases5_NETWORK
4090 @{
4091
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.
4094
4095 @code
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);
4098 @endcode
4099
4100 SAMPLE CODE:
4101 @code
4102 #include <ITapiNetwork.h>
4103 #include <stdio.h>
4104 #include "TapiCommon.h"
4105
4106 //SUBSCRIBE FOR EVENTS AS MENTIONED IN  Event Register and Deregister
4107 void setnwband()
4108 {
4109         int ret_status;
4110         TapiHandle *handle;
4111         TelNetworkBandPreferred_t mode;
4112         TelNetworkBand_t band;
4113         tapi_response_cb callback;
4114         void *user_data;
4115
4116         mode = TAPI_NETWORK_BAND_MODE_PREFERRED;
4117         band = TAPI_NETWORK_BAND_TYPE_GSM_900_1800;
4118
4119         ret_status = tel_set_network_band (handle, mode, band, callback, user_data);
4120         if (ret_status == TAPI_API_SUCCESS)
4121                 printf("successful\n");
4122         else
4123                 printf("error=%d\n", ret_status);
4124         //WAIT FOR EVENT HERE
4125 }
4126 //CALLBACK FUNCTION TO BE USED
4127 static void app_callback (TelTapiEvent_t *event)
4128 {
4129         int eventClass;
4130         int eventType;
4131         int requestId;
4132         int status;
4133         void* EventData = NULL;
4134
4135         //...
4136         eventClass = event->EventClass;
4137         eventType = event->EventType;
4138         requestId = event->RequestId;
4139         status = event->Status;
4140         EventData = event->pData;
4141
4142         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4143
4144         if (status != 0)
4145         {
4146                 //TEST_DEBUG("******This is nonzero status. ******\n");
4147                 return;
4148         }
4149         //...
4150         //...
4151         switch (eventType) //REFER Network Selection TO GET eventType
4152         {
4153                 case TAPI_EVENT_NETWORK_SETNWBAND_CNF:
4154                         printf("\n$$$$$$ TAPI_EVENT_NETWORK_SETNWBAND_CNF $$$$$$ \n");
4155                         break;
4156                         //...
4157         }
4158 }
4159
4160 //GET NETWORK BAND
4161 #include <ITapiNetwork.h>
4162 #include <stdio.h>
4163 #include "TapiCommon.h"
4164 void getnwband()
4165 {
4166         int ret_status;
4167         TapiHandle *handle;
4168         tapi_response_cb callback;
4169         void *user_data;
4170
4171         ret_status = tel_get_network_band(handle, callback, user_data);
4172         if (ret_status == TAPI_API_SUCCESS)
4173                 printf("successful\n");
4174         else
4175                 printf("error=%d\n", ret_status);
4176         //WAIT FOR EVENT HERE
4177 }
4178 //CALLBACK FUNCTION TO BE USED
4179 static void app_callback (TelTapiEvent_t *event)
4180 {
4181         int eventClass;
4182         int eventType;
4183         int requestId;
4184         int status;
4185         void* EventData = NULL;
4186
4187         //...
4188         eventClass = event->EventClass;
4189         eventType = event->EventType;
4190         requestId = event->RequestId;
4191         status = event->Status;
4192         EventData = event->pData;
4193
4194         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4195
4196         if (status != 0)
4197         {
4198                 //TEST_DEBUG("******This is nonzero status. ******\n");
4199                 return;
4200         }
4201         //...
4202         //...
4203         switch (eventType) // REFER Network Selection TO GET eventType
4204         {
4205                 case TAPI_EVENT_NETWORK_GETNWBAND_CNF:
4206                         printf("\n$$$$$$ TAPI_EVENT_NETWORK_GTNWBAND_CNF $$$$$$ \n");
4207                         break;
4208                         //...
4209         }
4210 }
4211 @endcode
4212 @}
4213 @defgroup Use_Cases5_8 Preferred PLMN
4214 @ingroup Use_Cases5_NETWORK
4215 @{
4216
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.
4220
4221 @code
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);
4224 @endcode
4225
4226 SAMPLE CODE
4227 @code
4228 #include <ITapiNetwork.h>
4229 #include <stdio.h>
4230 #include "TapiCommon.h"
4231
4232 //SUBSCRIBE FOR EVENTS AS MENTIONED IN  Event Register and Deregister
4233 void set_preferredplmn()
4234 {
4235         int ret_status;
4236         TapiHandle *handle;
4237         TelNetworkPreferredPlmnOp_t operation;
4238         TelNetworkPreferredPlmnInfo_t info;
4239         tapi_response_cb callback;
4240         void *user_data;
4241
4242         unsigned char *plmn = "45454";
4243
4244         //SET PLMN
4245         operation = TAPI_NETWORK_PREF_PLMN_ADD;
4246         memset(&info, 0, sizeof(TelNetworkPreferredPlmnInfo_t));
4247         info.Index = 0;
4248         info.SystemType = TAPI_NETWORK_SYSTEM_GSM;
4249         memcpy(info.Plmn, plmn, strlen(plmn));
4250
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");
4254         else
4255                 printf("error=%d\n", ret_status);
4256         //WAIT FOR EVENT HERE
4257 }
4258 //CALLBACK FUNCTION TO BE USED
4259 static void app_callback (TelTapiEvent_t *event)
4260 {
4261         int eventClass;
4262         int eventType;
4263         int requestId;
4264         int status;
4265         void* EventData = NULL;
4266
4267         //...
4268         eventClass = event->EventClass;
4269         eventType = event->EventType;
4270         requestId = event->RequestId;
4271         status = event->Status;
4272         EventData = event->pData;
4273
4274         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4275
4276         if (status != 0)
4277         {
4278                 //TEST_DEBUG("******This is nonzero status. ******\n");
4279                 return;
4280         }
4281
4282         //...
4283         //...
4284         switch (eventType) //REFER Network Selection TO GET eventType
4285         {
4286                 case TAPI_EVENT_NETWORK_SETPREFFPLMN_CNF:
4287                         printf("\n$$$$$$ TAPI TAPI_EVENT_NETWORK_SETPREFFPLMN_CNF $$$$$$ \n");
4288                         break;
4289         }
4290         //...
4291 }
4292 @endcode
4293
4294 @code
4295 //GET PLMN
4296 #include <ITapiNetwork.h>
4297 #include <stdio.h>
4298 #include "TapiCommon.h"
4299 void get_preferredplmn()
4300 {
4301         int ret_status;
4302         TapiHandle *handle;
4303         tapi_response_cb callback;
4304         void *user_data;
4305
4306         ret_status = tel_get_network_preferred_plmn(handle, callback, user_data);
4307         if (ret_status == TAPI_API_SUCCESS)
4308                 printf("successful\n");
4309         else
4310                 printf("error=%d\n", ret_status); //WAIT FOR EVENT HERE
4311         //WAIT FOR EVENT HERE
4312 }
4313
4314 //CALLBACK FUNCTION TO BE USED
4315 static void app_callback (TelTapiEvent_t *event)
4316 {
4317         int eventClass;
4318         int eventType;
4319         int requestId;
4320         int status;
4321         void* EventData = NULL;
4322
4323         //...
4324         eventClass = event->EventClass;
4325         eventType = event->EventType;
4326         requestId = event->RequestId;
4327         status = event->Status;
4328         EventData = event->pData;
4329
4330         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4331
4332         if (status != 0)
4333         {
4334                 //TEST_DEBUG("******This is nonzero status. ******\n");
4335                 return;
4336         }
4337         //...
4338         //...
4339         switch (eventType) //REFER Network Selection TO GET eventType
4340         {
4341                 case TAPI_EVENT_NETWORK_GETPREFFPLMN_CNF:
4342                         printf("\n$$$$$$ TAPI TAPI_EVENT_NETWORK_GETPREFFPLMN_CNF $$$$$$ \n");
4343                         break;
4344         }
4345 @endcode
4346 @}
4347 @defgroup Use_Cases6_1 SIM
4348 @ingroup Use_Cases6_SIM
4349 @{
4350
4351
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.
4355
4356 SAMPLE CODE:
4357 @code
4358 // REGISTER EVENT
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
4365
4366 api_err = TelTapiInit();
4367 if (api_err != TAPI_API_SUCCESS)
4368 {
4369         TEST_DEBUG("TelTapiInit Failed - api_err = %d \n", api_err);
4370 }
4371
4372 api_err = tel_register_noti_event(handle, noti_id, callback, user_data);
4373 printf("SIM Event registration is Done:");
4374
4375 // DEREGISTER EVENT
4376 api_err = tel_deregister_noti_event(handle, noti_id);
4377 if (api_err != TAPI_API_SUCCESS)
4378 {
4379         printf("Event Class Unregeration Fail\n");
4380
4381 }
4382 @endcode
4383 @}
4384 @defgroup Use_Cases6_2 PIN, SIM Lock operations
4385 @ingroup Use_Cases6_SIM
4386 @{
4387
4388
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.
4391
4392 @code
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);
4400 @endcode
4401
4402 SAMPLE CODE: PIN1/PIN2/SIM LOCK/PUK1 VERIFICATION AND CHANGE PIN1
4403 @code
4404 #include <ITapiSim.h>
4405 #include <stdio.h>
4406 #include "TapiCommon.h"
4407
4408 //  OPERATION REQUEST PIN1 VERIFICATION PART
4409 #define PIN1_NORMAL "0000" //Sample PIN1 code
4410
4411 Void pin1_verify()
4412 {
4413         int err_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
4420
4421         strcpy(init_pin_val, PIN1_NORMAL);
4422
4423         pin_data.type = TAPI_SIM_PTYPE_PIN1;
4424         pin_data.pw_len = strlen(init_pin_val);
4425
4426         printf("pw_len[%d]", pin_data.pw_len);
4427
4428         pin_data.pw = (char*)malloc(length);
4429         memcpy(pin_data.pw, init_pin_val, length);
4430
4431         err_code = tel_verifiy_sim_pins(handle, &pin_data, on_resp_sim_sec_op, user_data);
4432         if (err_code != TAPI_API_SUCCESS)
4433         {
4434                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4435         }
4436         // WAIT FOR EVENT FROM HERE
4437 }
4438
4439 //  OPERATION REQUEST PIN2 VERIFICATION PART
4440 #define PIN2_NORMAL "0000" //Sample PIN2 code
4441 Void verify_pin2()
4442 {
4443         int request_id = 0;
4444         int err_code;
4445         int length = TAPI_SIM_PIN_LENGTH+1;
4446         char init_pin_val[length] ;
4447         TelSimSecPw_t pin_data;
4448
4449         strcpy(init_pin_val, PIN2_NORMAL);
4450
4451         pin_data.type = TAPI_SIM_PTYPE_PIN2;
4452         pin_data.pw_len = strlen(init_pin_val);
4453
4454         printf("pw_len[%d]", pin_data.pw_len);
4455
4456         pin_data.pw = (char*)malloc(length);
4457         memcpy(pin_data.pw, init_pin_val, length);
4458
4459         err_code = tel_verifiy_sim_pins(&pin_data, &request_id);
4460         if (err_code != TAPI_API_SUCCESS)
4461         {
4462                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4463         }
4464         // WAIT FOR EVENT FROM HERE
4465 }
4466
4467 //  OPERATION REQUEST CHANGE PIN1 PART
4468 #define PIN1_ORG "0000" //Sample old PIN1 code
4469 #define PIN1_NEW "1111" //Sample new PIN1 code
4470 void change_pins()
4471 {
4472         int err_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
4481
4482         memset(&init_old_pin_val, 0, length);
4483         memset(&init_new_pin_val, 0, length);
4484
4485         strcpy(init_old_pin_val, PIN1_ORG);
4486
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);
4492
4493         strcpy(init_new_pin_val, PIN1_NEW);
4494
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);
4500
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)
4503         {
4504                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4505         }
4506         // WAIT EVENT RESPONSE FROM HERE
4507 }
4508
4509 //  OPERATION REQUEST VERIFICATION PUK1 PART
4510 #define PUK1_NORMAL "00000000" //Sample PUK1 code
4511 #define PIN1_NORMAL "0000" //Sample PIN1 code
4512
4513 void verify_puks()
4514 {
4515         int err_code;
4516         int length = TAPI_SIM_PIN_LENGTH + 1;
4517
4518         char init_pin_val[length];
4519         char init_puk_val[length];
4520
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
4526
4527         strcpy(init_pin_val, PIN1_NORMAL);
4528         strcpy(init_puk_val, PUK1_NORMAL);
4529
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);
4535
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);
4541
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)
4544         {
4545                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4546         }
4547         // WAIT EVENT RESPONSE FROM HERE
4548 }
4549 //  OPERATION REQUEST SIM LOCK VERIFICATION PART
4550 #define SIM_NORMAL "0000" //Sample SIM Lock code
4551 Void verify_sim()
4552 {
4553         int err_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
4560
4561         strcpy(init_pin_val, SIM_NORMAL);
4562
4563         pin_data.type = TAPI_SIM_PTYPE_SIM;
4564         pin_data.pw_len = strlen(init_pin_val);
4565
4566         printf("pw_len[%d]", pin_data.pw_len);
4567
4568         pin_data.pw = (char*)malloc(length);
4569         memcpy(pin_data.pw, init_pin_val, length);
4570
4571         err_code = tel_verifiy_sim_pins(handle, &pin_data, on_resp_sim_sec_op, user_data);
4572         if (err_code != TAPI_API_SUCCESS)
4573         {
4574                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4575         }
4576         // WAIT FOR EVENT FROM HERE
4577 }
4578
4579 //RESPONSE PART
4580 //CALLBACK FUNCTION TO BE USED
4581 static void on_resp_sim_sec_op(TapiHandle *handle, int result, void *data, void *user_data)
4582 {
4583         TelSimPinOperationResult_t sec_rt = result;
4584         TelSimSecResult_t *rt = data;
4585
4586         printf("sec_rt[%d]", sec_rt);
4587         printf("rt->type[%d]", rt->type);
4588         printf("rt->retry_count[%d]", rt->retry_count);
4589 }
4590 @endcode
4591
4592 SAMPLE CODE: ENABLE/DISABLE PIN1 and SIM LOCK
4593 @code
4594 #include <ITapiSim.h>
4595 #include <stdio.h>
4596 #include "TapiCommon.h"
4597
4598 //  OPERATION REQUEST DISABLING PIN1 PART
4599 #define PIN1_NORMAL "0000" //Sample PIN1 code
4600 void disable_pin1()
4601 {
4602         int request_id = 0;
4603         int err_code;
4604         int length = TAPI_SIM_PIN_LENGTH+1;
4605         char init_pin_val[length];
4606
4607         strcpy(init_pin_val, PIN1_NORMAL);
4608
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);
4613
4614         sec_data.pw = (char*)malloc(length);
4615         memcpy(sec_data.pw, init_pin_val, length);
4616
4617         err_code = tel_disable_sim_facility(handle, sec_data, on_resp_sim_facility_op, user_data);
4618         if (err_code != TAPI_API_SUCCESS)
4619         {
4620                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4621         }
4622         // WAIT EVENT RESPONSE FROM HERE
4623 }
4624
4625 //  OPERATION REQUEST ENABLING PIN1 PART
4626 #define PIN1_NORMAL "0000" //Sample PIN1 code
4627 void enable_pin1()
4628 {
4629         int request_id = 0;
4630         int err_code;
4631         int length = TAPI_SIM_PIN_LENGTH+1;
4632         char init_pin_val[length];
4633
4634         strcpy(init_pin_val, PIN1_NORMAL);
4635
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);
4640
4641         sec_data.pw = (char*)malloc(length);
4642         memcpy(sec_data.pw, init_pin_val, length);
4643
4644         err_code = tel_enable_sim_facility(handle, sec_data, on_resp_sim_facility_op, user_data);
4645         if (err_code != TAPI_API_SUCCESS)
4646         {
4647                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4648         }
4649         //WAIT EVENT RESPONSE FROM HERE
4650 }
4651
4652 //  OPERATION REQUEST DISABLING SIM LOCK PART
4653 #define SIM_NORMAL "0000" //Sample SIM LOCK code
4654 void disable_sim()
4655 {
4656         int err_code;
4657         int length = TAPI_SIM_PIN_LENGTH+1;
4658         char init_pin_val[length];
4659
4660         strcpy(init_pin_val, SIM_NORMAL);
4661
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);
4666
4667         sec_data.pw = (char*)malloc(length);
4668         memcpy(sec_data.pw, init_pin_val, length);
4669
4670         err_code = tel_disable_sim_facility(handle, sec_data, on_resp_sim_facility_op, user_data);
4671         if (err_code != TAPI_API_SUCCESS)
4672         {
4673                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4674         }
4675         //WAIT EVENT RESPONSE FROM HERE
4676 }
4677
4678
4679 //  OPERATION REQUEST ENABLING SIM LOCK PART
4680 #define SIM_NORMAL "0000" //Sample SIM LOCK code
4681 void enable_sim()
4682 {
4683         int request_id = 0;
4684         int err_code;
4685         int length = TAPI_SIM_PIN_LENGTH+1;
4686         char init_pin_val[length];
4687
4688         strcpy(init_pin_val, SIM_NORMAL);
4689
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);
4694
4695         sec_data.pw = (char*)malloc(length);
4696         memcpy(sec_data.pw, init_pin_val, length);
4697
4698         err_code = tel_enable_sim_facility(handle, sec_data, on_resp_sim_facility_op, user_data);
4699         if (err_code != TAPI_API_SUCCESS)
4700         {
4701                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4702         }
4703         //WAIT EVENT RESPONSE FROM HERE
4704 }
4705
4706 @endcode
4707
4708 SAMPLE CODE: GET PIN1/PIN2/SIM LOCK STATUS
4709 @code
4710 #include <ITapiSim.h>
4711 #include <stdio.h>
4712 #include "TapiCommon.h"
4713
4714 //  OPERATION REQUEST GET PIN1/PIN2/SIM LOCK STATUS PART
4715 void get_facility_status()
4716 {
4717         int error_code;
4718         TelSimLockType_t type = TAPI_SIM_PTYPE_PIN1 // or TAPI_SIM_PTYPE_PIN2 or TAPI_SIM_PTYPE_SIM;
4719
4720         err_code = tel_get_sim_facility(handle, type, callback, user_data);
4721         if (err_code != TAPI_API_SUCCESS)
4722         {
4723                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4724         }
4725         printf("*****************************************************");
4726 }
4727
4728 void get_lock_status()
4729 {
4730         int error_code;
4731         TelSimLockType_t type = TAPI_SIM_PTYPE_PIN1 // or TAPI_SIM_PTYPE_PIN2 or TAPI_SIM_PTYPE_SIM;
4732
4733         err_code = tel_get_sim_lock_info(handle, type, callback, user_data);
4734         if (err_code != TAPI_API_SUCCESS)
4735         {
4736                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4737         }
4738         printf("*****************************************************");
4739 }
4740
4741 @endcode
4742 @}
4743 @defgroup Use_Cases6_3 Personalisation Lock
4744 @ingroup Use_Cases6_SIM
4745 @{
4746
4747
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.
4750
4751 @code
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);
4755 @endcode
4756
4757 SAMPLE CODE: GET PERSONALIZATION STATUS
4758 @code
4759 #include <ITapiSim.h>
4760 #include <stdio.h>
4761 #include "TapiCommon.h"
4762
4763 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
4764 //  OPERATION REQUEST GET NETWORK PERSONALIZATION PART
4765 void get_net_pers()
4766 {
4767         int err_code;
4768         TelSimLockType_t type = TAPI_SIM_LOCK_PN; // Set locktype for which facility should be disabled;
4769
4770         err_code = tel_get_sim_facility(handle, type, on_resp_get_sim_facility, user_data);
4771         if (err_code != TAPI_API_SUCCESS)
4772         {
4773                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4774         }
4775         // WAIT EVENT RESPONSE FROM HERE
4776 }
4777
4778 //RESPONSE PART
4779 //CALLBACK FUNCTION TO BE USED
4780 static void on_resp_get_sim_facility(TapiHandle *handle, int result, void *data, void *user_data)
4781 {
4782         TelSimPinOperationResult_t sec_rt = result;
4783         TelSimFacilityInfo_t *fi = data;
4784
4785         printf("sec_rt[%d]", sec_rt);
4786         printf("fi->type[%d]", fi->type);
4787         printf("fi->f_status[%d]", fi->f_status);
4788 }
4789 @endcode
4790
4791 SAMPLE CODE: ENABLE/DISABLE PERSONALIZATION
4792 @code
4793 #include <ITapiSim.h>
4794 #include <stdio.h>
4795 #include "TapiCommon.h"
4796
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()
4801 {
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");
4805
4806         int err_code;
4807         TelSimFacilityPw_t *fc_pw;
4808         int length = TAPI_SIM_PIN_LENGTH+1;
4809         char init_pin_val[length] ;
4810
4811         strcpy(init_pin_val, PIN1_NORMAL);
4812
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);
4815
4816         printf("pw_len[%d]", fc_pw.pw_len);
4817
4818         fc_pw.pw = (char*)malloc(length);
4819          memcpy(fc_pw.pw,init_pin_val,length);
4820
4821         err_code = tel_enable_sim_facility(handle, fc_pw, on_resp_sim_facility_op, user_data);
4822
4823         if (err_code != TAPI_API_SUCCESS)
4824         {
4825                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4826         }
4827         // WAIT EVENT RESPONSE FROM HERE
4828 }
4829
4830 //  OPERATION REQUEST DISABLING NETWORK PERSONALIZATION PART
4831 #define NET_DISCODE "12345678" //Sample Network Personalization code
4832 void disable_net_pers()
4833 {
4834         printf("de Personalisation key is 8 byte \n");
4835         printf("We need to use this for testing : 12345678\n");
4836
4837         int err_code;
4838         TelSimFacilityPw_t *fc_pw;
4839         int length = TAPI_SIM_PIN_LENGTH+1;
4840         char init_pin_val[length] ;
4841
4842         strcpy(init_pin_val, PIN1_NORMAL);
4843
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);
4846
4847         printf("pw_len[%d]", fc_pw.pw_len);
4848
4849         fc_pw.pw = (char*)malloc(length);
4850         memcpy(fc_pw.pw,init_pin_val,length);
4851
4852         err_code = tel_disable_sim_facility(handle, fc_pw, on_resp_sim_facility_op, user_data);
4853         if (err_code != TAPI_API_SUCCESS)
4854         {
4855                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4856         }
4857         // WAIT EVENT RESPONSE FROM HERE
4858 }
4859
4860 //RESPONSE PART
4861 //CALLBACK FUNCTION TO BE USED
4862 static void on_resp_sim_facility_op(TapiHandle *handle, int result, void *data, void *user_data)
4863 {
4864         TelSimPinOperationResult_t sec_rt = result;
4865         TelSimFacilityResult_t *f_rt = data;
4866
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);
4870 }
4871
4872 @endcode
4873 @}
4874 @defgroup Use_Cases6_4 FDN
4875 @ingroup Use_Cases6_SIM
4876 @{
4877
4878
4879                 <h3 class="pg">FDN</h3>
4880 These APIs are used to enable/disable FDN and to retrieve the current FDN status.
4881
4882 @code
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);
4886
4887 @endcode
4888
4889 SAMPLE CODE
4890 @code
4891 #include <ITapiSim.h>
4892 #include <stdio.h>
4893 #include "TapiCommon.h"
4894
4895 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
4896
4897 //  OPERATION REQUEST ENABLE FDN MODE PART
4898 #define PIN2_NORMAL "0000" //Sample PIN2 code
4899 void enable_fdn()
4900 {
4901         int api_ret;
4902         TelSimFacilityPw_t *fc_pw;
4903         int length = TAPI_SIM_PIN_LENGTH+1;
4904         char init_pin_val[length] ;
4905
4906         strcpy(init_pin_val, PIN1_NORMAL);
4907
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);
4910
4911         printf("pw_len[%d]", fc_pw.pw_len);
4912
4913         fc_pw.pw = (char*)malloc(length);
4914         memcpy(fc_pw.pw,init_pin_val,length);
4915
4916         err_code = tel_enable_sim_facility(handle, fc_pw, on_resp_sim_facility_op, user_data);
4917         if (err_code != TAPI_API_SUCCESS)
4918         {
4919                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4920         }
4921         // WAIT FOR EVENT FROM HERE
4922 }
4923
4924
4925 //  OPERATION REQUEST DISABLE FDN MODE PART
4926 #define PIN2_NORMAL "0000" //Sample PIN2 code
4927 void disable_fdn()
4928 {
4929         int api_ret;
4930         TelSimFacilityPw_t *fc_pw;
4931         int length = TAPI_SIM_PIN_LENGTH+1;
4932         char init_pin_val[length] ;
4933
4934         strcpy(init_pin_val, PIN1_NORMAL);
4935
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);
4938
4939         printf("pw_len[%d]", fc_pw.pw_len);
4940
4941         fc_pw.pw = (char*)malloc(length);
4942         memcpy(fc_pw.pw,init_pin_val,length);
4943
4944         err_code = tel_disable_sim_facility(handle, fc_pw, on_resp_sim_facility_op, user_data);
4945
4946         if (err_code != TAPI_API_SUCCESS)
4947         {
4948                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4949         }
4950         // WAIT FOR EVENT FROM HERE
4951
4952
4953         //RESPONSE PART
4954         //CALLBACK FUNCTION TO BE USED
4955         static void on_resp_disable_sim_facility(TapiHandle *handle, int result, void *data, void *user_data)
4956         {
4957                 TelSimPinOperationResult_t sec_rt = result;
4958                 TelSimFacilityResult_t *f_rt = data;
4959
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);
4963         }
4964
4965         //  OPERATION REQUEST GET FDN STATUS PART
4966         void get_fdn_status()
4967         {
4968                 printf("Get FDN status");
4969                 TelSimLockType_t type = TAPI_SIM_LOCK_SC; // Set locktype for which facility should be disabled;
4970
4971                 err_code = tel_get_sim_facility(handle, type, on_resp_get_sim_facility, user_data);
4972
4973                 err_code = tel_get_sim_facility(handle, type, on_resp_get_sim_facility, user_data);
4974                 if (err_code == TAPI_API_SUCCESS)
4975                 {
4976                         if (fdn_status == 0)
4977                         {
4978                                 printf("*************************");
4979                                 printf("FDN disabled ");
4980                                 printf("*************************");
4981                         }
4982                         else
4983                         {
4984                                 printf("*************************");
4985                                 printf("FDN enabled");
4986                                 printf("*************************");
4987                         }
4988                 }
4989                 else
4990                 {
4991                         printf("TAPI API FAIL: Error Code [0x%x]", err_code);
4992                 }
4993
4994         }
4995 @endcode
4996 @}
4997 @defgroup Use_Cases6_5 IMSI Information
4998 @ingroup Use_Cases6_SIM
4999 @{
5000
5001
5002                 <h3 class="pg">IMSI Information</h3>
5003 This API retrieves the IMSI (International Mobile Subscriber Identity) information.
5004
5005 @code
5006 int tel_get_sim_imsi(TelSimImsiInfo_t* imsi);
5007 @endcode
5008
5009 SAMPLE CODE:
5010 @code
5011 #include <ITapiSim.h>
5012 #include <stdio.h>
5013 #include "TapiCommon.h"
5014
5015 void getimsiInfo()
5016 {
5017         int err_code;
5018         TelSimImsiInfo_t sim_imsi_info;
5019
5020         err_code = tel_get_sim_imsi(handle, &sim_imsi_info);
5021         if (err_code == TAPI_API_SUCCESS)
5022         {
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);
5027         }
5028         else
5029         {
5030                 // printf("Error Code [%x]\n", err_code);
5031         }
5032 }
5033 @endcode
5034 @}
5035 @defgroup Use_Cases6_6 ECC Information
5036 @ingroup Use_Cases6_SIM
5037 @{
5038
5039
5040                 <h3 class="pg">ECC Information</h3>
5041 This API retreieves the ECC (Emergency Call Codes) data.
5042
5043 @code
5044 int tel_get_sim_ecc(TelSimEccData_t *ecc_data, int *ecc_count);
5045 @endcode
5046
5047 SAMPLE CODE:
5048 @code
5049 #include <ITapiSim.h>
5050 #include <stdio.h>
5051 #include "TapiCommon.h"
5052
5053 void geteccinfo()
5054 {
5055         int err_code;
5056         TelSimEccList_t ecc_info = {0}; // Get ECC list info and ecc_count
5057         err_code = tel_get_sim_ecc(handle, &ecc_info);
5058
5059         printf("The Retrun Status is %d", err_code);
5060
5061         printf(" ECC count [%d]\n", ecc_info.ecc_rec_count);
5062 }
5063
5064 void get_uecc()
5065 {
5066         int err_code;
5067         int i = 0;
5068
5069         printf(" Get USIM ECC  ");
5070
5071         TelSimEccList_t uecc_info = {{{0,}}};
5072
5073         err_code = tel_get_sim_ecc(handle, &uecc_info);
5074         if (err_code == TAPI_API_SUCCESS)
5075         {
5076                 printf("ECC count [%d]", uecc_info.uecc_rec_count );
5077
5078                 for (i=0; i<uecc_info.uecc_rec_count; i++)
5079                 {
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);
5083
5084                         if (NULL != uecc_info.UeccInfo[i].szEcc)
5085                         {
5086                                 printf("ECC string [%s]", uecc_info.UeccInfo[i].szEcc);
5087                         }
5088                         else
5089                         {
5090                                 printf("ECC string [null]");
5091                         }
5092
5093                         printf("ECC alphaID [%s]",uecc_info.UeccInfo[i].szEccAlphaIdentifier);
5094                 }
5095         }
5096         else
5097         {
5098                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5099         }
5100 }
5101 @endcode
5102 @}
5103 @defgroup Use_Cases6_7 Language Preference Information
5104 @ingroup Use_Cases6_SIM
5105 @{
5106
5107
5108                 <h3 class="pg">Language Preference Information</h3>
5109 These APIs are used to get and set the language preference information stored in SIM.
5110
5111 @code
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);
5114 @endcode
5115
5116 SAMPLE CODE: GET SIM LANGUAGE
5117 @code
5118 #include <ITapiSim.h>
5119 #include <stdio.h>
5120 #include "TapiCommon.h"
5121
5122 void getlanguageprefinfo()
5123 {
5124         int err_code;
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
5128
5129         err_code = tel_get_sim_language(handle, on_resp_getlanguage, user_data);
5130         printf("Error Code [%x]\n", err_code);
5131
5132         for (i =0; i<li_info.LpCount; i++)
5133                 printf(" LI[%d] --> Val  [%d]\n", i, li_info.Lp[i]);
5134 }
5135 @endcode
5136
5137 SAMPLE CODE: UPDATE SIM LANGUAGE
5138 @code
5139 #include <ITapiSim.h>
5140 #include <stdio.h>
5141 #include "TapiCommon.h"
5142
5143 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
5144 //  OPERATION REQUEST UPDATE SIM LANGUAGE PART
5145 void setlanguageprefinfo()
5146 {
5147         int err_code;
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);
5154
5155         if (err_code != TAPI_API_SUCCESS)
5156         {
5157                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5158         }
5159         // WAIT EVENT RESPONSE FROM HERE
5160 }
5161
5162
5163 //RESPONSE PART
5164 //CALLBACK FUNCTION TO BE USED
5165 static void on_resp_getlanguage(TapiHandle *handle, int result, void *data, void *user_data)
5166 {
5167         TelSimLanguagePreferenceCode_t *language = data;
5168         TelSimAccessResult_t access_rt = result;
5169
5170         printf("access rt[%d]", access_rt);
5171         printf("language[%d]", *language);
5172 }
5173 static void on_resp_setlanguage(TapiHandle *handle, int result, void *data, void *user_data)
5174 {
5175         TelSimAccessResult_t access_rt = result;
5176
5177         printf("access_rt[%d]", access_rt);
5178 }
5179 @endcode
5180 @}
5181 @defgroup Use_Cases6_8 Getting Card Type
5182 @ingroup Use_Cases6_SIM
5183 @{
5184
5185
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.
5188
5189 @code
5190 int tel_get_sim_type(TelSimCardType_t *card_type);
5191 @endcode
5192
5193 SAMPLE CODE:
5194 @code
5195 #include <ITapiSim.h>
5196 #include <stdio.h>
5197 #include "TapiCommon.h"
5198
5199 void getcardtype()
5200 {
5201         int err_code;
5202         TelSimCardType_t cardInfo; //unkwon, sim(normally gsm), usim(normally umts)
5203         TapiHandle *handle;  // Handle given by tel_init()
5204
5205         err_code = tel_get_sim_type(handle, &cardInfo);
5206
5207         printf("card type is %d\n", cardInfo);
5208 }
5209 @endcode
5210 @}
5211 @defgroup Use_Cases6_9  Getting SIM Card Initialization Status
5212 @ingroup Use_Cases6_SIM
5213 @{
5214
5215
5216                 <h3 class="pg">Getting SIM Card Initialization Status</h3>
5217 API is a synchronous API which gets the Card Init status and Identification.
5218
5219 @code
5220 int tel_get_sim_init_info(TelSimCardStatus_t *sim_status, int *card_changed);
5221 @endcode
5222
5223 SAMPLE CODE:
5224 @code
5225 #include <ITapiSim.h>
5226 #include <stdio.h>
5227 #include "TapiCommon.h"
5228
5229 //  OPERATION REQUEST GET CARD INIT STATUS PART
5230 void get_sim_init_status()
5231 {
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()
5236
5237         // GET SIM INIT INFORMATION
5238         err_code = tel_get_sim_init_info(handle, &status, &b_card_changed);
5239
5240         if (err_code == TAPI_API_SUCCESS)
5241         {
5242                 printf("**********************************************");
5243                 printf("CardStatus:[0x%x]",status);
5244                 printf("b_card_changed[%d]\n",b_card_changed);
5245                 printf("**********************************************");
5246         }
5247         else
5248         {
5249                 printf("TAPI Fail: Error Code [%d]\n", err_code);
5250         }
5251 }
5252 @endcode
5253 @}
5254 @defgroup Use_Cases6_10 SIM ACCESS COMMANDS Interface
5255 @ingroup Use_Cases6_SIM
5256 @{
5257
5258
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.
5261
5262 @code
5263 int tel_req_sim_access(const TelSimRSimReq_t *rsim_data, int *req_id);
5264 @endcode
5265
5266 SAMPLE CODE: EF HANDLING ( SELECT-FILE INFO)
5267 @code
5268 #include <ITapiSim.h>
5269 #include <stdio.h>
5270 #include "TapiCommon.h"
5271
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()
5275 {
5276         int err_code;
5277         void *user_data = NULL; // Set User data
5278
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
5282
5283         err_code = tel_req_sim_access(handle, &rsim_data, user_data);
5284         if (err_code != TAPI_API_SUCCESS)
5285         {
5286                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5287         }
5288         // WAIT EVENT RESPONSE FROM HERE
5289 }
5290 @endcode
5291 @}
5292 @defgroup Use_Cases6_11 SIM Mailbox EF management
5293 @ingroup Use_Cases6_SIM
5294 @{
5295
5296
5297                 <h3 class="pg">SIM Mailbox EF management</h3>
5298 These APIs are used to get and update the mailbox information stored in SIM.
5299
5300 @code
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);
5303 @endcode
5304
5305 SAMPLE CODE: READ / UPDATE MAILBOX INFO
5306 @code
5307 #include <ITapiSim.h>
5308 #include <stdio.h>
5309 #include "TapiCommon.h"
5310
5311 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
5312
5313 void get_sim_mailbox()
5314 {
5315         int err_code = 0;
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");
5323                 } else {
5324                   printf("Current SIM is not CPHS but 3GPP");
5325                 }
5326         } else {
5327                 printf("TAPI API FAIL: Error Code [0x%x]",err_code);
5328         }
5329
5330 }
5331 //  OPERATION REQUEST UPDATE SIM MAILBOX INFO PART
5332 void update_sim_mailbox()
5333 {
5334         int err_code = 0;
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);
5340
5341         if (err_code != TAPI_API_SUCCESS)
5342         {
5343                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5344         }
5345         // WAIT EVENT RESPONSE FROM HERE
5346 }
5347
5348 //RESPONSE PART
5349 //CALLBACK FUNCTION TO BE USED
5350 static void on_resp_get_sim_mailbox(TapiHandle *handle, int result, void *data, void *user_data)
5351 {
5352         TelSimAccessResult_t access_rt = result;
5353         TelSimMailboxList_t *list = data;
5354         int i = 0;
5355
5356         printf("access_rt[%d]", access_rt);
5357         printf("count[%d]", list->count);
5358
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);
5372         }
5373 }
5374
5375 static void on_resp_set_sim_mailbox(TapiHandle *handle, int result, void *data, void *user_data)
5376 {
5377         TelSimAccessResult_t access_rt = result;
5378
5379         printf("access_rt[%d]", access_rt);
5380 }
5381 @endcode
5382 @}
5383 @defgroup Use_Cases6_12 SIM Indication Status EFs management
5384 @ingroup Use_Cases6_SIM
5385 @{
5386
5387
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.
5390
5391 @code
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);
5394 @endcode
5395
5396 SAMPLE CODE:  READ / UPDATE INDICATION STATUS DATA
5397 @code
5398 #include <ITapiSim.h>
5399 #include <stdio.h>
5400 #include "TapiCommon.h"
5401
5402 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
5403
5404 //  OPERATION REQUEST READ SIM MESSAGE WAITING INDICATION STATUS INFO PART
5405 void read_sim_mwis()
5406 {
5407         int err_code = 0;
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");
5415                 } else {
5416                   printf("Current SIM is not CPHS but 3GPP");
5417                 }
5418         } else {
5419                 printf("TAPI API FAIL: Error Code [0x%x]",err_code);
5420         }
5421
5422 }
5423
5424 //  OPERATION REQUEST UPDATE SIM MESSAGE WAITING INDICATION STATUS INFO PART
5425 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
5426
5427 void update_sim_mwis()
5428 {
5429         TelSimMessageWaiting_s mw_data;
5430         int err_code = 0;
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);
5436
5437         if (err_code != TAPI_API_SUCCESS)
5438         {
5439                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5440         }
5441         // WAIT EVENT RESPONSE FROM HERE
5442 }
5443
5444
5445 //RESPONSE PART
5446 //CALLBACK FUNCTION TO BE USED
5447 static void on_resp_get_sim_mwis(TapiHandle *handle, int result, void *data, void *user_data)
5448 {
5449         TelSimAccessResult_t access_rt = result;
5450         TelSimMessageWaitingResp_t *mw = data;
5451         int i = 0;
5452
5453         printf("access_rt[%d]", access_rt);
5454         printf("mw->b_cphs[%d]", mw->b_cphs);
5455
5456         if (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);
5461         }
5462         else {
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);
5478                 }
5479         }
5480
5481 }
5482
5483 static void on_resp_set_sim_mwis(TapiHandle *handle, int result, void *data, void *user_data)
5484 {
5485         TelSimAccessResult_t access_rt = result;
5486         printf("access_rt[%d]", access_rt);
5487 }
5488
5489 @endcode
5490 @}
5491 @defgroup Use_Cases6_13 Phone Book
5492 @ingroup Use_Cases6_SIM
5493 @{
5494
5495
5496                 <h3 class="pg">Phone Book</h3>
5497 <strong>[Note] Telephony Emulator does not support this feature.</strong>
5498
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.
5500
5501 @code
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);
5509 @endcode
5510
5511 SAMPLE CODE FOR GETTING STORAGE COUNT
5512 @code
5513 #include <ITapiSim.h>
5514 #include <stdio.h>
5515 #include "TapiCommon.h"
5516
5517 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
5518 void getstoragecount()
5519 {
5520         int ret_status;
5521         TelSimPbType_t StorageFileType = TAPI_SIM_PB_3GSIM;
5522         int pRequestId = 0;
5523         TapiHandle *handle;
5524
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");
5528         else
5529                 printf("error=%d\n", ret_status);
5530 }
5531 //WAIT FOR EVENT HERE
5532
5533 //CALLBACK FUNCTION TO BE USED
5534 static void on_resp_get_sim_pb_count (TapiHandle *handle, int result, void *data, void *user_data)
5535 {
5536         TelSimPbAccessResult_t access_rt = result;
5537         TelSimPbStorageInfo_t *ps = data;
5538
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]);
5544                 } else {
5545                         printf("StorageFileType[%d]", ps->StorageFileType);
5546                 }
5547                 printf("TotalRecordCount[%d]", ps->TotalRecordCount);
5548                 printf("UsedRecordCount[%d]", ps->UsedRecordCount);
5549         }
5550 }
5551 @endcode
5552
5553 SAMPLE CODE TO GET PHONE BOOK ENTRY INFO
5554 @code
5555 #include <ITapiSim.h>
5556 #include <stdio.h>
5557 #include "TapiCommon.h"
5558
5559 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
5560 void getPBEntryInfo()
5561 {
5562         int ret_status;
5563         TelSimPbType_t StorageFileType = TAPI_SIM_PB_FDN;
5564         int pRequestId = 0;
5565         TapiHandle *handle;
5566
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);
5570         else
5571                 printf(error=%d\n, ret_status);
5572         //WAIT FOR EVENT HERE
5573 }
5574
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)
5577 {
5578         TelSimPbAccessResult_t access_rt = result;
5579         TelSimPbEntryInfo_t *pe = data;
5580
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]);
5586                 } else {
5587                         printf("StorageFileType[%d]", pe->StorageFileType);
5588                 }
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);
5594         }
5595
5596 }
5597 @endcode
5598
5599 SAMPLE CODE TO GET USIM ENTRY INFO AND CAPABILITY INFO
5600 @code
5601 #include <ITapiSim.h>
5602 #include <stdio.h>
5603 #include "TapiCommon.h"
5604
5605 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
5606 void getPBCapabilityInfo()
5607 {
5608         int ret_status;
5609         int pRequestId = 0;
5610         TapiHandle *handle;
5611
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);
5615         else
5616                 printf(error=%d\n, ret_status);
5617         //WAIT FOR EVENT HERE
5618 }
5619
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)
5622 {
5623         TelSimPbAccessResult_t access_rt = result;
5624         TelSimPbCapabilityInfo_t *capa = data;
5625         int i = 0;
5626
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]);
5633                         } else {
5634                                 printf("capa->FileTypeInfo[%d].field_type[%d]", i, capa->FileTypeInfo[i].field_type);
5635                         }
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);
5639                 }
5640         }
5641
5642 }
5643 @endcode
5644
5645 SAMPLE CODE FOR READING RECORD
5646 @code
5647 #include <ITapiSim.h>
5648 #include <stdio.h>
5649 #include "TapiCommon.h"
5650
5651 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
5652 void simreadrecord()
5653 {
5654         int ret_status;
5655         TelSimPbType_t StorageFileType = TAPI_SIM_PB_FDN;
5656         unsigned short Index = 4;
5657         int pRequestId = 0;
5658         TapiHandle *handle;
5659
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);
5663         else
5664                 printf(error=%d\n, ret_status);
5665 }
5666 //WAIT FOR EVENT HERE
5667
5668 //CALLBACK FUNCTION TO BE USED
5669 static void on_resp_read_sim_pb_record (TapiHandle *handle, int result, void *data, void *user_data)
5670 {
5671         TelSimPbAccessResult_t access_rt = result;
5672         TelSimPbRecord_t *pr = data;
5673
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]);
5679                 } else {
5680                         printf("phonebook_type[%d]", pr->phonebook_type);
5681                 }
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]);
5687                 } else {
5688                         printf("dcs[%d]", pr->dcs);
5689                 }
5690                 printf("number[%s]", pr->number);
5691
5692                 if(pr->ton <= TAPI_SIM_TON_RESERVED_FOR_EXT) {
5693                         printf("ton[%d][%s]", pr->ton, dbg_pb_ton_name[pr->ton]);
5694                 } else {
5695                         printf("ton[%d]", pr->ton);
5696                 }
5697
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]);
5702                         } else {
5703                                 printf("anr1_ton[%d]", pr->anr1_ton);
5704                         }
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]);
5708                         } else {
5709                                 printf("anr2_ton[%d]", pr->anr2_ton);
5710                         }
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]);
5714                         } else {
5715                                 printf("anr3_ton[%d]", pr->anr3_ton);
5716                         }
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);
5723                 }
5724         }
5725
5726 }
5727 @endcode
5728
5729 SAMPLE CODE FOR UPDATING RECORD
5730 @code
5731 #include <ITapiSim.h>
5732 #include <stdio.h>
5733 #include "TapiCommon.h"
5734
5735 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
5736 void simupdaterecord()
5737 {
5738         int ret_status;
5739         TelSimPbRecord_t pb_add;
5740         int pRequestId = 0;
5741         TapiHandle *handle;
5742
5743         pb_add.StorageFileType = TAPI_SIM_PB_3GSIM;
5744         pb_add.Index  = 1;
5745         pb_add.NextIndex  = 0;
5746
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);
5750         else
5751                 printf(error=%d\n, ret_status);
5752 }
5753 //WAIT FOR EVENT HERE
5754
5755 //CALLBACK FUNCTION TO BE USED
5756 static void on_resp_update_sim_pb_record(TapiHandle *handle, int result, void *data, void *user_data)
5757 {
5758         TelSimPbAccessResult_t access_rt = result;
5759
5760         printf("on_pb_update_sim_pb_record received");
5761         printf("access_rt[%d]", access_rt);
5762 }
5763 @endcode
5764
5765 SAMPLE CODE FOR DELETING RECORD
5766 @code
5767 #include <ITapiSim.h>
5768 #include <stdio.h>
5769 #include "TapiCommon.h"
5770
5771 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
5772 void contactdelete()
5773 {
5774         int ret_status;
5775         TapiHandle *handle;
5776         TelSimPbType_t StorageFileType = TAPI_SIM_PB_3GSIM;
5777         unsigned short RecordIndex = 1;
5778         int pRequestId = 0;
5779
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);
5783         else
5784                 printf(error=%d\n, ret_status);
5785         //WAIT FOR EVENT HERE
5786 }
5787
5788 //CALLBACK FUNCTION TO BE USED
5789 static void on_resp_delete_sim_pb_record(TapiHandle *handle, int result, void *data, void *user_data)
5790 {
5791         TelSimPbAccessResult_t access_rt = result;
5792
5793         printf("on_pb_delete_sim_pb_record received");
5794         printf("access_rt[%d]", access_rt);
5795
5796 }
5797 @endcode
5798
5799 SAMPLE CODE FOR GETTING PHONEBOOK INIT INFO
5800 @code
5801 #include <ITapiSim.h>
5802 #include <stdio.h>
5803 #include "TapiCommon.h"
5804
5805 //  OPERATION REQUEST GET SIM PHONEBOOK INIT STATUS PART
5806 void get_sim_phonebook_init_status()
5807 {
5808         TapiHandle *handle;
5809         TelSimPbList_t pb_list;
5810         int pPbInitCompleted = 0;
5811
5812         err_code = tel_get_sim_pb_init_info(handle, &pPbInitCompleted, &pb_list);
5813         if (err_code == TAPI_API_SUCCESS)
5814         {
5815                 if (pPbInitCompleted == 0)
5816                 {
5817                         printf(" SIM PB INIT NOT completed ");
5818                 }
5819                 else
5820                 {
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);
5833                 }
5834         }
5835         else
5836         {
5837                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5838         }
5839 }
5840 @endcode
5841 @}
5842 @defgroup Use_Cases6_14 Getting 3G Phone Book Information
5843 @ingroup Use_Cases6_SIM
5844 @{
5845
5846
5847                 <h3 class="pg">Getting 3G Phone Book Information</h3>
5848 <strong>[Note] Telephony Emulator does not support this feature.</strong>
5849
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.
5851
5852 @code
5853 int tel_get_sim_pb_3g_meta_info(int *req_id);
5854 @endcode
5855
5856 SAMPLE CODE:
5857 @code
5858 #include <ITapiSim.h>
5859 #include <stdio.h>
5860 #include "TapiCommon.h"
5861
5862 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
5863 void get3gcapainfo()
5864 {
5865         int ret_status;
5866         int req_id = 0;
5867
5868         ret_status = tel_get_sim_pb_3g_meta_info (&req_id);
5869 }
5870 //WAIT FOR EVENT HERE
5871
5872 //CALLBACK FUNCTION TO BE USED
5873 static void app_callback (TelTapiEvent_t *event)
5874 {
5875         int eventClass;
5876         int eventType;
5877         int requestId, i;
5878         int status;
5879         void* EventData = NULL;
5880
5881         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
5882
5883         unsigned int temp_handle = -1;
5884         //
5885         eventClass = event->EventClass;
5886         eventType = event->EventType;
5887         requestId = event->RequestId;
5888         status = event->Status;
5889         EventData = event->pData;
5890
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;
5895                         int i;
5896                         for (i=0; i<sim_capability_info->FileTypeCount; i++)
5897                         {
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);
5902                         }
5903                         break;
5904                         //...
5905         }
5906 }
5907 @endcode
5908
5909 @}
5910 @defgroup Use_Cases6_15 SAP (Sim access Profile) features
5911 @ingroup Use_Cases6_SIM
5912 @{
5913
5914                 <h3 class="pg">SAP (Sim access Profile) features</h3>
5915 <strong>[Note] Telephony Emulator does not support this feature.</strong>
5916
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.
5918
5919 The SIM Access Profile specifies the following features:
5920 - Connection Management
5921 - Transfer APDU
5922 - Transfer ATR
5923 - Power SIM off/on
5924 - Transfer Card Reader Status
5925 - Set Transport Protocol
5926
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.
5930
5931 @code
5932 int tel_req_sap_connection( TelSimSapConnect_t *req_data, int *req_id);
5933 int tel_req_sap_connection_status( int *req_id);
5934 @endcode
5935
5936 SAMPLE CODE:
5937 @code
5938 #include <ITapiSim.h>
5939 #include <stdio.h>
5940 #include "TapiCommon.h"
5941 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
5942 void sapconnectreq()
5943 {
5944         int ret_status;
5945         TelSimSapConnect_t pConnectionReq;
5946         int pRequestId = 0;
5947
5948         pConnectionReq.MsgId = TAPI_SIM_SAP_CONNECT_REQ;
5949         pConnectionReq.MaxMsgSize = 10; //temp for testing only - not clear
5950
5951         ret_status = tel_req_sap_connection (&pConnectionReq, &pRequestId);
5952         if (ret_status == TAPI_API_SUCCESS)
5953                 printf("successful\n");
5954         else
5955                 printf("error=%d\n", ret_status);
5956 }
5957 //WAIT FOR EVENT HERE
5958
5959 //CALLBACK FUNCTION TO BE USED
5960 static void app_callback (TelTapiEvent_t *event)
5961 {
5962         int eventClass;
5963         int eventType;
5964         int requestId;
5965         int status;
5966         void* EventData = NULL;
5967
5968         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
5969
5970         unsigned int temp_handle = -1;
5971         //
5972         eventClass = event->EventClass;
5973         eventType = event->EventType;
5974         requestId = event->RequestId;
5975         status = event->Status;
5976         EventData = event->pData;
5977
5978         switch (eventType)
5979         {
5980                 case TAPI_SIM_EVENT_SAP_CONNECT_CNF:
5981                         printf("TAPI_SIM_EVENT_SAP_CONNECT_CNF");
5982                         break;
5983                         //...
5984         }
5985 }
5986
5987 //GET STATUS
5988 void sapconnectstatusreq()
5989 {
5990         int request_id = 0;
5991         int ret_status = tel_req_sap_connection_status (&request_id);
5992         if (ret_status == TAPI_API_SUCCESS)
5993                 printf("successful\n");
5994         else
5995                 printf("error=%d\n", ret_status);
5996 }
5997 //WAIT FOR EVENT HERE
5998
5999 //CALLBACK FUNCTION TO BE USED
6000
6001 static void app_callback (TelTapiEvent_t *event)
6002 {
6003         int eventClass;
6004         int eventType;
6005         int requestId;
6006         int status;
6007         void* EventData = NULL;
6008
6009         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6010
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;
6017
6018         switch (eventType)
6019         {
6020                 case TAPI_SIM_EVENT_SAP_CONNECT_STATUS_CNF:
6021                         printf("TAPI_SIM_EVENT_SAP_CONNECT_STATUS_CNF");
6022                         break;
6023                         //...
6024         }
6025 }
6026 @endcode
6027
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.
6031
6032 @code
6033 int tel_req_sap_transfer_apdu(TelSimSapApduData_t *apdu_data, int *req_id);
6034 @endcode
6035
6036 SAMPLE CODE:
6037 @code
6038 #include <ITapiSim.h>
6039 #include <stdio.h>
6040 #include "TapiCommon.h"
6041
6042 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
6043 void saptransferapdu()
6044 {
6045         int err_code;
6046         int file_id = TAPI_SIM_EFILE_ICCID;
6047
6048         // for selecting EF ICCID
6049         TelSimSapApduData_t apdu_data;
6050         int pRequestId = 0;
6051
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
6058
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");
6063         else
6064                 printf("error=%d\n", err_code);
6065 }
6066 //WAIT FOR EVENT HERE
6067 //CALLBACK FUNCTION TO BE USED
6068 static void app_callback (TelTapiEvent_t *event)
6069 {
6070         int eventClass;
6071         int eventType;
6072         int requestId;
6073         int status;
6074         void* EventData = NULL;
6075
6076         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6077
6078         unsigned int temp_handle = -1;
6079         //...
6080         eventClass = event->EventClass;
6081         eventType = event->EventType;
6082         requestId = event->RequestId;
6083         status = event->Status;
6084         EventData = event->pData;
6085
6086         switch (eventType)
6087         {
6088                 case TAPI_SIM_EVENT_SAP_TRANSFER_APDU_CNF:
6089                         printf("TAPI_SIM_EVENT_SAP_TRANSFER_APDU_CNF");
6090                         break;
6091         }//...
6092 }
6093 @endcode
6094
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.
6097
6098 @code
6099 int tel_req_sap_transfer_atr( int *req_id);
6100 @endcode
6101
6102 SAMPLE CODE
6103 @code
6104 #include <ITapiSim.h>
6105 #include <stdio.h>
6106 #include "TapiCommon.h"
6107
6108 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
6109 void saptransferatrreq()
6110 {
6111         int ret_status;
6112         int pRequestId = 0;
6113
6114         ret_status = tel_req_sap_transfer_atr (&pRequestId);
6115         if (ret_status == TAPI_API_SUCCESS)
6116                 printf("successful\n");
6117         else
6118                 printf("error=%d\n", ret_status);
6119 }
6120 //WAIT FOR EVENT HERE
6121
6122 //CALLBACK FUNCTION TO BE USED
6123 static void app_callback (TelTapiEvent_t *event)
6124 {
6125         int eventClass;
6126         int eventType;
6127         int requestId;
6128         int status;
6129         void* EventData = NULL;
6130
6131         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6132
6133         unsigned int temp_handle = -1;
6134         //...
6135         eventClass = event->EventClass;
6136         eventType = event->EventType;
6137         requestId = event->RequestId;
6138         status = event->Status;
6139         EventData = event->pData;
6140
6141         switch (eventType)
6142         {
6143                 case TAPI_SIM_EVENT_SAP_TRANSFER_ATR_CNF:
6144                         printf("TAPI_SIM_EVENT_SAP_TRANSFER_ATR_CNF");
6145                         break;
6146                         //...
6147         }
6148 }
6149 @endcode
6150
6151 <h4>Power sim on/off:</h4>
6152 The ability to power the subscription module on/off remotely.
6153
6154 @code
6155 int tel_req_sap_power_operation(TelSimSapMsgId_t req_data, int *req_id );
6156 @endcode
6157
6158 SAMPLE CODE
6159 @code
6160 #include <ITapiSim.h>
6161 #include <stdio.h>
6162 #include "TapiCommon.h"
6163
6164 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
6165 void sapsetpower()
6166 {
6167         int ret_status;
6168         TelSimSapMsgId_t MsgId = TAPI_SIM_SAP_CONNECT_REQ;
6169         int pRequestId = 0;
6170
6171         ret_status = tel_req_sap_power_operation (MsgId, &pRequestId);
6172         if (ret_status == TAPI_API_SUCCESS)
6173                 printf("successful\n");
6174         else
6175                 printf("error=%d\n", ret_status);
6176 }
6177 //WAIT FOR EVENT HERE
6178
6179 //CALLBACK FUNCTION TO BE USED
6180 static void app_callback (TelTapiEvent_t *event)
6181 {
6182         int eventClass;
6183         int eventType;
6184         int requestId;
6185         int status;
6186         void* EventData = NULL;
6187
6188         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6189
6190         unsigned int temp_handle = -1;
6191         //...
6192         eventClass = event->EventClass;
6193         eventType = event->EventType;
6194         requestId = event->RequestId;
6195         status = event->Status;
6196         EventData = event->pData;
6197
6198
6199         switch (EventType)
6200         {
6201                 case TAPI_SIM_EVENT_SAP_SET_SIM_POWER_CNF:
6202                         printf("TAPI_SIM_EVENT_SAP_SET_SIM_POWER_CNF");
6203                         break;
6204                         //...
6205         }
6206 }
6207 @endcode
6208
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).
6211
6212 @code
6213 int tel_req_sap_cardreader_status(int *req_id);
6214 @endcode
6215
6216 SAMPLE CODE
6217 @code
6218 #include <ITapiSim.h>
6219 #include <stdio.h>
6220 #include "TapiCommon.h"
6221
6222 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
6223 void simsapcardreaderstatus()
6224 {
6225         int ret_status;
6226         int pRequestId = 0;
6227
6228         ret_status = tel_req_sap_cardreader_status (&pRequestId);
6229         if (ret_status == TAPI_API_SUCCESS)
6230                 printf("successful\n");
6231         else
6232                 printf("error=%d\n", ret_status);
6233 }
6234 //WAIT FOR EVENT HERE
6235
6236 //CALLBACK FUNCTION TO BE USED
6237 static void app_callback (TelTapiEvent_t *event)
6238 {
6239         int eventClass;
6240         int eventType;
6241         int requestId;
6242         int status;
6243         void* EventData = NULL;
6244
6245         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6246
6247         unsigned int temp_handle = -1;
6248         //
6249         eventClass = event->EventClass;
6250         eventType = event->EventType;
6251         requestId = event->RequestId;
6252         status = event->Status;
6253         EventData = event->pData;
6254
6255
6256         switch (eventType)
6257         {
6258                 case TAPI_SIM_EVENT_SAP_CARD_READER_STATUS_CNF:
6259                         printf("TAPI_SIM_EVENT_SAP_CARD_READER_STATUS_CNF");
6260                         break;
6261                         //...
6262         }
6263 }
6264 @endcode
6265
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.
6268
6269 @code
6270 int tel_req_sap_transport_protocol(TelSimSapProtocol_t protocol, int *req_id);
6271 @endcode
6272
6273 SAMPLE CODE
6274 @code
6275 #include <ITapiSim.h>
6276 #include <stdio.h>
6277 #include "TapiCommon.h"
6278
6279 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
6280 void sapsettransportprotocol()
6281 {
6282         int ret_status;
6283         TelSimSapProtocol_t Protocol = TAPI_SIM_SAP_PROTOCOL_T0;
6284         int pRequestId = 0;
6285
6286         ret_status = tel_req_sap_transport_protocol (Protocol, &pRequestId);
6287         if (ret_status == TAPI_API_SUCCESS)
6288                 printf("successful\n");
6289         else
6290                 printf("error=%d\n", ret_status);
6291 }
6292 //WAIT FOR EVENT HERE
6293
6294 //CALLBACK FUNCTION TO BE USED
6295 static void app_callback (TelTapiEvent_t *event)
6296 {
6297         int eventClass;
6298         int eventType;
6299         int requestId;
6300         int status;
6301         void* EventData = NULL;
6302
6303         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6304
6305         unsigned int temp_handle = -1;
6306         //...
6307         eventClass = event->EventClass;
6308         eventType = event->EventType;
6309         requestId = event->RequestId;
6310         status = event->Status;
6311         EventData = event->pData;
6312
6313         switch (EventType)
6314         {
6315                 case TAPI_SIM_EVENT_SAP_SET_PROTOCOL_CNF:
6316                         printf("TAPI_SIM_EVENT_SAP_SET_PROTOCOL_CNF");
6317                         break;
6318                         //...
6319         }
6320 }
6321 @endcode
6322 @}
6323 @defgroup Use_Cases6_16 ISIM Features
6324 @ingroup Use_Cases6_SIM
6325 @{
6326
6327
6328                 <h3 class="pg">ISIM Features</h3>
6329 <strong>[Note] Telephony Emulator does not support this feature.</strong>
6330
6331 @code
6332 int tel_req_sim_authentication( TelSimAuthenticationData_t *authentication_data, int *req_id);
6333 @endcode
6334
6335 Application uses this API to send the ISIM authentication request to telephony.
6336
6337 SAMPLE CODE
6338 @code
6339 #include <ITapiSim.h>
6340 #include <stdio.h>
6341 #include "TapiCommon.h"
6342
6343 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
6344 void isimauthreq()
6345 {
6346         int ret_status;
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";
6352         int pRequestId = 0;
6353
6354         ret_status = tel_req_sim_authentication (&authenticationData, &pRequestId);
6355         if (ret_status == TAPI_API_SUCCESS)
6356                 printf("successful\n");
6357         else
6358                 printf("error=%d\n", ret_status);
6359 }
6360 //WAIT FOR EVENT HERE
6361
6362 //CALLBACK FUNCTION TO BE USED
6363 static void app_callback (TelTapiEvent_t *event)
6364 {
6365         int eventClass;
6366         int eventType;
6367         int requestId;
6368         int status;
6369         void* EventData = NULL;
6370
6371         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6372
6373         unsigned int temp_handle = -1;
6374         //...
6375         eventClass = event->EventClass;
6376         eventType = event->EventType;
6377         requestId = event->RequestId;
6378         status = event->Status;
6379         EventData = event->pData;
6380
6381         switch (EventType)
6382         {
6383                 case TAPI_EVENT_SIM_AUTHENTICATION_CNF:
6384                         printf("TAPI_EVENT_SIM_AUTHENTICATION_CNF");
6385                         break;
6386                         //...
6387         }
6388 }
6389 @endcode
6390 @}
6391 @defgroup Use_Cases6_17 SIM NOTIFICATION MESSAGE
6392 @ingroup Use_Cases6_SIM
6393 @{
6394
6395
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:
6398 @code
6399 TAPI_EVENT_SIM_STATUS_IND
6400 TAPI_EVENT_SIM_FDN_STATUS_IND
6401 @endcode
6402
6403 Application uses this event as follows.
6404 SAMPLE CODE
6405 @code
6406 #include <ITapiSim.h>
6407 #include <stdio.h>
6408 #include "TapiCommon.h"
6409
6410 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
6411
6412 //CALLBACK FUNCTION TO BE USED
6413 static void app_callback (TelTapiEvent_t *event)
6414 {
6415         int eventClass;
6416         int eventType;
6417         int requestId;
6418         int status;
6419         void* EventData = NULL;
6420
6421         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6422
6423         unsigned int temp_handle = -1;
6424         //...
6425         eventClass = event->EventClass;
6426         eventType = event->EventType;
6427         requestId = event->RequestId;
6428         status = event->Status;
6429         EventData = event->pData;
6430
6431         switch (EventType)
6432         {
6433                 case TAPI_EVENT_SIM_STATUS_IND:
6434                         printf("***********TAPI_EVENT_SIM_STATUS_IND**************");
6435
6436                         if (status == TAPI_SIM_STATUS_CARD_ERROR)
6437                         {
6438                                 printf("SIM CARD ERROR");
6439                         }
6440                         else if (status == TAPI_SIM_STATUS_CARD_NOT_PRESENT)
6441                         {
6442                                 printf("SIM CARD NOT INSERTED");
6443                         }
6444                         else if (status == TAPI_SIM_STATUS_SIM_INITIALIZING)
6445                         {
6446                                 printf("SIM INITITIALIZING");
6447                         }
6448                         else if (status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED)
6449                         {
6450                                 printf("SIM INIT COMPLETED");
6451                         }
6452                         else if (status == TAPI_SIM_STATUS_SIM_PIN_REQUIRED)
6453                         {
6454                                 printf("SIM PIN REQUIRED");
6455                         }
6456                         else if (status == TAPI_SIM_STATUS_SIM_PUK_REQUIRED)
6457                         {
6458                                 printf("SIM PUK REQUIRED");
6459                         }
6460                         else if (status == TAPI_SIM_STATUS_CARD_BLOCKED)
6461                         {
6462                                 printf("SIM CARD BLOCKED");
6463                         }
6464                         printf("********************************************");
6465                         break;
6466
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("********************************************");
6471                         break;
6472                         //...
6473         }
6474 }
6475 @endcode
6476 @}
6477
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.
6481
6482 @defgroup Use_Cases7_1 Event Register and Deregister
6483 @ingroup Use_Cases7_SOUND
6484 @{
6485
6486
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.
6489
6490 SAMPLE CODE:
6491 @code
6492 // REGISTER EVENT
6493 unsigned int subscription_id = 0;
6494 int api_err;
6495
6496 api_err = tel_init ();
6497 if (api_err != TAPI_API_SUCCESS)
6498 {
6499         TEST_DEBUG("tel_init Failed - api_err = %d \n", api_err);
6500 }
6501
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);
6504
6505 tel_register_app_name("com.samsung.appname");
6506
6507 // DEREGISTER EVENT
6508 api_err = tel_deregister_event (subscription_id);
6509 if (api_err != TAPI_API_SUCCESS)
6510 {
6511         printf("Event Class Deregestration Fail\n");
6512 }
6513 @endcode
6514
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.
6516 @}
6517 @defgroup Use_Cases7_2 Voice path control
6518 @ingroup Use_Cases7_SOUND
6519 @{
6520
6521
6522                 <h3 class="pg">Voice path control</h3>
6523 This API provides an interface for controlling voice path via application.
6524
6525 @code
6526 int tel_set_sound_path (tapi_sound_audio_path_t  vc_path, int *pRequestId);
6527 @endcode
6528
6529 <strong>This API is permitted for Samsung in-house applications only</strong>
6530 @}
6531 @defgroup Use_Cases7_3 Volume control
6532 @ingroup Use_Cases7_SOUND
6533 @{
6534
6535
6536                 <h3 class="pg">Volume control</h3>
6537 These APIs provide interfaces for controlling volume via application.
6538
6539 @code
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);
6542 @endcode
6543
6544 <strong>This API is permitted for Samsung in-house applications only</strong>
6545 @}
6546 @defgroup Use_Cases7_4 Mic mute control
6547 @ingroup Use_Cases7_SOUND
6548 @{
6549
6550
6551                 <h3 class="pg">Mic mute control</h3>
6552 This API provides an interface for mute/unmute mic via application.
6553
6554 @code
6555 int  tel_set_sound_mute_status(tapi_sound_mic_mute_t micmute_set, int * pRequestId);
6556 @endcode
6557
6558 <strong>This API is permitted for Samsung in-house applications only</strong>
6559
6560 SAMPLE CODE
6561 @code
6562 #include <stdio.h>
6563 #include <TapiCommon.h>
6564 #include <ITapiSound.h>
6565
6566 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
6567
6568 //VOLUME CONTROL
6569 void vol_controlset()
6570 {
6571         int ret_val;
6572         int requestId = -1;
6573         tapi_sound_volume_control_t vol_control;
6574
6575         vol_control.volume = TAPI_SOUND_VOLUME_LEVEL_3;
6576         vol_control.vol_type = TAPI_SOUND_VOL_VOICE;
6577
6578         ret_val = tel_set_sound_volume_info(vol_control, &requestId);
6579         if (ret_val == TAPI_API_SUCCESS)
6580                 printf("successful\n");
6581         else
6582                 printf("error=%d\n", ret_val);
6583         //WAIT FOR EVENT HERE
6584 }
6585 void vol_controlget()
6586 {
6587         int ret_val;
6588         int requestId = -1;
6589         api_sound_volume_type_t vol_type;
6590         vol_type = TAPI_SOUND_VOL_VOICE;
6591
6592         ret_val = tel_get_sound_volume_info (vol_type, &requestId);
6593         if (ret_val == TAPI_API_SUCCESS)
6594                 printf("successful\n");
6595         else
6596                 printf("error=%d\n", ret_val);
6597         //WAIT FOR EVENT HERE
6598 }
6599
6600 //VOICE PATH AND USER CONFIGURATION
6601 void voicepathset()
6602 {
6603         int ret_val;
6604         int requestId = -1;
6605
6606         tapi_sound_audio_path_t vc_path;
6607         //VOICE PATH
6608         vc_path = TAPI_SOUND_HANDSET;
6609
6610         ret_val = tel_set_sound_path (vc_path, &requestId);
6611         if (ret_val == TAPI_API_SUCCESS)
6612                 printf("successful\n");
6613         else
6614                 printf("error=%d\n", ret_status);
6615         //WAIT FOR EVENT HERE
6616 }
6617
6618
6619 //USER CONFIGURATION
6620 void usr_configset()
6621 {
6622         int ret_val;
6623         Int requestId = -1;
6624         tapi_sound_user_sound_mask_t snd_mask;
6625         tapi_sound_user_sound_value_t snd_value;
6626
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");
6633         else
6634                 printf("error=%d\n", ret_status);
6635         //WAIT FOR EVENT HERE
6636 }
6637
6638 void usr_configget()
6639 {
6640         int ret_val;
6641         tapi_sound_user_sound_mask_t snd_mask;
6642
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");
6648         else
6649                 printf("error=%d\n", ret_status);
6650         //WAIT FOR EVENT HERE
6651 }
6652
6653 //MIC MUTE CONT\ROL
6654 void micmute_controlset()
6655 {
6656         int ret_val;
6657         tapi_sound_mic_mute_t set_micmute;
6658
6659         set_micmute = TAPI_SOUND_MIC_MUTE;
6660
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");
6665         else
6666                 printf("error=%d\n", ret_status);
6667         //WAIT FOR EVENT HERE
6668 }
6669
6670
6671 //CALL BACK TO BE USED
6672 static void app_callback (TelTapiEvent_t *event)
6673 {
6674         int eventClass;
6675         int eventType;
6676         int requestId;
6677         int status;
6678         void* EventData = NULL;
6679
6680         unsigned int temp_handle = -1;
6681         //
6682         eventClass = event->EventClass;
6683         eventType = event->EventType;
6684         requestId = event->RequestId;
6685         status = event->Status;
6686         EventData = event->pData;
6687
6688         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
6689
6690         if (status != 0)
6691         {
6692                 //TEST_DEBUG("******This is nonzero status. ******\n");
6693                 return;
6694         }
6695
6696
6697         switch (eventClass)
6698         {
6699                 case TAPI_EVENT_CLASS_SOUND:
6700                         switch (eventType)
6701                         {
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;
6705                                         int index;
6706
6707                                         memcpy(&vlm_ctrl_info, event->pData,
6708                                                         sizeof(tapi_sound_volumn_ctrl_res));
6709                                         break;
6710
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);
6716                                         break;
6717
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);
6722                                         break;
6723
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);
6728                                         break;
6729
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);
6733
6734                                         printf("***  TAPI_EVENT_SOUND_MICMUTECTRL_RSP received : %x ****\n", eventType);
6735                                         break;
6736
6737                                 default:
6738                                         printf("***  Default Event  %x ****\n", eventType);
6739                                         break;
6740                         }
6741                         //...
6742                         break;
6743
6744                 default:
6745                         printf("*** Other TAPI EVENT received : class : %x ****\n", eventClass);
6746                         break;
6747         }
6748 }
6749 @endcode
6750 @}
6751
6752
6753         <h2 class="pg">SAT (SIM Application Toolkit)</h2>
6754 @defgroup Use_Cases8_1 Event register and deregister
6755 @ingroup Use_Cases8_SAT
6756 @{
6757
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.
6760
6761 SAMPLE CODE
6762 @code
6763 // REGISTER EVENT
6764 unsigned int subscription_id = 0;
6765 int api_err;
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
6770
6771 api_err = tel_init();
6772 if (api_err != TAPI_API_SUCCESS)
6773 {
6774         TEST_DEBUG("tel_init Failed - api_err = %d \n", api_err);
6775 }
6776
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);
6779
6780 tel_register_app_name("com.samsung.appname");
6781
6782 // DEREGISTER EVENT
6783 api_err = tel_deregister_noti_event(handle, noti_id);
6784 if (api_err != TAPI_API_SUCCESS)
6785 {
6786         printf("Event Class Unregeration Fail\n");
6787 }
6788
6789 api_err = tel_deinit();
6790 if (api_err != TAPI_API_SUCCESS)
6791 {
6792         printf("tel_deinit Fail\n");
6793 }
6794
6795 static void on_noti_sat(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
6796 {
6797         //CALL BACK FUNTION TO BE CALLED
6798         switch (noti_id)
6799         {
6800                 case TAPI_EVENT_SAT_DISPLAY_TEXT_IND:
6801                         TelSatDisplayTextInd_t *event_data;
6802                         event_data = (TelSatDisplayTextInd_t*)event->pData;
6803                         break;
6804                 case TAPI_EVENT_SAT_GET_INKEY_IND:
6805                         TelSatGetInkeyIndInfo_t *event_data;
6806                         event_data = (TelSatGetInkeyIndInfo_t *)event->pData;
6807                         break;
6808                 case TAPI_EVENT_SAT_GET_INPUT_IND:
6809                         TelSatGetInputInd_t *event_data;
6810                         event_data = (TelSatGetInputInd_t *)event->pData;
6811                         break;
6812
6813                 case TAPI_EVENT_SAT_UI_PLAY_TONE_IND:
6814                         TelSatPlayToneInd_t *event_data;
6815                         event_data = (TelSatPlayToneInd_t *)event->pData;
6816                         break;
6817
6818                 case TAPI_EVENT_SAT_PLAY_TONE_IND:
6819                         TelSatPlayToneInd_t *event_data;
6820                         event_data = (TelSatPlayToneInd_t *)event->pData;
6821                         break;
6822
6823                 case TAPI_EVENT_SAT_UI_REFRESH_IND:
6824                         TelSatRefreshIndUiInfo_t *event_data;
6825                         event_data = (TelSatRefreshIndUiInfo_t *)event->pData;
6826                         break;
6827
6828                 case TAPI_EVENT_SAT_SETUP_MENU_IND:
6829                         TelSatSetupMenuInfo_t *event_data;
6830                         event_data = (TelSatSetupMenuInfo_t *)event->pData;
6831                         break;
6832
6833                 case TAPI_EVENT_SAT_UI_SETUP_MENU_IND:
6834                         TelSatSetupMenuInfo_t *event_data;
6835                         event_data = (TelSatSetupMenuInfo_t *)event->pData;
6836                         break;
6837
6838                 case TAPI_EVENT_SAT_SELECT_ITEM_IND:
6839                         TelSatSelectItemInd_t *event_data;
6840                         event_data = (TelSatSelectItemInd_t *)event->pData;
6841                         break;
6842
6843                 case TAPI_EVENT_SAT_UI_SEND_SMS_IND:
6844                         TelSatSendSmsIndUiInfo_t *event_data;
6845                         event_data = (TelSatSendSmsIndUiInfo_t *)event->pData;
6846                         break;
6847
6848                 case TAPI_EVENT_SAT_UI_SEND_SS_IND:
6849                         TelSatSendSsIndUiInfo_t *event_data;
6850                         event_data = (TelSatSendSsIndUiInfo_t *)event->pData;
6851                         break;
6852
6853                 case TAPI_EVENT_SAT_UI_SEND_USSD_IND:
6854                         TelSatSendUssdIndUiInfo_t *event_data;
6855                         event_data = (TelSatSendUssdIndUiInfo_t *)event->pData;
6856                         break;
6857
6858                 case TAPI_EVENT_SAT_UI_SETUP_CALL_IND:
6859                         TelSatSetupCallIndUiInfo_t *event_data;
6860                         event_data = (TelSatSetupCallIndUiInfo_t *)event->pData;
6861                         break;
6862
6863                 case TAPI_EVENT_SAT_PROVIDE_LOCAL_INFO_IND:
6864                         TelSatProvideLocalInfoInd_t *event_data;
6865                         event_data = (TelSatProvideLocalInfoInd_t *)event->pData;
6866                         break;
6867
6868                 case TAPI_EVENT_SAT_SETUP_IDLE_MODE_TEXT_IND:
6869                         TelSatSetupIdleModeTextInd_t *event_data;
6870                         event_data = (TelSatSetupIdleModeTextInd_t *)event->pData;
6871                         break;
6872
6873                 case TAPI_EVENT_SAT_UI_SEND_DTMF_IND:
6874                         TelSatSendDtmfIndUiInfo_t *event_data;
6875                         event_data = (TelSatSendDtmfIndUiInfo_t *)event->pData;
6876                         break;
6877
6878                 case TAPI_EVENT_SAT_LANGUAGE_NOTIFICATION_IND:
6879                         TelSatLanguageNotiInfoInd_t *event_data;
6880                         event_data = (TelSatLanguageNotiInfoInd_t *)event->pData;
6881                         break;
6882
6883                 case TAPI_EVENT_SAT_UI_LAUNCH_BROWSER_IND:
6884                         TelSatLaunchBrowserIndUiInfo_t *event_data;
6885                         event_data = (TelSatLaunchBrowserIndUiInfo_t *)event->pData;
6886                         break;
6887
6888                 case TAPI_EVENT_SAT_END_PROACTIVE_SESSION_IND:
6889                         TelSatEndProactiveSessionIndInfo_t *event_data;
6890                         event_data = (TelSatEndProactiveSessionIndInfo_t *)event->pData;
6891                         break;
6892
6893                 case TAPI_EVENT_SAT_MENU_SELECTION_CNF:
6894                         TelSatEnvelopeResp_t *event_data;
6895                         event_data = (TelSatEnvelopeResp_t *)event->pData;
6896                         break;
6897
6898                 case TAPI_EVENT_SAT_CALL_CONTROL_IND:
6899                         TelSatCallCtrlIndData_t *event_data;
6900                         event_data = (TelSatCallCtrlIndData_t *)event->pData;
6901                         break;
6902
6903                 case TAPI_EVENT_SAT_MO_SMS_CONTROL_IND:
6904                         TelSatMoSmCtrlIndData_t *event_data;
6905                         event_data = (TelSatMoSmCtrlIndData_t *)event->pData;
6906                         break;
6907
6908                 case TAPI_EVENT_SAT_EVENT_DOWNLOAD_CNF:
6909                         TelSatEnvelopeResp_t *event_data;
6910                         event_data = (TelSatEnvelopeResp_t *)event->pData;
6911                         break;
6912
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;
6918                         break;
6919
6920                 case TAPI_EVENT_SAT_SEND_SMS_IND:
6921                         TelSatSendSmsIndSmsData_t *event_data;
6922                         event_data = (TelSatSendSmsIndSmsData_t *)event->pData;
6923                         break;
6924
6925                 case TAPI_EVENT_SAT_SETUP_CALL_IND:
6926                         TelSatSetupCallIndCallData_t *event_data;
6927                         event_data = (TelSatSetupCallIndCallData_t *)event->pData;
6928                         break;
6929
6930                 case TAPI_EVENT_SAT_SEND_SS_IND:
6931                         TelSatSendSsIndSsData_t *event_data;
6932                         event_data = (TelSatSendSsIndSsData_t *)event->pData;
6933                         break;
6934
6935                 case TAPI_EVENT_SAT_SEND_USSD_IND:
6936                         TelSatSendUssdIndUssdData_t *event_data;
6937                         event_data = (TelSatSendUssdIndUssdData_t *)event->pData;
6938                         break;
6939
6940                 case TAPI_EVENT_SAT_SEND_DTMF_IND:
6941                         TelSatSendDtmfIndDtmfData_t *event_data;
6942                         event_data = (TelSatSendDtmfIndDtmfData_t *)event->pData;
6943                         break;
6944
6945                 case TAPI_EVENT_SAT_LAUNCH_BROWSER_IND:
6946                         TelSatLaunchBrowserIndBrowserData_t *event_data;
6947                         event_data = (TelSatLaunchBrowserIndBrowserData_t *)event->pData;
6948                         break;
6949
6950                 case TAPI_EVENT_SAT_END_OF_APP_EXEC_IND:
6951                         TelSatProactiveCmdEndIndInfo_t *event_data;
6952                         event_data = (TelSatProactiveCmdEndIndInfo_t *)event->pData;
6953                         break;
6954
6955                 default:
6956                         break;
6957         }
6958 }
6959 @endcode
6960 @}
6961 @defgroup Use_Cases8_2 Main Menu Information
6962 @ingroup Use_Cases8_SAT
6963 @{
6964
6965
6966                 <h3 class="pg">Main Menu Information</h3>
6967 <strong>[Note] Telephony Emulator does not support this feature.</strong>
6968
6969 Telephony provides APIs for retreiving SAT Main Menu Information.
6970
6971 <strong>This API is permitted for Samsung in-house applications only</strong>
6972
6973 @code
6974 int tel_get_sat_main_menu_info(TelSatSetupMenuInfo_t* pMainMenu)
6975 @endcode
6976
6977 SAMPLE CODE:
6978 @code
6979 //SAT MAIN MENU INFORMATION
6980 #include <stdio.h>
6981 #include <TapiCommon.h>
6982 #include <ITapiSat.h>
6983
6984 void mainmenuinformation()
6985 {
6986         int i = 0;
6987         int ReturnStatus;
6988         TapiHandle *handle;  // Handle given by tel_init()
6989         TelSatSetupMenuInfo_t SatMainMenuInfo;
6990
6991         ReturnStatus = tel_get_sat_main_menu_info(handle, &SatMainMenuInfo);
6992         if (ReturnStatus == TAPI_API_SUCCESS)
6993         {
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]);
7000         }
7001         else
7002                 printf("ReturnStatus =%d\n", ReturnStatus);
7003 }
7004 @endcode
7005 @}
7006 @defgroup Use_Cases8_3 Envelope Commands
7007 @ingroup Use_Cases8_SAT
7008 @{
7009
7010
7011                 <h3 class="pg">Envelope Commands</h3>
7012 <strong>[Note] Telephony Emulator does not support this feature.</strong>
7013
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)
7015
7016 <strong>These APIs are permitted for Samsung in-house applications only</strong>
7017
7018 @code
7019 int tel_select_sat_menu(TelSatMenuSelectionReqInfo_t* pMenuSelect, int* pRequestId);
7020 int tel_download_sat_event(TelSatEventDownloadReqInfo_t*  pEventData, int* pRequestId);
7021 @endcode
7022
7023 SAMPLE CODE:
7024 @code
7025 //MENU SELECTION ENVELOPE
7026 #include <stdio.h>
7027 #include <TapiCommon.h>
7028 #include <ITapiSat.h>
7029
7030 //Precondition
7031 //SUBSCRIBE TO SAT EVENT(TAPI_EVENT_SAT_MENU_SELECTION_CNF) AS MENTIONED IN //Event Register and Deregister
7032
7033 void satmenuselectionenvelope()
7034 {
7035         int ReturnStatus;
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
7040
7041         SatMenuSelect.itemIdentifier = 1;
7042         SatMenuSelect.bIsHelpRequested = FALSE;
7043
7044         ReturnStatus = tel_select_sat_menu(handle, &SatMenuSelect, on_resp_sat_select_menu, user_data);
7045         if (ReturnStatus != TAPI_API_SUCCESS)
7046         {
7047                 printf("ReturnStatus =%d\n", ReturnStatus);
7048         }
7049         else
7050         {
7051                 //WAIT FOR TAPI_EVENT_SAT_MENU_SELECTION_CNF EVENT HERE
7052         }
7053 }
7054
7055 //CALLBACK FUNCTION TO BE USED
7056 static void on_resp_sat_select_menu(TapiHandle *handle, int result, void *data, void *user_data)
7057 {
7058         printf("select menu item result(%d)", result);
7059
7060 }
7061 @endcode
7062
7063 @code
7064 //EVENT DOWNLOAD ENVELOPE
7065 #include <stdio.h>
7066 #include <TapiCommon.h>
7067 #include <ITapiSat.h>
7068
7069
7070 //Precondition
7071 //SUBSCRIBE TO SAT EVENT(TAPI_EVENT_SAT_EVENT_DOWNLOAD_CNF) AS MENTIONED IN //Event Register and Deregister
7072 void eventdownloadenvelope()
7073 {
7074         int ReturnStatus;
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
7079
7080         SatEventData.eventDownloadType = TAPI_EVENT_SAT_DW_TYPE_IDLE_SCREEN_AVAILABLE;
7081
7082         SatEventData.u.bIdleScreenAvailable = TRUE;
7083
7084         ReturnStatus = tel_download_sat_event(handle, &SatEventData, on_resp_sat_download_event, user_data);
7085         if (ReturnStatus != TAPI_API_SUCCESS)
7086         {
7087                 printf("ReturnStatus =%d\n", ReturnStatus);
7088         }
7089         else
7090         {
7091                 //WAIT FOR TAPI_EVENT_SAT_EVENT_DOWNLOAD_CNF EVENT HERE
7092         }
7093 }
7094
7095 //CALLBACK FUNCTION TO BE USED
7096 static void on_resp_sat_download_event(TapiHandle *handle, int result, void *data, void *user_data)
7097 {
7098         printf("select menu item result(%d)", result);
7099 }
7100 @endcode
7101 @}
7102 @defgroup Use_Cases8_4 Application Execution result
7103 @ingroup Use_Cases8_SAT
7104 @{
7105
7106
7107                 <h3 class="pg">Application Execution result</h3>
7108 <strong>[Note] Telephony Emulator does not support this feature.</strong>
7109
7110 Telephony provides this API to get the Application execution result.
7111
7112 <strong>This API is permitted for Samsung in-house applications only</strong>
7113
7114 @code
7115 Int tel_send_sat_app_exec_result(TelSatAppsRetInfo_t* pAppRetInfo);
7116 @endcode
7117
7118 SAMPLE CODE:
7119 @code
7120 //SAT MAIN MENU TITLE
7121 #include <stdio.h>
7122 #include <TapiCommon.h>
7123 #include <ITapiSat.h>
7124
7125 void sendappexecutionresult()
7126 {
7127         int ReturnStatus;
7128         TapiHandle *handle;  // Handle given by tel_init()
7129         TelSatAppsRetInfo_t SatAppRetInfo;
7130
7131         SatAppRetInfo.commandType = TAPI_SAT_CMD_TYPE_SETUP_IDLE_MODE_TEXT;
7132         SatAppRetInfo.appsRet.setupIdleModeText.resp = TAPI_SAT_R_SUCCESS;
7133
7134         ReturnStatus = tel_send_sat_app_exec_result(handle, &SatAppRetInfo);
7135         if (ReturnStatus == TAPI_API_SUCCESS)
7136         {
7137                 printf(" Sending Application Execution Result Successful \n");
7138         }
7139         else
7140                 printf("ReturnStatus =%d\n", ReturnStatus);
7141 }
7142 @endcode
7143 @}
7144 @defgroup Use_Cases8_5  UI /User Confirmation
7145 @ingroup Use_Cases8_SAT
7146 @{
7147
7148
7149                 <h3 class="pg">UI /User Confirmation </h3>
7150 <strong>[Note] Telephony Emulator does not support this feature.</strong>
7151
7152 Send user's confirmation message to the USIM application
7153
7154 <strong>These APIs are permitted for Samsung in-house applications only</strong>
7155
7156 @code
7157 int tel_send_sat_ui_display_status(int commandId, TelSatUiDisplayStatusType_t status);
7158 int tel_send_sat_ui_user_confirm(TelSatUiUserConfirmInfo_t * pUserConfirmData) ;
7159 @endcode
7160
7161 SAMPLE CODE:
7162 @code
7163 //UI DISPLAY STATUS
7164 #include <stdio.h>
7165 #include <TapiCommon.h>
7166 #include <ITapiSat.h>
7167
7168 void senduidisplaystatus()
7169 {
7170         int ReturnStatus;
7171         TapiHandle *handle;
7172         TelSatUiDisplayStatusType_t DisplatStatus;
7173         int CommandId;
7174
7175         DisplatStatus = TAPI_SAT_DISPLAY_SUCCESS;
7176         CommandId = commandId; //Command Id of the Proactive Command
7177
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");
7181         else
7182                 printf("ReturnStatus =%d\n", ReturnStatus);
7183 }
7184 @endcode
7185
7186 @code
7187 //USER CONFIRMATION
7188 #include <stdio.h>
7189 #include <TapiCommon.h>
7190 #include <ITapiSat.h>
7191
7192 void senduiuserconfirm()
7193 {
7194         int ReturnStatus;
7195         TapiHandle *handle;  // Handle given by tel_init()
7196         TelSatUiUserConfirmInfo_t UserConfirmData;
7197
7198         UserConfirmData.commandId = commandId ; //Command Id of the Proactive Command
7199
7200         UserConfirmData.commandType = TAPI_SAT_CMD_TYPE_PLAY_TONE;
7201         UserConfirmData.keyType = TAPI_SAT_USER_CONFIRM_YES;
7202
7203         UserConfirmData.pAdditionalData = NULL;
7204         UserConfirmData.dataLen = 0;
7205
7206         ReturnStatus = tel_send_sat_ui_user_confirm(handle, &UserConfirmData);
7207         if (ReturnStatus == TAPI_API_SUCCESS)
7208                 printf(" Sending User Confirmation Data Successful \n");
7209         else
7210                 printf("ReturnStatus =%d\n", ReturnStatus);
7211 }
7212 @endcode
7213 @}
7214
7215 @defgroup Appendixes1 Appendix A. Sample Codes
7216 @ingroup Appendix
7217 @{
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
7221
7222 How to use supplementary service APIs and handle SS events
7223 @code
7224 #include <ITapiSs.h>
7225 #include <TapiEvent.h>
7226 #include <TapiCommon.h>
7227 #include <TelUtility.h>
7228
7229 GMainLoop *nw_context_loop = NULL;
7230
7231 typedef struct
7232 {
7233         int group;
7234         int type;
7235         int len;
7236         void *dst;
7237 } data_t;
7238
7239 static int SS_Callback(int eventClass, int eventType, void * param2)
7240 {
7241         int i;
7242         printf ("\n\n\n SS_Callback is called! eventClass : %d\n, eventType : %d\n", eventClass, eventType);
7243         fflush(stdout);
7244         switch (eventType)
7245         {
7246                 case TAPI_EVENT_SS_REL_COMP_MSG_NOTIFY:
7247                         if (param2 != NULL) {
7248                                 int x = 0;
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");
7253
7254                                 for (x=0; x<rel_comp_msg.RelCompMsgLen; x++)
7255                                 {
7256                                         printf("[%.2x]", rel_comp_msg.szRelCompMsg[x]);
7257                                 }
7258                         }// end if
7259                         break;
7260
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");
7265                         }
7266                         else {
7267                                 TelSsInfo_t SsInfo;
7268                                 memcpy(&SsInfo, (TelSsInfo_t*)param2, sizeof(TelSsInfo_t));
7269                                 for (i=0; i<SsInfo.NumberOfRecords; i++)
7270                                 {
7271                                         printf("Number of records %d \n", SsInfo.NumberOfRecords);
7272                                         printf("Record:%d Status:%d Teleservice:%d \n",
7273                                                         i,
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");
7278                                         else
7279                                                 printf("####     Status: Not Active   #### \n");
7280                                 } //end for
7281                         }//end else
7282                         break;
7283
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");
7288                                 break;
7289                         }
7290                         TelSsInfo_t SsInfo;
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",
7295                                                 i,
7296                                                 SsInfo.SsRecord.WaitingRecord.rec_class[i].Status,
7297                                                 SsInfo.SsRecord.WaitingRecord.rec_class[i].TeleCommService);
7298
7299                                 if (SsInfo.SsRecord.WaitingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
7300                                         printf("####    Status: Active      #### \n");
7301                                 else
7302                                         printf("####     Status: Not Active   #### \n");
7303                         }//end for
7304                         break;
7305
7306                 case TAPI_EVENT_SS_BARRING_QUERYSTATUS_CNF:
7307                         printf("####    Received Event :TAPI_EVENT_SS_BARRING_QUERYSTATUS_CNF  ##### \n");
7308                         break;
7309
7310                 case TAPI_EVENT_SS_BARRING_CNF:
7311                         printf("####    Received Event :TAPI_EVENT_SS_BARRING_CNF   ##### \n");
7312                         break;
7313
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");
7317                         break;
7318
7319                 case TAPI_EVENT_SS_FORWARD_CNF:
7320                         printf("####    Received Event :TAPI_EVENT_SS_FORWARD_CNF  ##### \n");
7321                         if (param2 != NULL) {
7322                                 TelSsInfo_t SsInfo;
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++)
7327                                 {
7328                                         printf("Number of records %d\n", SsInfo.NumberOfRecords);
7329                                         printf("Record:%d Status:%d Teleservice:%d \n",
7330                                                         i,
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");
7337                                         else
7338                                                 printf("####    Status: Not Registered /Not Active     ####\n");
7339                                 }//end for
7340                         }
7341                         else
7342                         {
7343                                 printf("param2 is NULL\n");
7344                         }
7345                         break;
7346
7347                 case TAPI_EVENT_SS_FORWARD_QUERYSTATUS_CNF:
7348                         printf("####    Received Event : TAPI_EVENT_SS_FORWARD_QUERYSTATUS_CNF  ##### \n");
7349                         if (param2 != NULL) {
7350                                 TelSsInfo_t SsInfo;
7351                                 memcpy(&SsInfo, (TelSsInfo_t*)param2, sizeof(TelSsInfo_t));
7352                                 for (i=0; i<SsInfo.NumberOfRecords; i++)
7353                                 {
7354                                         printf("Number of records %d \n", SsInfo.NumberOfRecords);
7355                                         printf("Record:%d Status:%d Teleservice:%d \n",
7356                                                         i,
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");
7363                                         else
7364                                                 printf("####    Status: Not Registered /Not Active     #### \n");
7365                                 }//end for
7366                         }//end if
7367                         else
7368                         {
7369                                 printf("param 2 is NULL\n");
7370                         }
7371                         break;
7372
7373                 case TAPI_EVENT_SS_CLI_QUERYSTATUS_CNF:
7374                         printf("####    Received Event : TAPI_EVENT_SS_IDENTIFY_IND #### \n");
7375                         if (param2 != NULL) {
7376                                 TelSsInfo_t SsInfo;
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");
7393                         }
7394                         else
7395                         {
7396                                 printf("param 2 is NULL\n");
7397                         }
7398                         break;
7399
7400                 default:
7401                         printf("\n\nDID NOT GET THE EVENT\n");
7402                         break;
7403         }//end switch
7404         g_main_loop_quit(nw_context_loop);
7405         return 0;
7406 }//end call back
7407
7408 static void app_callback (TelTapiEvent_t *event)
7409 {
7410         int eventClass;
7411         int eventType;
7412         int requestId;
7413         int status;
7414         void* EventData = NULL;
7415
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 );
7422         if (status != 0)
7423         {
7424                 //TEST_DEBUG("******This is nonzero status. ******\n");
7425                 return;
7426         }
7427         SS_Callback((int)eventClass, (int)eventType, EventData);
7428 }
7429
7430 ss_test_subscribe_tapi_events()
7431 {
7432         //REGISTER EVENT
7433         unsigned int subscription_id = 0;
7434         TapiResult_t api_err;
7435
7436         api_err = TelTapiInit();
7437         if (api_err != TAPI_API_SUCCESS)
7438         {
7439                 printf("TelTapiInit Failed - api_err = %d \n", api_err);
7440         }
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);
7443         fflush(stdout);
7444 }
7445
7446 noti_finish()
7447 {
7448         //DEREGISTER EVENT
7449         unsigned int subscription_id = 0;
7450         TapiResult_t api_err;
7451
7452         api_err = tel_deregister_event(subscription_id);
7453         if (api_err != TAPI_API_SUCCESS)
7454         {
7455                 printf("Event Class Unregeration Fail\n");
7456         }
7457 }
7458
7459 tapi_ss_call_barr()
7460 {
7461         TapiResult_t ret_status;
7462         TelSsCallBarringInfo_t pBarringInfo;
7463         int pRequestId = 0;
7464         char *bar_pwd = "0000";
7465
7466         printf("Before copying ,,,length is %d\n", strlen(pBarringInfo.szPassword));
7467         printf("len initially is %d\n", strlen(bar_pwd));
7468
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) {
7476                 return;
7477         }
7478
7479         nw_context_loop = g_main_loop_new(NULL, FALSE);
7480         g_main_loop_run(nw_context_loop);
7481
7482
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) {
7488                 return ;
7489         }
7490
7491         nw_context_loop = g_main_loop_new(NULL, FALSE);
7492         g_main_loop_run(nw_context_loop);
7493 }
7494
7495 tapi_ss_call_fwd()
7496 {
7497         TapiResult_t ret_status;
7498         TelSsForwardInfo_t pForwardInfo;
7499         int len;
7500         int pRequestId = 0;
7501         char *cf_number = "9986529874";
7502
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;
7507
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) {
7513                 return ;
7514         }
7515
7516         nw_context_loop = g_main_loop_new(NULL, FALSE);
7517         g_main_loop_run(nw_context_loop);
7518
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;
7522
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) {
7526                 return ;
7527         }
7528
7529         nw_context_loop = g_main_loop_new(NULL, FALSE);
7530         g_main_loop_run(nw_context_loop);
7531 }
7532
7533 tapi_ss_call_wait()
7534 {
7535         //set and get call waiting
7536         TapiResult_t ret_status;
7537         TelSsWaitingInfo_t waitInfo;
7538         int RequestID;
7539
7540         waitInfo.Mode = TAPI_SS_CW_ACTIVATE;
7541         waitInfo.CallType = TAPI_CALL_TYPE_VOICE_EV;
7542
7543         //set call wait
7544         ret_status = tel_set_ss_waiting(&waitInfo, &RequestID);
7545         if (ret_status != TAPI_API_SUCCESS) {
7546                 return;
7547         }
7548
7549         nw_context_loop = g_main_loop_new(NULL, FALSE);
7550         g_main_loop_run(nw_context_loop);
7551
7552         sleep(4);
7553
7554         //now get call wait
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) {
7558                 return;
7559         }
7560         nw_context_loop = g_main_loop_new(NULL, FALSE);
7561         g_main_loop_run(nw_context_loop);
7562 }
7563
7564 ss_test()
7565 {
7566         ss_test_subscribe_tapi_events();
7567         tapi_ss_call_barr();
7568         tapi_ss_call_fwd();
7569         tapi_ss_call_wait();
7570         noti_finish();
7571 }
7572
7573 int main(int argc, char *argv[])
7574 {
7575         ss_test();
7576         return 0;
7577 }
7578 @endcode
7579 @}
7580 @defgroup Appendixes2 Appendix   B. Error Code
7581 @ingroup Appendix
7582 @{
7583
7584         <h2 class="pg">Appendix B. Error Code</h2>
7585 <table>
7586 <tr><td>Error Num.</td>
7587 <td>Error Code</td>
7588 <td>Error Description</td></tr>
7589 <tr><td>0</td>
7590 <td>TAPI_API_SUCCESS</td>
7591 <td>No Error occurred</td></tr>
7592 <tr><td>-1</td>
7593 <td>TAPI_API_INVALID_INPUT</td>
7594 <td>Input values are not correct in TAPI Library</td></tr>
7595 <tr><td>-2</td>
7596 <td>TAPI_API_INVALID_PTR</td>
7597 <td>invalid pointer</td></tr>
7598 <tr><td>-3</td>
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>
7601 <tr><td>-4</td>
7602 <td>TAPI_API_DEPRICATED </td>
7603 <td>This API is deprecated and will be so in future also </td></tr>
7604 <tr><td>-5</td>
7605 <td>TAPI_API_SYSTEM_OUT_OF_MEM</td>
7606 <td>Out of memory</td></tr>
7607 <tr><td>-6</td>
7608 <td>TAPI_API_SYSTEM_RPC_LINK_DOWN</td>
7609 <td>RPC link down</td></tr>
7610 <tr><td>-7</td>
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>
7613 <tr><td>-8</td>
7614 <td>TAPI_API_SERVER_FAILURE</td>
7615 <td>error occurred in Telephony server</td></tr>
7616 <tr><td>-9</td>
7617 <td>TAPI_API_OEM_PLUGIN_FAILURE</td>
7618 <td>Plug-in layer failure</td></tr>
7619 <tr><td>-10</td>
7620 <td>TAPI_API_TRANSPORT_LAYER_FAILURE</td>
7621 <td>Transport layer Failure</td></tr>
7622 <tr><td>-11</td>
7623 <td>TAPI_API_INVALID_DATA_LEN</td>
7624 <td>Invalid data length</td></tr>
7625 </table>
7626 @}
7627 */
7628 /**
7629 * @defgroup  TELEPHONY
7630  @{
7631 *       @defgroup Appendix Reference
7632 *       @defgroup TELEPHONY_USECASES Use Cases
7633         @{
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
7642         @}
7643  @}
7644 */