sync with private git ver.0.6.14
[framework/telephony/libslp-tapi.git] / 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_exe_call_mo _t (const TelCallSetupParams_t* const pParams, unsigned int  * pCallHandle, int * pRequestID);
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         int ret_status;
590         int pRequestID = 0;
591         unsigned int pCallHandle;
592         TelCallSetupParams_t pParams;
593         char normal[16] = "1234"; //Called party number
594
595         memset(&pParams, 0, sizeof(TelCallSetupParams_t));
596         pParams.CallType = TAPI_CALL_TYPE_VOICE;
597         strcpy(pParams.szNumber, normal);
598
599         ret_status = tel_exe_call_mo (&pParams, &pCallHandle, &pRequestID);
600         if (ret_status == TAPI_API_SUCCESS)
601                 printf("successful\n");
602         else
603                 printf("error=%d\n", ret_status); //WAIT FOR EVENT HERE
604 }
605
606 //CALLBACK FUNCTION TO BE USED
607 static void app_callback (TelTapiEvent_t *event)
608 {
609         int eventClass;
610         int eventType;
611         int requestId;
612         int status;
613         void* EventData = NULL;
614
615         unsigned int temp_handle = 0;
616
617         eventClass = event->EventClass;
618         eventType = event->EventType;
619         requestId = event->RequestId;
620         status = event->Status;
621         EventData = event->pData;
622
623         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
624
625         if (status != 0)
626         {
627                 //TEST_DEBUG("******This is nonzero status. ******\n");
628                 return;
629         }
630
631         switch (eventType)
632         {
633                 case TAPI_EVENT_CALL_SETUP_CNF:
634                         printf("TAPI_EVENT_CALL_SETUP_CNF");
635                         memcpy(&temp_handle, EventData, sizeof(unsigned int));
636                         TEST_DEBUG("Received setup cnf for call Handle [%d]", temp_handle);
637
638                         break;
639
640                 case TAPI_EVENT_CALL_ALERT_IND:
641                         int index;
642                         TEST_DEBUG("TAPI_EVENT_CALL_ALERT_IND");
643                         memcpy(&temp_handle, event->pData, sizeof(unsigned int));
644                         TEST_DEBUG("Received Alert for call Handle [%d]", temp_handle);
645                         break;
646
647                 case TAPI_EVENT_CALL_CONNECTED_IND:
648                         int index;
649                         TEST_DEBUG("TAPI_EVENT_CALL_CONNECTED_IND");
650                         memcpy(&temp_handle, event->pData, sizeof(TS_UINT));
651                         TEST_DEBUG("Received Connected Event  for call Handle [%d]", temp_handle);
652                         break;
653         }
654         //...
655 }
656 @endcode
657 @}
658 @defgroup Use_Cases2_3 Call Answer
659 @ingroup Use_Cases2_CALL
660 @{
661
662                 <h3 class="pg">Call Answer</h3>
663 This API responds to an incoming call either by accepting or rejecting the call.
664
665 Pre Conditions:
666 @n Call associated with the call handle should be in TAPI_CALL_STATE_INCOM state.
667 @n There should be no more than one existing call.
668
669 @code
670 int  tel_answer_call (unsigned int CallHandle,TelCallAnswerType_t AnsType, int * pRequestID);
671 @endcode
672
673 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
674
675 SAMPLE CODE:
676 @code
677 #include <ITapiCall.h>
678 #include <stdio.h>
679 #include "TapiCommon.h"
680 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
681
682 void callsetup(unsigned int CallHandle)
683 {
684         int ret_status;
685         int pRequestID = 0;
686
687         ret_status = tel_answer_call (CallHandle, &pRequestID);
688         if (ret_status == TAPI_API_SUCCESS)
689                 printf("successful\n");
690         else
691                 printf("error=%d\n", ret_status); //WAIT FOR EVENT HERE
692 }
693
694 //CALLBACK FUNCTION TO BE USED
695 static void app_callback (TelTapiEvent_t *event)
696 {
697         //..
698         switch (eventType) //REFER Call Setup TO GET eventType
699         {
700                 //GET CALL HANDLE FROM INCOMING CALL EVENT DATA
701                 case TAPI_EVENT_CALL_INCOM_IND:
702                         unsigned int CallHandle;
703                         TelCallIncomingCallInfo_t IncomingInfo;
704                         memcpy(&IncomingInfo, event->pData, sizeof(TelCallIncomingCallInfo_t));
705                         CallHandle = IncomingInfo.CallHandle;
706                         break;
707
708                 case TAPI_EVENT_CALL_ANSWER_CNF:
709                         memcpy(&CallHandle, event->pData, sizeof(unsigned int));
710                         printf("TAPI_EVENT_CALL_ANSWER_CNF\n");
711                         break;
712         }
713         //..
714 }
715 @endcode
716 @}
717 @defgroup Use_Cases2_4 Call Release
718 @ingroup Use_Cases2_CALL
719 @{
720
721                 <h3 class="pg">Call Release</h3>
722 This API is used to release the call.
723 @n The call to be released can be a single call based on the call handle, or all active calls or all calls.
724
725 Pre Conditions:
726 @n Call handle should be valid and there should be an existing call in Active/hold state.
727
728 @code
729 int tel_release_call (unsigned int  CallHandle, int * pRequestID);
730 int tel_release_call_all (int * pRequestId);
731 int tel_release_call_all_active (int *pRequestID);
732 int tel_release_call_all_held (int *pRequestID);
733 @endcode
734
735 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
736
737 SAMPLE CODE:
738 @code
739 #include <ITapiCall.h>
740 #include <stdio.h>
741 #include "TapiCommon.h"
742
743 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
744
745 void callrelease(unsigned int CallHandle)
746 {
747         int ret_status;
748         int pRequestID = 0;
749
750         ret_status = tel_release_call (CallHandle, &pRequestID);
751         //OR
752         ret_status = tel_release_call_all (&pRequestID);
753         //OR
754         ret_status = tel_release_call_all_active (&pRequestID);
755         //OR
756         ret_status = tel_release_call_all_held (&pRequestID);
757
758         if (ret_status == TAPI_API_SUCCESS)
759                 printf("successful\n");
760         else
761                 printf("error=%d\n", ret_status);
762 } //WAIT FOR EVENT HERE
763
764 //CALLBACK FUNCTION TO BE USED
765 static void app_callback(TelTapiEvent_t *event)
766 {
767         //...
768         switch (eventType) //REFER Call Setup TO GET eventType
769         {
770                 //GET CALL HANDLE FROM INCOMING CALL EVENT DATA
771                 case TAPI_EVENT_CALL_INCOM_IND:
772                         TelCallIncomingCallInfo_t IncomingInfo;
773                         memcpy(&IncomingInfo, event->pData, sizeof(TelCallIncomingCallInfo_t));
774                         CallHandle = IncomingInfo.CallHandle;
775                         break;
776
777                 case TAPI_EVENT_CALL_RELEASE_CNF:
778                 case TAPI_EVENT_CALL_RELEASE_ALL_CNF:
779                 case TAPI_EVENT_CALL_RELEASE_ALL_ACTIVE_CNF:
780                 case TAPI_EVENT_CALL_RELEASE_ALL_HELD_CNF:
781                 case TAPI_EVENT_CALL_END_IND_IND:
782                         unsigned int handle;
783                         memcpy(&handle, event->pData, sizeof(unsigned int));
784                         printf("TAPI_EVENT_CALL_RELEASE_CNF\n");
785                         break;
786                         //...
787         }
788 }
789 @endcode
790 @}
791 @defgroup Use_Cases2_5 Call Hold
792 @ingroup Use_Cases2_CALL
793 @{
794
795                 <h3 class="pg">Call Hold</h3>
796 This API puts the specified call on hold. The call identified by Call Handle should be in the active state.
797
798 @code
799 int tel_hold_call (unsigned int CallHandle, int * pRequestID);
800 @endcode
801
802 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
803
804 SAMPLE CODE
805 @code
806 #include <ITapiCall.h>
807 #include <stdio.h>
808 #include "TapiCommon.h"
809
810 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
811 void callhold(unsigned int CallHandle)
812 {
813         int ret_status;
814         int pRequestID = 0;
815
816         ret_status = tel_hold_call(CallHandle, &pRequestID);
817         if (ret_status == TAPI_API_SUCCESS)
818                 printf("successful\n");
819         else
820                 printf("error=%d\n", ret_status);
821 } //WAIT FOR EVENT HERE
822
823 //CALLBACK FUNCTION TO BE USED
824 static void app_callback (TelTapiEvent_t *event)
825 {
826         //..
827         switch (eventType) //REFER Call Setup TO GET eventType
828         {
829                 case TAPI_EVENT_CALL_HOLD_CNF:
830                         unsigned int CallHandle;
831                         memcpy(&CallHandle, event->pData, sizeof(unsigned int));
832                         printf("TAPI_EVENT_CALL_HOLD_CNF\n");
833                         break;
834                 //...
835         }
836         //...
837 }
838 @endcode
839 @}
840 @defgroup Use_Cases2_6  Call Retrieve
841 @ingroup Use_Cases2_CALL
842 @{
843
844                 <h3 class="pg">Call Retrieve</h3>
845 This API can be used to retrieve a held call.
846
847 Pre Conditions:
848 @n Call should be in held state in order to return to the active state, and no other call should be active.
849
850 @code
851 int tel_retrieve_call (unsigned int CallHandle, int * pRequestID);
852 @endcode
853
854 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
855
856 SAMPLE CODE:
857 @code
858 #include <ITapiCall.h>
859 #include <stdio.h>
860 #include "TapiCommon.h"
861
862
863 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
864 void callretrieve(unsigned int CallHandle)
865 {
866         int ret_status;
867         int pRequestID=0;
868
869         ret_status = tel_retrieve_call(CallHandle, &pRequestID);
870         if (ret_status == TAPI_API_SUCCESS)
871                 printf("successful\n");
872         else
873                 printf("error=%d\n", ret_status);
874 } //WAIT FOR EVENT HERE
875
876 //CALLBACK FUNCTION TO BE USED
877 static void app_callback(TelTapiEvent_t *event)
878 {
879         //..
880         switch (eventType) //REFER Call Setup TO GET eventType
881         {
882                 case TAPI_EVENT_CALL_HOLD_CNF:
883                         unsigned int CallHandle;
884                         memcpy(&CallHandle, event->pData, sizeof(unsigned int));
885                         printf("TAPI_EVENT_CALL_HOLD_CNF\n");
886                         break;
887
888                 case TAPI_EVENT_CALL_RETRIEVE_CNF:
889                         unsigned int CallHandle;
890                         memcpy(&CallHandle, event->pData, sizeof(unsigned int));
891                         printf("TAPI_EVENT_CALL_RETRIEVE_CNF ");
892                         break;
893         }
894         //...
895 }
896 //...
897 @endcode
898 @}
899 @defgroup Use_Cases2_7  Call Swap
900 @ingroup Use_Cases2_CALL
901 @{
902
903                 <h3 class="pg">Call Swap</h3>
904 This API can be used to swap calls. This feature is only available for the calls that have been setup and answered using the Telephony service. The swap functionality is only available for voice calls.
905
906 Pre Conditions:
907 @n Two calls should be present, one of them in the Active state and the other in the held state
908
909 @code
910 int tel_swap_call (unsigned int CallHandle1, const TS_UINT CallHandle2, int * pRequestID);
911 @endcode
912
913 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
914
915 SAMPLE CODE:
916 @code
917 #include <ITapiCall.h>
918 #include <stdio.h>
919 #include "TapiCommon.h"
920 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
921
922 void callswap(unsigned int CallHandle1, unsigned int CallHandle2)
923 {
924         int ret_status;
925         int pRequestID = 0;
926
927         ret_status = tel_swap_call(CallHandle1, CallHandle2, &pRequestID);
928         if (ret_status == TAPI_API_SUCCESS)
929                 printf("successful\n");
930         else
931                 printf("error=%d\n", ret_status);
932         //..
933 } //WAIT FOR EVENT HERE
934
935 //CALLBACK FUNCTION TO BE USED
936 static void app_callback (TelTapiEvent_t *event)
937 {
938         //..
939         switch (eventType) //REFER Call Setup TO GET eventType
940         {
941                 case TAPI_EVENT_CALL_SWAP_CNF:
942                         printf("TAPI_EVENT_CALL_RETRIEVE_CNF\n");
943                         break;
944         }
945         //..
946 }
947 //..
948 @endcode
949 @}
950 @defgroup Use_Cases2_8 Send DTMF
951 @ingroup Use_Cases2_CALL
952 @{
953
954                 <h3 class="pg">Send DTMF</h3>
955 This API can be used for sending one or more DTMF digits during the call.
956
957 Pre Conditions:
958 @n Active call should be present.
959
960 @code
961 int tel_send_call_dtmf (char const * const pDtmfString, int * pRequestID);
962 @endcode
963
964 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
965
966 SAMPLE CODE:
967 @code
968 #include <ITapiCall.h>
969 #include <stdio.h>
970 #include "TapiCommon.h"
971
972 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
973 void senddtmf()
974 {
975         int ret_status;
976         int pRequestID = 0;
977         char DtmfString[10];
978
979         strcpy(DtmfString, "123456789"); //Sample DTMF digits that need to be sent
980
981         ret_status = tel_send_call_dtmf(DtmfString, &pRequestID);
982         if (ret_status == TAPI_API_SUCCESS)
983                 printf("successful\n");
984         else
985                 printf("error=%d\n", ret_status);
986 }
987 //WAIT FOR EVENT HERE
988 static void app_callback(TelTapiEvent_t *event)
989 {
990         //..
991         switch (eventType) //REFER Call Setup TO GET eventType
992         {
993                 case TAPI_EVENT_CALL_SEND_DTMF_CNF:
994                         printf("TAPI_EVENT_CALL_SEND_DTMF_CNF\n");
995                         break;
996         }
997         //..
998 }
999 @endcode
1000 @}
1001 @defgroup Use_Cases2_9 Call Join
1002 @ingroup Use_Cases2_CALL
1003 @{
1004
1005                 <h3 class="pg">Call Join</h3>
1006 This API joins the specified two calls (one call which is in the active state and other call which is in the held state) into a conference call.
1007
1008 Pre Conditions:
1009 @n For a Multiparty call or for joining two calls into conference, there should be one call in active state and another call in held state.
1010
1011 @code
1012 int tel_join_call (unsigned int CallHandle1, const unsigned int CallHandle2,int * pRequestID);
1013 @endcode
1014
1015 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1016
1017 SAMPLE CODE
1018 @code
1019 #include <ITapiCall.h>
1020 #include <stdio.h>
1021 #include "TapiCommon.h"
1022
1023 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1024 void calljoin(unsigned int CallHandle1, unsigned int CallHandle2)
1025 {
1026         int ret_status;
1027         int pRequestID = 0;
1028
1029         ret_status= tel_join_call(CallHandle1, CallHandle2, &pRequestID);
1030         if (ret_status == TAPI_API_SUCCESS)
1031                 printf("successful\n");
1032         else
1033                 printf("error=%d\n", ret_status);
1034 } //WAIT FOR EVENT HERE
1035
1036 //CALLBACK FUNCTION TO BE USED
1037 static void app_callback (TelTapiEvent_t *event)
1038 {
1039         //..
1040         switch (eventType) //REFER Call Setup TO GET eventType
1041         {
1042                 case TAPI_EVENT_CALL_SETUPCONFERENCE_CNF:
1043                         unsigned int temp_handle;
1044                         memcpy(&temp_handle, event->pData, sizeof(unsigned int));
1045                         printf("TAPI_EVENT_CALL_SETUPCONFERENCE_CNF ");
1046                         break;
1047         }
1048         //..
1049 }
1050 @endcode
1051 @}
1052 @defgroup Use_Cases2_10 Call Split
1053 @ingroup Use_Cases2_CALL
1054 @{
1055
1056                 <h3 class="pg">Call Split</h3>
1057 This API triggers the split of a single call from multiparty call. This can be used for creating a private communication with one of remote parties in a multiparty session.
1058 @n TAPI client application has to pass the call handle which should be split from the multiparty call.
1059
1060 Pre Conditions:
1061 @n Call should be in multiparty conference call.
1062
1063 Post Conditions:
1064 @n Split call will be the active call and the conference will be held call.
1065
1066 @code
1067 int tel_split_call (unsigned int CallHandle, int * pRequestID);
1068 @endcode
1069
1070 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1071
1072 SAMPLE CODE
1073 @code
1074 #include <ITapiCall.h>
1075 #include <stdio.h>
1076 #include "TapiCommon.h"
1077
1078 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1079 void callsplit(unsigned int CallHandle)
1080 {
1081         int ret_status;
1082         int pRequestID = 0;
1083
1084         ret_status = tel_split_call(CallHandle, &pRequestID);
1085         if (ret_status == TAPI_API_SUCCESS)
1086                 printf("successful\n");
1087         else
1088                 printf("error=%d\n", ret_status);
1089 }//WAIT FOR EVENT HERE
1090
1091 //CALLBACK FUNCTION TO BE USED
1092 static void app_callback (TelTapiEvent_t *event)
1093 {
1094         //..
1095         switch (eventType) //REFER Call Setup TO GET eventType
1096         {
1097                 case TAPI TAPI_EVENT_CALL_SPLITCONFERENCE_CNF:
1098                         unsigned int temp_handle;
1099                         memcpy(&temp_handle, event->pData, sizeof(unsigned int));
1100                         printf("TAPI_EVENT_CALL_SPLITCONFERENCE_CNF ");
1101                         break;
1102         }
1103         //..
1104 }
1105 @endcode
1106 @}
1107 @defgroup Use_Cases2_11 Active Line
1108 @ingroup Use_Cases2_CALL
1109 @{
1110
1111                 <h3 class="pg">Active Line </h3>
1112 <strong>[Note] Telephony Emulator does not support this feature.</strong>
1113 @n Telephony provides APIs for setting and getting the current calling line identification number.
1114
1115 @code
1116 int tel_set_call_act_line const TelCallActiveLine_t active_line, int * pRequestID);
1117 int tel_get_call_act_line ( int * pRequestID);
1118 @endcode
1119
1120 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1121
1122 SAMPLE CODE
1123 @code
1124 #include <ITapiCall.h>
1125 #include <stdio.h>
1126 #include "TapiCommon.h"
1127
1128 //SET ACTIVE LINE
1129 void activeline()
1130 {
1131         int ret_status;
1132         int pRequestID = 0;
1133         TelCallActiveLine_t g_curLine = TAPI_CALL_ACTIVE_LINE1;
1134         TelCallActiveLine_t active_line;
1135
1136         printf (" Set Active Line with TAPI_ACTIVE_LINE1.");
1137
1138         ret_status = tel_set_call_act_line (g_curLine, &pRequestID);
1139         if (ret_status == TAPI_API_SUCCESS)
1140                 printf("successful\n");
1141         else
1142                 printf("error=%d\n", ret_status);
1143
1144         //GET ACTIVE LINE
1145         ret_status = tel_get_call_act_line (&pRequestID);
1146         if (ret_status == TAPI_API_SUCCESS)
1147                 printf("successful\n");
1148         else
1149                 printf("error=%d\n", ret_status);
1150         //..
1151 }
1152
1153 //CALLBACK FUNCTION TO BE USED
1154 static void app_callback (TelTapiEvent_t *event)
1155 {
1156         //..
1157         switch (eventType) //REFER Call Setup TO GET eventType
1158         {
1159                 case TAPI_EVENT_CALL_SET_LINEID_CNF:
1160                         //TEST_DEBUG("Received TAPI_EVENT_CALL_SET_LINEID_CNF");
1161                         //AUTO_LOG("EVENT: SET_LINEID_CNF:");
1162                         break;
1163
1164                 case TAPI_EVENT_CALL_GET_LINEID_CNF:
1165                         TelCallActiveLine_t active_line;
1166                         memcpy(&active_line, event->pData, sizeof(TelCallActiveLine_t));
1167                         TEST_DEBUG("Received TAPI_EVENT_CALL_GET_LINEID_CNF");
1168                         break;
1169         }
1170         //..
1171 }
1172 @endcode
1173 @}
1174 @defgroup Use_Cases2_12  Call transfer
1175 @ingroup Use_Cases2_CALL
1176 @{
1177
1178                 <h3 class="pg">Call transfer</h3>
1179 This API triggers an explicit call transfer by connecting two parties, one of which is in the active state with the other in the held state.
1180
1181 Pre Conditions:
1182 @n In order to call transfer, 2 calls should be present. One in the active state and the other in the Held state.
1183
1184 Post Conditions:
1185 @n When the request has been completed successfully, Call end indication will be sent to both the calls (active and held).
1186
1187 @code
1188 int tel_exe_call_explicit_transfer (unsigned int CallHandle, int * pRequestID);
1189 @endcode
1190
1191 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1192
1193 SAMPLE CODE:
1194 @code
1195 #include <ITapiCall.h>
1196 #include <stdio.h>
1197 #include "TapiCommon.h"
1198
1199 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1200 void calltransfer(unsigned int CallHandle)
1201 {
1202         int ret_status;
1203         int pRequestID = 0;
1204
1205         ret_status = tel_exe_call_explicit_transfer (CallHandle, &pRequestID);
1206         if (ret_status == TAPI_API_SUCCESS)
1207                 printf("successful\n");
1208         else
1209                 printf("error=%d\n", ret_status);
1210 }//WAIT FOR EVENT HERE
1211
1212 //CALLBACK FUNCTION TO BE USED
1213 static void app_callback (TelTapiEvent_t *event)
1214 {
1215         //..
1216         switch (eventType) //REFER Call Setup TO GET eventType
1217         {
1218                 case TAPI_EVENT_CALL_TRANSFER_CNF:
1219                         unsigned int temp_handle = 0;
1220                         memcpy(&temp_handle, event->pData, sizeof(unsigned int));
1221                         printf("TAPI_EVENT_CALL_TRANSFER_CNF. ");
1222                         break;
1223         }
1224         //..
1225 }
1226 @endcode
1227 @}
1228 @defgroup Use_Cases2_13 Get Call Status
1229 @ingroup Use_Cases2_CALL
1230 @{
1231
1232                 <h3 class="pg">Get Call Status</h3>
1233 When call status is requested by the application, this API gets the status of the call associated with the input Call Handle. Call status information consists of destination number, call direction (MO or MT), call type (voice or data etc), multiparty state (whether the call is in conference state or not) and present call state.
1234 @n Call handle must be valid.
1235
1236 @code
1237 int tel_get_call_status (unsigned int CallHandle, TelCallStatus_t * pCallStatus)
1238 @endcode
1239
1240 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1241
1242 SAMPLE CODE
1243 @code
1244 #include <ITapiCall.h>
1245 #include <stdio.h>
1246 #include "TapiCommon.h"
1247
1248 void getcallstatus(unsigned int CallHandle)
1249 {
1250         int ret_status;
1251         TelCallStatus_t callStatus;
1252
1253         ret_status = tel_get_call_status(CallHandle, &callStatus);
1254         if (ret_status == TAPI_API_SUCCESS)
1255         {
1256                 printf("successful\n");
1257                 printf("CallNumber: %s\n", callStatus.pNumber);
1258                 printf("Is Mobile Originated:%d n\t CallType : %d \n\t CallActiveState: %d\n\t CallState : %d\n\t isConferenceState:%d \n",
1259                                 callStatus.bMoCall,
1260                                 callStatus.CallType,
1261                                 callStatus.CallActiveState,
1262                                 callStatus.CallState,
1263                                 callStatus.bConferenceState);
1264         }
1265         else {
1266                 printf("error=%d\n", ret_status);
1267         }
1268 }
1269 @endcode
1270 @}
1271 @defgroup Use_Cases2_14  Get Call Duration
1272 @ingroup Use_Cases2_CALL
1273 @{
1274
1275                 <h3 class="pg">Get Call Duration</h3>
1276 This API gets the duration of the specified call.
1277 @n This is a synchronous API. Duration is timed from the moment the connection is established, i.e. call goes into active state for first time. The total call duration is provided in seconds, from the call connecting time to the current time.
1278
1279 @code
1280 int tel_get_call_duration unsigned int CallHandle, unsigned int * pDurationInSecs);
1281 @endcode
1282
1283 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1284
1285 SAMPLE CODE
1286 @code
1287 #include <ITapiCall.h>
1288 #include <stdio.h>
1289 #include "TapiCommon.h"
1290
1291 void getcallduration(unsigned int CallHandle)
1292 {
1293         int ret_status;
1294         unsigned int duration;
1295
1296         ret_status = tel_get_call_duration (CallHandle, &duration);
1297         if (ret_status == TAPI_API_SUCCESS)
1298         {
1299                 printf("successful\n");
1300                 printf("Call Duration : %d Seconds\n", duration);
1301         }
1302         else {
1303                 printf("error=%d\n", ret_status);
1304         }
1305 }
1306 @endcode
1307 @}
1308 @defgroup Use_Cases2_15 Get Call Conference List
1309 @ingroup Use_Cases2_CALL
1310 @{
1311
1312                 <h3 class="pg">Get Call Conference List</h3>
1313 This is a synchronous API which returns information about all the call handles and the total number of call handles, within the specified conference call.
1314
1315 Pre Conditions:
1316 @n Call should be a multi-party conference call in order to return actual number of calls and call handles in the conference call.
1317
1318 @code
1319 int tel_get_call_conf_list(unsigned int  CallHandle,  unsigned int * pCallList, int * pNoOfCalls);
1320 @endcode
1321
1322 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1323
1324 SAMPLE CODE
1325 @code
1326 #include <ITapiCall.h>
1327 #include <stdio.h>
1328 #include "TapiCommon.h"
1329
1330 void getconferencelist(unsigned int CallHandle)
1331 {
1332         int ret_status ;
1333         unsigned int callList[5];
1334         int  noOfCalls;
1335
1336         ret_status = tel_get_call_conf_list(CallHandle, callList, &noOfCalls);
1337         if (ret_status == TAPI_API_SUCCESS)
1338         {
1339                 printf("successful\n");
1340                 printf("\n No.of Calls %d, \n", noOfCalls);
1341                 for (i = 0; i < noOfCalls; i++)
1342                 {
1343                         printf("\n Call Handle in conference calls %d \n", callList[i]);
1344                 }
1345         }
1346         else {
1347                 printf("error=%d\n", ret_status);
1348         }
1349 }
1350 @endcode
1351 @}
1352 @defgroup Use_Cases2_16 Voice Privacy Mode
1353 @ingroup Use_Cases2_CALL
1354 @{
1355
1356                 <h3 class="pg">Voice Privacy Mode</h3>
1357 Telephony provides two APIs which can be used to set and get the CDMA voice privacy mode .
1358
1359 @code
1360 int tel_get_call_privacy_mode (TelCallVoicePrivacyInfo_t PrivacyInfo, int *pRequestID);
1361 int tel_set_call_privacy_mode (TelCallPrivacyType_t PrivacyType, int *pRequestID);
1362 @endcode
1363
1364 This API is restricted for direct use.  Use the Voice call engine API instead.
1365
1366 SAMPLE CODE
1367 @code
1368 #include <ITapiCall.h>
1369 #include <stdio.h>
1370 #include "TapiCommon.h"
1371
1372 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1373
1374 //SetVoicePrivacyMode
1375 void setvoiceprivacymode()
1376 {
1377         int ReqId = -1;
1378         int ret_status = -1;
1379         int api_err;
1380         TelCallPrivacyMode_t PrivacyMode_info;
1381
1382         pPrivacyMode_info = TAPI_CALL_PRIVACY_MODE_STANDARD;
1383
1384         ret_status = tel_set_call_privacy_mode (pPrivacyMode_info, &reqId);
1385         if (ret_status == TAPI_API_SUCCESS)
1386                 printf("Successful\n");
1387         else
1388                 printf("error:%d\n", ret_status);
1389 }
1390 //WAIT FOR EVENT HERE
1391
1392 //CALLBACK FUNCTION TO BE USED
1393
1394 bool call_app_callback (TelTapiEvent_t *Event)
1395 {
1396         int ret = -1;
1397         int eventClass = Event->EventClass;
1398         int eventType = Event->EventType;
1399         int RequestId = Event->RequestId;
1400         int Status = Event->Status;
1401
1402         if (eventClass == TAPI_EVENT_CLASS_CALL_VOICE)
1403         {
1404                 switch (eventType) {
1405                         case TAPI_EVENT_CALL_SET_PRIVACYMODE_CNF:
1406                                 if (RequestId != reqId) {
1407                                         printf("Invalid RequestID received %d \n", reqId);
1408                                         return false;
1409                                 }
1410
1411                                 if (Status != TAPI_CAUSE_SUCCESS) {
1412                                         printf("Invalid Status value received");
1413                                         return false;
1414                                 }
1415                                 break;
1416                 }
1417         }
1418 }
1419
1420 //GetVoicePrivacyMode
1421 void getprivacymode()
1422 {
1423         Int ReqId = -1;
1424         int ret_status = -1;
1425         int api_err;
1426         TelCallPrivacyType_t privacyType;
1427
1428         privacyType = TAPI_CALL_PRIVACY_TYPE_MS;
1429
1430         ret_status = tel_get_call_privacy_mode (privacyType, &req_id);
1431         if (ret_status == TAPI_API_SUCCESS)
1432                 printf("Successful\n");
1433         else
1434                 printf("error:%d\n", ret_status);
1435 }
1436
1437 //WAIT FOR EVENT HERE
1438
1439 //CALLBACK FUNCTION TO BE USED
1440
1441 bool call_app_callback (TelTapiEvent_t *Event)
1442 {
1443         int ret = -1;
1444         int eventClass = Event->EventClass;
1445         int eventType = Event->EventType;
1446         int RequestId = Event->RequestId;
1447         int Status = Event->Status;
1448
1449         if (eventClass == TAPI_EVENT_CLASS_CALL_VOICE)
1450         {
1451                 switch (eventType) {
1452                         case TAPI_EVENT_CALL_GET_PRIVACYMODE_CNF:
1453                                 TelCallVoicePrivacyInfo_t vp_info;
1454                                 memcpy(&vp_info, event->pData, sizeof(TelCallVoicePrivacyInfo_t));
1455                                 if (Status != TAPI_CAUSE_SUCCESS)
1456                                 {
1457                                         printf("Invalid Status value received");
1458                                         return false;
1459                                 }
1460                                 break;
1461                 }
1462         }
1463 }
1464 @endcode
1465 @}
1466 @defgroup Use_Cases2_17 Call FlashInformation
1467 @ingroup Use_Cases2_CALL
1468 @{
1469
1470                 <h3 class="pg">Call FlashInformation</h3>
1471 The user makes an additional outgoing call in CDMA, this API is used instead of the CALL Outgoing API because there is no additional voice call transaction in CDMA. So the voice call id is only one in CDMA. The multiparty call is not supported in CDMA.
1472
1473 @code
1474 int tel_exe_call_flash_info (const char* pDialNumber, int *pRequestID);
1475 @endcode
1476
1477 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1478
1479 SAMPLE CODE
1480 @code
1481 #include <ITapiCall.h>
1482 #include <stdio.h>
1483 #include "TapiCommon.h"
1484
1485 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1486 //CallFlashInfo
1487 void callflashinfo()
1488 {
1489         int ret_status = -1;
1490         int api_err;
1491         const char *pDialNumber = "9999900000";
1492
1493         ret_status = tel_exe_call_flash_info(pDialNumber, &reqId);
1494         if (ret_status == TAPI_API_SUCCESS)
1495                 printf("Successful\n");
1496         else
1497                 printf("error:%d\n", ret_status);
1498 }
1499 //WAIT FOR EVENT HERE
1500
1501 //CALLBACK FUNCTION TO BE USED
1502 bool call_app_callback(TelTapiEvent_t *Event)
1503 {
1504         int ret = -1;
1505         int eventClass = Event->EventClass;
1506         int eventType = Event->EventType;
1507         int RequestId = Event->RequestId;
1508         int Status = Event->Status;
1509
1510         if (eventClass == TAPI_EVENT_CLASS_CALL_VOICE)
1511         {
1512                 switch (eventType)
1513                 {
1514                         case TAPI_EVENT_CALL_FLASHINFO_CNF:
1515                                 if (RequestId != reqId)
1516                                 {
1517                                         printf("Invalid RequestID received %d \n", reqId);
1518                                         return false;
1519                                 }
1520
1521                                 if (Status != TAPI_CAUSE_SUCCESS)
1522                                 {
1523                                         printf("Invalid Status value received");
1524                                         return false;
1525                                 }
1526                                 printf("\n Received TAPI_EVENT_CALL_FLASHINFO_CNF \n");
1527                                 break;
1528
1529                 }
1530         }
1531         return true;
1532 }
1533 @endcode
1534 @}
1535 @defgroup Use_Cases2_18 Getting Call Time
1536 @ingroup Use_Cases2_CALL
1537 @{
1538
1539                 <h3 class="pg">Getting Call Time</h3>
1540 This API is used to query information about a call time and call count.
1541
1542 @code
1543 int tel_get_call_time (const TS_WORD req_mask, int *pRequestID);
1544 @endcode
1545
1546 <strong>This API is restricted for direct use.  Use the Voice call engine API instead.</strong>
1547
1548 SAMPLE CODE
1549 @code
1550 #include <ITapiCall.h>
1551 #include <stdio.h>
1552 #include "TapiCommon.h"
1553
1554 void getcalltime()
1555 {
1556         int ret_status = -1;
1557         int api_err;
1558         TelCallTimeMaskType_t mask_byte1;
1559         TelCallTimeMaskType_t mask_byte2;
1560         unsigned short mask_type;
1561
1562         mask_byte1 = TAPI_CALL_TIME_TYPE_TOTAL_CALL_CNT;
1563         mask_byte2 = TAPI_CALL_TIME_TYPE_TOTAL_CALL_TIME;
1564
1565         mask_type = (mask_byte1 | mask_byte2);
1566
1567         ret_status = tel_get_call_time(mask_type, &reqId);
1568         if (ret_status == TAPI_API_SUCCESS)
1569                 printf("Successful\n");
1570         else
1571                 printf("error:%d\n", ret_status);
1572 }
1573 //WAIT FOR EVENT HERE
1574
1575 bool call_app_callback(TelTapiEvent_t *Event)
1576 {
1577         int ret = -1;
1578         int eventClass = Event->EventClass;
1579         int eventType = Event->EventType;
1580         int RequestId = Event->RequestId;
1581         int Status = Event->Status;
1582
1583         if (eventClass == TAPI_EVENT_CLASS_CALL_VOICE)
1584         {
1585                 switch (eventType)
1586                 {
1587                         case TAPI_EVENT_CALL_SET_PRIVACYMODE_CNF:
1588                                 if (RequestId != reqId)
1589                                 {
1590                                         printf("Invalid RequestID received %d \n", reqId);
1591                                         return false;
1592                                 }
1593
1594                                 if (Status != TAPI_CAUSE_SUCCESS)
1595                                 {
1596                                         printf("Invalid Status value received");
1597                                         return false;
1598                                 }
1599                                 break;
1600                 }
1601         }
1602 }
1603 @endcode
1604 @}
1605
1606 <h2 class="pg">SUPPLEMENTARY SERVICE </h2>
1607 @defgroup Use_Cases3_1 Event register and deregister
1608 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
1609 @{
1610                 <h3 class="pg">Event register and deregister</h3>
1611 To receive asynchronous event notifications for the SS APIs, the registration of related events with their associated call backs is required. After these are registered, when an asynchronous API is called, the confirmation is returned as an asynchronous event notification which invokes the callback function along with the event data.
1612
1613 SAMPLE CODE
1614 @code
1615 // REGISTER EVENT
1616 unsigned int subscription_id = 0;
1617 int api_err;
1618
1619 api_err = tel_init();
1620 if (api_err != TAPI_API_SUCCESS)
1621 {
1622         TEST_DEBUG("tel_init Failed - api_err = %d \n", api_err);
1623 }
1624
1625 api_err = tel_register_event (TAPI_EVENT_SS_WAITING_CNF, &subscription_id, (TelAppCallback)&app_callback);
1626 printf("SS Event registration is Done: sub id is %d, api_err is %d\n",subscription_id,api_err);
1627
1628 tel_register_app_name("com.samsung.appname");
1629
1630 // DEREGISTER EVENT
1631 api_err = tel_deregister_event(subscription_id);
1632 if (api_err != TAPI_API_SUCCESS)
1633 {
1634         printf("Event Class Unregisteration Fail\n");
1635 }
1636 @endcode
1637 @}
1638 @defgroup Use_Cases3_2 Call Barring
1639 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
1640 @{
1641
1642                 <h3 class="pg">Call Barring </h3>
1643 Telephony provides APIs to activate/deactivate call barring, get the barring status and change the barring password. It also provides APIs for applications to provide barring password requested by network for Call Barring Request or Change barring password request.
1644 @n This service makes it possible for a mobile subscriber to activate barring for certain categories of outgoing or incoming calls. It also allows the deactivation of call barring based on categories set.
1645 @n The mobile subscriber may also determine the type of barring preferrred for incoming/outgoing calls, by subscribing to a set of one or more unique barring programs .
1646
1647 @code
1648 int   tel_set_ss_barring (const  TelSsCallBarringInfo_t *pBarringInfo, int * pRequestId);
1649 int   tel_get_ss_barring_status (TelSsCallBarType_t  BarType, TelSsCallType_t  CallType,  int * pRequestId )
1650 int   tel_change_ss_barring_password ( const char*  pOldPassword,const char*  pNewPassword,const char * pNewPasswordAgain, int *  pRequestId);
1651 @endcode
1652
1653 SAMPLE CODE FOR CALL BARRING
1654 @code
1655 #include <stdio.h>
1656 #include <TapiCommon.h>
1657 #include <ITapiSS.h>
1658
1659 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1660 void callbarring()
1661 {
1662         int ret_status = -1;
1663         TelSsCallBarringInfo_t BarringInfo;
1664         int RequestId = 0;
1665         char *bar_pwd = "0000";
1666
1667         BarringInfo.Mode = TAPI_SS_CALL_BAR_ACTIVATE;
1668         BarringInfo.Type = TAPI_CALL_BARRING_ALL_OUTGOING_CALLS;
1669         BarringInfo.CallType = TAPI_CALL_TYPE_VOICE_EV;
1670         strcpy(BarringInfo.szPassword, bar_pwd);
1671
1672         ret_status = tel_set_ss_barring (&BarringInfo, &RequestId);
1673         if (ret_status == TAPI_API_SUCCESS) {
1674                 printf("successful\n");
1675         }
1676         else {
1677                 printf("Error  = %d \n", ret_status);
1678         }
1679 }
1680 //WAIT FOR THE EVENT  HERE
1681
1682 static void app_callback (TelTapiEvent_t *event)
1683 {
1684         int eventClass;
1685         int eventType;
1686         int requestId;
1687         int status;
1688         void* EventData = NULL;
1689         unsigned int temp_handle = -1;
1690
1691         //...
1692         eventClass = event->EventClass;
1693         eventType = event->EventType;
1694         requestId = event->RequestId;
1695         status = event->Status;
1696         EventData = event->pData;
1697
1698         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
1699
1700         if (status != 0)
1701         {
1702                 //TEST_DEBUG("******This is nonzero status. ******\n");
1703                 return;
1704         }
1705
1706         switch (eventType)
1707         {
1708                 case TAPI_EVENT_SS_BARRING_CNF:
1709                         TelSsInfo_t SsInfo;
1710                         memcpy(&SsInfo, (TelSsInfo_t*)event->pData, sizeof(TelSsInfo_t));
1711                         printf("Received Event :TAPI_EVENT_SS_BARRING_CNF\n");
1712                         break;
1713         }
1714 }
1715 @endcode
1716
1717 SAMPLE CODE FOR BARRING STATUS
1718 @code
1719 #include <stdio.h>
1720 #include <TapiCommon.h>
1721 #include <ITapiSS.h>
1722
1723 void callbarringstatus()
1724 {
1725         //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1726         int ret_status;
1727         TelSsCallBarType_t BarType = TAPI_CALL_BARRING_ALL_OUTGOING_INTERN_CALL;
1728         TelSsCallType_t CallType = TAPI_CALL_TYPE_VOICE_EV;
1729         int pRequestId = 0;
1730
1731         ret_status = tel_get_ss_barring_status (BarType, CallType, &pRequestId);
1732         if (ret_status == TAPI_API_SUCCESS)
1733         {
1734                 printf("successful\n");
1735         }
1736         else
1737         {
1738                 printf("Error  = %d \n", ret_status);
1739         }
1740 }
1741 //WAIT FOR THE EVENT  HERE
1742
1743 static void app_callback (TelTapiEvent_t *event)
1744 {
1745         int eventClass;
1746         int eventType;
1747         int requestId, i;
1748         int status;
1749         void* EventData = NULL;
1750         unsigned int temp_handle = -1;
1751
1752         //...
1753         eventClass = event->EventClass;
1754         eventType = event->EventType;
1755         requestId = event->RequestId;
1756         status = event->Status;
1757         EventData = event->pData;
1758
1759         if (status != 0)
1760         {
1761                 //TEST_DEBUG("******This is nonzero status. ******\n");
1762                 return;
1763         }
1764
1765         switch (eventType)
1766         {
1767                 case TAPI_EVENT_SS_BARRING_QUERYSTATUS_CNF:
1768                         printf(" Received Event :TAPI_EVENT_SS_BARRING_QUERYSTATUS_CNF \n");
1769                         TelSsInfo_t SsInfo;
1770                         memcpy(&SsInfo, (TelSsInfo_t*)EventData, sizeof(TelSsInfo_t));
1771
1772                         for (i=0; i<SsInfo.NumberOfRecords; i++) {
1773                                 printf("Number of records %d \n", SsInfo.NumberOfRecords);
1774                                 printf("Record:%d Status:%d Teleservice:%d \n", i,
1775                                                 SsInfo.SsRecord.BarringRecord.rec_class[i].Status,
1776                                                 SsInfo.SsRecord.BarringRecord.rec_class[i].TeleCommService);
1777
1778                                 if (SsInfo.SsRecord.BarringRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
1779                                         printf("  Status: Active \n");
1780                                 else
1781                                         printf("Status: Not Active \n");
1782                         }
1783
1784                         break;
1785         }
1786 }
1787 @endcode
1788
1789 SAMPLE CODE FOR CHANGING BARRING PASSWORD
1790 @code
1791 #include <stdio.h>
1792 #include <TapiCommon.h>
1793 #include <ITapiSS.h>
1794
1795 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1796 void changebarpwd()
1797 {
1798         int ret_status;
1799         int pRequestId = 0;
1800
1801         ret_status = tel_change_ss_barring_password ("0000", "0000", "0000", &pRequestId);
1802         if (ret_status == TAPI_API_SUCCESS)
1803         {
1804                 printf("successful\n");
1805         }
1806         else
1807         {
1808                 printf("Error  = %d \n", ret_status);
1809         }
1810 }
1811
1812 //WAIT FOR THE EVENT  HERE
1813
1814 static void app_callback (TelTapiEvent_t *event)
1815 {
1816         int eventClass;
1817         int eventType;
1818         int requestId;
1819         int status;
1820         void* EventData = NULL;
1821         unsigned int temp_handle = -1;
1822
1823         //...
1824         eventClass = event->EventClass;
1825         eventType = event->EventType;
1826         requestId = event->RequestId;
1827         status = event->Status;
1828         EventData = event->pData;
1829
1830         if (status != 0)
1831         {
1832                 //TEST_DEBUG("******This is nonzero status. ******\n");
1833                 return;
1834         }
1835
1836         //...
1837         switch (eventType)
1838         {
1839                 case TAPI_EVENT_SS_BARRING_CHANGEPASS_CNF:
1840                         printf("Received Event : TAPI_EVENT_SS_BARRING_CHANGEPASS_CNF\n");
1841                         //check data
1842                         //
1843                         printf("Call barring Password Changed successfully\n");
1844                         break;
1845                         //...
1846         }
1847 }
1848 @endcode
1849 @}
1850 @defgroup Use_Cases3_3 Call Forward
1851 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
1852 @{
1853
1854
1855                 <h3 class="pg">Call Forward</h3>
1856 These APIs are used to set (activate/deactivate) the call forwarding option at the Network and to get call forward status. Call forwarding allows a user to forward incoming calls to another party. This service permits a called mobile subscriber to have the network send all incoming calls, or just those associated with a specific Basic service group meeting various call FORWARD conditions, to another directory number. The ability of the served mobile subscriber to originate calls is unaffected. If the service is activated, a call is forwarded only if the enabled forward condition is satisfied.
1857 @n Application has to call this API in order to explicitly register/erase/activate/deactivate the call forwarding. Request will be sent irrespective of whether another SS call forward is already ongoing.
1858
1859 @code
1860 int   tel_set_ss_forward ( const  TelSsForwardInfo_t *pForwardInfo, int * pRequestId);
1861 int   tel_get_ss_forward_status (TelSsForwardType_t Type, TelSsForwardWhen_t Condition, int *  pRequestId);
1862 @endcode
1863
1864 SAMPLE CODE FOR CALL FORWARD
1865 @code
1866 #include <stdio.h>
1867 #include <TapiCommon.h>
1868 #include <ITapiSS.h>
1869
1870 //SUBSCRIBE FOR EVENTS AS MENTIONED INEvent Register and Deregister
1871 void callfwd()
1872 {
1873         int ret_status = 0;
1874         int pRequestId = 0;
1875         TelSsForwardInfo_t pForwardInfo;
1876
1877         pForwardInfo.Mode = TAPI_CALL_FORWARD_MODE_ENABLE_EV;
1878         pForwardInfo.Type = TAPI_CS_FORWARD_TYPE_VOICE_EV;
1879         pForwardInfo.Condition = TAPI_SS_FORWARD_WHEN_UNCONDITIONAL_EV;
1880         pForwardInfo.NoReplyConditionTimer = 10;
1881
1882         int len;
1883         char *cf_number = "9986529874"; //number to which calles need to be forwarded.
1884
1885         len = strlen(cf_number);
1886         printf("Length of CF number :%d \n", len);
1887         memcpy(&(pForwardInfo.szPhoneNumber), cf_number, len);
1888
1889         ret_status = tel_set_ss_forward (&pForwardInfo, &pRequestId);
1890         if (ret_status == TAPI_API_SUCCESS)
1891         {
1892                 printf("successful\n");
1893         }
1894         else
1895         {
1896                 printf("Error  = %d \n", ret_status);
1897         }
1898 }
1899 //WAIT FOR THE EVENT  HERE
1900
1901 static void app_callback (TelTapiEvent_t *event)
1902 {
1903         int eventClass;
1904         int eventType;
1905         int requestId,i;
1906         int status;
1907         void* EventData = NULL;
1908         unsigned int temp_handle = -1;
1909
1910         //...
1911         eventClass = event->EventClass;
1912         eventType = event->EventType;
1913         requestId = event->RequestId;
1914         status = event->Status;
1915         EventData = event->pData;
1916
1917         if (status != 0)
1918         {
1919                 //TEST_DEBUG("******This is nonzero status. ******\n");
1920                 return;
1921         }
1922
1923         //REFER Call Barring TO GET eventType AND EventData
1924         switch (eventType)
1925         {
1926                 case TAPI_EVENT_SS_FORWARD_CNF:
1927                         printf("Received Event :TAPI_EVENT_SS_FORWARD_CNF \n");
1928                         TelSsInfo_t SsInfo;
1929
1930                         if (EventData != NULL) {
1931                                 memcpy(&SsInfo, (TelSsInfo_t*)EventData, sizeof(TelSsInfo_t));
1932                                 printf("Number of records %d\n", SsInfo.NumberOfRecords);
1933                         }
1934
1935                         for (i=0; i<SsInfo.NumberOfRecords; i++)
1936                         {
1937                                 printf("Number of records %d\n", SsInfo.NumberOfRecords);
1938                                 printf("Record:%d Status:%d Teleservice:%d \n",
1939                                                 i,
1940                                                 SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status,
1941                                                 SsInfo.SsRecord.ForwardingRecord.rec_class[i].TeleCommService);
1942
1943                                 if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_REGISTERED)
1944                                         printf("Status: Registered \n");
1945                                 else if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
1946                                         printf("Status: Active \n");
1947                                 else
1948                                         printf("Status: Not Registered /Not Active\n");
1949                         }
1950                         break;
1951         }
1952 }
1953 @endcode
1954
1955 SAMPLE CODE FOR CALL FORWARD STATUS
1956 @code
1957 #include <stdio.h>
1958 #include <TapiCommon.h>
1959 #include <ITapiSS.h>
1960
1961 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
1962 void callfwdstatus()
1963 {
1964         int ret_status = 0;
1965         TelSsForwardType_t Type = TAPI_CS_FORWARD_TYPE_VOICE_EV;
1966         TelSsForwardWhen_t Condition = TAPI_SS_FORWARD_WHEN_UNCONDITIONAL_EV;
1967         int pRequestId = 0;
1968
1969         ret_status = tel_get_ss_forward_status(Type, Condition, &pRequestId);
1970         if (ret_status == TAPI_API_SUCCESS)
1971         {
1972                 printf("successful\n");
1973         }
1974         else
1975         {
1976                 printf("Error  = %d \n", ret_status);
1977         }
1978 }
1979
1980 //WAIT FOR THE EVENT  HERE
1981
1982 static void app_callback (TelTapiEvent_t *event)
1983 {
1984         int eventClass;
1985         int eventType;
1986         int requestId, i;
1987         int status;
1988         void* EventData = NULL;
1989         unsigned int temp_handle = -1;
1990
1991         //...
1992         eventClass = event->EventClass;
1993         eventType = event->EventType;
1994         requestId = event->RequestId;
1995         status = event->Status;
1996         EventData = event->pData;
1997
1998         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
1999
2000         if (status != 0)
2001         {
2002                 //TEST_DEBUG("******This is nonzero status. ******\n");
2003                 return;
2004         }
2005
2006         //...
2007         //...
2008         switch (eventType)
2009         {
2010                 case TAPI_EVENT_SS_FORWARD_QUERYSTATUS_CNF:
2011                         // REFER Call Barring TO GET eventType AND EventData
2012                         TelSsInfo_t SsInfo;
2013
2014                         if (EventData != NULL)
2015                                 memcpy(&SsInfo, (TelSsInfo_t*)EventData, sizeof(TelSsInfo_t));
2016
2017                         for (i=0; i<SsInfo.NumberOfRecords; i++)
2018                         {
2019                                 printf("Number of records %d \n",SsInfo.NumberOfRecords);
2020                                 printf("Record:%d Status:%d Teleservice:%d \n",
2021                                                 i,
2022                                                 SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status,
2023                                                 SsInfo.SsRecord.ForwardingRecord.rec_class[i].TeleCommService);
2024
2025                                 if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_REGISTERED)
2026                                         printf(" Status: Registered      \n");
2027                                 else if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
2028                                         printf("  Status: Active   \n");
2029                                 else
2030                                         printf("    Status: Not Registered /Not Active     \n");
2031                         }
2032                         break;
2033         }
2034 }
2035 //...
2036 @endcode
2037 @}
2038 @defgroup Use_Cases3_4 Call Waiting
2039 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2040 @{
2041
2042
2043                 <h3 class="pg">Call Waiting</h3>
2044 These APIs activate/deactivate the call waiting service and provide the status of call wait feature. The call waiting service permits a mobile to be notified of an incoming call (as per basic call procedures) whilst the traffic channel is not available for the incoming call or when the mobile subscriber is engaged in an active or held call. Subsequently, the subscriber can accept, reject, or ignore the incoming call.
2045
2046 @code
2047 int   tel_set_ss_waiting ( const TelSsWaitingInfo_t *waitInfo, int * RequestID);
2048 int   tel_get_ss_waiting_status ( const TelSsCallType_t CallType, int * RequestID);
2049 @endcode
2050
2051 SAMPLE CODE FOR CALL WAITING
2052 @code
2053 #include <stdio.h>
2054 #include <TapiCommon.h>
2055 #include <ITapiSS.h>
2056
2057 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2058 void callwaiting()
2059 {
2060         int ret_status;
2061         int RequestID;
2062         TelSsWaitingInfo_t waitInfo;
2063
2064         waitInfo.Mode = TAPI_SS_CW_ACTIVATE;
2065         waitInfo.CallType = TAPI_CALL_TYPE_VOICE_EV;
2066
2067         ret_status = tel_set_ss_waiting (&waitInfo, &RequestID);
2068         if (ret_status == TAPI_API_SUCCESS)
2069         {
2070                 printf("successful\n");
2071         }
2072         else
2073         {
2074                 printf("Error  = %d \n", ret_status);
2075         }
2076 }
2077 //WAIT FOR THE EVENT  HERE
2078
2079 //CALLBACK FUNCTION TO BE USED
2080 static void app_callback (TelTapiEvent_t *event)
2081 {
2082         int eventClass;
2083         int eventType;
2084         int requestId, i;
2085         int status;
2086         void* EventData = NULL;
2087         unsigned int temp_handle = -1;
2088
2089         //...
2090         eventClass = event->EventClass;
2091         eventType = event->EventType;
2092         requestId = event->RequestId;
2093         status = event->Status;
2094         EventData = event->pData;
2095
2096         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
2097
2098         if (status != 0)
2099         {
2100                 //TEST_DEBUG("******This is nonzero status. ******\n");
2101                 return;
2102         }
2103
2104         //...
2105         switch (eventType)
2106         {
2107                 case TAPI_EVENT_SS_WAITING_CNF:
2108                         printf("Received Event : TAPI_EVENT_SS_WAITING_CNF  \n");
2109                         //REFER Call Barring TO GET eventType AND EventData
2110
2111                         TelSsInfo_t SsInfo;
2112
2113                         memcpy(&SsInfo, (TelSsInfo_t*)EventData, sizeof(TelSsInfo_t));
2114
2115                         for (i=0; i<SsInfo.NumberOfRecords; i++)
2116                         {
2117                                 printf("Number of records %d \n", SsInfo.NumberOfRecords);
2118                                 printf("Record:%d Status:%d Teleservice:%d \n",
2119                                                 i,
2120                                                 SsInfo.SsRecord.WaitingRecord.rec_class[i].Status,
2121                                                 SsInfo.SsRecord.WaitingRecord.rec_class[i].TeleCommService);
2122
2123                                 if (SsInfo.SsRecord.WaitingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
2124                                         printf("Status: Active      \n");
2125                                 else
2126                                         printf(" Status: Not Active   \n");
2127                         }
2128                         break;
2129                 //...
2130         }
2131 }
2132 @endcode
2133
2134 SAMPLE CODE FOR CALL WAITING STATUS
2135 @code
2136 #include <stdio.h>
2137 #include <TapiCommon.h>
2138 #include <ITapiSS.h>
2139
2140 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2141 void callwaiting()
2142 {
2143         int ret_status;
2144         TelSsCallType_t CallType = TAPI_CALL_TYPE_VOICE_EV;
2145         int RequestID=0;
2146
2147         ret_status = tel_get_ss_waiting_status(CallType, &RequestID);
2148         if (ret_status == TAPI_API_SUCCESS)
2149         {
2150                 printf("successful\n");
2151         }
2152         else
2153         {
2154                 printf("Error  = %d \n", ret_status);
2155         }
2156 }
2157 //WAIT FOR THE EVENT  HERE
2158
2159 //CALLBACK FUNCTION TO BE USED
2160 static void app_callback (TelTapiEvent_t *event)
2161 {
2162         int eventClass;
2163         int eventType;
2164         int requestId, i;
2165         int status;
2166         void* EventData = NULL;
2167         unsigned int temp_handle = -1;
2168
2169         //
2170         eventClass = event->EventClass;
2171         eventType = event->EventType;
2172         requestId = event->RequestId;
2173         status = event->Status;
2174         EventData = event->pData;
2175
2176         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
2177
2178         if (status != 0)
2179         {
2180                 //TEST_DEBUG("******This is nonzero status. ******\n");
2181                 return;
2182         }
2183
2184         //...
2185         switch (eventType)
2186         {
2187                 case TAPI_EVENT_SS_WAITING_QUERYSTATUS_CNF:
2188                         printf("Received Event :TAPI_EVENT_SS_WAITING_QUERYSTATUS_CNF\n");
2189                         //REFER Call Barring TO GET eventType AND EventData
2190
2191                         TelSsInfo_t SsInfo;
2192                         if (EventData != NULL)
2193                                 memcpy(&SsInfo, (TelSsInfo_t*)EventData, sizeof(TelSsInfo_t));
2194
2195                         for (i=0; i<SsInfo.NumberOfRecords; i++)
2196                         {
2197                                 printf("Number of records %d \n", SsInfo.NumberOfRecords);
2198                                 printf("Record:%d Status:%d Teleservice:%d \n",
2199                                                 i,
2200                                                 SsInfo.SsRecord.WaitingRecord.rec_class[i].Status,
2201                                                 SsInfo.SsRecord.WaitingRecord.rec_class[i].TeleCommService);
2202
2203                                 if (SsInfo.SsRecord.WaitingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
2204                                         printf(" Status: Active      \n");
2205                                 else
2206                                         printf("Status: Not Active   \n");
2207                         }
2208                         break;
2209                         //...
2210         }
2211 }
2212 @endcode
2213 @}
2214 @defgroup Use_Cases3_5 CLI Service Status
2215 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2216 @{
2217
2218
2219                 <h3 class="pg">CLI Service Status</h3>
2220 <strong>[Note] Telephony Emulator does not support this feature.</strong>
2221
2222 Telephony provides an API to query the status of calling line identity service. The CLI service permits a mobile to show or hide his identity to the called party.
2223
2224 @code
2225 int   tel_get_ss_cli_status (TelSsCliType_t CliType,int * pRequestId );
2226 @endcode
2227
2228 SAMPLE CODE
2229 @code
2230 #include <stdio.h>
2231 #include <TapiCommon.h
2232 #include <ITapiSS.h>
2233
2234 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2235 void cliservicestatus()
2236 {
2237         int ret_status;
2238         TelSsCliType_t CliType = TAPI_SS_CLI_CDIP;
2239         int pRequestId;
2240
2241         ret_status = tel_get_ss_cli_status (CliType, &pRequestId);
2242         if (ret_status == TAPI_API_SUCCESS)
2243         {
2244                 printf("successful\n");
2245         }
2246         else
2247         {
2248                 printf("Error  = %d \n", ret_status);
2249         }
2250 }
2251 //WAIT FOR THE EVENT  HERE
2252
2253 //CALLBACK FUNCTION TO BE USED
2254 static void app_callback (TelTapiEvent_t *event)
2255 {
2256         int eventClass;
2257         int eventType;
2258         Int requestId;
2259         int status;
2260         void* EventData = NULL;
2261         unsigned int temp_handle = -1;
2262
2263         //...
2264         eventClass = event->EventClass;
2265         eventType = event->EventType;
2266         requestId = event->RequestId;
2267         status = event->Status;
2268         EventData = event->pData;
2269
2270         // TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
2271
2272         if (status != 0)
2273         {
2274                 //TEST_DEBUG("******This is nonzero status. ******\n");
2275                 return;
2276         }
2277
2278         //...
2279         switch (eventType)
2280         {
2281                 //REFER Call Barring TO GET eventType AND EventData
2282
2283                 case TAPI_EVENT_SS_IDENTIFY_IND:
2284                         TelSsInfo_t SsInfo;
2285                         memcpy(&SsInfo, (TelSsInfo_t*)EventData, sizeof(TelSsInfo_t));
2286                         printf("Received Event : TAPI_EVENT_SS_IDENTIFY_IND \n");
2287                         printf("Status :%d   CLI Service : %d\n",
2288                                         SsInfo.SsRecord.CliRecord.CliStatus,
2289                                         SsInfo.SsRecord.CliRecord.IdentificationType);
2290                         break;
2291                         //...
2292         }
2293 }
2294 @endcode
2295 @}
2296 @defgroup Use_Cases3_6 Send USSD Request
2297 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2298 @{
2299
2300
2301                 <h3 class="pg">Send USSD Request </h3>
2302 This API is used to send a USSD string to the Network. This is an Asynchronous API.
2303
2304 Pre Conditions:
2305 @n No SS and USSD Transaction should be ongoing. If there an ongoing transaction, new USSD request will be returned to the Application with an error (USSD_BUSY)
2306
2307 @code
2308 int  tel_send_ss_ussd_request( const char* szUssdString, int * pRequestId);
2309 @endcode
2310
2311 SAMPLE CODE
2312 @code
2313 #include <stdio.h>
2314 #include <TapiCommon.h>
2315 #include <ITapiSS.h>
2316
2317 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2318 void sendussdreq()
2319 {
2320         char ussdString[TAPI_SS_USSD_DATA_SIZE_MAX];
2321         int ret;
2322
2323         memset(ussdString, 0, TAPI_SS_USSD_DATA_SIZE_MAX);
2324         strcpy(ussdString, "*124#");
2325
2326         ret = tel_send_ss_ussd_request (ussdString, &request_id);
2327
2328         ret = tel_send_ss_ussd_request (pAppMsg, &pRequestId);
2329 }
2330 //WAIT FOR THE EVENT  HERE
2331
2332 static void app_callback (TelTapiEvent_t *event)
2333 {
2334         int eventClass;
2335         int eventType;
2336         int requestId;
2337         int status;
2338         void* EventData = NULL;
2339         unsigned int temp_handle = -1;
2340
2341         //..
2342         eventClass = event->EventClass;
2343         eventType = event->EventType;
2344         requestId = event->RequestId;
2345         status = event->Status;
2346         EventData = event->pData;
2347
2348         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
2349
2350         if (status != 0)
2351         {
2352                 //TEST_DEBUG("******This is nonzero status. ******\n");
2353                 return;
2354         }
2355         //..
2356
2357         switch (eventType)
2358         {
2359                 case TAPI_EVENT_SS_USSD_CNF:
2360                         TelSsUssdMsgIndInfo_t UssdRecord;
2361                         memcpy(&UssdRecord, (TelSsInfo_t*)EventData, sizeof(TelSsUssdMsgIndInfo_t));
2362                         printf("got event : TAPI_EVENT_SS_USSD_CNF:\n");
2363                         //...
2364                         break;
2365                 //..
2366         }
2367 }
2368 @endcode
2369 @}
2370 @defgroup Use_Cases3_7 Send USSD Response
2371 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2372 @{
2373
2374
2375                 <h3 class="pg">Send USSD Response</h3>
2376 This API is used to send a User response to the Network. This is an Asynchronous API.
2377
2378 Pre Conditions:
2379 No SS and USSD Transaction should be ongoing. If there an ongoing transaction, new USSD request will be returned to the Application with an error (USSD_BUSY)
2380 @code
2381 int  tel_send_ss_ussd_response( const TelSsUssdMsgRspInfo_t* ussdRspRecord, int * RequestID);
2382 @endcode
2383
2384 SAMPLE CODE
2385 @code
2386 #include <stdio.h>
2387 #include <TapiCommon.h>
2388 #include <ITapiSS.h>
2389
2390 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2391 void sendussdresp()
2392 {
2393         char *ussd_str = "*123*0#";
2394         int ret = 0;
2395         int pRequestId = 0;
2396
2397         TelSsUssdMsgRspInfo_t *ussdRspRecord;
2398
2399         ussdRspRecord = (TelSsUssdMsgRspInfo_t*)malloc(sizeof(TelSsUssdMsgRspInfo_t));
2400         ussdRspRecord->SsRespType = TAPI_USSD_RES_OK;
2401         ussdRspRecord->IndType = TAPI_USSD_IND_NOTIFY;
2402         ussdRspRecord->UssdInfo.Dcs = 0x0f;
2403         ussdRspRecord->UssdInfo.RequestedBySAT = 0;
2404         strncpy(ussdRspRecord->UssdInfo.szUssdString, ussd_str, TAPI_SS_USSD_DATA_SIZE_MAX);
2405         ussdRspRecord->UssdInfo.szUssdString[strlen(ussdRspRecord->UssdInfo.szUssdString)] = '\0';
2406         ussdRspRecord->UssdInfo.UssdStringLength = strlen(ussd_str);
2407
2408         ret = tel_send_ss_ussd_response (ussdRspRecord, &pRequestId);
2409         printf ("The return value is %d\n", ret);
2410 }
2411 //WAIT FOR THE EVENT  HERE
2412
2413 static void app_callback (TelTapiEvent_t *event)
2414 {
2415         int eventClass;
2416         int eventType;
2417         int requestId;
2418         int status;
2419         void* EventData = NULL;
2420         unsigned int temp_handle = -1;
2421
2422         //...
2423         eventClass = event->EventClass;
2424         eventType = event->EventType;
2425         requestId = event->RequestId;
2426         status = event->Status;
2427         EventData = event->pData;
2428
2429         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
2430
2431         if (status != 0)
2432         {
2433                 //TEST_DEBUG("******This is nonzero status. ******\n");
2434                 return;
2435         }
2436         //...
2437         //...
2438         switch (eventType)
2439         {
2440                 case TAPI_EVENT_SS_USSD_CNF:
2441                         TelSsUssdMsgIndInfo_t UssdRecord;
2442                         memcpy(&UssdRecord, (TelSsInfo_t*)EventData, sizeof(TelSsUssdMsgIndInfo_t));
2443                         printf("got event : TAPI_EVENT_SS_USSD_CNF:\n");
2444                         //...
2445                         break;
2446                         //...
2447         }
2448 }
2449 @endcode
2450 @}
2451 @defgroup Use_Cases3_8 Send USSD Cancel Request
2452 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2453 @{
2454
2455
2456                 <h3 class="pg">Send USSD Cancel Request </h3>
2457 This API sends a USSD cancel request to the Network to release USSD session.
2458
2459 Pre Conditions:
2460 @n SS and USSD Transaction should be ongoing.
2461
2462 @code
2463 int  tel_send_ss_ussd_cancel ( int * pRequestId);
2464 @endcode
2465
2466 SAMPLE CODE
2467 @code
2468 #include <stdio.h>
2469 #include <TapiCommon.h>
2470 #include <ITapiSS.h>
2471
2472 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2473 void sendussdcancelreq()
2474 {
2475         char ussdString[TAPI_SS_USSD_DATA_SIZE_MAX];
2476         int ret;
2477         int requestId = 0;
2478
2479         memset(ussdString, 0, TAPI_SS_USSD_DATA_SIZE_MAX);
2480         strcpy(ussdString, "*124#");
2481
2482         ret = tel_send_ss_ussd_request(ussdString, &requestId);
2483         printf ("The return value is %d\n", ret);
2484
2485         ret = tel_send_ss_ussd_cancel(&equestId);
2486         printf ("The return value is %d\n", ret);
2487 }
2488
2489 //WAIT FOR THE EVENTS  HERE
2490
2491 static void app_callback (TelTapiEvent_t *event)
2492 {
2493         int eventClass;
2494         int eventType;
2495         int requestId;
2496         int status;
2497         void* EventData = NULL;
2498         unsigned int temp_handle = -1;
2499
2500         //...
2501         eventClass = event->EventClass;
2502         eventType = event->EventType;
2503         requestId = event->RequestId;
2504         status = event->Status;
2505         EventData = event->pData;
2506
2507         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]          \n", eventClass, eventType , requestId, status );
2508
2509         if (status != 0)
2510         {
2511                 //TEST_DEBUG("******This is nonzero status. ******\n");
2512                 return;
2513         }
2514         //...
2515         //...
2516         switch (eventType)
2517         {
2518                 case TAPI_EVENT_SS_USSD_CNF:
2519                         printf("got event : TAPI_EVENT_SS_USSD_CNF:\n");
2520                         //...
2521                         break;
2522
2523                 case TAPI_EVENT_SS_USSD_CANCEL_CNF:
2524                         printf("got event : TAPI_EVENT_SS_USSD_CANCEL_CNF:\n");
2525                         //...
2526                         break;
2527
2528                 //...
2529         }
2530 }
2531 @endcode
2532 @}
2533 @defgroup Use_Cases3_9 AOC Info
2534 @ingroup Use_Cases3_SUPPLEMENTARY_SERVICE
2535 @{
2536
2537
2538                 <h3 class="pg">AOC Info</h3>
2539 These APIs set and read AOC parameter values on the SIM.
2540
2541 Pre Conditions:
2542 @n Advice of charge feature is dependent on the SIM for setting or reading aoc parameters. Setting of AOC requires PIN2 Verification
2543
2544 @code
2545 int  tel_get_ss_aoc_info ( TelSsAocType_t AocType, int * pRequestId);
2546 int  tel_set_ss_aoc_info ( TelCallAocInfo_t * pAocSetInfo, int * pRequestId);
2547 @endcode
2548
2549 SAMPLE CODE
2550 @code
2551 #include <stdio.h>
2552 #include <TapiCommon.h>
2553 #include <ITapiSS.h>
2554
2555 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2556
2557 //Complete PIN2verification process as mentioned in SIM
2558 void aocinforeq()
2559 {
2560         //set aoc
2561         printf(" Resetting Total Cost  \n");
2562
2563         TelCallAocInfo_t *pAocSetInfo;
2564         int request_id;
2565         int ret_status = 0;
2566
2567         pAocSetInfo = (TelCallAocInfo_t *)calloc(1, sizeof(TelCallAocInfo_t));
2568         pAocSetInfo->AocType = TAPI_SS_AOC_TYPE_RESET;
2569
2570         ret = tel_set_ss_aoc_info (pAocSetInfo, &request_id);
2571         if (ret_status == TAPI_API_SUCCESS)
2572         {
2573                 printf("successful\n");
2574         }
2575         else
2576         {
2577                 printf("Error  = %d \n", ret_status);
2578         }
2579 }
2580
2581 //WAIT FOR THE EVENT  HERE
2582 static void app_callback (TelTapiEvent_t *event)
2583 {
2584         int eventClass;
2585         int eventType;
2586         int requestId;
2587         int status;
2588         void* EventData = NULL;
2589         unsigned int temp_handle = -1;
2590
2591         //
2592         eventClass = event->EventClass;
2593         eventType = event->EventType;
2594         requestId = event->RequestId;
2595         status = event->Status;
2596         EventData = event->pData;
2597
2598         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
2599
2600         if (status != 0)
2601         {
2602                 //TEST_DEBUG("******This is nonzero status. ******\n");
2603                 return;
2604         }
2605         switch (eventType)
2606         {
2607                 case TAPI_EVENT_SS_SET_AOC_CNF:
2608                         printf("Received Event : SS -- TAPI_EVENT_SS_SET_AOC_CNF\n");
2609                         break;
2610         }//...
2611 }
2612
2613 //read aoc
2614 void readaoc()
2615 {
2616         TelSsAocType_t AocType = TAPI_SS_AOC_TYPE_ACM;
2617
2618         ret_status = tel_get_ss_aoc_info (AocType, &pRequestId);
2619         if (ret_status == TAPI_API_SUCCESS)
2620         {
2621                 printf("successful\n");
2622         }
2623         else
2624         {
2625                 printf("Error  = %d \n", ret_status);
2626         }
2627 }
2628 //WAIT FOR THE EVENT  HERE
2629
2630 static void app_callback (TelTapiEvent_t *event)
2631 {
2632         int eventClass;
2633         int eventType;
2634         int requestId;
2635         int status;
2636         void* EventData = NULL;
2637         unsigned int temp_handle = -1;
2638
2639         eventClass = event->EventClass;
2640         eventType = event->EventType;
2641         requestId = event->RequestId;
2642         status = event->Status;
2643         EventData = event->pData;
2644
2645         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
2646
2647         if (status != 0)
2648         {
2649                 //TEST_DEBUG("******This is nonzero status. ******\n");
2650                 return;
2651         }
2652
2653         switch (eventType)
2654         {
2655                 case TAPI_EVENT_SS_AOC_RSP:
2656                         TelCallAocInfo_t aoc_info;
2657                         memcpy(&aoc_info, (TelCallAocInfo_t*)EventData, sizeof(TelCallAocInfo_t));
2658                         printf("Received Event : SS -- TAPI_EVENT_SS_AOC_RSP\n");
2659                         printf(" AOC TYPE :%d\n", aoc_info.AocType);
2660                         break;
2661         }
2662
2663 }//...
2664 @endcode
2665 @}
2666
2667         <h2 class="pg">SMS</h2>
2668
2669 @defgroup Use_Cases4_1 Event register and deregister
2670 @ingroup Use_Cases4_SMS
2671 @{
2672
2673                 <h3 class="pg">Event register and deregister</h3>
2674 To receive asynchronous event notifications for the SMS APIs, the registration of related events with their associated call backs is required. When an asynchronous API is called, the confirmation is returned as an asynchronous event notification which invokes the callback function along with the event data.
2675 @nSMS in the telephony framework only provides an interface to the modem and doesn’t handle Transport layer, storing and deleting the SMS in the storage except SIM. Because of this we recommend you shouldn’t access this API directly, and should use the MAPI of Message Framework instead.
2676
2677 Notification Events are as follows.
2678 @code
2679 TAPI_EVENT_NETTEXT_INCOM_IND
2680 TAPI_EVENT_NETTEXT_CB_INCOM_IND
2681 TAPI_EVENT_NETTEXT_INCOM_EX_IND
2682 TAPI_EVENT_NETTEXT_CB_INCOM_EX_IND
2683 TAPI_EVENT_NETTEXT_MEMORY_STATUS_IND
2684 TAPI_EVENT_NETTEXT_DEVICE_READY_IND
2685 @endcode
2686
2687 SAMPLE CODE
2688 @code
2689 // REGISTER EVENT
2690 unsigned int subscription_id = 0;
2691 int api_err;
2692
2693 api_err = tel_init();
2694 if (api_err != TAPI_API_SUCCESS)
2695 {
2696         TEST_DEBUG("tel_init Failed - api_err = %d \n", api_err);
2697 }
2698 api_err = tel_register_event(TAPI_EVENT_NETTEXT_SENTSTATUS_CNF, &subscription_id, (TelAppCallback)&app_callback);
2699 printf("Nettext Class registration is Done: sub id is %d, api_err is %d\n", subscription_id, api_err);
2700
2701 tel_register_app_name("com.samsung.appname");
2702
2703 // DEREGISTER EVENT
2704 api_err = tel_deregister_event(subscription_id);
2705 if (api_err != TAPI_API_SUCCESS)
2706 {
2707         printf("Event Class Unregistration Fail\n");
2708 }
2709
2710 // SMS notification callback function
2711 void app_callback(void)
2712 {
2713         int eventClass;
2714         int eventType;
2715         int requestId;
2716         int status;
2717         void *EventData = NULL;
2718
2719         eventClass = event->EventClass;
2720         eventType = event->EventType;
2721         requestId = event->RequestId;
2722         status = event->Status;
2723         EventData = event->pData;
2724
2725         printf(" app _callback is called \n");
2726
2727         print_events((int)eventType);
2728         printf("\n event came in power_callback [%d] \n", eventType);
2729         printf("\n expected event is  in callback [%d] \n", expected_event);
2730
2731         switch (eventType)
2732         {
2733                 case TAPI_EVENT_NETTEXT_INCOM_IND:
2734                         TelSmsDatapackageInfo_t *ptrDataPackage;
2735                         printf("SMS Incoming Message\n");
2736                         ptrDataPackage = (TelSmsDatapackageInfo_t *)EventData;
2737                         // Decoding Service Center Address
2738                         // Decoding TPDU(SMS-DELIVER, SMS-STATUS)
2739                         break;
2740
2741                 case TAPI_EVENT_NETTEXT_CB_INCOM_IND:
2742                         TelSmsCbMsg_t *ptrCbMsgInfo;
2743                         printf("SMS Cell Broadcasting Incoming Message\n");
2744                         ptrCbMsgInfo = (TelSmsCbMsg_t *)EventData;
2745                         // Decoding Cell broadcasting Message in szData [Refer to 3GPP TS23.041 9.4.1]
2746                         break;
2747
2748                 case TAPI_EVENT_NETTEXT_INCOM_EX_IND:
2749                         TelSmsMsgInfo_t *pMsgInfo;
2750                         printf("CDMA SMS Incoming Message\n");
2751                         pMsgInfo = (TelSmsMsgInfo_t *)EventData;
2752                         // Decoding TPDU(SMS-DELIVER, SMS-STATUS)
2753                         break;
2754
2755                 case TAPI_EVENT_NETTEXT_CB_INCOM_EX_IND:
2756                         TelSmsMsgInfo_t *pMsgInfo = NULL;
2757                         printf("CDMA SMS Incoming Message\n");
2758                         pMsgInfo = (TelSmsMsgInfo_t *)EventData;
2759                         // Decoding Cell broadcasting Message in szData
2760                         break;
2761
2762                 case TAPI_EVENT_NETTEXT_MEMORY_STATUS_IND:
2763                         int *status = NULL;
2764                         printf("SIM Memory Status Notification\n");
2765                         status = (TelSmsMemStatusType *)EventData;
2766                         if (*status == TAPI_NETTEXT_PHONE_MEMORY_STATUS_AVAILABLE)
2767                                 printf("SIM Memory Available\n");
2768                         else if (*status == TAPI_NETTEXT_PHONE_MEMORY_STATUS_FULL)
2769                                 printf("SIM Memory Full\n");
2770                         else
2771                                 printf("Unknown Type\n");
2772                         break;
2773
2774                 case TAPI_EVENT_NETTEXT_DEVICE_READY_IND:
2775                         int *pDeviceReady = NULL;
2776                         printf("SMS Device Ready Status Notification\n");
2777                         pDeviceReady = (int*)EventData;
2778                         if (pDeviceReady->Result == 1)
2779                                 printf("Device Ready\n");
2780                         else
2781                                 printf("Unknown Type\n");
2782                         break;
2783         }
2784         return;
2785 }
2786 @endcode
2787 @}
2788 @defgroup Use_Cases4_2 Send SMS
2789 @ingroup Use_Cases4_SMS
2790 @{
2791
2792
2793                 <h3 class="pg">Send SMS</h3>
2794 Telephony provides an API to send an SMS to the network. This API allows the transmission of an SMS PDU as defined by 3GPP TS 23.040 (SMS-SUBMIT, SMS-COMMAND) to the lower layers. If there is a need to send multiple parts of a concatenated message, this API requests for a dedicated link, through the input parameter MoreMessageToSend, from the lower layers. This will ensure the lower layers do not release the dedicated connection if there are more messages expected.
2795
2796 @code
2797 int tel_send_sms (const TelSmsDatapackageInfo_t* pDataPackage, int bMoreMsgToSend, int *pRequestId);
2798 @endcode
2799
2800 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
2801
2802 SAMPLE CODE
2803 @code
2804 #include <stdio.h>
2805 #include <stdlib.h>
2806 #include <TapiCommon.h>
2807 #include <ITapiNetText.h>
2808
2809 void send_sms()
2810 {
2811         //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2812         TelSmsDatapackageInfo_t *pDataPackage;
2813         int ret_status;
2814         int pRequestId = 0;
2815
2816         pDataPackage = (TelSmsDatapackageInfo_t *)malloc(sizeof(TelSmsDatapackageInfo_t));
2817
2818         //fill the structure appropriately
2819         //Sca parameter is optional. If you don't provide Service center address, you should fill "00" in sca array.
2820         //MsgLength is length of szData//fill the szData in TelSmsDatapackageInfo_t with SMS-SUBMIT or SMS-COMMAND TPDU.
2821
2822         ret_status = tel_send_sms (pDataPackage, 0, &pRequestId);
2823         if  (ret_status == TAPI_API_SUCCESS)
2824         {
2825                 printf("successful\n");
2826         }
2827         else
2828         {
2829                 printf("error = %d\n", ret_status);
2830         }
2831         //WAIT FOR THE EVENT  HERE
2832 }
2833
2834 static void app_callback (TelTapiEvent_t* event)
2835 {
2836         int eventClass;
2837         int eventType;
2838         int requestId;
2839         int status;
2840         void* EventData = NULL;
2841
2842         //...
2843         eventClass = event->EventClass;
2844         eventType = event->EventType;
2845         requestId = event->RequestId;
2846         status = event->Status;
2847         EventData = event->pData;
2848
2849         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
2850
2851         if (status != 0)
2852         {
2853                 //TEST_DEBUG("******This is nonzero status. ******\n");
2854                 return;
2855         }
2856
2857         switch (eventType) {
2858                 case TAPI_EVENT_NETTEXT_SENTSTATUS_CNF:
2859                         printf("\n***************************************\n");
2860                         printf("\n$$$ TAPI_EVENT_NETTEXT_SENTSTATUS_CNF $$$\n");
2861                         // Extract the Event Data here
2862
2863                         break;
2864         }
2865         //..
2866 }
2867 @endcode
2868 @}
2869 @defgroup Use_Cases4_3 Send SMS Message
2870 @ingroup Use_Cases4_SMS
2871 @{
2872
2873
2874                 <h3 class="pg">Send SMS Message</h3>
2875 This API is used to send an SMS message to the network. This API allows the transmission of an SMS PDU as defined by 3GPP2 C.S0015 (SMS-SUBMIT, SMS-ACK, SMS-CANCEL) to the lower layers. If there is a need to send multiple parts of a concatenated message, this API requests for a dedicated link, through the input parameter MoreMessageToSend, from the lower layers. This will ensure the lower layers do not release the dedicated connection if there are more messages expected. This is currently supported in CDMA.
2876
2877 @code
2878 int tel_send_sms_msg (const TelSmsMsgInfo_t* pSmsMsgInfo,unsigned int MoreMsgToSend, int *pRequestId);
2879 @endcode
2880
2881 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
2882
2883 SAMPLE CODE
2884 @code
2885 #include <stdio.h>
2886 #include <stdlib.h>
2887 #include <TapiCommon.h>
2888 #include <ITapiNetText.h>
2889
2890 void send_sms_ex()
2891 {
2892         //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2893         int ret_status;
2894         int requestId = 0;
2895         TelSmsMsgInfo_t pMsgInfo;
2896         char* diallingNum;
2897         int dialNumLen;
2898         TelSmsMsgInfo_t *pDataPackage = malloc(sizeof(TelSmsMsgInfo_t));
2899
2900         memset(pDataPackage, 0, sizeof(TelSmsMsgInfo_t));
2901         pDataPackage->MsgType = TAPI_NETTEXT_MESSAGETYPE_SUBMIT;
2902         pDataPackage->ParamMask |= TAPI_NETTEXT_PARAM_TELESERVICE_MASK;
2903         //fill structure appropriately
2904
2905         ret_status = tel_send_sms_msg (pDataPackage, 0, &requestId);
2906         if (ret_status == TAPI_API_SUCCESS)
2907         {
2908                 printf("successful\n");
2909         }
2910         else
2911         {
2912                 printf("error = %d\n", ret_status);
2913         }
2914 }
2915 //WAIT FOR EVENT HERE
2916 //CALLBACK FUNTION TO BE USED
2917 static void app_callback (TelTapiEvent_t *event)
2918 {
2919         int eventClass;
2920         int eventType;
2921         int requestId;
2922         int status;
2923         void* EventData = NULL;
2924
2925         //...
2926         eventClass = event->EventClass;
2927         eventType = event->EventType;
2928         requestId = event->RequestId;
2929         status = event->Status;
2930         EventData = event->pData;
2931
2932         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
2933
2934         if (status != 0)
2935         {
2936                 //TEST_DEBUG("******This is nonzero status. ******\n");
2937                 return;
2938         }
2939
2940         switch (eventType) {
2941                 case TAPI_EVENT_NETTEXT_SENTSTATUS_EX_CNF:
2942                         printf("\n***************************************\n");
2943                         printf("\n$$$ TAPI_EVENT_NETTEXT_SENTSTATUS_EX_CNF $$$\n");
2944                         break;
2945         }
2946         //...
2947 }
2948 @endcode
2949 @}
2950 @defgroup Use_Cases4_4 Read SMS
2951 @ingroup Use_Cases4_SMS
2952 @{
2953
2954
2955                 <h3 class="pg">Read SMS</h3>
2956 This API reads a message from SIM card storage. You should not access this API directly; instead use the Message Framework API.
2957
2958 @code
2959 int  tel_read_sms_in_sim(int Index, int *pRequestId);
2960 @endcode
2961
2962 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
2963
2964 SAMPLE CODE
2965 @code
2966 #include <stdio.h>
2967 #include <stdlib.h>
2968 #include <TapiCommon.h>
2969 #include <ITapiNetText.h>
2970
2971 void read_sms()
2972 {
2973         //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
2974         int ret_status;
2975         int pRequestId = 0;
2976
2977         ret_status = tel_read_sms_in_sim(0, &pRequestId);
2978         if (ret_status == TAPI_API_SUCCESS)
2979         {
2980                 printf("successful\n");
2981         }
2982         else
2983         {
2984                 printf("Error  = %d \n", ret_status);
2985         }
2986         //WAIT FOR EVENT HERE
2987 }
2988
2989 static void app_callback (TelTapiEvent_t *event)
2990 {
2991         int eventClass;
2992         int eventType;
2993         int requestId;
2994         int status;
2995         void* EventData = NULL;
2996
2997         //
2998         eventClass = event->EventClass;
2999         eventType = event->EventType;
3000         requestId = event->RequestId;
3001         status = event->Status;
3002         EventData = event->pData;
3003
3004         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3005
3006         if (status != 0)
3007         {
3008                 //TEST_DEBUG("******This is nonzero status. ******\n");
3009                 return;
3010         }
3011         //...
3012         //...
3013         switch (eventType) //REFER Send SMS TO GET eventType
3014         {
3015                 case TAPI_EVENT_NETTEXT_READ_SMS_CNF:
3016                         TelSmsData_t *pReadData;
3017                         printf("\n$$Read Msg Notification $$$\n");
3018                         pReadData = (TelSmsData_t *) event->pData;
3019                         printf("\n$$Read Msg index = [%d] $$$\n", pReadData->SimIndex);
3020                         printf("\n$$Read Msg status = [%d] $$$\n", pReadData->MsgStatus);
3021                         // TPDU
3022                         // pReadData->SmsData.szData
3023
3024                         break;
3025         }
3026 }
3027 //...
3028 @endcode
3029 @}
3030 @defgroup Use_Cases4_5 Write Sms
3031 @ingroup Use_Cases4_SMS
3032 @{
3033
3034
3035                 <h3 class="pg">Write Sms</h3>
3036 This API writes a message to SIM storage area.
3037 @n The parameter of this API is changed into TelSmsData_t.
3038 @n If SIM index in TelSmsData_t is -1, SMS message is stored at the first empty SIM index . The contents of szData is SMS-SUBMIT, SMS-DELIVER or SMS-STATUS REPORT TPDU. You should not access this API directly; use the Message Framework API.
3039
3040 @code
3041 int   tel_write_sms_in_sim(const TelSmsData_t *pWriteData, int *pRequestId);
3042 @endcode
3043
3044 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
3045
3046 SAMPLE CODE
3047 @code
3048 #include <stdio.h>
3049 #include <stdlib.h>
3050 #include <TapiCommon.h>
3051 #include <ITapiNetText.h>
3052
3053 void write_sms()
3054 {
3055         // SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3056         int ret_status;
3057         TelSmsData_t *pWriteData;
3058         int pRequestId = 0;
3059         char *msg = "This is an Test SMS";
3060         char *SCA = "821091";
3061
3062         pWriteData = malloc(sizeof(TelSmsData_t));
3063         if (pWriteData == NULL) {
3064                 printf("Memory Allocation fails\n");
3065                 return;
3066         }
3067
3068         // conv_service_center_address(pWriteData->SmsData.Sca, SCA);
3069         // conv_msg_into_tpdu(pWriteData->SmsData.szData, pWriteData->SmsData.MsgLength, msg);
3070         pWrite->MsgStatus = TAPI_NETTEXT_STATUS_READ;
3071         pWrite-> SimIndex = -1;
3072
3073         ret_status = tel_write_sms_in_sim (pWriteData, &pRequestId);
3074         if (ret_status == TAPI_API_SUCCESS)
3075         {
3076                 printf("successful\n");
3077         }
3078         else
3079         {
3080                 printf("error = %d\n", ret_status);
3081         }
3082         //WAIT FOR EVENT HERE
3083 }
3084 static void app_callback (TelTapiEvent_t *event)
3085 {
3086         int eventClass;
3087         int eventType;
3088         int requestId;
3089         int status;
3090         void* EventData = NULL;
3091
3092         //..
3093         eventClass = event->EventClass;
3094         eventType = event->EventType;
3095         requestId = event->RequestId;
3096         status = event->Status;
3097         EventData = event->pData;
3098
3099         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3100
3101         if (status != 0)
3102         {
3103                 //TEST_DEBUG("******This is nonzero status. ******\n");
3104                 return;
3105         }
3106         //..
3107         switch (eventType) //REFER Send SMS TO GET eventType
3108         {
3109                 case TAPI_EVENT_NETTEXT_SAVE_STATUS_CNF:
3110                         int *SimIndex = NULL;
3111                         printf("\n***************************************\n");
3112                         printf("\n$$Save Status Notification$$\n");
3113                         SimIndex = (int *)EventData;
3114                         printf("SIM Index stored SMS is [%d]\n", *SimIndex);
3115                         break;
3116         }
3117         //..
3118 }
3119 @endcode
3120 @}
3121 @defgroup Use_Cases4_6 Delete Sms
3122 @ingroup Use_Cases4_SMS
3123 @{
3124
3125
3126                 <h3 class="pg">Delete Sms</h3>
3127 This API deletes a message specified by the index (SIM index used when storing the sms) number or all the messages in the SIM storage area. If SIM index is -1, all SMS stored in SIM are deleted. You should not access this API directly; use the Message Framework API.
3128
3129 @code
3130 int tel_delete_sms_in_sim(int Index, int *pRequestId);
3131 @endcode
3132
3133 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
3134
3135 SAMPLE CODE:
3136 @code
3137 #include <stdio.h>
3138 #include <stdlib.h>
3139 #include <TapiCommon.h>
3140 #include <ITapiNetText.h>
3141
3142 void delete_sms()
3143 {
3144         //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3145         int ret_status;
3146         int pRequestId = 0;
3147
3148         ret_status = tel_delete_sms_in_sim(1, &pRequestId);
3149         if (ret_status == TAPI_API_SUCCESS)
3150         {
3151                 printf("successful\n");
3152         }
3153         else
3154         {
3155                 printf("error = %d\n", ret_status);
3156         }
3157         //WAIT FOR EVENT HERE
3158 }
3159 static void app_callback (TelTapiEvent_t *event)
3160 {
3161         int eventClass;
3162         int eventType;
3163         int requestId;
3164         int status;
3165         void* EventData = NULL;
3166
3167         //...
3168         eventClass = event->EventClass;
3169         eventType = event->EventType;
3170         requestId = event->RequestId;
3171         status = event->Status;
3172         EventData = event->pData;
3173
3174         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3175
3176         if (status != 0)
3177         {
3178                 //TEST_DEBUG("******This is nonzero status. ******\n");
3179                 return;
3180         }
3181
3182         switch (eventType) //REFER Send SMS TO GET eventType
3183         {
3184                 case TAPI_EVENT_NETTEXT_DELETE_STATUS_CNF:
3185                         printf("\n***************************************\n");
3186                         printf("\n$$Delete Notification$$$\n");
3187                         break;
3188         }
3189         //..
3190 }
3191 @endcode
3192 @}
3193 @defgroup Use_Cases4_7 Getting Sms Count
3194 @ingroup Use_Cases4_SMS
3195 @{
3196
3197
3198                 <h3 class="pg">Getting Sms Count</h3>
3199 This API is used to retrieve message count information such as Total record count, used record count and the indices list for SIM Storage. You should not access this API directly; use the Message Framework API.
3200
3201 @code
3202 int tel_get_sms_count (int *pRequestId);
3203 @endcode
3204
3205 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
3206
3207 SAMPLE CODE
3208 @code
3209 #include <stdio.h>
3210 #include <stdlib.h>
3211 #include <TapiCommon.h>
3212 #include <ITapiNetText.h>
3213
3214 void get_count()
3215 {
3216         //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3217         int ret_status;
3218         int pRequestId = 0;
3219
3220         ret_status = tel_get_sms_count (&pRequestId);
3221         if  (ret_status == TAPI_API_SUCCESS)
3222         {
3223                 printf("successful\n");
3224         }
3225         else
3226         {
3227                 printf("error = %d\n", ret_status);
3228         }
3229         //WAIT FOR EVENT HERE
3230 }
3231 static void app_callback (TelTapiEvent_t *event)
3232 {
3233         int eventClass;
3234         int eventType;
3235         int requestId;
3236         int status;
3237         void* EventData = NULL;
3238
3239         //
3240         eventClass = event->EventClass;
3241         eventType = event->EventType;
3242         requestId = event->RequestId;
3243         status = event->Status;
3244         EventData = event->pData;
3245
3246         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3247
3248         if (status != 0)
3249         {
3250                 //TEST_DEBUG("******This is nonzero status. ******\n");
3251                 return;
3252         }
3253         //..
3254         switch (eventType) //REFER Send SMS TO GET eventType
3255         {
3256                 case TAPI_EVENT_NETTEXT_GET_COUNT_CNF:
3257                         printf("\n***************************************\n");
3258                         printf("\n$$$GetMsgCountNotification$$$$\n");
3259                         MsgCountNotification(tapiEvent.pData);
3260                         break;
3261         }
3262         //..
3263 }
3264 void MsgCountNotification (char *pData)
3265 {
3266         static TelSmsStoredMsgCountInfo_t *countInfo;
3267         int loop_counter = 0;
3268         int returnStatus;
3269         countInfo = (TelSmsStoredMsgCountInfo_t *)pData;
3270         int requestId = 0;
3271
3272         if (countInfo->UsedCount != 0x00)
3273         {
3274                 fprintf(stderr, "Index LIST..........\n");
3275                 for (loop_counter  = 0; loop_counter < countInfo->UsedCount; loop_counter++)
3276                 {
3277                         fprintf(stderr, "[%02x]", countInfo->IndexList[loop_counter]);
3278                         returnStatus = tel_read_sms_in_sim (countInfo->IndexList[loop_counter], &requestId);
3279                         printf("After read msg: returnstatus %d request id is %d\n", returnStatus, requestId);
3280                 }
3281                 printf("In MsgCountNotification total cnt is %d, usedcnt is %dapi_err %d\n",
3282                                 countInfo->TotalCount,
3283                                 countInfo->UsedCount,
3284                                 returnStatus);
3285         }
3286
3287         printf("In MsgCountNotification total cnt is %d, usedcnt is %d\n", countInfo->TotalCount, countInfo->UsedCount);
3288 }
3289 @endcode
3290 @}
3291 @defgroup Use_Cases4_8 Setting Sms CB message
3292 @ingroup Use_Cases4_SMS
3293 @{
3294
3295
3296                 <h3 class="pg">Setting Sms CB message</h3>
3297 <strong>[Note] Telephony Emulator does not support this feature.</strong>
3298 @n This API is used to set the SMS CB Message Identifiers in the appropriate EF-CBMI/EF-CBMIR file in (U)SIM. This API also indicates the underlying provider to enable or disable CB Channel on which CB messages are received. You should not access this API directly; use the Message Framework API.
3299
3300 @code
3301 int  tel_set_sms_cb_config(const TelSmsCbConfig_t *pCBConfig, int *pRequestId);
3302 @endcode
3303
3304 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
3305
3306 SAMPLE CODE
3307 @code
3308 #include <stdio.h>
3309 #include <stdlib.h>
3310 #include <TapiCommon.h>
3311 #include <ITapiNetText.h>
3312
3313 void set_cbconfig()
3314 {
3315         //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3316         int ret_status;
3317         int pRequestId = 0;
3318         TelSmsCbConfig_t *pCBConfig = NULL;
3319
3320         pCBConfig = (TelSmsCbConfig_t *)malloc(sizeof(TelSmsCbConfig_t));
3321         pCBConfig->bCBEnabled = 1;
3322         pCBConfig->SelectedId = 0x01;
3323         pCBConfig->MsgIdCount = 0x02;
3324
3325         pCBConfig->MsgIDs[0] = 0x0c;
3326         pCBConfig->MsgIDs[1] = 0x0c;
3327         pCBConfig->MsgIDs[2] = 0xdf;
3328         pCBConfig->MsgIDs[3] = 0x00;
3329
3330         ret_status = tel_set_sms_cb_config(pCBConfig, &pRequestId);
3331         if (ret_status == TAPI_API_SUCCESS)
3332         {
3333                 printf("successful\n");
3334         }
3335         else
3336         {
3337                 printf("error = %d\n", ret_status);
3338         }
3339         //WAIT FOR EVENT HERE
3340 }
3341
3342 //CALLBACK FUNCTION TO BE USED
3343 static void app_callback (TelTapiEvent_t *event)
3344 {
3345         int eventClass;
3346         int eventType;
3347         int requestId;
3348         int status;
3349         void* EventData = NULL;
3350
3351         //..
3352         eventClass = event->EventClass;
3353         eventType = event->EventType;
3354         requestId = event->RequestId;
3355         status = event->Status;
3356         EventData = event->pData;
3357
3358         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3359
3360         if (status != 0)
3361         {
3362                 //TEST_DEBUG("******This is nonzero status. ******\n");
3363                 return;
3364         }
3365
3366         switch (eventType) //REFER Send SMS TO GET eventType
3367         {
3368                 case TAPI_EVENT_NETTEXT_SET_REQUEST_CNF:
3369                         TelSmsSetResponse *RequestType;
3370                         printf("\n***************************************\n");
3371                         printf("\n$$$$$$   SET CONFIRMATION $$$$$$ \n");
3372                         RequestType = (TelSmsSetResponse *)EventData;
3373                         if (*RequestType == TAPI_NETTEXT_CBSETCONFIG_RSP) {
3374                                 printf("\n$$$$$$   SET CB CONFIRMATION $$$$$$ \n");
3375                         }
3376                         break;
3377         }
3378 }
3379 @endcode
3380 @}
3381 @defgroup Use_Cases4_9 Getting Sms CB configuration
3382 @ingroup Use_Cases4_SMS
3383 @{
3384
3385
3386                 <h3 class="pg">Getting Sms CB configuration</h3>
3387 <strong>[Note] Telephony Emulator does not support this feature.</strong>
3388 @n This API is used to retrieve SMS CB configuration options from EFcbmi file in the SIM. You should not access this API directly; use the Message Framework API.
3389
3390 @code
3391 TapiResult_t    tel_get_sms_cb_config (int *pRequestId);
3392 @endcode
3393
3394 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
3395
3396 SAMPLE CODE:
3397
3398 @code
3399 #include <stdio.h>
3400 #include <stdlib.h>
3401 #include <TapiCommon.h>
3402 #include <ITapiNetText.h>
3403
3404 void get_cbconfig()
3405 {
3406         int ret_status;
3407         int pRequestId = 0;
3408
3409         //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3410         ret_status = tel_get_sms_cb_config (&pRequestId);
3411
3412         printf ("The return value is %d\n", ret_status);
3413         if (ret_status == TAPI_API_SUCCESS)
3414         {
3415                 printf("successful\n");
3416         }
3417         else
3418         {
3419                 printf("error = %d\n", ret_status);
3420         }
3421         //WAIT FOR EVENT HERE
3422 }
3423 static void app_callback (TelTapiEvent_t *event)
3424 {
3425         int eventClass;
3426         int eventType;
3427         int requestId;
3428         int status;
3429         void* EventData = NULL;
3430
3431         //..
3432         eventClass = event->EventClass;
3433         eventType = event->EventType;
3434         requestId = event->RequestId;
3435         status = event->Status;
3436         EventData = event->pData;
3437
3438         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3439
3440         if (status != 0)
3441         {
3442                 //TEST_DEBUG("******This is nonzero status. ******\n");
3443                 return;
3444         }
3445         //..
3446         switch (eventType) //REFER Send SMS TO GET eventType
3447         {
3448                 case TAPI_EVENT_NETTEXT_GET_CB_CONFIG_CNF:
3449                         printf("\n***************************************\n");
3450                         printf("\n$$$GET CB Config$$$\n");
3451                         GetCBNotification(tapiEvent.pData);
3452                         break;
3453         }
3454         //..
3455 }
3456
3457 void GetCBNotification (char *pData)
3458 {
3459         TelSmsCbConfig_t *CBConfig;
3460         int i = 0;
3461
3462         CBConfig = (TelSmsCbConfig_t *) pData;
3463         printf("=========CB Configuration=========\n");
3464
3465         // CB Enable/Diable
3466         if (CBConfig->bCBEnabled == 0x01)
3467                 printf("Cell Broadcast Msg Enabled...\n");
3468         else if (CBConfig->bCBEnabled == 0x02)
3469                 printf("Cell Broadcast Msg Disabled...\n");
3470
3471         // Selected ID
3472         if (CBConfig->SelectedId == 0x01)
3473                 printf("All CBMI is selected... \n");
3474         else if (CBConfig->SelectedId == 0x02)
3475                 printf("There are some selected CBMI...\n");
3476
3477         // CBMI  Count
3478         printf("CBMI Count: %d \n\n", CBConfig->MsgIdCount);
3479         // CBMI  List
3480         if (CBConfig->MsgIdCount != 0)
3481         {
3482                 printf("----- CBMI List -----\n");
3483                 for (i=0; i < CBConfig->MsgIdCount; i++)
3484                 {
3485                         printf("No.%d - [0x%04x]\n", i, CBConfig->MsgIDs[i]);
3486                 }
3487         }
3488 }
3489 //...
3490 @endcode
3491 @}
3492 @defgroup Use_Cases4_10 Service Center Address
3493 @ingroup Use_Cases4_SMS
3494 @{
3495
3496
3497                 <h3 class="pg">Service Center Address</h3>
3498 This API sets the SMS Service Centre Address information in order to send the SMS.
3499 @n It is also possible to get current SMS Service Centre Address information. Currently Only index 0 is supported in Aquila’s Telephony OEM Plugin. You should not access this API directly; use the Message Framework API.
3500
3501 @code
3502 int  tel_set_sms_sca(const TelSmsAddressInfo_t *pSCA, int Index, int *pRequestId);
3503 int  tel_get_sms_sca (int Index, int *pRequestId)
3504 @endcode
3505
3506 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
3507
3508 SAMPLE CODE
3509 @code
3510 #include <stdio.h>
3511 #include <stdlib.h>
3512 #include <TapiCommon.h>
3513 #include <ITapiNetText.h>
3514
3515 void set_sca()
3516 {
3517
3518         //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3519         int ret_status;
3520         int pRequestId = 0;
3521         BYTE scabuf[512];
3522         char scaNum[TAPI_NETTEXT_SCADDRESS_LEN_MAX];
3523         BYTE scaNum_len = 0;
3524         TelSmsAddressInfo_t *sc_addr = NULL;
3525         BYTE packet[500];
3526         int idx = 0;
3527         int i;
3528
3529         printf("***Setting the SCA(Api:SetSCA)****\n");
3530         sc_addr = (TelSmsAddressInfo_t *)malloc(sizeof(TelSmsAddressInfo_t));
3531         memset(sc_addr, 0, sizeof(sc_addr));
3532         memset(scaNum, 0, sizeof(scaNum));
3533         memset(scabuf, 0, sizeof(scabuf));
3534         sprintf(scaNum, "821091");
3535         scaNum_len = strlen(scaNum);
3536         scaNum_len = strlen(scaNum);
3537         scaNum[scaNum_len] = 0;
3538         scaNum_len = scaNum_len - 1;
3539
3540         printf("==========================\n");
3541         printf("Sca Number :%s\n", scaNum);
3542         printf("sca  number length : %d \n", scaNum_len);
3543         printf("==========================\n");
3544
3545         //idx = SmsUtilEncodeAddrField( packet, scaNum, scaNum_len, 0x01, 0x01);
3546         //get idx
3547         printf("idx =%d\n", idx);
3548         sc_addr->DialNumLen = idx ;
3549         memcpy(sc_addr->szDiallingNum, packet, (unsigned int)idx);
3550
3551         ret_status = tel_set_sms_sca(sc_addr, 0, &pRequestId);
3552         //[Note] Telephony Emulator Not Support
3553
3554         printf("returnstatus after scaddr set is %d requestId:%d \n", ret_status, pRequestId);
3555         if (ret_status == TAPI_API_SUCCESS)
3556         {
3557                 printf("successful\n");
3558         }
3559         else
3560         {
3561                 printf("error = %d\n", ret_status);
3562         }
3563         //WAIT FOR EVENT HERE
3564 }
3565
3566 static void app_callback (TelTapiEvent_t *event)
3567 {
3568         int eventClass;
3569         int eventType;
3570         int requestId;
3571         int status;
3572         void* EventData = NULL;
3573
3574         //..
3575         eventClass = event->EventClass;
3576         eventType = event->EventType;
3577         requestId = event->RequestId;
3578         status = event->Status;
3579         EventData = event->pData;
3580
3581         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3582
3583         if (status != 0)
3584         {
3585                 //TEST_DEBUG("******This is nonzero status. ******\n");
3586                 return;
3587         }
3588         //..
3589         switch (eventType) //REFER Send SMS TO GET eventType
3590         {
3591                 case TAPI_EVENT_NETTEXT_SET_REQUEST_CNF:
3592                         TelSmsSetResponse *RequestType;
3593                         printf("\n***************************************\n");
3594                         RequestType = (TelSmsSetResponse *)EventData;
3595                         if (*RequestType == TAPI_NETTEXT_SETSCADDR_RSP) {
3596                                 printf("\n$$$TAPI_EVENT_NETTEXT_SET_SCA_CNF$$$\n");
3597                                 // service center address decoding
3598                         }
3599                         break;
3600         }
3601 }
3602 //..
3603
3604 //get SCA
3605 #include <stdio.h>
3606 #include <stdlib.h>
3607 #include <TapiCommon.h>
3608 #include <ITapiNetText.h>
3609
3610 void get_sca()
3611 {
3612         int ret_status;
3613         int pRequestId = 0;
3614
3615         ret_status = tel_get_sms_sca(0, &pRequestId);
3616         if (ret_status == TAPI_API_SUCCESS)
3617         {
3618                 printf("successful\n");
3619         }
3620         else
3621         {
3622                 printf("error = %d\n", ret_status);
3623         }
3624
3625         //WAIT FOR EVENT HERE
3626 }
3627
3628 static void app_callback (TelTapiEvent_t *event)
3629 {
3630         int eventClass;
3631         int eventType;
3632         int requestId;
3633         int status;
3634         void* EventData = NULL;
3635         unsigned int temp_handle = -1;
3636
3637         //
3638         eventClass = event->EventClass;
3639         eventType = event->EventType;
3640         requestId = event->RequestId;
3641         status = event->Status;
3642         EventData = event->pData;
3643
3644         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3645
3646         if (status != 0)
3647         {
3648                 //TEST_DEBUG("******This is nonzero status. ******\n");
3649                 return;
3650         }
3651
3652         //...
3653         switch (eventType) //REFER Send SMS TO GET eventType
3654         {
3655                 case TAPI_EVENT_NETTEXT_GET_SCA_CNF:
3656                         printf("\n****************************************\n");
3657                         printf("\n$$$ TAPI_EVENT_NETTEXT_GET_SCA_CNF$$$\n");
3658                         // SCA address decoding
3659                         printf("\n****************************************\n");
3660                         break;
3661         }
3662         //...
3663 }
3664 @endcode
3665 @}
3666 @defgroup Use_Cases4_11 Sms Preferred Bearer
3667 @ingroup Use_Cases4_SMS
3668 @{
3669
3670
3671                 <h3 class="pg">Sms Preferred Bearer</h3>
3672 <strong>[Note] Telephony Emulator and Aquila’s Telephony OEM Plugin do not support this feature.</strong>
3673 @n Telephony provides APIs to set SMS preferred bearer on which SMS has to be transmitted. You should not access this API directly; use the Message Framework API.
3674
3675 @code
3676 int  tel_set_sms_preferred_bearer (TelSmsBearerType_t    BearerType, int *pRequestId);
3677 int  tel_get_sms_preferred_bearer(int *pRequestId);
3678 @endcode
3679
3680 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
3681
3682 SAMPLE CODE:
3683 @code
3684 #include <stdio.h>
3685 #include <stdlib.h>
3686 #include <TapiCommon.h>
3687 #include <ITapiNetText.h>
3688
3689 void set_pb()
3690 {
3691         //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3692         int ret_status;
3693         int pRequestId = 0;
3694         TelSmsBearerType_t BearerType = TAPI_NETTEXT_BEARER_PS_ONLY;
3695
3696         ret_status = tel_set_sms_preferred_bearer(BearerType, &pRequestId);
3697         if (ret_status == TAPI_API_SUCCESS)
3698         {
3699                 printf("successful\n");
3700         }
3701         else
3702         {
3703                 printf("error = %d\n", ret_status);
3704         }
3705         //WAIT FOR EVENT HERE
3706 }
3707 static void app_callback (TelTapiEvent_t *event)
3708 {
3709         int eventClass;
3710         int eventType;
3711         int requestId;
3712         int status;
3713         void* EventData = NULL;
3714
3715         //
3716         eventClass = event->EventClass;
3717         eventType = event->EventType;
3718         requestId = event->RequestId;
3719         status = event->Status;
3720         EventData = event->pData;
3721
3722         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3723
3724         if (status != 0)
3725         {
3726                 //TEST_DEBUG("******This is nonzero status. ******\n");
3727                 return;
3728         }
3729         //...
3730         //...
3731         switch (eventType) //REFER Send SMS TO GET eventType
3732         {
3733                 case TAPI_EVENT_NETTEXT_SET_REQUEST_CNF:
3734                         TelSmsSetResponse *RequestType;
3735                         RequestType = (TelSmsSetResponse *)EventData;
3736                         if (*RequestType == TAPI_NETTEXT_SETPREFERREDBEARER_RSP) {
3737                                 printf("\n$$$TAPI_EVENT_NETTEXT_SET_Preferred Bearer_CNF$$$\n");
3738                         }
3739                         break;
3740         }
3741         //...
3742 }
3743
3744 //get preferred bearer
3745 #include <stdio.h>
3746 #include <stdlib.h>
3747 #include <TapiCommon.h>
3748 #include <ITapiNetText.h>
3749 void get_pb()
3750 {
3751         int ret_status;
3752         int pRequestId = 0;
3753
3754         ret_status = tel_get_sms_preferred_bearer(&pRequestId);
3755         if (ret_status == TAPI_API_SUCCESS)
3756         {
3757                 printf("successful\n");
3758         }
3759         else
3760         {
3761                 printf("error = %d\n", ret_status);
3762         }
3763         //WAIT FOR EVENT HERE
3764 }
3765
3766 static void app_callback (TelTapiEvent_t *event)
3767 {
3768         int eventClass;
3769         int eventType;
3770         int requestId;
3771         int status;
3772         void* EventData = NULL;
3773
3774         //
3775         eventClass = event->EventClass;
3776         eventType = event->EventType;
3777         requestId = event->RequestId;
3778         status = event->Status;
3779         EventData = event->pData;
3780
3781         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3782
3783         if (status != 0)
3784         {
3785                 //TEST_DEBUG("******This is nonzero status. ******\n");
3786                 return;
3787         }
3788
3789         //...
3790         //...
3791         switch (eventType) //REFER Send SMS TO GET eventType
3792         {
3793                 case TAPI_EVENT_NETTEXT_GET_SMSBEARER_CNF:
3794                         printf("\n****************************************\n");
3795                         printf("\n$$$ GET PREFERRED BEARER$$$\n");
3796                         printf("\n****************************************\n");
3797                         break;
3798         }
3799         //...
3800 }
3801 @endcode
3802 @}
3803 @defgroup Use_Cases4_12 Sms Parameters
3804 @ingroup Use_Cases4_SMS
3805 @{
3806
3807
3808                 <h3 class="pg">Sms Parameters</h3>
3809 <strong>[Note] Telephony Emulator does not support this feature.</strong>
3810 @n Telephony provides APIs to set the header parameters of SMS, which are used in the origination of MO messages. It also provides API to get the SMS parameters for a particular SMS (sent/received) based on the SIM index where it is stored. You should not access this API directly; use the Message Framework API.
3811
3812 @code
3813 int  tel_set_sms_parameters(const TelSmsParams_t SmsSetParameters, int *pRequestId);
3814 int  tel_get_sms_parameters(const int SmsRecordIndex, int *pRequestId);
3815 @endcode
3816
3817 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
3818
3819 SAMPLE CODE:
3820 @code
3821 #include <stdio.h>
3822 #include <stdlib.h>
3823 #include <TapiCommon.h>
3824 #include <ITapiNetText.h>
3825
3826 void set_param()
3827 {
3828         //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3829         int ret_status;
3830         int pRequestId = 0;
3831         TelSmsParams_t SmsSetParameters;
3832
3833         SmsSetParameters.RecordIndex = 0x01;
3834         SmsSetParameters.RecordLen = 28;
3835         memcpy(SmsSetParameters.TpDestAddr.szDiallingNum, "9986529874", 10);
3836         printf("\ndial no is %s\n", SmsSetParameters.TpDestAddr.szDiallingNum);
3837
3838         SmsSetParameters.TpDestAddr.DialNumLen = 10;
3839         SmsSetParameters.TpDestAddr.Ton = TAPI_SIM_TON_NATIONAL;//national no
3840         SmsSetParameters.TpDestAddr.Npi = TAPI_SIM_NPI_NATIONAL;
3841
3842         ret_status = tel_set_sms_parameters(SmsSetParameters, &pRequestId);
3843         if (ret_status == TAPI_API_SUCCESS)
3844         {
3845                 printf("successful\n");
3846         }
3847         else
3848         {
3849                 printf("error = %d\n", ret_status);
3850         }
3851         //WAIT FOR EVENT HERE
3852 }
3853 static void app_callback (TelTapiEvent_t *event)
3854 {
3855         int eventClass;
3856         int eventType;
3857         int requestId;
3858         int status;
3859         void* EventData = NULL;
3860
3861         //
3862         eventClass = event->EventClass;
3863         eventType = event->EventType;
3864         requestId = event->RequestId;
3865         status = event->Status;
3866         EventData = event->pData;
3867
3868         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
3869
3870         if (status != 0)
3871         {
3872                 //TEST_DEBUG("******This is nonzero status. ******\n");
3873                 return;
3874         }
3875         //...
3876         //...
3877         switch (eventType) //REFER Send SMS TO GET eventType
3878         {
3879                 case TAPI_EVENT_NETTEXT_SET_REQUEST_CNF:
3880                         TelSmsSetResponse *RequestType;
3881                         RequestType = (TelSmsSetResponse *)EventData;
3882                         if (*RequestType == TAPI_NETTEXT_SETPARAMETERS_RSP) {
3883                                 printf("\n$$$TAPI_EVENT_NETTEXT_SET_Parameter_CNF$$$\n");
3884                         }
3885                         break;
3886         }
3887 }
3888 //...
3889
3890 //get params
3891 #include <stdio.h>
3892 #include <stdlib.h>
3893 #include <TapiCommon.h>
3894 #include <ITapiNetText.h>
3895
3896 void get_params()
3897 {
3898         int ret_status;
3899         int pRequestId = 0;
3900
3901         ret_status = tel_get_sms_parameters(1, &pRequestId);
3902         if (ret_status == TAPI_API_SUCCESS)
3903         {
3904                 printf("successful\n");
3905         }
3906         else
3907         {
3908                 printf("error = %d\n", ret_status);
3909         }
3910         //WAIT FOR EVENT HERE
3911 }
3912 static void app_callback (TelTapiEvent_t *event)
3913 {
3914         int eventClass;
3915         int eventType;
3916         int requestId;
3917         int status;
3918         void* EventData = NULL;
3919
3920         //
3921         eventClass = event->EventClass;
3922         eventType = event->EventType;
3923         requestId = event->RequestId;
3924         status = event->Status;
3925         EventData = event->pData;
3926
3927         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
3928
3929         if (status != 0)
3930         {
3931                 //TEST_DEBUG("******This is nonzero status. ******\n");
3932                 return;
3933         }
3934         //...
3935         //...
3936         switch (eventType) //REFER Send SMS TO GET eventType
3937         {
3938                 case TAPI_EVENT_NETTEXT_GET_PARAM_CNF:
3939                         printf("\n***************************************\n");
3940                         printf("\n$$$ GET PARAM NOTI$$$\n");
3941                         // decoding SMS parameter
3942                         break;
3943         }
3944         //...
3945 }
3946 @endcode
3947 @}
3948 @defgroup Use_Cases4_13 Sending Delivery Report
3949 @ingroup Use_Cases4_SMS
3950 @{
3951
3952
3953                 <h3 class="pg">Sending Delivery Report</h3>
3954 This API sends a SMS-deliver report to the network, after receiving an incoming SMS. You should not access this API directly.
3955
3956 @code
3957 int  tel_send_sms_deliver_report(const TelSmsDatapackageInfo_t *pDataPackage, TelSmsResponse_t RPCause, int *pRequestId);
3958 @endcode
3959
3960 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
3961
3962 SAMPLE CODE
3963 @code
3964 #include <stdio.h>
3965 #include <stdlib.h>
3966 #include <TapiCommon.h>
3967 #include <ITapiNetText.h>
3968 void send_delivery()
3969 {
3970         int ret_status;
3971         int requestId = -1;
3972         TelSmsResponse_t RPCause;
3973         //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
3974         TelSmsDatapackageInfo_t *del_report = NULL;
3975
3976         del_report = malloc(sizeof(TelSmsDatapackageInfo_t));
3977         memset(del_report, 0, sizeof(TelSmsDatapackageInfo_t));
3978         //Encode Send Delivery Report here
3979         //EncodeSmsDeliveryReportTpdu();
3980
3981         RPCause = TAPI_NETTEXT_SENDSMS_SUCCESS;
3982         printf("***receive message (Api:SendDeliverreport)****\n");
3983
3984         ret_status = tel_send_sms_deliver_report(del_report, RPCause, &requestId);
3985         if (ret_status == TAPI_API_SUCCESS)
3986         {
3987                 printf("successful\n");
3988         }
3989         else
3990         {
3991                 printf("error = %d\n", ret_status);
3992         }
3993         //WAIT FOR EVENT HERE
3994 }
3995 static void app_callback (TelTapiEvent_t *event)
3996 {
3997         int eventClass;
3998         int eventType;
3999         int requestId;
4000         int status;
4001         void* EventData = NULL;
4002
4003         //
4004         eventClass = event->EventClass;
4005         eventType = event->EventType;
4006         requestId = event->RequestId;
4007         status = event->Status;
4008         EventData = event->pData;
4009
4010         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
4011
4012         if (status != 0)
4013         {
4014                 //TEST_DEBUG("******This is nonzero status. ******\n");
4015                 return;
4016         }
4017         //...
4018         //...
4019         switch (eventType) //REFER Send SMS TO GET eventType
4020         {
4021                 case TAPI_EVENT_NETTEXT_DELIVERY_REPORT_CNF:
4022                         printf("\n***************************************\n");
4023                         printf("\n$$$ DELIVER REPORT NOTI$$$\n");
4024                         printf("\n***************************************\n");
4025                         break;
4026         }
4027         //...
4028 }
4029 @endcode
4030 @}
4031 @defgroup Use_Cases4_14 Setting Memory Status
4032 @ingroup Use_Cases4_SMS
4033 @{
4034
4035
4036                 <h3 class="pg">Setting Memory Status</h3>
4037 <strong>[Note] Telephony Emulator does not support this feature.</strong>
4038 @n This API is used by applications to inform the modem about the memory status of PDA (whether FULL or AVAILABLE) so that modem can inform network. You should not access this API directly.
4039
4040 @code
4041 int  tel_set_sms_memory_status      (int  MemoryStatus ,  int *pRequestId);
4042 @endcode
4043
4044 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
4045
4046 SAMPLE CODE:
4047 @code
4048 #include <stdio.h>
4049 #include <stdlib.h>
4050 #include <TapiCommon.h>
4051 #include <ITapiNetText.h>
4052 void set_memstatus()
4053 {
4054
4055         //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
4056         int ret_status;
4057         int pRequestId = 0;
4058         int MemoryStatus = TAPI_NETTEXT_PDA_MEMORY_STATUS_AVAILABLE;
4059
4060         ret_status = tel_set_sms_memory_status(MemoryStatus, &pRequestId);
4061         if (ret_status == TAPI_API_SUCCESS)
4062         {
4063                 printf("successful\n");
4064         }
4065         else
4066         {
4067                 printf("error = %d\n", ret_status);
4068         }
4069         //WAIT FOR EVENT HERE
4070 }
4071 static void app_callback (TelTapiEvent_t *event)
4072 {
4073         int eventClass;
4074         int eventType;
4075         int requestId;
4076         int status;
4077         void* EventData = NULL;
4078
4079         //...
4080         eventClass = event->EventClass;
4081         eventType = event->EventType;
4082         requestId = event->RequestId;
4083         status = event->Status;
4084         EventData = event->pData;
4085
4086         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4087
4088         if (status != 0)
4089         {
4090                 //TEST_DEBUG("******This is nonzero status. ******\n");
4091                 return;
4092         }
4093         //...
4094         //...
4095         switch (eventType) //REFER Send SMS TO GET eventType
4096         {
4097                 case TAPI_EVENT_NETTEXT_SET_REQUEST_CNF:
4098                         TelSmsSetResponse *RequestType;
4099                         printf("\n***************************************\n");
4100                         printf("\n$$$$$$   SET CONFIRMATION $$$$$$ \n");
4101                         RequestType = (TelSmsSetResponse *)EventData;
4102                         if (*RequestType == TAPI_NETTEXT_SETMEMORYSTATUS_RSP) {
4103                                 printf("\n$$$$$$   SET Memory Status $$$$$$ \n");
4104                         }
4105                         break;
4106         }
4107         //...
4108 }
4109 @endcode
4110 @}
4111 @defgroup Use_Cases4_15 Setting Message Status
4112 @ingroup Use_Cases4_SMS
4113 @{
4114
4115
4116                 <h3 class="pg">Setting Message Status</h3>
4117 <strong>[Note] Telephony Emulator does not support this feature.</strong>
4118 This API is used by applications to set the message status in the Sim file. You should not access this API directly; use the Message Framework API.
4119
4120 @code
4121 int    tel_set_sms_message_status(int Index, TelSmsMsgStatus_t MsgStatus, int *pRequestId);
4122 @endcode
4123
4124 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
4125
4126 SAMPLE CODE:
4127 @code
4128 #include <stdio.h>
4129 #include <stdlib.h>
4130 #include <TapiCommon.h>
4131 #include <ITapiNetText.h>
4132
4133 void set_msgstatus()
4134 {
4135         //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
4136         int ret_status;
4137         int Index = 2;
4138         int pRequestId = 0;
4139         TelSmsMsgStatus_t MsgStatus = TAPI_NETTEXT_STATUS_READ;
4140
4141         ret_status = tel_set_sms_message_status (Index, MsgStatus, &pRequestId);
4142         printf ("The return value is %d\n", ret_status);
4143         printf("RequestId is %d\n", pRequestId);
4144         if (ret_status == TAPI_API_SUCCESS)
4145         {
4146                 printf("successful\n");
4147         }
4148         else
4149         {
4150                 printf("error = %d\n", ret_status);
4151         }
4152         //WAIT FOR EVENT HERE
4153 }
4154 static void app_callback (TelTapiEvent_t *event)
4155 {
4156         int eventClass;
4157         int eventType;
4158         int requestId;
4159         int status;
4160         void* EventData = NULL;
4161
4162         //
4163         eventClass = event->EventClass;
4164         eventType = event->EventType;
4165         requestId = event->RequestId;
4166         status = event->Status;
4167         EventData = event->pData;
4168
4169         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4170
4171         if (status != 0)
4172         {
4173                 //TEST_DEBUG("******This is nonzero status. ******\n");
4174                 return;
4175         }
4176         //...
4177         //...
4178         switch (eventType)
4179         {
4180                 case TAPI_EVENT_NETTEXT_SET_REQUEST_CNF:
4181                         TelSmsSetResponse *RequestType;
4182                         printf("\n***************************************\n");
4183                         printf("\n$$$$$$   SET CONFIRMATION $$$$$$ \n");
4184                         RequestType = (TelSmsSetResponse *)EventData;
4185                         if (*RequestType == TAPI_NETTEXT_SETMESSAGESTATUS_RSP) {
4186                                 printf("\n$$$$$$   SET Memory Status $$$$$$ \n");
4187                         }
4188                         break;
4189         }
4190         //...
4191 }
4192 @endcode
4193 @}
4194 @defgroup Use_Cases4_16 Getting SMS Parameter Count
4195 @ingroup Use_Cases4_SMS
4196 @{
4197
4198
4199                 <h3 class="pg">Getting SMS Parameter Count</h3>
4200 <strong>[Note] Telephony Emulator does not support this feature.</strong>
4201 @n This API is used by applications to get the count of sms parameter records stored in Sim EF. You should not access this API directly.
4202
4203 @code
4204 int  tel_get_sms_parameter_count (int *pRequestId);
4205 @endcode
4206
4207 <strong>This API is restricted for direct use.  Use the Message Framework API instead.</strong>
4208
4209 SAMPLE CODE:
4210 @code
4211 #include <stdio.h>
4212 #include <stdlib.h>
4213 #include <TapiCommon.h>
4214 #include <ITapiNetText.h>
4215
4216 void get_paramcount()
4217 {
4218         //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
4219         int ret_status;
4220         int pRequestId = 0;
4221
4222         ret_status = tel_get_sms_parameter_count (&pRequestId);
4223         printf ("The return value is %d\n", ret_status);
4224         if (ret_status == TAPI_API_SUCCESS)
4225         {
4226                 printf("successful\n");
4227         }
4228         else
4229         {
4230                 printf("error = %d\n", ret_status);
4231         }
4232         //WAIT FOR EVENT HERE
4233 }
4234 static void app_callback (TelTapiEvent_t *event)
4235 {
4236         int eventClass;
4237         int eventType;
4238         int requestId;
4239         int status;
4240         void* EventData = NULL;
4241
4242         //
4243         eventClass = event->EventClass;
4244         eventType = event->EventType;
4245         requestId = event->RequestId;
4246         status = event->Status;
4247         EventData = event->pData;
4248
4249         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4250
4251         if (status != 0)
4252         {
4253                 //TEST_DEBUG("******This is nonzero status. ******\n");
4254                 return;
4255         }
4256         //...
4257         //...
4258         switch (eventType) //REFER Send SMS TO GET eventType
4259         {
4260                 case TAPI_EVENT_NETTEXT_PARAM_COUNT_IND:
4261                         printf("\n***************************************\n");
4262                         printf("\n$$$ PARAM COUNT NOTI$$$\n");
4263                         printf("\n***************************************\n");
4264                         break;
4265         }
4266         //...
4267 }
4268 @endcode
4269 @}
4270         <h2 class="pg">NETWORK Registration and Configuration<h/h2>
4271
4272 @defgroup Use_Cases5_1 Event register and deregister
4273 @ingroup Use_Cases5_NETWORK
4274 @{
4275
4276                 <h3 class="pg">Event register and deregister</h3>
4277 To receive asynchronous event notifications for the network APIs, the registration of related events with their associated call backs is required. When an asynchronous API is called, the confirmation is returned as an asynchronous event notification which invokes the callback function along with the event data.
4278
4279 Network Notification Events
4280 @code
4281 TAPI_EVENT_NETWORK_LOCATIONCELLINFO_IND
4282 TAPI_EVENT_NETWORK_RADIO_INFO_IND
4283 TAPI_EVENT_NETWORK_SPN_INFO
4284 TAPI_EVENT_NETWORK_DISPLAYINFO_IND
4285 @endcode
4286
4287 SAMPLE CODE:
4288 @code
4289 // REGISTER EVENT
4290 unsigned int subscription_id = 0;
4291 int api_err;
4292
4293 api_err = tel_init();
4294 if (api_err != TAPI_API_SUCCESS)
4295 {
4296         TEST_DEBUG("TelTapiInit Failed - api_err = %d \n", api_err);
4297 }
4298
4299 api_err = tel_register_event(TAPI_EVENT_NETWORK_GETNWBAND_CNF, &subscription_id, (TelAppCallback)&app_callback);
4300 printf("Network Event registration is Done: sub id is %d, api_err is %d\n", subscription_id, api_err);
4301
4302 tel_register_app_name("com.samsung.appname");
4303
4304 // DEREGISTER EVENT
4305 api_err = tel_deregister_event (subscription_id);
4306 if (api_err != TAPI_API_SUCCESS)
4307 {
4308         printf("Event Class Unregeration Fail\n");
4309 }
4310
4311 // Network notification callback function
4312 void app_callback(void)
4313 {
4314         int eventClass;
4315         int eventType;
4316         int requestId;
4317         int status;
4318         void *EventData = NULL;
4319
4320         eventClass = event->EventClass;
4321         eventType = event->EventType;
4322         requestId = event->RequestId;
4323         status = event->Status;
4324         EventData = event->pData;
4325         printf(" app _callback is called \n");
4326
4327         print_events((int)eventType);
4328         printf("\n event came in power_callback [%d] \n", eventType);
4329         printf("\n expected event is  in callback [%d] \n", expected_event);
4330
4331         switch (eventType)
4332         {
4333                 case TAPI_EVENT_NETWORK_LOCATIONCELLINFO_IND:
4334                         TelSmsDatapackageInfo_t *ptrDataPackage = NULL;
4335                         printf("SMS Incoming Message\n");
4336                         ptrDataPackage = (TelSmsDatapackageInfo_t *)EventData;
4337                         // Decoding Service Center Address
4338                         // Decoding TPDU(SMS-DELIVER, SMS-STATUS)
4339                         break;
4340
4341                 case TAPI_EVENT_NETWORK_RADIO_INFO_IND:
4342                         TelSmsDatapackageInfo_t *ptrDataPackage = NULL;
4343                         printf("SMS Incoming Message\n");
4344                         ptrDataPackage = (TelSmsDatapackageInfo_t *)EventData;
4345                         // Decoding Service Center Address
4346                         // Decoding TPDU(SMS-DELIVER, SMS-STATUS)
4347                         break;
4348
4349                 case TAPI_EVENT_NETWORK_SPN_INFO:
4350                         TelSmsDatapackageInfo_t *ptrDataPackage = NULL;
4351                         printf("SMS Incoming Message\n");
4352                         ptrDataPackage = (TelSmsDatapackageInfo_t *)EventData;
4353                         // Decoding Service Center Address
4354                         // Decoding TPDU(SMS-DELIVER, SMS-STATUS)
4355                         break;
4356
4357                 case TAPI_EVENT_NETWORK_DISPLAYINFO_IND:
4358                         TelSmsDatapackageInfo_t *ptrDataPackage = NULL;
4359                         printf("SMS Incoming Message\n");
4360                         ptrDataPackage = (TelSmsDatapackageInfo_t *)EventData;
4361                         // Decoding Service Center Address
4362                         // Decoding TPDU(SMS-DELIVER, SMS-STATUS)
4363                         break;
4364         }
4365 }
4366 @endcode
4367 @}
4368 @defgroup Use_Cases5_2 Network Selection
4369 @ingroup Use_Cases5_NETWORK
4370 @{
4371
4372
4373                 <h3 class="pg">Network Selection</h3>
4374 Telephony provides APIs which can request the lower layers use the network (PLMN) which has been selected by the user from the Network List displayed to the User.
4375
4376 @code
4377 int tel_select_network_automatic(int *pRequestId)
4378 int tel_select_network_manual(unsigned int Plmn, int *pRequestId)
4379 @endcode
4380
4381 SAMPLE CODE:
4382 @code
4383 #include <ITapiNetwork.h>
4384 #include <stdio.h>
4385 #include "TapiCommon.h"
4386
4387 void select_nw()
4388 {
4389         //SUBSCRIBE FOR EVENTS AS MENTIONED IN  Event Register and Deregister
4390         int ret_status;
4391         int pRequestID;
4392         unsigned int plmn = 0;
4393
4394         //CASE 1. MANUAL MODE
4395         plmn = 45454;
4396         ret_status = tel_select_network_manual(Plmn, &pRequestId);
4397
4398         // CASE 2. AUTOMATIC MODE
4399         // selectionMode = TAPI_NETWORK_SELECTIONMODE_AUTOMATIC;
4400         ret_status = tel_select_network_automatic(&pRequestId);
4401         if (ret_status == TAPI_API_SUCCESS)
4402                 printf("successful\n");
4403         else
4404                 printf("error=%d\n", ret_status);
4405
4406         //WAIT FOR EVENT HERE
4407 }
4408
4409 //CALLBACK FUNCTION TO BE USED
4410 static void app_callback (TelTapiEvent_t *event)
4411 {
4412         int eventClass;
4413         int eventType;
4414         int requestId;
4415         int status;
4416         void* EventData = NULL;
4417
4418         //...
4419         eventClass = event->EventClass;
4420         eventType = event->EventType;
4421         requestId = event->RequestId;
4422         status = event->Status;
4423         EventData = event->pData;
4424
4425         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4426
4427         if (status != 0)
4428         {
4429                 //TEST_DEBUG("******This is nonzero status. ******\n");
4430                 return;
4431         }
4432         //...
4433         //...
4434         switch (eventType)
4435         {
4436                 case TAPI_EVENT_NETWORK_SELECT_CNF:
4437                         printf("\n$$$$$$ TAPI_EVENT_NETWORK_SELECT_CNF $$$$$$ \n");
4438         }
4439 }
4440 @endcode
4441 @}
4442 @defgroup Use_Cases5_3 Network Search
4443 @ingroup Use_Cases5_NETWORK
4444 @{
4445
4446
4447                 <h3 class="pg">Network Search</h3>
4448 This API is used to search for the available networks, and to provide the Network List to the User/Application.
4449
4450 @code
4451 int     tel_search_network (int *pRequestId);
4452 @endcode
4453
4454 SAMPLE CODE:
4455 @code
4456 #include <ITapiNetwork.h>
4457 #include <stdio.h>
4458 #include "TapiCommon.h"
4459
4460 void searchnw()
4461 {
4462         //SUBSCRIBE FOR EVENTS AS MENTIONED IN  Event Register and Deregister
4463         int ret_status;
4464
4465         ret_status = tel_search_network(&pRequestId);
4466         if (ret_status == TAPI_API_SUCCESS)
4467                 printf("successful\n");
4468         else
4469                 printf("error=%d\n", ret_status);
4470         //WAIT FOR EVENT HERE
4471 }
4472 //CALLBACK FUNCTION TO BE USED
4473 static void app_callback (TelTapiEvent_t *event)
4474 {
4475         int eventClass;
4476         int eventType;
4477         int requestId;
4478         int status;
4479         void* EventData = NULL;
4480         unsigned int temp_handle = -1;
4481
4482         //
4483         eventClass = event->EventClass;
4484         eventType = event->EventType;
4485         requestId = event->RequestId;
4486         status = event->Status;
4487         EventData = event->pData;
4488
4489         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4490
4491         if (status != 0)
4492         {
4493                 //TEST_DEBUG("******This is nonzero status. ******\n");
4494                 return;
4495         }
4496         //...
4497         //...
4498         switch (eventType)   //REFER Network Selection TO GET eventType
4499         {
4500                 case TAPI_EVENT_NETWORK_SEARCH_CNF:
4501                         int ui_entry_count = 0;
4502                         TelNetworkPlmnList_t *pNetSearchCnf;
4503                         pNetSearchCnf = (TelNetworkPlmnList_t *)EventData;
4504                         while (ui_entry_count <  pNetSearchCnf->networks_count)
4505                         {
4506                                 printf("Type_of_plmn[%d] 0:unkwon,1:home,2:available,3:forbidden, NetworkName[%s]",
4507                                                 pNetSearchCnf->network_list[ui_entry_count].type_of_plmn,
4508                                                 pNetSearchCnf->network_list[ui_entry_count].network_name);
4509                                 printf("ServiceProviderName[%s]", pNetSearchCnf->network_list[ui_entry_count].service_provider_name);
4510                                 printf("PLMN ID[%lu]", pNetSearchCnf->network_list[ui_entry_count].plmn_id);
4511                                 ui_entry_count++;
4512                         }
4513                         break;
4514         }
4515         //...
4516 }
4517 @endcode
4518 @}
4519 @defgroup Use_Cases5_4 Selection Mode
4520 @ingroup Use_Cases5_NETWORK
4521 @{
4522
4523
4524                 <h3 class="pg">Selection Mode</h3>
4525 Telephony provides APIs to set and retrieve the current mode of network selection i.e. automatic or manual. Request for Automatic network selection or Manual network selection will allow OEM provider to do PLMN Selection based on network selection preference.
4526
4527 @code
4528 int tel_get_network_selection_mode (int *pRequestId);
4529 @endcode
4530
4531 SAMPLE CODE
4532 @code
4533 #include <ITapiNetwork.h>
4534 #include <stdio.h>
4535 #include "TapiCommon.h"
4536 void get_selmode()
4537 {
4538         //SUBSCRIBE FOR EVENTS AS MENTIONED IN  Event Register and Deregister
4539         int ret_status;
4540         int pRequestId;
4541         //GET THE SELECTION MODE
4542
4543         ret_status = tel_get_network_selection_mode (&pRequestId);
4544         if (ret_status == TAPI_API_SUCCESS)
4545                 printf("successful\n");
4546         else
4547                 printf("error=%d\n", ret_status);
4548         //WAIT FOR EVENT HERE
4549 }
4550 //CALLBACK FUNCTION TO BE USED
4551 static void app_callback (TelTapiEvent_t *event)
4552 {
4553         int eventClass;
4554         int eventType;
4555         int requestId;
4556         int status;
4557         void* EventData = NULL;
4558
4559         //
4560         eventClass = event->EventClass;
4561         eventType = event->EventType;
4562         requestId = event->RequestId;
4563         status = event->Status;
4564         EventData = event->pData;
4565
4566         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4567
4568         if (status != 0)
4569         {
4570                 //TEST_DEBUG("******This is nonzero status. ******\n");
4571                 return;
4572         }
4573         //...
4574         //...
4575         switch (eventType) // REFER Network Selection TO GET eventType
4576         {
4577                 case TAPI_EVENT_NETWORK_GETSELECTIONMODE_CNF:
4578                         printf("\n$$$$$$ TAPI_EVENT_NETWORK_GETSELECTIONMODE_CNF $$$$$$ \n");
4579                         break;
4580         }
4581         //...
4582 }
4583 @endcode
4584 @}
4585 @defgroup Use_Cases5_5 Service Domain
4586 @ingroup Use_Cases5_NETWORK
4587 @{
4588
4589
4590                 <h3 class="pg">Service Domain</h3>
4591 Telephony provides APIs so that User/application can configure the service domain and also retrieve the present network service domain.
4592
4593 @code
4594 int tel_set_network_service_domain (TelNetworkServiceDomain_t ServiceDomain, int *pRequestId);
4595 int tel_get_network_service_domain (int *pRequestId);
4596 @endcode
4597
4598 SAMPLE CODE
4599 @code
4600 #include <stdio.h>
4601 #include <ITapiNetwork.h>
4602 #include <stdio.h>
4603 #include "TapiCommon.h"
4604
4605 void set_servicedomain()
4606 {
4607         //SUBSCRIBE FOR EVENTS AS MENTIONED IN  Event Register and Deregister
4608         int ret_status;
4609         int pRequestId;
4610         //SET NETWORK SERVICE DOMAIN
4611         TelNetworkServiceDomain_t ServiceDomain = TAPI_NETWORK_SERVICE_DOMAIN_AUTOMATIC;
4612
4613         ret_status = tel_set_network_service_domain (ServiceDomain, &pRequestId);
4614         if (ret_status == TAPI_API_SUCCESS)
4615                 printf("successful\n");
4616         else
4617                 printf("error=%d\n", ret_status);
4618         //WAIT FOR EVENT HERE
4619 }
4620 //CALLBACK FUNCTION TO BE USED
4621 static void app_callback (TelTapiEvent_t *event)
4622 {
4623         int eventClass;
4624         int eventType;
4625         int requestId;
4626         int status;
4627         void* EventData = NULL;
4628         unsigned int temp_handle = -1;
4629
4630         //...
4631         eventClass = event->EventClass;
4632         eventType = event->EventType;
4633         requestId = event->RequestId;
4634         status = event->Status;
4635         EventData = event->pData;
4636
4637         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4638
4639         if (status != 0)
4640         {
4641                 //TEST_DEBUG("******This is nonzero status. ******\n");
4642                 return;
4643         }
4644         //...
4645         //...
4646         switch (eventType) //REFER Network Selection TO GET eventType
4647         {
4648                 case TAPI_EVENT_NETWORK_SET_SVC_DOMAIN_CNF:
4649                         printf("\n$$$$$$ TAPI_EVENT_NETWORK_SET_SVC_DOMAIN_CNF $$$$$$ \n");
4650                         break;
4651         }
4652
4653         //...
4654 }
4655
4656 //GET NETWORK SERVICE DOMAIN
4657 #include <ITapiNetwork.h>
4658 #include <stdio.h>
4659 #include "TapiCommon.h"
4660 void get_servicedomain()
4661 {
4662         int ret_status;
4663         ret_status = tel_get_network_service_domain (&pRequestId);
4664         if (ret_status == TAPI_API_SUCCESS)
4665                 printf("successful\n");
4666         else
4667                 printf("error=%d\n", ret_status);
4668         //WAIT FOR EVENT HERE
4669 }
4670 //CALLBACK FUNCTION TO BE USED
4671 static void app_callback (TelTapiEvent_t *event)
4672 {
4673         int eventClass;
4674         int eventType;
4675         int requestId;
4676         int status;
4677         void* EventData = NULL;
4678         //...
4679         eventClass = event->EventClass;
4680         eventType = event->EventType;
4681         requestId = event->RequestId;
4682         status = event->Status;
4683         EventData = event->pData;
4684
4685         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4686
4687         if (status != 0)
4688         {
4689                 //TEST_DEBUG("******This is nonzero status. ******\n");
4690                 return;
4691         }
4692         //...
4693         //...
4694         switch (eventType) //REFER Network Selection TO GET eventType
4695         {
4696                 case TAPI_EVENT_NETWORK_GET_SVC_DOMAIN_CNF:
4697                         printf("\n$$$$$$ TAPI_EVENT_NETWORK_GET_SVC_DOMAIN_CNF $$$$$$ \n");
4698                         break;
4699                         //...
4700         }
4701 }
4702 @endcode
4703 @}
4704 @defgroup Use_Cases5_6 Network Mode
4705 @ingroup Use_Cases5_NETWORK
4706 @{
4707
4708
4709                 <h3 class="pg">Network Mode</h3>
4710 <strong>[Note] Telephony Emulator does not support this feature.</strong>
4711 @n The Network Mode (Automatic, GSM, and WCDMA) can be configured at OEM provider, based on which lower layers can scan only those radio access technologies, to register with network.
4712
4713 @code
4714 int tel_set_network_mode (TelNetworkMode_t NwMode, int *pRequestId);
4715 int     tel_get_network_mode (int *pRequestId);
4716 @endcode
4717
4718 SAMPLE CODE
4719 @code
4720 #include <ITapiNetwork.h>
4721 #include <stdio.h>
4722 #include "TapiCommon.h"
4723 void setnwmode()
4724 {
4725         //SUBSCRIBE FOR EVENTS AS MENTIONED IN  Event Register and Deregister
4726         int ret_status;
4727         int pRequestId;
4728
4729         ret_status = tel_set_network_mode(NwMode, &pRequestId);
4730         if (ret_status == TAPI_API_SUCCESS)
4731                 printf("successful\n");
4732         else
4733                 printf("error=%d\n", ret_status);
4734         //WAIT FOR EVENT HERE
4735 }
4736 //CALLBACK FUNCTION TO BE USED
4737 static void app_callback (TelTapiEvent_t *event)
4738 {
4739         int eventClass;
4740         int eventType;
4741         int requestId;
4742         int status;
4743         void* EventData = NULL;
4744
4745         //...
4746         eventClass = event->EventClass;
4747         eventType = event->EventType;
4748         requestId = event->RequestId;
4749         status = event->Status;
4750         EventData = event->pData;
4751
4752         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4753
4754         if (status != 0)
4755         {
4756                 //TEST_DEBUG("******This is nonzero status. ******\n");
4757                 return;
4758         }
4759         //...
4760         //...
4761         switch (eventType) //REFER Network Selection TO GET eventType
4762         {
4763                 case TAPI_EVENT_NETWORK_SETNWMODE_CNF:
4764                         printf("\n$$$$$$ TAPI_EVENT_NETWORK_SETNWMODE_CNF $$$$$$ \n");
4765                         break;
4766                         //...
4767         }
4768 }
4769
4770 //GET NETWORK MODE
4771 #include <ITapiNetwork.h>
4772 #include <stdio.h>
4773 #include "TapiCommon.h"
4774
4775 void getnwmode()
4776 {
4777         int ret_status;
4778         int pRequestId;
4779
4780         ret_status = tel_get_network_mode(&pRequestId);
4781         if (ret_status == TAPI_API_SUCCESS)
4782                 printf("successful\n");
4783         else
4784                 printf("error=%d\n", ret_status);
4785         //WAIT FOR EVENT HERE
4786 }
4787 //CALLBACK FUNCTION TO BE USED
4788 static void app_callback (TelTapiEvent_t *event)
4789 {
4790         int eventClass;
4791         int eventType;
4792         int requestId;
4793         int status;
4794         void* EventData = NULL;
4795
4796         //...
4797         eventClass = event->EventClass;
4798         eventType = event->EventType;
4799         requestId = event->RequestId;
4800         status = event->Status;
4801         EventData = event->pData;
4802
4803         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4804
4805         if (status != 0)
4806         {
4807                 //TEST_DEBUG("******This is nonzero status. ******\n");
4808                 return;
4809         }
4810         //...
4811         //...
4812         switch (eventType) //REFER Network Selection TO GET eventType
4813         {
4814                 case TAPI_EVENT_NETWORK_GETNWMODE_CNF:
4815                         printf("\n$$$$$$ TAPI_EVENT_NETWORK_GETNWMODE_CNF $$$$$$ \n");
4816                         break;
4817                         //...
4818         }
4819 }
4820 @endcode
4821 @}
4822 @defgroup Use_Cases5_7 Network Band
4823 @ingroup Use_Cases5_NETWORK
4824 @{
4825
4826
4827                 <h3 class="pg">Network Band</h3>
4828 Telephony provides APIs to set and retrieve the network band and allows the underlying OEM provider to scan the set band.
4829
4830 @code
4831 int tel_set_network_band (TelNetworkBandPreferred_t BandMode, TelNetworkBand_t Band, int *pRequestId);
4832 int tel_get_network_band ( int *pRequestId);
4833 @endcode
4834
4835 SAMPLE CODE:
4836 @code
4837 #include <ITapiNetwork.h>
4838 #include <stdio.h>
4839 #include "TapiCommon.h"
4840 void setnwband()
4841 {
4842         //SUBSCRIBE FOR EVENTS AS MENTIONED IN  Event Register and Deregister
4843         int ret_status;
4844         int pRequestId;
4845         TelNetworkBandPreferred_t BandMode = TAPI_NETWORK_BAND_MODE_PREFERRED;
4846         TelNetworkBand_t Band = TAPI_NETWORK_BAND_TYPE_GSM_900_1800;
4847         int pRequestId = 0;
4848
4849         ret_status = tel_set_network_band (BandMode,Band, &pRequestId);
4850         if (ret_status == TAPI_API_SUCCESS)
4851                 printf("successful\n");
4852         else
4853                 printf("error=%d\n", ret_status);
4854         //WAIT FOR EVENT HERE
4855 }
4856 //CALLBACK FUNCTION TO BE USED
4857 static void app_callback (TelTapiEvent_t *event)
4858 {
4859         int eventClass;
4860         int eventType;
4861         int requestId;
4862         int status;
4863         void* EventData = NULL;
4864
4865         eventClass = event->EventClass;
4866         eventType = event->EventType;
4867         requestId = event->RequestId;
4868         status = event->Status;
4869         EventData = event->pData;
4870
4871         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4872
4873         if (status != 0)
4874         {
4875                 //TEST_DEBUG("******This is nonzero status. ******\n");
4876                 return;
4877         }
4878         //...
4879         //...
4880         switch (eventType) //REFER Network Selection TO GET eventType
4881         {
4882                 case TAPI_EVENT_NETWORK_SETNWBAND_CNF:
4883                         printf("\n$$$$$$ TAPI_EVENT_NETWORK_SETNWBAND_CNF $$$$$$ \n");
4884                         break;
4885                         //...
4886         }
4887 }
4888
4889 //GET NETWORK BAND
4890 #include <ITapiNetwork.h>
4891 #include <stdio.h>
4892 #include "TapiCommon.h"
4893 void getnwband()
4894 {
4895         int ret_status;
4896         int pRequestId;
4897         ret_status = tel_get_network_band (BandMode, Band, &pRequestId);
4898         if (ret_status == TAPI_API_SUCCESS)
4899                 printf("successful\n");
4900         else
4901                 printf("error=%d\n", ret_status);
4902         //WAIT FOR EVENT HERE
4903 }
4904 //CALLBACK FUNCTION TO BE USED
4905 static void app_callback (TelTapiEvent_t *event)
4906 {
4907         int eventClass;
4908         int eventType;
4909         int requestId;
4910         int status;
4911         void* EventData = NULL;
4912
4913         //
4914         eventClass = event->EventClass;
4915         eventType = event->EventType;
4916         requestId = event->RequestId;
4917         status = event->Status;
4918         EventData = event->pData;
4919
4920         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4921
4922         if (status != 0)
4923         {
4924                 //TEST_DEBUG("******This is nonzero status. ******\n");
4925                 return;
4926         }
4927         //...
4928         //...
4929         switch (eventType) // REFER Network Selection TO GET eventType
4930         {
4931                 case TAPI_EVENT_NETWORK_GETNWBAND_CNF:
4932                         printf("\n$$$$$$ TAPI_EVENT_NETWORK_GTNWBAND_CNF $$$$$$ \n");
4933                         break;
4934                         //...
4935         }
4936 }
4937 @endcode
4938 @}
4939 @defgroup Use_Cases5_8 Preferred PLMN
4940 @ingroup Use_Cases5_NETWORK
4941 @{
4942
4943
4944                 <h3 class="pg">Preferred PLMN</h3>
4945 <strong>[Note] Telephony Emulator does not support this feature.</strong>
4946 @n Telephony provides APIs which can be used to set and retrieve the preferred plmn of network.
4947
4948 @code
4949 int tel_set_network_preferred_plmn (TelNetworkPrefferedPlmnOp_t Operation, TelNetworkPrefferedPlmnInfo_t  PreffPlmnInfo, int *pRequestId);
4950 int tel_get_network_preferred_plmn ( int *pRequestId);
4951 @endcode
4952
4953 SAMPLE CODE
4954 @code
4955 #include <ITapiNetwork.h>
4956 #include <stdio.h>
4957 #include "TapiCommon.h"
4958 void set_preferredplmn()
4959 {
4960         //SUBSCRIBE FOR EVENTS AS MENTIONED IN  Event Register and Deregister
4961         int ret_status;
4962         int pRequestId;
4963
4964         //SET PLMN
4965         TelNetworkPrefferedPlmnOp_t Operation = TAPI_NETWORK_PREF_PLMN_ADD;
4966         TelNetworkPrefferedPlmnInfo_t PreffPlmnInfo;
4967         unsigned char *plmn = "45454";
4968
4969         memset(&PreffPlmnInfo, 0, sizeof(TelNetworkPrefferedPlmnInfo_t));
4970         PreffPlmnInfo.Index = 0;
4971         PreffPlmnInfo.SystemType = TAPI_NETWORK_SYSTEM_GSM;
4972         memcpy(PreffPlmnInfo.Plmn, plmn, 6);
4973
4974         ret_status = tel_set_network_preferred_plmn (Operation,PreffPlmnInfo, &pRequestId);
4975         if (ret_status == TAPI_API_SUCCESS)
4976                 printf("successful\n");
4977         else
4978                 printf("error=%d\n", ret_status);
4979         //WAIT FOR EVENT HERE
4980 }
4981 //CALLBACK FUNCTION TO BE USED
4982 static void app_callback (TelTapiEvent_t *event)
4983 {
4984         int eventClass;
4985         int eventType;
4986         int requestId;
4987         int status;
4988         void* EventData = NULL;
4989
4990         //...
4991         eventClass = event->EventClass;
4992         eventType = event->EventType;
4993         requestId = event->RequestId;
4994         status = event->Status;
4995         EventData = event->pData;
4996
4997         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
4998
4999         if (status != 0)
5000         {
5001                 //TEST_DEBUG("******This is nonzero status. ******\n");
5002                 return;
5003         }
5004
5005         //...
5006         //...
5007         switch (eventType) //REFER Network Selection TO GET eventType
5008         {
5009                 case TAPI_EVENT_NETWORK_SETPREFFPLMN_CNF:
5010                         printf("\n$$$$$$ TAPI TAPI_EVENT_NETWORK_SETPREFFPLMN_CNF $$$$$$ \n");
5011                         break;
5012         }
5013         //...
5014 }
5015 @endcode
5016
5017 @code
5018 //GET PLMN
5019 #include <ITapiNetwork.h>
5020 #include <stdio.h>
5021 #include "TapiCommon.h"
5022 void get_preferredplmn()
5023 {
5024         int ret_status;
5025         int pRequestId;
5026
5027         ret_status = tel_get_network_preferred_plmn (&pRequestId);
5028         if (ret_status == TAPI_API_SUCCESS)
5029                 printf("successful\n");
5030         else
5031                 printf("error=%d\n", ret_status); //WAIT FOR EVENT HERE
5032         //WAIT FOR EVENT HERE
5033 }
5034
5035 //CALLBACK FUNCTION TO BE USED
5036 static void app_callback (TelTapiEvent_t *event)
5037 {
5038         int eventClass;
5039         int eventType;
5040         int requestId;
5041         int status;
5042         void* EventData = NULL;
5043
5044         //...
5045         eventClass = event->EventClass;
5046         eventType = event->EventType;
5047         requestId = event->RequestId;
5048         status = event->Status;
5049         EventData = event->pData;
5050
5051         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
5052
5053         if (status != 0)
5054         {
5055                 //TEST_DEBUG("******This is nonzero status. ******\n");
5056                 return;
5057         }
5058         //...
5059         //...
5060         switch (eventType) //REFER Network Selection TO GET eventType
5061         {
5062                 case TAPI_EVENT_NETWORK_GETPREFFPLMN_CNF:
5063                         printf("\n$$$$$$ TAPI TAPI_EVENT_NETWORK_GETPREFFPLMN_CNF $$$$$$ \n");
5064                         break;
5065         }
5066 @endcode
5067 @}
5068 @defgroup Use_Cases5_9 Network Roaming Mode
5069 @ingroup Use_Cases5_NETWORK
5070 @{
5071
5072
5073                 <h3 class="pg">Network Roaming Mode</h3>
5074 <strong>[Note] Telephony Emulator does not support this feature.</strong>
5075 Telephony provides APIs which can be used to set and retrieve the mode of network roaming. This is for CDMA.
5076
5077 @code
5078 int tel_set_network_roaming (TelNetworkRoamingMode_t *RoamingMode, int *pRequestId);
5079 int tel_get_network_roaming (int *pRequestId);
5080 @endcode
5081
5082 SAMPLE CODE:
5083 @code
5084 //SetRoamingMode
5085 #include <ITapiNetwork.h>
5086 #include <stdio.h>
5087 #include "TapiCommon.h"
5088 void set_roamingmode()
5089 {
5090         //SUBSCRIBE FOR EVENTS AS MENTIONED IN  Event Register and Deregister
5091
5092         TelNetworkRoamingMode_t roamingMode;
5093         int ret_status;
5094
5095         roamingMode.pref_net_type = TAPI_NETWORK_PREF_NET_HOME_ONLY;
5096         roamingMode.prl_pref_only = TAPI_NETWORK_PRL_PREF_ONLY_ON;
5097
5098         ret_status = tel_get_network_roaming (&roamingMode, &requestId);
5099         if (ret_status == TAPI_API_SUCCESS)
5100                 printf("Successful\n");
5101         else
5102                 printf("error:%d\n", ret_status);
5103
5104         //WAIT FOR EVENT HERE
5105 }
5106 //CALLBACK FUNCTION TO BE USED
5107 static void app_callback (TelTapiEvent_t *event)
5108 {
5109         int eventClass;
5110         int eventType;
5111         int requestId;
5112         int status;
5113         void* EventData = NULL;
5114         //...
5115         eventClass = event->EventClass;
5116         eventType = event->EventType;
5117         requestId = event->RequestId;
5118         status = event->Status;
5119         EventData = event->pData;
5120
5121         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
5122
5123         if (status != 0)
5124         {
5125                 //TEST_DEBUG("******This is nonzero status. ******\n");
5126                 return;
5127         }
5128         //...
5129         //...
5130         switch (eventType) //REFER Network Selection TO GET eventType
5131         {
5132                 case TAPI_EVENT_NETWORK_SET_ROAMING_MODE_CNF:
5133                         printf("$$$$$TAPI_EVENT_NETWORK_SET_ROAMING_MODE_CNF$$$$$\n");
5134                         //....
5135                         break;
5136         }
5137         //...
5138 }
5139 @endcode
5140
5141 @code
5142 //GetRoamingMode
5143 #include<stdio.h>
5144 #include<TapiCommon.h>
5145 #include<ITapiNetwork.h>
5146 void set_roamingmode()
5147 {
5148         int ret_status;
5149
5150         ret_status = tel_get_network_roaming(&requestId);
5151         if (ret_status == TAPI_API_SUCCESS)
5152                 ("Successful\n");
5153         else
5154                 printf("error:%d\n", ret_status);
5155
5156         //WAIT FOR EVENT HERE
5157 }
5158
5159 //CALLBACK FUNCTION TO BE USED
5160 static void app_callback (TelTapiEvent_t *event)
5161 {
5162         int eventClass;
5163         int eventType;
5164         int requestId;
5165         int status;
5166         void* EventData = NULL;
5167         //...
5168         eventClass = event->EventClass;
5169         eventType = event->EventType;
5170         requestId = event->RequestId;
5171         status = event->Status;
5172         EventData = event->pData;
5173
5174         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
5175
5176         if (status != 0)
5177         {
5178                 //TEST_DEBUG("******This is nonzero status. ******\n");
5179                 return;
5180         }
5181         //...
5182         //...
5183         switch (eventType) //REFER Network Selection TO GET eventType
5184         {
5185                 case TAPI_EVENT_NETWORK_GET_ROAMING_MODE_CNF:
5186                         printf("$$$$TAPI_EVENT_NETWORK_GET_ROAMING_MODE_CNF$$$$\n");
5187                         //...
5188                         break;
5189         }
5190         //...
5191 }
5192 @endcode
5193 @}
5194 @defgroup Use_Cases5_10 Network CDMA Hybrid Mode
5195 @ingroup Use_Cases5_NETWORK
5196 @{
5197
5198
5199                 <h3 class="pg">Network CDMA Hybrid Mode</h3>
5200 <strong>[Note] Telephony Emulator does not support this feature.</strong>
5201 Telephony provides APIs which can be used to set and get the CDMA Hybrid Mode. This is for CDMA.
5202 Hybrid means 1x only, EVDO only combined. we can set network mode separately also in CDMA network.
5203
5204 @code
5205 int tel_set_network_hybrid_in_cdma (TelNetworkCDMAHybridMode_t CDMAHybridMode, int *pRequestId);
5206 int tel_get_network_hybrid_in_cdma (int *pRequestId);
5207 @endcode
5208
5209 SAMPLE CODE:
5210 @code
5211 //Set CDMA Hybrid Mode
5212 #include <ITapiNetwork.h>
5213 #include <stdio.h>
5214 #include "TapiCommon.h"
5215 void set_hybridmode()
5216 {
5217         int ret_status;
5218
5219         //SUBSCRIBE FOR EVENTS AS MENTIONED IN  Event Register and Deregister
5220
5221         TelNetworkCDMAHybridMode_t cdmaHybridMode;
5222         cdmaHybridMode = TAPI_NETWORK_CDMA_HYBRID; // TAPI_NETWORK_CDMA_1X_ONLY, TAPI_NETWORK_CDMA_EVDO_ONLY, TAPI_NETWORK_CDMA_HYBRID(1X + EVDO)
5223
5224         ret_status = tel_get_network_hybrid_in_cdma(cdmaHybridMode, &requestId);
5225         if (ret_status == TAPI_API_SUCCESS)
5226                 printf("Successful\n");
5227         else
5228                 printf("error:%d\n", ret_status);
5229
5230         //WAIT FOR EVENT HERE
5231 }
5232 //CALLBACK FUNCTION TO BE USED
5233
5234 static void app_callback (TelTapiEvent_t *event)
5235 {
5236         int eventClass;
5237         int eventType;
5238         int requestId;
5239         int status;
5240         void* EventData = NULL;
5241
5242         //...
5243         eventClass = event->EventClass;
5244         eventType = event->EventType;
5245         requestId = event->RequestId;
5246         status = event->Status;
5247         EventData = event->pData;
5248
5249         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
5250
5251         if (status != 0)
5252         {
5253                 //TEST_DEBUG("******This is nonzero status. ******\n");
5254                 return;
5255         }
5256         //...
5257         //...
5258         switch (eventType) //REFER Network Selection TO GET eventType
5259         {
5260                 case TAPI_EVENT_NETWORK_SET_CDMA_HYBRID_MODE_CNF:
5261                         printf("\n$$$$$$ TAPI_EVENT_NETWORK_SET_CDMA_HYBRID_MODE_CNF $$$$$$ \n");
5262                         break;
5263                         //...
5264         }
5265 }
5266 @endcode
5267
5268 @code
5269 //Get CDMA Hybrid Mode
5270 #include<stdio.h>
5271 #include<TapiCommon.h>
5272 #include<ITapiNetwork.h>
5273 void get_hybridmode()
5274 {
5275         int ret_status;
5276
5277         ret_status = tel_get_network_hybrid_in_cdma (&requestId);
5278         if (ret_status == TAPI_API_SUCCESS)
5279                 printf(successful\n);
5280         else
5281                 printf(error=%d\n, ret_status);
5282         //WAIT FOR EVENT HERE
5283 }
5284
5285 //CALLBACK FUNCTION TO BE USED
5286 static void app_callback (TelTapiEvent_t *event)
5287 {
5288         int eventClass;
5289         int eventType;
5290         int requestId;
5291         int status;
5292         void* EventData = NULL;
5293
5294         //...
5295
5296         eventClass = event->EventClass;
5297
5298         eventType = event->EventType;
5299
5300         requestId = event->RequestId;
5301         status = event->Status;
5302         EventData = event->pData;
5303
5304         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
5305
5306         if (status != 0)
5307         {
5308                 //TEST_DEBUG("******This is nonzero status. ******\n");
5309                 return;
5310         }
5311         //...
5312         //...
5313         switch (eventType) //REFER Network Selection TO GET eventType
5314         {
5315                 case TAPI_EVENT_NETWORK_GET_CDMA_HYBRID_MODE_CNF:
5316                         printf("$$$$$TAPI_EVENT_NETWORK_GET_CDMA_HYBRID_MODE_CNF$$$$\n");
5317                         //...
5318                         break;
5319         }
5320 }
5321 @endcode
5322 @}
5323 @defgroup Use_Cases5_11 SIM
5324 @ingroup Use_Cases5_NETWORK
5325 @{
5326
5327
5328                 <h3 class="pg">SIM</h3>
5329 Event Register and Deregister
5330 To receive asynchronous event notifications for the SIM APIs, the registration of related events with their associated call backs is required. When an asynchronous API is called, the confirmation is returned as an asynchronous event notification which invokes the callback function along with the event data.
5331
5332 SAMPLE CODE:
5333 @code
5334 // REGISTER EVENT
5335 unsigned int subscription_id = 0;
5336 TapiResult_t api_err;
5337
5338 api_err = TelTapiInit();
5339 if (api_err != TAPI_API_SUCCESS)
5340 {
5341         TEST_DEBUG("TelTapiInit Failed - api_err = %d \n", api_err);
5342 }
5343
5344 api_err = TelTapiRegisterEvent (TAPI_EVENT_SIM_ENABLE_PERS_CNF, &subscription_id, (TelAppCallback)&app_callback);
5345 printf("VSIM Event registration is Done: sub id is %d, api_err is %d\n",subscription_id,api_err);
5346
5347
5348 // DEREGISTER EVENT
5349 api_err = TelTapiDeRegister(subscription_id);
5350 if (api_err != TAPI_API_SUCCESS)
5351 {
5352         printf("Event Class Unregeration Fail\n");
5353
5354 }
5355 @endcode
5356 @}
5357 @defgroup Use_Cases5_12 PIN, SIM Lock operations
5358 @ingroup Use_Cases5_NETWORK
5359 @{
5360
5361
5362                 <h3 class="pg">PIN, SIM Lock operations</h3>
5363 Telephony provides APIs to enable/disable pin, change pin, unblock pin, pin verification and sim lock enable/disable/verification. It is also possible to retrieve the pin/sim lock status.
5364
5365 @code
5366 int tel_enable_sim_security(TelSimSecPw_t *sec_data, int *req_id);
5367 int tel_disable_sim_security(TelSimSecPw_t *sec_data, int *req_id);
5368 int  tel_change_sim_pins(const TelSimSecPw_t *old_pin , const TelSimSecPw_t *new_pin, int *req_id);
5369 int tel_verify_sim_puks(const TelSimSecPw_t *puk_data, const TelSimSecPw_t *new_pin_data, int *req_id)
5370 int  tel_verifiy_sim_pins(const TelSimSecPw_t *pin_data, int *req_id)
5371 int  tel_get_sim_security_status(TelSimPinType_t type, TelSimPinStatus_t *status)
5372 @endcode
5373
5374 SAMPLE CODE: PIN1/PIN2/SIM LOCK/PUK1 VERIFICATION AND CHANGE PIN1
5375 @code
5376 #include <ITapiSim.h>
5377 #include <stdio.h>
5378 #include "TapiCommon.h"
5379
5380 //  OPERATION REQUEST PIN1 VERIFICATION PART
5381 #define PIN1_NORMAL "0000" //Sample PIN1 code
5382
5383 Void pin1_verify()
5384 {
5385         int request_id = 0;
5386         int err_code;
5387         int length = TAPI_SIM_PIN_LENGTH + 1;
5388         char init_pin_val[length] ;
5389         TelSimSecPw_t pin_data;
5390
5391         strcpy(init_pin_val, PIN1_NORMAL);
5392
5393         pin_data.type = TAPI_SIM_PTYPE_PIN1;
5394         pin_data.pw_len = strlen(init_pin_val);
5395
5396         printf("pw_len[%d]", pin_data.pw_len);
5397
5398         pin_data.pw = (char*)malloc(length);
5399         memcpy(pin_data.pw, init_pin_val, length);
5400
5401         err_code = tel_verifiy_sim_pins(&pin_data, &request_id);
5402         if (err_code != TAPI_API_SUCCESS)
5403         {
5404                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5405         }
5406         // WAIT FOR EVENT FROM HERE
5407 }
5408
5409 //  OPERATION REQUEST PIN2 VERIFICATION PART
5410 #define PIN2_NORMAL "0000" //Sample PIN2 code
5411 Void verify_pin2()
5412 {
5413         int request_id = 0;
5414         int err_code;
5415         int length = TAPI_SIM_PIN_LENGTH+1;
5416         char init_pin_val[length] ;
5417         TelSimSecPw_t pin_data;
5418
5419         strcpy(init_pin_val, PIN2_NORMAL);
5420
5421         pin_data.type = TAPI_SIM_PTYPE_PIN2;
5422         pin_data.pw_len = strlen(init_pin_val);
5423
5424         printf("pw_len[%d]", pin_data.pw_len);
5425
5426         pin_data.pw = (char*)malloc(length);
5427         memcpy(pin_data.pw, init_pin_val, length);
5428
5429         err_code = tel_verifiy_sim_pins(&pin_data, &request_id);
5430         if (err_code != TAPI_API_SUCCESS)
5431         {
5432                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5433         }
5434         // WAIT FOR EVENT FROM HERE
5435 }
5436
5437 //  OPERATION REQUEST CHANGE PIN1 PART
5438 #define PIN1_ORG "0000" //Sample old PIN1 code
5439 #define PIN1_NEW "1111" //Sample new PIN1 code
5440 void change_pins()
5441 {
5442         int request_id = 0;
5443         int err_code;
5444         int length = TAPI_SIM_PIN_LENGTH+1;
5445         char init_old_pin_val[length] ;
5446         char init_new_pin_val[length];
5447         TelSimSecPw_t old_pin;
5448         TelSimSecPw_t new_pin;
5449
5450         memset(&init_old_pin_val, 0, length);
5451         memset(&init_new_pin_val, 0, length);
5452
5453         strcpy(init_old_pin_val, PIN1_ORG);
5454
5455         old_pin.type = TAPI_SIM_PTYPE_PIN1;
5456         old_pin.pw_len = strlen(init_old_pin_val);
5457         printf("pw_len[%d]", old_pin.pw_len);
5458         old_pin.pw = (char*)malloc(length);
5459         memcpy(old_pin.pw, init_old_pin_val, length);
5460
5461         strcpy(init_new_pin_val, PIN1_NEW);
5462
5463         new_pin.type = TAPI_SIM_PTYPE_PIN1;
5464         new_pin.pw_len = strlen(init_new_pin_val);
5465         printf("pw_len[%d]", new_pin.pw_len);
5466         new_pin.pw = (char*)malloc(length);
5467         memcpy(new_pin.pw, init_new_pin_val, length);
5468
5469         err_code = tel_change_sim_pins(&old_pin, &new_pin, &request_id);
5470         if (err_code != TAPI_API_SUCCESS)
5471         {
5472                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5473         }
5474         // WAIT EVENT RESPONSE FROM HERE
5475 }
5476
5477 //  OPERATION REQUEST VERIFICATION PUK1 PART
5478 #define PUK1_NORMAL "00000000" //Sample PUK1 code
5479 #define PIN1_NORMAL "0000" //Sample PIN1 code
5480
5481 void verify_puks()
5482 {
5483         int request_id = 0;
5484         int err_code;
5485         int length = TAPI_SIM_PIN_LENGTH + 1;
5486
5487         char init_pin_val[length];
5488         char init_puk_val[length];
5489
5490         TelSimSecPw_t puk_data;
5491         TelSimSecPw_t new_pin_data;
5492
5493         strcpy(init_pin_val, PIN1_NORMAL);
5494         strcpy(init_puk_val, PUK1_NORMAL);
5495
5496         puk_data.type = TAPI_SIM_PTYPE_PUK1;   // 0x00
5497         puk_data.pw_len = length;
5498         puk_data.pw_len = strlen(init_puk_val);
5499         printf("pw_len[%d]", puk_data.pw_len);
5500         memcpy(puk_data.pw, init_pin_val, length);
5501
5502         new_pin_data.type = TAPI_SIM_PTYPE_PIN1;   // 0x00
5503         new_pin_data.pw_len = strlen(init_pin_val);
5504         printf("pw_len[%d]", new_pin_data.pw_len);
5505         new_pin_data.pw = (char*)malloc(length);
5506         memcpy(new_pin_data.pw, init_pin_val, length);
5507
5508         err_code = tel_verify_sim_puks(&puk_data, &new_pin_data, &request_id);
5509         if (err_code != TAPI_API_SUCCESS)
5510         {
5511                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5512         }
5513         // WAIT EVENT RESPONSE FROM HERE
5514 }
5515 //  OPERATION REQUEST SIM LOCK VERIFICATION PART
5516 #define SIM_NORMAL "0000" //Sample SIM Lock code
5517 Void verify_sim()
5518 {
5519         int request_id = 0;
5520         int err_code;
5521         int length = TAPI_SIM_PIN_LENGTH + 1;
5522         char init_pin_val[length] ;
5523         TelSimSecPw_t pin_data;
5524
5525         strcpy(init_pin_val, SIM_NORMAL);
5526
5527         pin_data.type = TAPI_SIM_PTYPE_SIM;
5528         pin_data.pw_len = strlen(init_pin_val);
5529
5530         printf("pw_len[%d]", pin_data.pw_len);
5531
5532         pin_data.pw = (char*)malloc(length);
5533         memcpy(pin_data.pw, init_pin_val, length);
5534
5535         err_code = tel_verifiy_sim_pins(&pin_data, &request_id);
5536         if (err_code != TAPI_API_SUCCESS)
5537         {
5538                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5539         }
5540         // WAIT FOR EVENT FROM HERE
5541 }
5542
5543 //  EVENT RESPONSE PART
5544 //CALLBACK FUNCTION TO BE USED
5545
5546 static void app_callback(TelTapiEvent_t *event)
5547 {
5548         int eventClass;
5549         int eventType;
5550         int requestId;
5551         int status;
5552         void* EventData = NULL;
5553
5554         TelTapiEvent_t *sim_event = (TelTapiEvent_t*)event;
5555
5556         unsigned int temp_handle = -1;
5557
5558         //
5559         eventClass = event->EventClass;
5560         eventType = event->EventType;
5561         requestId = event->RequestId;
5562         status = event->Status;
5563         EventData = event->pData;
5564
5565         printf("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
5566
5567         switch (EventType)
5568         {
5569                 case TAPI_EVENT_SIM_VERIFY_SEC_CNF:
5570                         printf("********TAPI_EVENT_SIM_VERIFY_SEC_CNF**********");
5571
5572                         TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*) EventData;
5573
5574                         if (status == TAPI_SIM_OPERATION_TIMEOUT )
5575                         {
5576                                 printf("TAPI SIM Operation Timeout!!");
5577                         }
5578                         else if (sim_event->Status == TAPI_SIM_PIN_OPERATION_SUCCESS)
5579                         {
5580                                 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5581                                 {
5582                                         printf("PIN1 Verification Success!");
5583                                 }
5584                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM)
5585                                 {
5586                                         printf("SIM Lock Verification Success!");
5587                                 }
5588                                 else
5589                                 {
5590                                         printf("PIN2 Vefication Success!");
5591                                 }
5592                         }
5593                         else
5594                         {
5595                                 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5596                                 {
5597                                         printf("PIN1 Verification Failed! - PIN Required ");
5598                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5599                                 }
5600                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1)
5601                                 {
5602                                         printf("PIN1 Verification Failed! - PUK Required ");
5603                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5604                                 }
5605                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
5606                                 {
5607                                         printf("PIN2 Verification Failed! - PIN2 Required ");
5608                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5609                                 }
5610                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2)
5611                                 {
5612                                         printf("PIN2 Verification Failed! - PUK2 Required ");
5613                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5614                                 }
5615                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM)
5616                                 {
5617                                         printf("SIM Lock Verification Failed! - SIM Lock code Required");
5618                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5619                                 }
5620                         }
5621                         printf("********************************************");
5622                         break;
5623
5624                 case TAPI_EVENT_SIM_VERIFY_PUK_CNF:
5625                         printf("**********TAPI_EVENT_SIM_VERIFY_PUK_CNF********");
5626
5627                         TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*)EventData;
5628
5629                         if (status == TAPI_SIM_PIN_OPERATION_SUCCESS)
5630                         {
5631                                 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5632                                 {
5633                                         printf("Unblock PIN1 Success!");
5634                                 }
5635                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
5636                                 {
5637                                         printf("Unblock PIN2 Success!");
5638                                 }
5639                         }
5640                         else
5641                         {
5642                                 if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1)
5643                                 {
5644                                         printf("PIN1 Verification Failed! - PUK Required ");
5645                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5646                                 }
5647                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2)
5648                                 {
5649                                         printf("PIN2 Verification Failed! - PUK2 Required ");
5650                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5651                                 }
5652                         }
5653                         printf("********************************************");
5654                         break;
5655
5656                 case TAPI_EVENT_SIM_CHANGE_PINS_CNF:
5657                         printf("*********TAPI_EVENT_SIM_CHANGE_PINS_CNF*******************");
5658
5659                         TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*)EventData;
5660
5661                         printf("PinType[%d]", pPinInfo->type);
5662
5663                         if (status == TAPI_SIM_PIN_OPERATION_SUCCESS)
5664                         {
5665                                 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5666                                 {
5667                                         printf("Change PIN1 Success!");
5668                                 }
5669                                 else
5670                                 {
5671                                         printf("Change PIN2 Success!");
5672                                 }
5673
5674                         }
5675                         else
5676                         {
5677                                 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5678                                 {
5679                                         printf("Change PIN1 Failed! - PIN Required ");
5680                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5681                                 }
5682                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1)
5683                                 {
5684                                         printf("Change PIN1 Failed! - PUK Required ");
5685                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5686                                 }
5687                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
5688                                 {
5689                                         printf("Change PIN2 Failed! - PIN2 Required ");
5690                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5691                                 }
5692                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2)
5693                                 {
5694                                         printf("Change PIN2 Failed! - PUK2 Required ");
5695                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5696                                 }
5697                         }
5698                         printf("********************************************");
5699                         break;
5700         }
5701         //...
5702 }
5703 @endcode
5704
5705 SAMPLE CODE: ENABLE/DISABLE PIN1 and SIM LOCK
5706 @code
5707 #include <ITapiSim.h>
5708 #include <stdio.h>
5709 #include "TapiCommon.h"
5710
5711 //  OPERATION REQUEST DISABLING PIN1 PART
5712 #define PIN1_NORMAL "0000" //Sample PIN1 code
5713 void disable_pin1()
5714 {
5715         int request_id = 0;
5716         int err_code;
5717         int length = TAPI_SIM_PIN_LENGTH+1;
5718         char init_pin_val[length];
5719
5720         strcpy(init_pin_val, PIN1_NORMAL);
5721
5722         TelSimSecPw_t sec_data;
5723         sec_data.type = TAPI_SIM_PTYPE_PIN1;   // 0x00
5724         sec_data.pw_len = strlen(init_pin_val);
5725         printf("pw_len[%d]", sec_data.pw_len);
5726
5727         sec_data.pw = (char*)malloc(length);
5728         memcpy(sec_data.pw, init_pin_val, length);
5729
5730         err_code = tel_disable_sim_security(&sec_data, &request_id);
5731         if (err_code != TAPI_API_SUCCESS)
5732         {
5733                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5734         }
5735         // WAIT EVENT RESPONSE FROM HERE
5736 }
5737
5738 //  OPERATION REQUEST ENABLING PIN1 PART
5739 #define PIN1_NORMAL "0000" //Sample PIN1 code
5740 void enable_pin1()
5741 {
5742         int request_id = 0;
5743         int err_code;
5744         int length = TAPI_SIM_PIN_LENGTH+1;
5745         char init_pin_val[length];
5746
5747         strcpy(init_pin_val, PIN1_NORMAL);
5748
5749         TelSimSecPw_t sec_data;
5750         sec_data.type = TAPI_SIM_PTYPE_PIN1;   // 0x00
5751         sec_data.pw_len = strlen(init_pin_val);
5752         printf("pw_len[%d]", sec_data.pw_len);
5753
5754         sec_data.pw = (char*)malloc(length);
5755         memcpy(sec_data.pw, init_pin_val, length);
5756
5757         err_code = tel_enable_sim_security(&sec_data, &request_id);
5758         if (err_code != TAPI_API_SUCCESS)
5759         {
5760                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5761         }
5762         //WAIT EVENT RESPONSE FROM HERE
5763 }
5764
5765 //  OPERATION REQUEST DISABLING SIM LOCK PART
5766 #define SIM_NORMAL "0000" //Sample SIM LOCK code
5767 void disable_sim()
5768 {
5769         int request_id = 0;
5770         int err_code;
5771         int length = TAPI_SIM_PIN_LENGTH+1;
5772         char init_pin_val[length];
5773
5774         strcpy(init_pin_val, SIM_NORMAL);
5775
5776         TelSimSecPw_t sec_data;
5777         sec_data.type = TAPI_SIM_PTYPE_SIM;   // 0x00
5778         sec_data.pw_len = strlen(init_pin_val);
5779         printf("pw_len[%d]", sec_data.pw_len);
5780
5781         sec_data.pw = (char*)malloc(length);
5782         memcpy(sec_data.pw, init_pin_val, length);
5783
5784         err_code = tel_disable_sim_security(&sec_data, &request_id);
5785         if (err_code != TAPI_API_SUCCESS)
5786         {
5787                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5788         }
5789         //WAIT EVENT RESPONSE FROM HERE
5790 }
5791
5792
5793 //  OPERATION REQUEST ENABLING SIM LOCK PART
5794 #define SIM_NORMAL "0000" //Sample SIM LOCK code
5795 void enable_sim()
5796 {
5797         int request_id = 0;
5798         int err_code;
5799         int length = TAPI_SIM_PIN_LENGTH+1;
5800         char init_pin_val[length];
5801
5802         strcpy(init_pin_val, SIM_NORMAL);
5803
5804         TelSimSecPw_t sec_data;
5805         sec_data.type = TAPI_SIM_PTYPE_SIM;   // 0x00
5806         sec_data.pw_len = strlen(init_pin_val);
5807         printf("pw_len[%d]", sec_data.pw_len);
5808
5809         sec_data.pw = (char*)malloc(length);
5810         memcpy(sec_data.pw, init_pin_val, length);
5811
5812         err_code = tel_enable_sim_security(&sec_data, &request_id);
5813         if (err_code != TAPI_API_SUCCESS)
5814         {
5815                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5816         }
5817         //WAIT EVENT RESPONSE FROM HERE
5818 }
5819
5820
5821 //  EVENT RESPONSE PART
5822 //CALLBACK FUNCTION TO BE USED
5823 static void app_callback(TelTapiEvent_t *event)
5824 {
5825         int eventClass;
5826         int eventType;
5827         int requestId;
5828         int status;
5829         void* EventData = NULL;
5830
5831         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event;
5832
5833         unsigned int temp_handle = -1;
5834
5835         //
5836         eventClass = event->EventClass;
5837         eventType = event->EventType;
5838         requestId = event->RequestId;
5839         status = event->Status;
5840         EventData = event->pData;
5841
5842         printf("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
5843
5844         switch (EventType)
5845         {
5846                 case TAPI_EVENT_SIM_DISABLE_SEC_CNF:
5847                         printf("****************TAPI_EVENT_SIM_DISABLE_SEC_CNF****************");
5848
5849                         TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*)EventData;
5850
5851                         if (status == TAPI_SIM_PIN_OPERATION_SUCCESS)
5852                         {
5853                                 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5854                                 {
5855                                         printf("Disable PIN1 Success!");
5856                                 }
5857                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
5858                                 {
5859                                         printf("Disable PIN2 Success!");
5860                                 }
5861                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM)
5862                                 {
5863                                         printf("Disable SIM LOCK Success!");
5864                                 }
5865                         }
5866                         else
5867                         {
5868                                 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5869                                 {
5870                                         printf("Disable PIN1 Failed! - PIN1Required ");
5871                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5872                                 }
5873                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
5874                                 {
5875                                         printf("Disable PIN2 Failed! - PIN2 Required ");
5876                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5877                                 }
5878                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1)
5879                                 {
5880                                         printf("Disable PIN1 Failed! - PUK1 Required ");
5881                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5882                                 }
5883                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2)
5884                                 {
5885                                         printf("Disable PIN2 Failed! - PUK2 Required ");
5886                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5887                                 }
5888                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM)
5889                                 {
5890                                         printf("Disable SIM LOCK Failed! - SIM LOCK CODE Required ");
5891                                 }
5892                         }
5893                         printf("********************************************");
5894                         break;
5895
5896                 case TAPI_EVENT_SIM_ENABLE_SEC_CNF:
5897                         printf("*****************TAPI_EVENT_SIM_ENABLE_SEC_CNF****************");
5898
5899                         TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*)EventData;
5900
5901                         if (status == TAPI_SIM_PIN_OPERATION_SUCCESS)
5902                         {
5903                                 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5904                                 {
5905                                         printf("Enable PIN1 Success!");
5906                                 }
5907                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
5908                                 {
5909                                         printf("Enable PIN2 Success!");
5910                                 }
5911                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM)
5912                                 {
5913                                         printf("Enable SIM LOCK Success!");
5914                                 }
5915                         }
5916                         else
5917                         {
5918                                 if (pPinInfo->type == TAPI_SIM_PTYPE_PIN1)
5919                                 {
5920                                         printf("Enable PIN1 Failed! - PIN1Required ");
5921                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5922                                 }
5923                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
5924                                 {
5925                                         printf("Enable PIN2 Failed! - PIN2 Required ");
5926                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5927                                 }
5928                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK1)
5929                                 {
5930                                         printf("Enable PIN1 Failed! - PUK1 Required ");
5931                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5932                                 }
5933                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2)
5934                                 {
5935                                         printf("Enable PIN2 Failed! - PUK2 Required ");
5936                                         printf("Remainint attempts [%d]", pPinInfo->retry_count);
5937                                 }
5938
5939                                 else if (pPinInfo->type == TAPI_SIM_PTYPE_SIM)
5940                                 {
5941                                         printf("Enable SIM LOCK Failed! - SIM LOCK CODE Required ");
5942                                 }
5943                         }
5944                         printf("********************************************");
5945                         break;
5946         }
5947         //...
5948 }
5949 @endcode
5950
5951 SAMPLE CODE: GET PIN1/PIN2/SIM LOCK STATUS
5952 @code
5953 #include <ITapiSim.h>
5954 #include <stdio.h>
5955 #include "TapiCommon.h"
5956
5957 //  OPERATION REQUEST GET PIN1/PIN2/SIM LOCK STATUS PART
5958 void get_security_status()
5959 {
5960         int error_code;
5961         TelSimPinType_t type = TAPI_SIM_PTYPE_PIN1 // or TAPI_SIM_PTYPE_PIN2 or TAPI_SIM_PTYPE_SIM;
5962         TelSimPinStatus_t status = -1;
5963         printf("Get Security status");
5964
5965         err_code = tel_get_sim_security_status(type, &status);
5966         if (err_code == TAPI_API_SUCCESS)
5967         {
5968                 printf(" *****************************************************");
5969                 switch (status)
5970                 {
5971                         case TAPI_SIM_PIN_STATUS_DISABLED:
5972                                 printf("TAPI_SIM_PIN_STATUS_DISABLED ");
5973                                 break;
5974
5975                         case TAPI_SIM_PIN_STATUS_ENABLED:
5976                                 printf("TAPI_SIM_PIN_STATUS_ENABLED ");
5977                                 break;
5978
5979                         case TAPI_SIM_PIN_STATUS_BLOCKED:
5980                                 printf("TAPI_SIM_PIN_STATUS_BLOCKED ");
5981                                 break;
5982
5983                         case TAPI_SIM_PIN_STATUS_PUK_BLOCKED:
5984                                 printf("TAPI_SIM_PIN_STATUS_PUK_BLOCKED ");
5985                                 break;
5986
5987                         case TAPI_SIM_PIN_STATUS_UNKNOWN:
5988                                 printf("TAPI_SIM_PIN_STATUS_UNKNOWN ");
5989                                 break;
5990
5991                         default:
5992                                 printf(" Default case statment: sim_status(%d)", status);
5993                                 break;
5994                 }
5995         }
5996         else
5997         {
5998                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
5999         }
6000         printf("*****************************************************");
6001 }
6002 @endcode
6003 @}
6004 @defgroup Use_Cases5_13 Personalisation Lock
6005 @ingroup Use_Cases5_NETWORK
6006 @{
6007
6008
6009                 <h3 class="pg">Personalisation Lock</h3>
6010 These APIs are used to enable/disable and get the status information about personalisation of network, network subset, corporate, service provider personalisation.
6011
6012 @code
6013 int tel_enable_sim_personalization(TelSimPersPw_t *pers_data, int *req_id);
6014 int tel_disable_sim_personalization(TelSimPersPw_t *pers_data, int *req_id);
6015 int tel_get_sim_personalization_status(TelSimPersType_t type, int *req_id);
6016 @endcode
6017
6018 SAMPLE CODE: GET PERSONALIZATION STATUS
6019 @code
6020 #include <ITapiSim.h>
6021 #include <stdio.h>
6022 #include "TapiCommon.h"
6023
6024 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
6025 //  OPERATION REQUEST GET NETWORK PERSONALIZATION PART
6026 void get_net_pers()
6027 {
6028         int request_id = 0;
6029         int err_code;
6030
6031         TelSimPersType_t type = TAPI_SIM_PERS_NET;
6032
6033         err_code = tel_get_sim_personalization_status(type, &request_id);
6034         if (err_code != TAPI_API_SUCCESS)
6035         {
6036                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6037         }
6038         // WAIT EVENT RESPONSE FROM HERE
6039 }
6040
6041 //  EVENT RESPONSE PART
6042 //CALLBACK FUNCTION TO BE USED
6043 static void app_callback (TelTapiEvent_t *event)
6044 {
6045         int eventClass;
6046         int eventType;
6047         int requestId;
6048         int status;
6049         void* EventData = NULL;
6050
6051         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6052
6053         unsigned int temp_handle = -1;
6054         //...
6055         eventClass = event->EventClass;
6056         eventType = event->EventType;
6057         requestId = event->RequestId;
6058         status = event->Status;
6059         EventData = event->pData;
6060
6061         switch (eventType)
6062         {
6063                 case TAPI_EVENT_SIM_PERS_STATUS_CNF:
6064                         int i = 0;
6065                         TelSimPersStatus_t* pers_status = (TelSimPersStatus_t*)EventData;
6066
6067                         printf("[SIM APP]*********** TAPI_EVENT_SIM_PERS_STATUS_CNF************\n");
6068                         printf("[SIM APP]SIM lock personalisation event status = [%x]\n", status);
6069                         printf("[SIM APP]SIM lock personalisation status - net0-ns1-sp2-cp3  = [%d]\n", pers_status->type);
6070                         printf("[SIM APP]SIM lock personalisation status - unlock0-lock1  = [%d]\n", pers_status->mode);
6071                         printf("[SIM APP]***************************************************\n");
6072                         break;
6073         }
6074 }
6075 @endcode
6076
6077 SAMPLE CODE: ENABLE/DISABLE PERSONALIZATION
6078 @code
6079 #include <ITapiSim.h>
6080 #include <stdio.h>
6081 #include "TapiCommon.h"
6082
6083 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
6084 //  OPERATION REQUEST ENABLING NETWORK PERSONALIZATION PART
6085 #define NET_ENCODE "54500112345678" //Sample Network Personalization code
6086 void enable_net_pers()
6087 {
6088         printf("Lock Personalisation MCC+MNC 5\n");
6089         printf("Plese input Network Lock CODE : length of MCC+MNC, MCC, MNC, NCK\n");
6090         printf("We need to use this for testing : length of MCC+MNC(5), MCC(450), MNC(01), NCK(12345678) => 54500112345678\n");
6091
6092         int request_id = 0;
6093         int err_code;
6094         int length = 14+1;
6095         char init_pin_val[length];
6096
6097         strcpy(init_pin_val, NET_ENCODE);
6098
6099         TelSimPersPw_t lock_pers = {0,};
6100         lock_pers.type = TAPI_SIM_PERS_NET;
6101         lock_pers.pw_len = 14;
6102         lock_pers.pw = (char*)malloc(length);
6103         memcpy(lock_pers.pw, init_password_val, length);
6104
6105         err_code = tel_enable_sim_personalization(&lock_pers, &request_id);
6106         if (err_code != TAPI_API_SUCCESS)
6107         {
6108                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6109         }
6110         // WAIT EVENT RESPONSE FROM HERE
6111 }
6112
6113 //  OPERATION REQUEST DISABLING NETWORK PERSONALIZATION PART
6114 #define NET_DISCODE "12345678" //Sample Network Personalization code
6115 void disable_net_pers()
6116 {
6117         printf("de Personalisation key is 8 byte \n");
6118         printf("We need to use this for testing : 12345678\n");
6119
6120         int request_id = 0;
6121         int err_code;
6122         int length = 8+1;
6123         char init_pin_val[length];
6124
6125         strcpy(init_pin_val, NET_DISCODE);
6126
6127         TelSimPersPw_t lock_pers = {0,};
6128         lock_pers.pw_len =  8; //control key
6129         lock_pers.pw = (char*)malloc(length);
6130         memcpy(lock_pers.pw,init_password_val,length);
6131
6132         err_code = tel_disable_sim_personalization(&lock_pers, &request_id);
6133         if (err_code != TAPI_API_SUCCESS)
6134         {
6135                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6136         }
6137         // WAIT EVENT RESPONSE FROM HERE
6138 }
6139
6140 //  EVENT RESPONSE PART
6141 //CALLBACK FUNCTION TO BE USED
6142 static void app_callback (TelTapiEvent_t *event)
6143 {
6144         int eventClass;
6145         int eventType;
6146         int requestId;
6147         int status;
6148         void* EventData = NULL;
6149
6150         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
6151
6152         unsigned int temp_handle = -1;
6153         //...
6154         eventClass = event->EventClass;
6155         eventType = event->EventType;
6156         requestId = event->RequestId;
6157         status = event->Status;
6158         EventData = event->pData;
6159
6160         switch (eventType)
6161         {
6162                 case TAPI_EVENT_SIM_DISABLE_PERS_CNF:
6163                         TelSimPinOperationResult_t opResult = (TelSimPinOperationResult_t)status;
6164
6165                         printf("[SIM APP]**** *TAPI_EVENT_SIM_DISABLE_PERS_CNF********\n");
6166                         printf("[SIM APP]Eable Personalization event status = [%x]\n", opResult);
6167
6168                         if (opResult == TAPI_SIM_PIN_OPERATION_SUCCESS)
6169                         {
6170                                 ("[SIM APP]Disable Personalization Success!\n");
6171                         }
6172                         else
6173                         {
6174                                 printf("[SIM APP]Verification Failed! - Correct Password Required\n");
6175                         }
6176                         printf("\n***************************************************************\n");
6177                         break;
6178
6179                 case TAPI_EVENT_SIM_ENABLE_PERS_CNF:
6180                         TelSimPinOperationResult_t opResult = (TelSimPinOperationResult_t)status;
6181
6182                         printf("[SIM APP]****** *TAPI_EVENT_SIM_ENABLE_PERS_CNF*********\n");
6183                         printf("[SIM APP]Eable Personalization event status = [%x]\n", opResult);
6184
6185                         if (opResult == TAPI_SIM_PIN_OPERATION_SUCCESS)
6186                         {
6187                                 printf("[SIM APP]Enable Personalization Success!\n");
6188                         }
6189                         else
6190                         {
6191                                 printf("[SIM APP]Verification Failed! - Correct Password Required\n");
6192                         }
6193                         printf("\n***************************************************************\n");
6194                         break;
6195         }
6196 }
6197 @endcode
6198 @}
6199 @defgroup Use_Cases5_14 FDN
6200 @ingroup Use_Cases5_NETWORK
6201 @{
6202
6203
6204                 <h3 class="pg">FDN</h3>
6205 These APIs are used to enable/disable FDN and to retrieve the current FDN status.
6206
6207 @code
6208 int tel_enable_sim_fdn(const unsigned char *pin2, int *pin2_len, int *req_id);
6209 int tel_disable_sim_fdn(const unsigned char *pin2, int *pin2_len, int *req_id);
6210 int tel_get_sim_fdn_status(int *fdn_status);
6211 @endcode
6212
6213 SAMPLE CODE
6214 @code
6215 #include <ITapiSim.h>
6216 #include <stdio.h>
6217 #include "TapiCommon.h"
6218
6219 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
6220
6221 //  OPERATION REQUEST ENABLE FDN MODE PART
6222 #define PIN2_NORMAL "0000" //Sample PIN2 code
6223 void enable_fdn()
6224 {
6225         int request_id = 0;
6226         int api_ret;
6227         int length = TAPI_SIM_PIN_LENGTH+1;
6228         char init_pin_val[length] ;
6229
6230         strcpy(init_pin_val, PIN2_NORMAL);
6231
6232         TelSimSecPw_t pin_data = {0,};
6233
6234         pin_data.type = TAPI_SIM_PTYPE_PIN2;
6235         pin_data.pw_len = strlen(init_pin_val);
6236
6237         printf("pw_len[%d]", pin_data.pw_len);
6238
6239         pin_data.pw = (char*)malloc(length);
6240         memcpy(pin_data.pw, init_pin_val, length);
6241
6242         err_code = tel_enable_sim_fdn(pin_data.pw, &pin_data.pw_len, &request_id);
6243         if (err_code != TAPI_API_SUCCESS)
6244         {
6245                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6246         }
6247         // WAIT FOR EVENT FROM HERE
6248 }
6249
6250
6251 //  OPERATION REQUEST DISABLE FDN MODE PART
6252 #define PIN2_NORMAL "0000" //Sample PIN2 code
6253 void disable_fdn()
6254 {
6255         int request_id = 0;
6256         int api_ret;
6257         int length = TAPI_SIM_PIN_LENGTH+1;
6258         char init_pin_val[length] ;
6259
6260         strcpy(init_pin_val, PIN2_NORMAL);
6261
6262         TelSimSecPw_t pin_data = {0,};
6263
6264         pin_data.type = TAPI_SIM_PTYPE_PIN2;
6265         pin_data.pw_len = strlen(init_pin_val);
6266
6267         printf("pw_len[%d]", pin_data.pw_len);
6268
6269         pin_data.pw = (char*)malloc(length);
6270         memcpy(pin_data.pw, init_pin_val, length);
6271
6272         err_code = tel_disable_sim_fdn(pin_data.pw, &pin_data.pw_len, &request_id);
6273         if (err_code != TAPI_API_SUCCESS)
6274         {
6275                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6276         }
6277         // WAIT FOR EVENT FROM HERE
6278
6279
6280         //  EVENT RESPONSE PART
6281         //CALLBACK FUNCTION TO BE USED
6282         static void app_callback (TelTapiEvent_t *event)
6283         {
6284                 int eventClass;
6285                 int eventType;
6286                 int requestId;
6287                 int status;
6288                 void* EventData = NULL;
6289
6290                 TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event;
6291
6292                 unsigned int temp_handle = -1;
6293                 //
6294                 eventClass = event->EventClass;
6295                 eventType = event->EventType;
6296                 requestId = event->RequestId;
6297                 status = event->Status;
6298                 EventData = event->pData;
6299
6300                 switch (eventType)
6301                 {
6302                         case TAPI_EVENT_SIM_DISABLE_FDNMODE_CNF:
6303                                 printf("**********TAPI_EVENT_SIM_DISABLE_FDNMODE_CNF***********");
6304
6305                                 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*)EventData;
6306
6307                                 if (status == TAPI_SIM_PIN_OPERATION_SUCCESS)
6308                                 {
6309                                         if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
6310                                         {
6311                                                 printf("Disable FDN Success!");
6312                                         }
6313                                         else
6314                                         {
6315                                                 printf("Unhandled type[%d]", pPinInfo->type);
6316                                         }
6317                                 }
6318                                 else
6319                                 {
6320                                         if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
6321                                         {
6322                                                 printf("Disable FDN Failed! - PIN2 Required ");
6323                                                 printf("Remainint attempts [%d]", pPinInfo->retry_count);
6324                                         }
6325                                         else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2)
6326                                         {
6327                                                 printf("Disable FDN Failed! - PUK2 Required ");
6328                                                 printf("Remainint attempts [%d]", pPinInfo->retry_count);
6329                                         }
6330                                         else
6331                                         {
6332                                                 printf("Unhandled type[%d]", pPinInfo->type);
6333                                         }
6334                                 }
6335                                 printf("********************************************");
6336                                 break;
6337
6338                         case TAPI_EVENT_SIM_ENABLE_FDNMODE_CNF:
6339                                 printf("*******TAPI_EVENT_SIM_ENABLE_FDNMODE_CNF*******");
6340
6341                                 TelSimSecResult_t *pPinInfo = (TelSimSecResult_t*)EventData;
6342
6343                                 if (status == TAPI_SIM_PIN_OPERATION_SUCCESS)
6344                                 {
6345                                         if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
6346                                         {
6347                                                 printf("Enable FDN Success!");
6348                                         }
6349                                         else
6350                                         {
6351                                                 printf("Unhandled type[%d]", pPinInfo->type);
6352                                         }
6353                                 }
6354                                 else
6355                                 {
6356                                         if (pPinInfo->type == TAPI_SIM_PTYPE_PIN2)
6357                                         {
6358                                                 printf("Enable FDN Failed! - PIN2 Required ");
6359                                                 printf("Remainint attempts [%d]", pPinInfo->retry_count);
6360                                         }
6361                                         else if (pPinInfo->type == TAPI_SIM_PTYPE_PUK2)
6362                                         {
6363                                                 printf("Enable FDN Failed! - PUK2 Required ");
6364                                                 printf("Remainint attempts [%d]", pPinInfo->retry_count);
6365                                         }
6366                                         else
6367                                         {
6368                                                 printf("Unhandled type[%d]", pPinInfo->type);
6369                                         }
6370                                 }
6371                                 printf("********************************************");
6372                                 break;
6373                 }
6374         }
6375
6376
6377         //  OPERATION REQUEST GET FDN STATUS PART
6378         void get_fdn_status()
6379         {
6380                 printf("Get FDN status");
6381                 int fdn_status = 0 ;
6382
6383                 err_code = tel_get_sim_fdn_status(&fdn_status);
6384                 if (err_code == TAPI_API_SUCCESS)
6385                 {
6386                         if (fdn_status == 0)
6387                         {
6388                                 printf("*************************");
6389                                 printf("FDN disabled ");
6390                                 printf("*************************");
6391                         }
6392                         else
6393                         {
6394                                 printf("*************************");
6395                                 printf("FDN enabled");
6396                                 printf("*************************");
6397                         }
6398                 }
6399                 else
6400                 {
6401                         printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6402                 }
6403
6404         }
6405 @endcode
6406 @}
6407 @defgroup Use_Cases5_15 IMSI Information
6408 @ingroup Use_Cases5_NETWORK
6409 @{
6410
6411
6412                 <h3 class="pg">IMSI Information</h3>
6413 This API retrieves the IMSI (International Mobile Subscriber Identity) information.
6414
6415 @code
6416 int tel_get_sim_imsi(TelSimImsiInfo_t* imsi);
6417 @endcode
6418
6419 SAMPLE CODE:
6420 @code
6421 #include <ITapiSim.h>
6422 #include <stdio.h>
6423 #include "TapiCommon.h"
6424
6425 void getimsiInfo()
6426 {
6427         int err_code;
6428         TelSimImsiInfo_t sim_imsi_info;
6429
6430         err_code = tel_get_sim_imsi (&sim_imsi_info);
6431         if (err_code == TAPI_API_SUCCESS)
6432         {
6433                 printf("[SIM APP] IMSI [mcc,mnc,msin]= ");
6434                 printf(" [%s]",sim_imsi_info.szMcc);
6435                 printf(" [%s]",sim_imsi_info.szMnc);
6436                 printf(" [%s]",sim_imsi_info.szMsin);
6437         }
6438         else
6439         {
6440                 printf("Error Code [%x]\n", err_code);
6441         }
6442 }
6443 @endcode
6444 @}
6445 @defgroup Use_Cases5_16 ECC Information
6446 @ingroup Use_Cases5_NETWORK
6447 @{
6448
6449
6450                 <h3 class="pg">ECC Information</h3>
6451 This API retreieves the ECC (Emergency Call Codes) data.
6452
6453 @code
6454 int tel_get_sim_ecc(TelSimEccData_t *ecc_data, int *ecc_count);
6455 @endcode
6456
6457 SAMPLE CODE:
6458 @code
6459 #include <ITapiSim.h>
6460 #include <stdio.h>
6461 #include "TapiCommon.h"
6462
6463 void geteccinfo()
6464 {
6465         int err_code;
6466         int ecc_rec_count = 0;
6467         TelSimEccData_t  ecc_info = {0,};
6468
6469         err_code = tel_get_sim_ecc (&ecc_info, &ecc_rec_count);
6470         printf("The Retrun Status is %d", err_code);
6471
6472         printf(" ECC count [%d]\n", ecc_rec_count);
6473         printf("ECC1 [%s]\n", ecc_info.EccInfo.szEcc1);
6474         printf("ECC2 [%s]\n", ecc_info.EccInfo.szEcc2);
6475         printf("ECC3 [%s]\n", ecc_info.EccInfo.szEcc3);
6476         printf("ECC4 [%s]\n", ecc_info.EccInfo.szEcc4);
6477         printf("ECC5 [%s]\n", ecc_info.EccInfo.szEcc5);
6478 }
6479
6480 void get_uecc()
6481 {
6482         int err_code;
6483         int i = 0;
6484         int uecc_rec_count = 0;
6485
6486         printf(" Get USIM ECC  ");
6487
6488         TelSimEccData_t uecc_info = {{{0,}}};
6489
6490         err_code = tel_get_sim_ecc(&uecc_info, &uecc_rec_count);
6491         if (err_code == TAPI_API_SUCCESS)
6492         {
6493                 printf("ECC count [%d]",uecc_rec_count );
6494
6495                 for (i=0; i<uecc_rec_count; i++)
6496                 {
6497                         printf("Loop(%d): ", i);
6498                         printf(" ECC Used [%d]", uecc_info.UeccInfo[i].bUsed);
6499                         printf(" ECC Len [%d]", uecc_info.UeccInfo[i].EccLen);
6500
6501                         if (NULL != uecc_info.UeccInfo[i].szEcc)
6502                         {
6503                                 printf("ECC string [%s]", uecc_info.UeccInfo[i].szEcc);
6504                         }
6505                         else
6506                         {
6507                                 printf("ECC string [null]");
6508                         }
6509
6510                         printf("ECC alphaID [%s]",uecc_info.UeccInfo[i].szEccAlphaIdentifier);
6511                 }
6512         }
6513         else
6514         {
6515                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6516         }
6517 }
6518 @endcode
6519 @}
6520 @defgroup Use_Cases5_17 Language Preference Information
6521 @ingroup Use_Cases5_NETWORK
6522 @{
6523
6524
6525                 <h3 class="pg">Language Preference Information</h3>
6526 These APIs are used to get and set the language preference information stored in SIM.
6527
6528 @code
6529 int tel_get_sim_language(TelSimLanguageInfo_t *sim_language);
6530 int tel_set_sim_language(TelSimLanguagePreferenceCode_t language, int *req_id);
6531 @endcode
6532
6533 SAMPLE CODE: GET SIM LANGUAGE
6534 @code
6535 #include <ITapiSim.h>
6536 #include <stdio.h>
6537 #include "TapiCommon.h"
6538
6539 void getlanguageprefinfo()
6540 {
6541         int err_code;
6542         TelSimLanguageInfo_t li_info;
6543         int i;
6544
6545         err_code = tel_get_sim_language (&li_info);
6546         printf("Error Code [%x]\n", err_code);
6547
6548         for (i =0; i<li_info.LpCount; i++)
6549                 printf(" LI[%d] --> Val  [%d]\n", i, li_info.Lp[i]);
6550 }
6551 @endcode
6552
6553 SAMPLE CODE: UPDATE SIM LANGUAGE
6554 @code
6555 #include <ITapiSim.h>
6556 #include <stdio.h>
6557 #include "TapiCommon.h"
6558
6559 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
6560 //  OPERATION REQUEST UPDATE SIM LANGUAGE PART
6561 void get_net_pers()
6562 {
6563         int err_code;
6564         int request_id = 0;
6565         TelSimLanguagePreferenceCode_t language = 0x00;
6566
6567         language = TAPI_SIM_LP_ENGLISH; //0x01
6568
6569         err_code = tel_set_sim_language(language, &request_id);
6570         if (err_code != TAPI_API_SUCCESS)
6571         {
6572                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6573         }
6574         // WAIT EVENT RESPONSE FROM HERE
6575 }
6576
6577
6578 //  EVENT RESPONSE PART
6579 //CALLBACK FUNCTION TO BE USED
6580 static void app_callback (TelTapiEvent_t *event)
6581 {
6582         int eventClass;
6583         int eventType;
6584         int requestId;
6585         int status;
6586         void* EventData = NULL;
6587
6588         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event;
6589
6590         unsigned int temp_handle = -1;
6591         //
6592         eventClass = event->EventClass;
6593         eventType = event->EventType;
6594         requestId = event->RequestId;
6595         status = event->Status;
6596         EventData = event->pData;
6597
6598         switch (eventType)
6599         {
6600                 case TAPI_EVENT_SIM_SET_LANGUAGE_CNF:
6601                         printf("*****TAPI_EVENT_SIM_SET_LANGUAGE_CNF*********");
6602                         printf("update event status = [0x%x]", status);
6603                         printf("*********************************************");
6604                         break;
6605
6606         }
6607 }
6608 @endcode
6609 @}
6610 @defgroup Use_Cases5_18 Getting Card Type
6611 @ingroup Use_Cases5_NETWORK
6612 @{
6613
6614
6615                 <h3 class="pg">Getting Card Type</h3>
6616 This API is a synchronous API which gets the Card Type i.e. whether the SIM Card is a GSM SIM or a 3G SIM.
6617
6618 @code
6619 int tel_get_sim_type(TelSimCardType_t *card_type);
6620 @endcode
6621
6622 SAMPLE CODE:
6623 @code
6624 #include <ITapiSim.h>
6625 #include <stdio.h>
6626 #include "TapiCommon.h"
6627
6628 void getcardtype()
6629 {
6630         int err_code;
6631         TelSimCardType_t cardInfo;
6632
6633         printf("Get card type !!!\n");
6634         err_code = tel_get_sim_type (&cardInfo);
6635         printf("card type is %d\n", cardInfo);
6636 }
6637 @endcode
6638 @}
6639 @defgroup Use_Cases5_19  Getting SIM Card Initialization Status
6640 @ingroup Use_Cases5_NETWORK
6641 @{
6642
6643
6644                 <h3 class="pg">Getting SIM Card Initialization Status</h3>
6645 API is a synchronous API which gets the Card Init status and Identification.
6646
6647 @code
6648 int tel_get_sim_init_info(TelSimCardStatus_t *sim_status, int *card_changed);
6649 @endcode
6650
6651 SAMPLE CODE:
6652 @code
6653 #include <ITapiSim.h>
6654 #include <stdio.h>
6655 #include "TapiCommon.h"
6656
6657 //  OPERATION REQUEST GET CARD INIT STATUS PART
6658 void get_sim_init_status()
6659 {
6660         int err_code;
6661         TelSimCardStatus_t status = 0x00;
6662         int b_card_changed = 0;
6663
6664         err_code = tel_get_sim_init_info(&status, &b_card_changed);
6665         if (err_code == TAPI_API_SUCCESS)
6666         {
6667                 printf("**********************************************");
6668                 printf("CardStatus:[0x%x]",status);
6669                 printf("b_card_changed[%d]\n",b_card_changed);
6670                 printf("**********************************************");
6671         }
6672         else
6673         {
6674                 printf("TAPI Fail: Error Code [%d]\n", err_code);
6675         }
6676 }
6677 @endcode
6678 @}
6679 @defgroup Use_Cases5_20 SIM ACCESS COMMANDS Interface
6680 @ingroup Use_Cases5_NETWORK
6681 @{
6682
6683
6684                 <h3 class="pg">SIM ACCESS COMMANDS Interface</h3>
6685 This API is used to handle SIM EF data directly according to sim access command (select-file info, read, update command). Use_Cases is defined in the 3GPP or ETSI SIM specifications.
6686
6687 @code
6688 int tel_req_sim_access(const TelSimRSimReq_t *rsim_data, int *req_id);
6689 @endcode
6690
6691 SAMPLE CODE: EF HANDLING ( SELECT-FILE INFO)
6692 @code
6693 #include <ITapiSim.h>
6694 #include <stdio.h>
6695 #include "TapiCommon.h"
6696
6697 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
6698 //  OPERATION REQUEST GET SIM FILE INFO PART
6699 void get_sim_file_info()
6700 {
6701         int err_code;
6702         int request_id = 0;
6703
6704         TelRSimReq_t rsim_data;
6705         rsim_data.file_id = TAPI_SIM_EFILE_SPN;      // rsim access : sim file id to access
6706         rsim_data.rsim_cmd = TAPI_SIM_GET_RESPONSE;  // rsim access : get response, read, update available
6707
6708         err_code = tel_req_sim_access(&rsim_data, &request_id);
6709         if (err_code != TAPI_API_SUCCESS)
6710         {
6711                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6712         }
6713         // WAIT EVENT RESPONSE FROM HERE
6714 }
6715
6716 //  EVENT RESPONSE PART
6717 //CALLBACK FUNCTION TO BE USED
6718 static void app_callback (TelTapiEvent_t *event)
6719 {
6720         int eventClass;
6721         int eventType;
6722         int requestId;
6723
6724         int status;
6725
6726         void* EventData = NULL;
6727
6728         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event;
6729
6730         unsigned int temp_handle = -1;
6731         //
6732         eventClass = event->EventClass;
6733         eventType = event->EventType;
6734         requestId = event->RequestId;
6735         status = event->Status;
6736         EventData = event->pData;
6737
6738         switch (eventType)
6739         {
6740                 case TAPI_EVENT_SIM_RSIM_ACCESS_CNF:
6741                         TelSimReadFileRaw_t* rsim_resp = (TelSimReadFileRaw_t*)EventData;
6742
6743                         printf("*******TAPI_EVENT_SIM_RSIM_ACCESS_CNF**********");
6744                         printf("Read event status = [0x%x]", status);
6745
6746                         if ((rsim_resp->sw1 == 0x90 && rsim_resp->sw2 == 0x00) ||rsim_resp->sw1 == 0x91)
6747                         {
6748                                 printf("**********GET FILE INFO************");
6749                                 printf("you should parse current data array value properly regarding 3GPP or ETSI TS 102 221 SPEC");
6750                         }
6751                         printf("************************************************");
6752                         break;
6753         }
6754 }
6755 @endcode
6756 @}
6757 @defgroup Use_Cases5_21 SIM Mailbox EF management
6758 @ingroup Use_Cases5_NETWORK
6759 @{
6760
6761
6762                 <h3 class="pg">SIM Mailbox EF management</h3>
6763 These APIs are used to get and update the mailbox information stored in SIM.
6764
6765 @code
6766 int tel_get_sim_mailbox_info(TelSimMsgWaitingGroup_t type, int *req_id);
6767 int tel_set_sim_mailbox_info(TelSimMsgWaitingGroup_t type, const TelSimDialingNumberInfo_t *update_data, int *req_id);
6768 @endcode
6769
6770 SAMPLE CODE: READ / UPDATE MAILBOX INFO
6771 @code
6772 #include <ITapiSim.h>
6773 #include <stdio.h>
6774 #include "TapiCommon.h"
6775
6776 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
6777
6778 void get_sim_mailbox()
6779 {
6780         int err_code;
6781         int request_id = 0;
6782         TelSimMsgWaitingGroup_t type = 0x00;
6783
6784         type = TAPI_SIM_MWG_VOICE;
6785
6786         err_code = tel_get_sim_mailbox_info(type, &request_id);
6787         if (err_code != TAPI_API_SUCCESS)
6788         {
6789                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6790         }
6791         // WAIT EVENT RESPONSE FROM HERE
6792 }
6793 //  OPERATION REQUEST UPDATE SIM MAILBOX INFO PART
6794 void update_sim_mailbox()
6795 {
6796         int err_code;
6797         int request_id = 0;
6798
6799         TelSimMsgWaitingGroup_t type = 0x00;
6800         TelSimDialingNumberInfo_t update_data;
6801
6802         type = TAPI_SIM_MWG_VOICE;
6803
6804         memcpy(update_data.AlphaId, "TestUpdate", 10);
6805         update_data.AlphaIdLength = strlen(update_data.AlphaId);
6806         update_data.CapaConfigId = 1;
6807         memcpy(update_data.DiallingNum, "101020203030", 12);
6808         update_data.DiallingnumLength = strlen(update_data.DiallingNum);
6809         update_data.Ext1RecordId = 1;
6810         update_data.NumberingPlanIdent =2;
6811         update_data.TypeOfNumber = 2;
6812
6813         err_code = tel_set_sim_mailbox_info(type, &update_data, &request_id);
6814         if (err_code != TAPI_API_SUCCESS)
6815         {
6816                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6817         }
6818         // WAIT EVENT RESPONSE FROM HERE
6819 }
6820
6821 //  EVENT RESPONSE PART
6822 //CALLBACK FUNCTION TO BE USED
6823 static void app_callback (TelTapiEvent_t *event)
6824 {
6825         int eventClass;
6826         int eventType;
6827         int requestId;
6828         int status;
6829         void* EventData = NULL;
6830
6831         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event;
6832
6833         unsigned int temp_handle = -1;
6834         //
6835         eventClass = event->EventClass;
6836         eventType = event->EventType;
6837         requestId = event->RequestId;
6838         status = event->Status;
6839         EventData = event->pData;
6840
6841         switch (eventType)
6842         {
6843                 case TAPI_EVENT_SIM_GET_MAILBOX_CNF:
6844                         TelSimDialingNumberInfo_t* mailbox = (TelSimDialingNumberInfo_t*)EventData;
6845
6846                         printf("*******TAPI_EVENT_SIM_GET_MAILBOX_CNF*********");
6847                         printf("Read event status = [0x%x]", status);
6848                         printf("bUsed[%d]", mailbox->bUsed);
6849                         printf("AlphaIDMaxLength[%d]", mailbox->AlphaIDMaxLength);
6850                         printf("AlphaIdLength[%d]", mailbox->AlphaIdLength);
6851                         printf("AlphaId[%s]", mailbox->AlphaId);
6852                         printf("DiallingNumMaxLength[%d]", mailbox->DiallingNumMaxLength);
6853                         printf("DiallingnumLength[%d]", mailbox->DiallingnumLength);
6854                         printf("TypeOfNumber:0-unknown,1-international,2-national[%d]", mailbox->TypeOfNumber);
6855                         printf("NumberingPlanIdent:0-unknown,1-isdn,3-data[%d]", mailbox->NumberingPlanIdent);
6856                         printf("DiallingNum[%s]", mailbox->DiallingNum);
6857                         printf("CapaConfigId[%c]", mailbox->CapaConfigId);
6858                         printf("Ext1RecordId[%c]", mailbox->Ext1RecordId);
6859                         printf("**********************************************************");
6860                         break;
6861
6862                 case TAPI_EVENT_SIM_SET_MAILBOX_CNF:
6863                         printf("*********NEW*TAPI_EVENT_SIM_SET_MAILBOX_CNF************");
6864                         printf("update event status = [0x%x]", status);
6865                         printf("**********************************************************");
6866                         break;
6867         }
6868 }
6869 @endcode
6870 @}
6871 @defgroup Use_Cases5_22 SIM Indication Status EFs management
6872 @ingroup Use_Cases5_NETWORK
6873 @{
6874
6875
6876                 <h3 class="pg">SIM Indication Status EFs management</h3>
6877 These APIs are used to get and set the message indication status stored in SIM.
6878
6879 @code
6880 int tel_get_sim_indicator_info(TelSimIndicationStatusType_t type, int *req_id);
6881 int tel_set_sim_indicator_info(const TelSimIndicationStatusData_t *update_data, int *req_id);
6882 @endcode
6883
6884 SAMPLE CODE:  READ / UPDATE INDICATION STATUS DATA
6885 @code
6886 #include <ITapiSim.h>
6887 #include <stdio.h>
6888 #include "TapiCommon.h"
6889
6890 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
6891
6892 //  OPERATION REQUEST READ SIM MESSAGE WAITING INDICATION STATUS INFO PART
6893 void read_sim_mwis()
6894 {
6895         int err_code;
6896         int request_id = 0;
6897
6898         TelSimIndicationStatusType_t type = 0x00;
6899
6900         type = TAPI_SIM_INDICATION_MW;
6901
6902         err_code = tel_get_sim_indicator_info(type, &request_id);
6903         if (err_code != TAPI_API_SUCCESS)
6904         {
6905                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6906         }
6907         // WAIT EVENT RESPONSE FROM HERE
6908 }
6909
6910 //  OPERATION REQUEST UPDATE SIM MESSAGE WAITING INDICATION STATUS INFO PART
6911 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
6912
6913 void update_sim_mwis()
6914 {
6915         int err_code;
6916         int request_id = 0;
6917
6918         TelSimIndicationStatusType_t type = 0x00;
6919         TelSimIndicationStatusData_t update_data;
6920         memset(&update_data, 0x00, sizeof(TelSimIndicationStatusData_t));
6921
6922         type = TAPI_SIM_INDICATION_MW;
6923
6924         update_data.requested_type = type;
6925         update_data.data.Mwis.VoiceMailCount = 1;           // VoiceMail Count
6926         update_data.data.Mwis.FaxCount = 2;                 // Fax Count
6927         update_data.data.Mwis.EmailCount = 3;               // Email Count
6928         update_data.data.Mwis.OtherCount = 4;               // Other Count
6929         update_data.data.Mwis.VideoMailCount = 5;           // VideoMail Count
6930
6931         err_code = tel_set_sim_indicator_info(&update_data, &request_id);
6932         if (err_code != TAPI_API_SUCCESS)
6933         {
6934                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
6935         }
6936         // WAIT EVENT RESPONSE FROM HERE
6937 }
6938
6939
6940 //  EVENT RESPONSE PART
6941 //CALLBACK FUNCTION TO BE USED
6942 static void app_callback (TelTapiEvent_t *event)
6943 {
6944         int eventClass;
6945         int eventType;
6946         int requestId;
6947         int status;
6948         void* EventData = NULL;
6949
6950         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event;
6951
6952         unsigned int temp_handle = -1;
6953         //
6954         eventClass = event->EventClass;
6955         eventType = event->EventType;
6956         requestId = event->RequestId;
6957         status = event->Status;
6958         EventData = event->pData;
6959
6960         switch (eventType)
6961         {
6962                 case TAPI_EVENT_SIM_GET_INDICATION_CNF:
6963                         TelSimIndicationStatusData_t* indi_data = (TelSimIndicationStatusData_t*)EventData;
6964
6965                         printf("*******TAPI_EVENT_SIM_GET_INDICATION_CNF**********");
6966                         printf("Read event status = [0x%x]", status);
6967
6968                         if (indi_data->requested_type == TAPI_SIM_INDICATION_MW)
6969                         {
6970                                 printf("**********MWIS************");
6971                                 printf("IndicatorType[%d]", indi_data->data.Mwis.IndicatorType);
6972                                 printf("VoiceMailCount[%d]", indi_data->data.Mwis.VoiceMailCount);
6973                                 printf("FaxCount[%d]", indi_data->data.Mwis.FaxCount);
6974                                 printf("EmailCount[%d]", indi_data->data.Mwis.EmailCount);
6975                                 printf("OtherCount[%d]", indi_data->data.Mwis.OtherCount);
6976                                 printf("VideoMailCount[%d]", indi_data->data.Mwis.VideoMailCount);
6977                         }
6978                         else if (indi_data->requested_type == TAPI_SIM_INDICATION_CF)
6979                         {
6980                                 printf("**********CFIS************");
6981                                 printf("bUsed[%d]", indi_data->data.Cfis.bUsed);
6982                                 printf("MspNumber[%d]", indi_data->data.Cfis.MspNumber);
6983                                 printf("Status[%d]", indi_data->data.Cfis.Status);
6984                                 printf("DiallingnumLen[%d]", indi_data->data.Cfis.DiallingnumLen);
6985                                 printf("TypeOfNumber[%d]", indi_data->data.Cfis.TypeOfNumber);
6986                                 printf("NumberingPlanIdent[%d]", indi_data->data.Cfis.NumberingPlanIdent);
6987                                 printf("DiallingNum[%s]", indi_data->data.Cfis.DiallingNum);
6988                                 printf("CapaConfig2Id[%d]", indi_data->data.Cfis.CapaConfig2Id);
6989                                 printf("Ext7RecordId[%d]", indi_data->data.Cfis.Ext7RecordId);
6990                         }
6991                         else
6992                         {
6993                                 printf("Unhandled indication status type[%d]",indi_data->requested_type );
6994                         }
6995                         printf("************************************************");
6996                         break;
6997
6998                 case TAPI_EVENT_SIM_SET_INDICATION_CNF:
6999                         printf("******TAPI_EVENT_SIM_SET_INDICATION_CNF*******");
7000                         printf("update event status = [0x%x]", status);
7001                         printf("**********************************************");
7002                         break;
7003         }
7004 }
7005 @endcode
7006 @}
7007 @defgroup Use_Cases5_23 Phone Book
7008 @ingroup Use_Cases5_NETWORK
7009 @{
7010
7011
7012                 <h3 class="pg">Phone Book</h3>
7013 <strong>[Note] Telephony Emulator does not support this feature.</strong>
7014
7015 Telephony provides APIs for various phone book related features, such as getting total records in phone book, retrieving phone book entry information, reading, updating and deleting phone book information, getting first valid index.
7016
7017 @code
7018 int tel_get_sim_pb_count(TelSimPbFileType_t pb_type, int* req_id);
7019 int tel_get_sim_pb_meta_info(TelSimPbFileType_t pb_type, int* req_id);
7020 int tel_read_sim_pb_record(TelSimPbFileType_t pb_type, unsigned short index, int *req_id );
7021 int tel_update_sim_pb_record(const TelSimPbRecordData_t *req_data, int *req_id );
7022 int tel_delete_sim_pb_record(TelSimPbFileType_t pb_type, unsigned short index, int *req_id );
7023 int tel_get_sim_pb_init_info(int *init_completed, TelSimPbList_t *pb_list, int *first_index );
7024 @endcode
7025
7026 SAMPLE CODE FOR GETTING STORAGE COUNT
7027 @code
7028 #include <ITapiSim.h>
7029 #include <stdio.h>
7030 #include "TapiCommon.h"
7031
7032 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7033 void getstoragecount()
7034 {
7035         int ret_status;
7036         TelSimPbFileType_t StorageFileType = TAPI_SIM_PB_LDN;
7037         int pRequestId = 0;
7038
7039         ret_status = tel_get_sim_pb_count (StorageFileType, &pRequestId);
7040         if (ret_status == TAPI_API_SUCCESS)
7041                 printf("successful\n");
7042         else
7043                 printf("error=%d\n", ret_status);
7044 }
7045 //WAIT FOR EVENT HERE
7046
7047 //CALLBACK FUNCTION TO BE USED
7048 static void app_callback (TelTapiEvent_t *event)
7049 {
7050         int eventClass;
7051         int eventType;
7052         int requestId;
7053         int status;
7054         void* EventData = NULL;
7055
7056         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7057
7058         unsigned int temp_handle = -1;
7059         //...
7060         eventClass = event->EventClass;
7061         eventType = event->EventType;
7062         requestId = event->RequestId;
7063         status = event->Status;
7064         EventData = event->pData;
7065
7066         switch (eventType)
7067         {
7068                 case TAPI_EVENT_SIM_PB_STORAGE_COUNT_CNF:
7069                         printf("TAPI_EVENT_SIM_PB_STORAGE_COUNT_CNF");
7070                         break;
7071         }
7072 }
7073 @endcode
7074
7075 SAMPLE CODE TO GET PHONE BOOK ENTRY INFO
7076 @code
7077 #include <ITapiSim.h>
7078 #include <stdio.h>
7079 #include "TapiCommon.h"
7080
7081 //SUBSCRIBE FOR EVENTS AS MENIONED IN Event Register and Deregister
7082 void getPBEntryInfo()
7083 {
7084         int ret_status;
7085         TelSimPbFileType_t StorageFileType = TAPI_SIM_PB_FDN;
7086         int pRequestId = 0;
7087
7088         ret_status = tel_get_sim_pb_meta_info (StorageFileType, &pRequestId);
7089         if (ret _status == TAPI_API_SUCCESS)
7090                 printf(successful\n);
7091         else
7092                 printf(error=%d\n, ret_status);
7093         //WAIT FOR EVENT HERE
7094 }
7095 //CALLBACK FUNCTION TO BE USED
7096 static void app_callback (TelTapiEvent_t *event)
7097 {
7098         int eventClass;
7099         int eventType;
7100         int requestId;
7101         int status;
7102         void* EventData = NULL;
7103
7104         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event;
7105
7106         unsigned int temp_handle = -1;
7107         eventClass = event->EventClass;
7108         eventType = event->EventType;
7109         requestId = event->RequestId;
7110         status = event->Status;
7111         EventData = event->pData;
7112
7113         switch (EventType) {
7114                 case TAPI_EVENT_SIM_PB_ENTRY_INFO_CNF:
7115                         TelSimPbEntryInfo_t *entryInfo = (TelSimPbEntryInfo_t*)sim_event->pData ;
7116                         printf("SIM PB entry info event status = [%x]\n", sim_event->Status);
7117                         printf("[SIM APP]STORAGE TYPE [%d]\n", entryInfo->StorageFileType);
7118                         printf("[SIM APP]PB_INDEX_MIN %d\n", entryInfo->PbIndexMin);
7119                         printf("[SIM APP]PB_INDEX_MAX = %d\n", entryInfo->PbIndexMax);
7120                         printf("[SIM APP]PB_NUM_LEN_MAX =  %d\n", entryInfo->PbNumLenMax);
7121                         printf("[SIM APP]PB_TEXT_LEN_MAX =  %d\n", entryInfo->PbTextLenMax);
7122                         printf("********************************************\n");
7123                         break;
7124         }
7125 }
7126 @endcode
7127
7128 SAMPLE CODE FOR READING RECORD
7129 @code
7130 #include <ITapiSim.h>
7131 #include <stdio.h>
7132 #include "TapiCommon.h"
7133
7134 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7135 void simreadrecord()
7136 {
7137         int ret_status;
7138         TelSimPbFileType_t StorageFileType = TAPI_SIM_PB_FDN;
7139         unsigned short Index = 4;
7140         int pRequestId = 0;
7141
7142         ret_status = tel_read_sim_pb_record (StorageFileType,Index, &pRequestId);
7143         if (ret_status == TAPI_API_SUCCESS)
7144                 printf(successful\n);
7145         else
7146                 printf(error=%d\n, ret_status);
7147 }
7148 //WAIT FOR EVENT HERE
7149
7150 //CALLBACK FUNCTION TO BE USED
7151 static void app_callback (TelTapiEvent_t *event)
7152 {
7153         int eventClass;
7154         int eventType;
7155         int requestId;
7156         int status;
7157         void* EventData = NULL;
7158
7159         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7160
7161         unsigned int temp_handle = -1;
7162         eventClass = event->EventClass;
7163         eventType = event->EventType;
7164         requestId = event->RequestId;
7165         status = event->Status;
7166         EventData = event->pData;
7167
7168         switch (eventType) {
7169                 case TAPI TAPI_EVENT_SIM_PB_ACCESS_READ_CNF:
7170                         printf("TAPI_EVENT_SIM_PB_ACCESS_READ_CNF");
7171                         //READ DATA
7172                         break;
7173                         //
7174         }
7175 }
7176 @endcode
7177
7178 SAMPLE CODE FOR UPDATING RECORD
7179 @code
7180 #include <ITapiSim.h>
7181 #include <stdio.h>
7182 #include "TapiCommon.h"
7183
7184 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7185 void simupdaterecord()
7186 {
7187         int ret_status;
7188         TelSimPbRecordData_t pb_add;
7189         pb_add.StorageFileType = TAPI_SIM_PB_GAS;
7190         int pRequestId = 0;
7191
7192         pb_add.Index = 1;
7193
7194         ret_status = tel_update_sim_pb_record (&pb_add, &pRequestId);
7195 }
7196 //WAIT FOR EVENT HERE
7197
7198 //CALLBACK FUNCTION TO BE USED
7199 static void app_callback (TelTapiEvent_t *event)
7200 {
7201         int eventClass;
7202         int eventType;
7203         int requestId;
7204         int status;
7205         void* EventData = NULL;
7206
7207         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7208
7209         unsigned int temp_handle = -1;
7210         //
7211         eventClass = event->EventClass;
7212         eventType = event->EventType;
7213         requestId = event->RequestId;
7214         status = event->Status;
7215         EventData = event->pData;
7216
7217         switch (EventType)
7218         {
7219                 case TAPI_EVENT_SIM_PB_UPDATE_CNF:
7220                         printf("TAPI_EVENT_SIM_PB_UPDATE_CNF");
7221                         break;
7222                         //...
7223         }
7224 }
7225 @endcode
7226
7227 SAMPLE CODE FOR DELETING RECORD
7228 @code
7229 #include <ITapiSim.h>
7230 #include <stdio.h>
7231 #include "TapiCommon.h"
7232
7233 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7234 void contactdelete()
7235 {
7236         int ret_status;
7237         //DELETE RECORD
7238         TelSimPbFileType_t StorageFileType = TAPI_SIM_PB_3GSIM;
7239         unsigned short RecordIndex = 1;
7240         int pRequestId = 0;
7241
7242         ret_status = tel_delete_sim_pb_record (StorageFileType, RecordIndex, &pRequestId);
7243 }//WAIT FOR EVENT HERE
7244
7245 //CALLBACK FUNCTION TO BE USED
7246 static void app_callback (TelTapiEvent_t *event)
7247 {
7248         int eventClass;
7249         int eventType;
7250         int requestId;
7251         int status;
7252         void* EventData = NULL;
7253
7254         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7255
7256         unsigned int temp_handle = -1;
7257         //
7258         eventClass = event->EventClass;
7259         eventType = event->EventType;
7260         requestId = event->RequestId;
7261         status = event->Status;
7262         EventData = event->pData;
7263
7264         switch (EventType)
7265         {
7266                 case TAPI_EVENT_SIM_PB_DELETE_CNF:
7267                         printf(TAPI_EVENT_SIM_PB_DELETE_CNF);
7268                         //
7269                         break;
7270         }
7271 }
7272 @endcode
7273
7274 SAMPLE CODE FOR GETTING PHONEBOOK INIT INFO
7275 @code
7276 #include <ITapiSim.h>
7277 #include <stdio.h>
7278 #include "TapiCommon.h"
7279
7280 //  OPERATION REQUEST GET SIM PHONEBOOK INIT STATUS PART
7281 void get_sim_phonebook_init_status()
7282 {
7283         int valid_index = 0;
7284         TelSimPbList_t pb_list;
7285         int pPbInitCompleted = 0;
7286
7287         err_code = tel_get_sim_pb_init_info(&pPbInitCompleted, &pb_list, &valid_index);
7288         if (err_code == TAPI_API_SUCCESS)
7289         {
7290                 if (pPbInitCompleted == 0)
7291                 {
7292                         printf(" SIM PB INIT NOT completed ");
7293                 }
7294                 else
7295                 {
7296                         printf("SIM PB INIT completed");
7297                         // if no sim records at all then valid_index = 0xFF
7298                         printf ("ADN First index is [%d]",valid_index);
7299                         printf ("SIM phone book storage list Information ");
7300                         printf ("********************************************");
7301                         printf ("pb_list.b_fdn[%d]",pb_list.b_fdn);
7302                         printf ("pb_list.b_msisdn[%d]",pb_list.b_msisdn);
7303                         printf ("pb_list.b_adn[%d]",pb_list.b_adn);
7304                         printf ("pb_list.b_sdn[%d]",pb_list.b_sdn);
7305                         printf ("pb_list.b_3g[%d]",pb_list.b_3g);
7306                         printf ("pb_list.b_aas[%d]",pb_list.b_aas);
7307                         printf ("pb_list.b_gas[%d]",pb_list.b_gas);
7308                 }
7309         }
7310         else
7311         {
7312                 printf("TAPI API FAIL: Error Code [0x%x]", err_code);
7313         }
7314 }
7315 @endcode
7316 @}
7317 @defgroup Use_Cases5_24 Getting 3G Phone Book Information
7318 @ingroup Use_Cases5_NETWORK
7319 @{
7320
7321
7322                 <h3 class="pg">Getting 3G Phone Book Information</h3>
7323 <strong>[Note] Telephony Emulator does not support this feature.</strong>
7324
7325 Telephony provides APIs to retrieve SIM EFs supported by 3G phone , such as ANR, SNE, GRP, EMAIL etc and corresponding EFs max text length, number length and size.
7326
7327 @code
7328 int tel_get_sim_pb_3g_meta_info(int *req_id);
7329 @endcode
7330
7331 SAMPLE CODE:
7332 @code
7333 #include <ITapiSim.h>
7334 #include <stdio.h>
7335 #include "TapiCommon.h"
7336
7337 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7338 void get3gcapainfo()
7339 {
7340         int ret_status;
7341         int req_id = 0;
7342
7343         ret_status = tel_get_sim_pb_3g_meta_info (&req_id);
7344 }
7345 //WAIT FOR EVENT HERE
7346
7347 //CALLBACK FUNCTION TO BE USED
7348 static void app_callback (TelTapiEvent_t *event)
7349 {
7350         int eventClass;
7351         int eventType;
7352         int requestId, i;
7353         int status;
7354         void* EventData = NULL;
7355
7356         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7357
7358         unsigned int temp_handle = -1;
7359         //
7360         eventClass = event->EventClass;
7361         eventType = event->EventType;
7362         requestId = event->RequestId;
7363         status = event->Status;
7364         EventData = event->pData;
7365
7366         switch (eventType) {
7367                 case TAPI_EVENT_SIM_PB_CAPABILITY_INFO_CNF:
7368                         printf("[SIM APP]SIM PB Capability Info event status = [%x]\n", sim_event->Status);
7369                         TelSimPbCapabilityInfo_t *sim_capability_info = (TelSimPbCapabilityInfo_t*)sim_event->pData;
7370                         int i;
7371                         for (i=0; i<sim_capability_info->FileTypeCount; i++)
7372                         {
7373                                 printf(" [SIM APP]Filed tag type[%d]", sim_capability_info->FileTypeInfo[i].FileType3G);
7374                                 printf(" [SIM APP]max index [%d]\n", sim_capability_info->FileTypeInfo[i].PbIndexMax);
7375                                 printf(" [SIM APP]max text [%d]\n", sim_capability_info->FileTypeInfo[i].PbTextMax);
7376                                 printf(" [SIM APP]used count [%d]\n",  sim_capability_info->FileTypeInfo[i].TotalRecordCount);
7377                         }
7378                         break;
7379                         //...
7380         }
7381 }
7382 @endcode
7383
7384 @}
7385 @defgroup Use_Cases5_25 SAP (Sim access Profile) features
7386 @ingroup Use_Cases5_NETWORK
7387 @{
7388
7389                 <h3 class="pg">SAP (Sim access Profile) features</h3>
7390 <strong>[Note] Telephony Emulator does not support this feature.</strong>
7391
7392 The SIM Access Profile defines the protocols and procedures that shall be used to access data and services of GSM SIM card, a UICC card or a R-UIM card via a Bluetooth link.
7393
7394 The SIM Access Profile specifies the following features:
7395 - Connection Management
7396 - Transfer APDU
7397 - Transfer ATR
7398 - Power SIM off/on
7399 - Transfer Card Reader Status
7400 - Set Transport Protocol
7401
7402 <h4>Connection Management:</h4>
7403 An established SIM Access Profile connection is the prerequisite for all other features.
7404 Telephony exposes APIs to make a connection request to SIM and to get connection status information.
7405
7406 @code
7407 int tel_req_sap_connection( TelSimSapConnect_t *req_data, int *req_id);
7408 int tel_req_sap_connection_status( int *req_id);
7409 @endcode
7410
7411 SAMPLE CODE:
7412 @code
7413 #include <ITapiSim.h>
7414 #include <stdio.h>
7415 #include "TapiCommon.h"
7416 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7417 void sapconnectreq()
7418 {
7419         int ret_status;
7420         TelSimSapConnect_t pConnectionReq;
7421         int pRequestId = 0;
7422
7423         pConnectionReq.MsgId = TAPI_SIM_SAP_CONNECT_REQ;
7424         pConnectionReq.MaxMsgSize = 10; //temp for testing only - not clear
7425
7426         ret_status = tel_req_sap_connection (&pConnectionReq, &pRequestId);
7427         if (ret_status == TAPI_API_SUCCESS)
7428                 printf("successful\n");
7429         else
7430                 printf("error=%d\n", ret_status);
7431 }
7432 //WAIT FOR EVENT HERE
7433
7434 //CALLBACK FUNCTION TO BE USED
7435 static void app_callback (TelTapiEvent_t *event)
7436 {
7437         int eventClass;
7438         int eventType;
7439         int requestId;
7440         int status;
7441         void* EventData = NULL;
7442
7443         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7444
7445         unsigned int temp_handle = -1;
7446         //
7447         eventClass = event->EventClass;
7448         eventType = event->EventType;
7449         requestId = event->RequestId;
7450         status = event->Status;
7451         EventData = event->pData;
7452
7453         switch (eventType)
7454         {
7455                 case TAPI_SIM_EVENT_SAP_CONNECT_CNF:
7456                         printf("TAPI_SIM_EVENT_SAP_CONNECT_CNF");
7457                         break;
7458                         //...
7459         }
7460 }
7461
7462 //GET STATUS
7463 void sapconnectstatusreq()
7464 {
7465         int request_id = 0;
7466         int ret_status = tel_req_sap_connection_status (&request_id);
7467         if (ret_status == TAPI_API_SUCCESS)
7468                 printf("successful\n");
7469         else
7470                 printf("error=%d\n", ret_status);
7471 }
7472 //WAIT FOR EVENT HERE
7473
7474 //CALLBACK FUNCTION TO BE USED
7475
7476 static void app_callback (TelTapiEvent_t *event)
7477 {
7478         int eventClass;
7479         int eventType;
7480         int requestId;
7481         int status;
7482         void* EventData = NULL;
7483
7484         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7485
7486         unsigned int temp_handle = -1;
7487         eventClass = event->EventClass;
7488         eventType = event->EventType;
7489         requestId = event->RequestId;
7490         status = event->Status;
7491         EventData = event->pData;
7492
7493         switch (eventType)
7494         {
7495                 case TAPI_SIM_EVENT_SAP_CONNECT_STATUS_CNF:
7496                         printf("TAPI_SIM_EVENT_SAP_CONNECT_STATUS_CNF");
7497                         break;
7498                         //...
7499         }
7500 }
7501 @endcode
7502
7503 <h4>Transfer APDU:</h4>
7504 The ability to send APDUs (Application Protocol Data Units) over the Bluetooth link
7505 @n Telephony provides API to transfer APDU to sim.
7506
7507 @code
7508 int tel_req_sap_transfer_apdu(TelSimSapApduData_t *apdu_data, int *req_id);
7509 @endcode
7510
7511 SAMPLE CODE:
7512 @code
7513 #include <ITapiSim.h>
7514 #include <stdio.h>
7515 #include "TapiCommon.h"
7516
7517 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7518 void saptransferapdu()
7519 {
7520         int err_code;
7521         int file_id = TAPI_SIM_EFILE_ICCID;
7522
7523         // for selecting EF ICCID
7524         TelSimSapApduData_t apdu_data;
7525         int pRequestId = 0;
7526
7527         apdu_data.ApduLength = 7;
7528         apdu_data.Apdu[0] = 0xA0; // class
7529         apdu_data.Apdu[1] = 0xA4; // instruction
7530         apdu_data.Apdu[2] = 0; // p1 = parameter 1
7531         apdu_data.Apdu[3] = 0; // p2 = parameter 2
7532         apdu_data.Apdu[4] = 2; // p3 - parameter 3
7533
7534         memcpy(&apdu_data.Apdu[5], &file_id, sizeof(unsigned short));
7535         err_code = tel_req_sap_transfer_apdu (&apdu_data, NULL);
7536         if (err_code == TAPI_API_SUCCESS)
7537                 printf("successful\n");
7538         else
7539                 printf("error=%d\n", err_code);
7540 }
7541 //WAIT FOR EVENT HERE
7542 //CALLBACK FUNCTION TO BE USED
7543 static void app_callback (TelTapiEvent_t *event)
7544 {
7545         int eventClass;
7546         int eventType;
7547         int requestId;
7548         int status;
7549         void* EventData = NULL;
7550
7551         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7552
7553         unsigned int temp_handle = -1;
7554         //...
7555         eventClass = event->EventClass;
7556         eventType = event->EventType;
7557         requestId = event->RequestId;
7558         status = event->Status;
7559         EventData = event->pData;
7560
7561         switch (eventType)
7562         {
7563                 case TAPI_SIM_EVENT_SAP_TRANSFER_APDU_CNF:
7564                         printf("TAPI_SIM_EVENT_SAP_TRANSFER_APDU_CNF");
7565                         break;
7566         }//...
7567 }
7568 @endcode
7569
7570 <h4>Transfer ATR:</h4>
7571 The ability to send the content of the ATR (Answer to Reset) from the Server to the Client over the Bluetooth link. It contains information about the interface provided by the subscription module and the services on the GSM SIM, the UICC or the R-UIM.
7572
7573 @code
7574 int tel_req_sap_transfer_atr( int *req_id);
7575 @endcode
7576
7577 SAMPLE CODE
7578 @code
7579 #include <ITapiSim.h>
7580 #include <stdio.h>
7581 #include "TapiCommon.h"
7582
7583 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7584 void saptransferatrreq()
7585 {
7586         int ret_status;
7587         int pRequestId = 0;
7588
7589         ret_status = tel_req_sap_transfer_atr (&pRequestId);
7590         if (ret_status == TAPI_API_SUCCESS)
7591                 printf("successful\n");
7592         else
7593                 printf("error=%d\n", ret_status);
7594 }
7595 //WAIT FOR EVENT HERE
7596
7597 //CALLBACK FUNCTION TO BE USED
7598 static void app_callback (TelTapiEvent_t *event)
7599 {
7600         int eventClass;
7601         int eventType;
7602         int requestId;
7603         int status;
7604         void* EventData = NULL;
7605
7606         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7607
7608         unsigned int temp_handle = -1;
7609         //...
7610         eventClass = event->EventClass;
7611         eventType = event->EventType;
7612         requestId = event->RequestId;
7613         status = event->Status;
7614         EventData = event->pData;
7615
7616         switch (eventType)
7617         {
7618                 case TAPI_SIM_EVENT_SAP_TRANSFER_ATR_CNF:
7619                         printf("TAPI_SIM_EVENT_SAP_TRANSFER_ATR_CNF");
7620                         break;
7621                         //...
7622         }
7623 }
7624 @endcode
7625
7626 <h4>Power sim on/off:</h4>
7627 The ability to power the subscription module on/off remotely.
7628
7629 @code
7630 int tel_req_sap_power_operation(TelSimSapMsgId_t req_data, int *req_id );
7631 @endcode
7632
7633 SAMPLE CODE
7634 @code
7635 #include <ITapiSim.h>
7636 #include <stdio.h>
7637 #include "TapiCommon.h"
7638
7639 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7640 void sapsetpower()
7641 {
7642         int ret_status;
7643         TelSimSapMsgId_t MsgId = TAPI_SIM_SAP_CONNECT_REQ;
7644         int pRequestId = 0;
7645
7646         ret_status = tel_req_sap_power_operation (MsgId, &pRequestId);
7647         if (ret_status == TAPI_API_SUCCESS)
7648                 printf("successful\n");
7649         else
7650                 printf("error=%d\n", ret_status);
7651 }
7652 //WAIT FOR EVENT HERE
7653
7654 //CALLBACK FUNCTION TO BE USED
7655 static void app_callback (TelTapiEvent_t *event)
7656 {
7657         int eventClass;
7658         int eventType;
7659         int requestId;
7660         int status;
7661         void* EventData = NULL;
7662
7663         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7664
7665         unsigned int temp_handle = -1;
7666         //...
7667         eventClass = event->EventClass;
7668         eventType = event->EventType;
7669         requestId = event->RequestId;
7670         status = event->Status;
7671         EventData = event->pData;
7672
7673
7674         switch (EventType)
7675         {
7676                 case TAPI_SIM_EVENT_SAP_SET_SIM_POWER_CNF:
7677                         printf("TAPI_SIM_EVENT_SAP_SET_SIM_POWER_CNF");
7678                         break;
7679                         //...
7680         }
7681 }
7682 @endcode
7683
7684 <h4>Transfer Card Reader Status:</h4>
7685 The card reader status contains some basic information about the Card Reader and the subscription module (e.g. the size of the SIM or if the SIM is removable).
7686
7687 @code
7688 int tel_req_sap_cardreader_status(int *req_id);
7689 @endcode
7690
7691 SAMPLE CODE
7692 @code
7693 #include <ITapiSim.h>
7694 #include <stdio.h>
7695 #include "TapiCommon.h"
7696
7697 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7698 void simsapcardreaderstatus()
7699 {
7700         int ret_status;
7701         int pRequestId = 0;
7702
7703         ret_status = tel_req_sap_cardreader_status (&pRequestId);
7704         if (ret_status == TAPI_API_SUCCESS)
7705                 printf("successful\n");
7706         else
7707                 printf("error=%d\n", ret_status);
7708 }
7709 //WAIT FOR EVENT HERE
7710
7711 //CALLBACK FUNCTION TO BE USED
7712 static void app_callback (TelTapiEvent_t *event)
7713 {
7714         int eventClass;
7715         int eventType;
7716         int requestId;
7717         int status;
7718         void* EventData = NULL;
7719
7720         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7721
7722         unsigned int temp_handle = -1;
7723         //
7724         eventClass = event->EventClass;
7725         eventType = event->EventType;
7726         requestId = event->RequestId;
7727         status = event->Status;
7728         EventData = event->pData;
7729
7730
7731         switch (eventType)
7732         {
7733                 case TAPI_SIM_EVENT_SAP_CARD_READER_STATUS_CNF:
7734                         printf("TAPI_SIM_EVENT_SAP_CARD_READER_STATUS_CNF");
7735                         break;
7736                         //...
7737         }
7738 }
7739 @endcode
7740
7741 <h4>Set Transport Protocol:</h4>
7742 The server shall reset the subscription module and switch to the desired protocol if supported by subscription module and Server.
7743
7744 @code
7745 int tel_req_sap_transport_protocol(TelSimSapProtocol_t protocol, int *req_id);
7746 @endcode
7747
7748 SAMPLE CODE
7749 @code
7750 #include <ITapiSim.h>
7751 #include <stdio.h>
7752 #include "TapiCommon.h"
7753
7754 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7755 void sapsettransportprotocol()
7756 {
7757         int ret_status;
7758         TelSimSapProtocol_t Protocol = TAPI_SIM_SAP_PROTOCOL_T0;
7759         int pRequestId = 0;
7760
7761         ret_status = tel_req_sap_transport_protocol (Protocol, &pRequestId);
7762         if (ret_status == TAPI_API_SUCCESS)
7763                 printf("successful\n");
7764         else
7765                 printf("error=%d\n", ret_status);
7766 }
7767 //WAIT FOR EVENT HERE
7768
7769 //CALLBACK FUNCTION TO BE USED
7770 static void app_callback (TelTapiEvent_t *event)
7771 {
7772         int eventClass;
7773         int eventType;
7774         int requestId;
7775         int status;
7776         void* EventData = NULL;
7777
7778         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7779
7780         unsigned int temp_handle = -1;
7781         //...
7782         eventClass = event->EventClass;
7783         eventType = event->EventType;
7784         requestId = event->RequestId;
7785         status = event->Status;
7786         EventData = event->pData;
7787
7788         switch (EventType)
7789         {
7790                 case TAPI_SIM_EVENT_SAP_SET_PROTOCOL_CNF:
7791                         printf("TAPI_SIM_EVENT_SAP_SET_PROTOCOL_CNF");
7792                         break;
7793                         //...
7794         }
7795 }
7796 @endcode
7797 @}
7798 @defgroup Use_Cases5_26 ISIM Features
7799 @ingroup Use_Cases5_NETWORK
7800 @{
7801
7802
7803                 <h3 class="pg">ISIM Features</h3>
7804 <strong>[Note] Telephony Emulator does not support this feature.</strong>
7805
7806 @code
7807 int tel_req_sim_authentication( TelSimAuthenticationData_t *authentication_data, int *req_id);
7808 @endcode
7809
7810 Application uses this API to send the ISIM authentication request to telephony.
7811
7812 SAMPLE CODE
7813 @code
7814 #include <ITapiSim.h>
7815 #include <stdio.h>
7816 #include "TapiCommon.h"
7817
7818 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7819 void isimauthreq()
7820 {
7821         int ret_status;
7822         TelSimAuthenticationData_t authenticationData;
7823         authenticationData.rand_length = 100;
7824         authenticationData.rand_length = 100;
7825         authenticationData.rand_data = "test data";
7826         authenticationData.autn_data = "test data";
7827         int pRequestId = 0;
7828
7829         ret_status = tel_req_sim_authentication (&authenticationData, &pRequestId);
7830         if (ret_status == TAPI_API_SUCCESS)
7831                 printf("successful\n");
7832         else
7833                 printf("error=%d\n", ret_status);
7834 }
7835 //WAIT FOR EVENT HERE
7836
7837 //CALLBACK FUNCTION TO BE USED
7838 static void app_callback (TelTapiEvent_t *event)
7839 {
7840         int eventClass;
7841         int eventType;
7842         int requestId;
7843         int status;
7844         void* EventData = NULL;
7845
7846         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7847
7848         unsigned int temp_handle = -1;
7849         //...
7850         eventClass = event->EventClass;
7851         eventType = event->EventType;
7852         requestId = event->RequestId;
7853         status = event->Status;
7854         EventData = event->pData;
7855
7856         switch (EventType)
7857         {
7858                 case TAPI_EVENT_SIM_AUTHENTICATION_CNF:
7859                         printf("TAPI_EVENT_SIM_AUTHENTICATION_CNF");
7860                         break;
7861                         //...
7862         }
7863 }
7864 @endcode
7865 @}
7866 @defgroup Use_Cases5_27 SIM NOTIFICATION MESSAGE
7867 @ingroup Use_Cases5_NETWORK
7868 @{
7869
7870
7871                 <h3 class="pg">SIM NOTIFICATION MESSAGE </h3>
7872 These are not APIs, but EVENTs from the low layer. User can receive the following events:
7873 @code
7874 TAPI_EVENT_SIM_STATUS_IND
7875 TAPI_EVENT_SIM_FDN_STATUS_IND
7876 @endcode
7877
7878 Application uses this event as follows.
7879 SAMPLE CODE
7880 @code
7881 #include <ITapiSim.h>
7882 #include <stdio.h>
7883 #include "TapiCommon.h"
7884
7885 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
7886
7887 //CALLBACK FUNCTION TO BE USED
7888 static void app_callback (TelTapiEvent_t *event)
7889 {
7890         int eventClass;
7891         int eventType;
7892         int requestId;
7893         int status;
7894         void* EventData = NULL;
7895
7896         TelTapiEvent_t *sim_event = (TelTapiEvent_t*) event ;
7897
7898         unsigned int temp_handle = -1;
7899         //...
7900         eventClass = event->EventClass;
7901         eventType = event->EventType;
7902         requestId = event->RequestId;
7903         status = event->Status;
7904         EventData = event->pData;
7905
7906         switch (EventType)
7907         {
7908                 case TAPI_EVENT_SIM_STATUS_IND:
7909                         printf("***********TAPI_EVENT_SIM_STATUS_IND**************");
7910
7911                         if (status == TAPI_SIM_STATUS_CARD_ERROR)
7912                         {
7913                                 printf("SIM CARD ERROR");
7914                         }
7915                         else if (status == TAPI_SIM_STATUS_CARD_NOT_PRESENT)
7916                         {
7917                                 printf("SIM CARD NOT INSERTED");
7918                         }
7919                         else if (status == TAPI_SIM_STATUS_SIM_INITIALIZING)
7920                         {
7921                                 printf("SIM INITITIALIZING");
7922                         }
7923                         else if (status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED)
7924                         {
7925                                 printf("SIM INIT COMPLETED");
7926                         }
7927                         else if (status == TAPI_SIM_STATUS_SIM_PIN_REQUIRED)
7928                         {
7929                                 printf("SIM PIN REQUIRED");
7930                         }
7931                         else if (status == TAPI_SIM_STATUS_SIM_PUK_REQUIRED)
7932                         {
7933                                 printf("SIM PUK REQUIRED");
7934                         }
7935                         else if (status == TAPI_SIM_STATUS_CARD_BLOCKED)
7936                         {
7937                                 printf("SIM CARD BLOCKED");
7938                         }
7939                         printf("********************************************");
7940                         break;
7941
7942                 case TAPI_EVENT_SIM_FDN_STATUS_IND:
7943                         printf("*********TAPI_EVENT_SIM_FDN_STATUS_IND***********");
7944                         printf("SIM FDN status event status = [0x%x]", status);
7945                         printf("********************************************");
7946                         break;
7947                         //...
7948         }
7949 }
7950 @endcode
7951 @}
7952
7953         <h2 class="pg">SOUND</h2>
7954 <strong>[Note] Telephony Emulator does not support this feature.</strong>
7955 These APIs provide the interface for configuring sound related parameters.
7956
7957 @defgroup Use_Cases6_1 Event Register and Deregister
7958 @ingroup Use_Cases6_SOUND
7959 @{
7960
7961
7962                 <h3 class="pg">Event Register and Deregister </h3>
7963 To receive asynchronous event notifications for the Sound APIs, the registration of related events with their associated call backs is required. When an asynchronous API is called, the confirmation is returned as an asynchronous event notification which invokes the callback function along with the event data.
7964
7965 SAMPLE CODE:
7966 @code
7967 // REGISTER EVENT
7968 unsigned int subscription_id = 0;
7969 int api_err;
7970
7971 api_err = tel_init ();
7972 if (api_err != TAPI_API_SUCCESS)
7973 {
7974         TEST_DEBUG("tel_init Failed - api_err = %d \n", api_err);
7975 }
7976
7977 api_err = tel_register_event (TAPI_EVENT_SOUND_VOLUMECTRL_CNF, &subscription_id, (TelAppCallback)&app_callback);
7978 printf("VSOUND Event registration is Done: sub id is %d, api_err is %d\n",subscription_id,api_err);
7979
7980 tel_register_app_name("com.samsung.appname");
7981
7982 // DEREGISTER EVENT
7983 api_err = tel_deregister_event (subscription_id);
7984 if (api_err != TAPI_API_SUCCESS)
7985 {
7986         printf("Event Class Deregestration Fail\n");
7987 }
7988 @endcode
7989
7990 The main features provided by the Sound APIs include setting the volume,voice path and user configuration such as minute alert,Service change,Connet tone, Disconnect Tone...etc.
7991 @}
7992 @defgroup Use_Cases6_2 Voice path control
7993 @ingroup Use_Cases6_SOUND
7994 @{
7995
7996
7997                 <h3 class="pg">Voice path control</h3>
7998 This API provides an interface for controlling voice path via application.
7999
8000 @code
8001 int tel_set_sound_path (tapi_sound_audio_path_t  vc_path, int *pRequestId);
8002 @endcode
8003
8004 <strong>This API is permitted for Samsung in-house applications only</strong>
8005 @}
8006 @defgroup Use_Cases6_3 Volume control
8007 @ingroup Use_Cases6_SOUND
8008 @{
8009
8010
8011                 <h3 class="pg">Volume control</h3>
8012 These APIs provide interfaces for controlling volume via application.
8013
8014 @code
8015 int     tel_set_sound_volume_info (tapi_sound_volume_control_t vol_control, int *pRequestId);
8016 int     tel_get_sound_volume_info (tapi_sound_volume_type_t vol_control, int *pRequestId);
8017 @endcode
8018
8019 <strong>This API is permitted for Samsung in-house applications only</strong>
8020 @}
8021 @defgroup Use_Cases6_4 Mic mute control
8022 @ingroup Use_Cases6_SOUND
8023 @{
8024
8025
8026                 <h3 class="pg">Mic mute control</h3>
8027 This API provides an interface for mute/unmute mic via application.
8028
8029 @code
8030 int  tel_set_sound_mute_status(tapi_sound_mic_mute_t micmute_set, int * pRequestId);
8031 @endcode
8032
8033 <strong>This API is permitted for Samsung in-house applications only</strong>
8034
8035 SAMPLE CODE
8036 @code
8037 #include <stdio.h>
8038 #include <TapiCommon.h>
8039 #include <ITapiSound.h>
8040
8041 //SUBSCRIBE FOR EVENTS AS MENTIONED IN Event Register and Deregister
8042
8043 //VOLUME CONTROL
8044 void vol_controlset()
8045 {
8046         int ret_val;
8047         int requestId = -1;
8048         tapi_sound_volume_control_t vol_control;
8049
8050         vol_control.volume = TAPI_SOUND_VOLUME_LEVEL_3;
8051         vol_control.vol_type = TAPI_SOUND_VOL_VOICE;
8052
8053         ret_val = tel_set_sound_volume_info(vol_control, &requestId);
8054         if (ret_val == TAPI_API_SUCCESS)
8055                 printf("successful\n");
8056         else
8057                 printf("error=%d\n", ret_val);
8058         //WAIT FOR EVENT HERE
8059 }
8060 void vol_controlget()
8061 {
8062         int ret_val;
8063         int requestId = -1;
8064         api_sound_volume_type_t vol_type;
8065         vol_type = TAPI_SOUND_VOL_VOICE;
8066
8067         ret_val = tel_get_sound_volume_info (vol_type, &requestId);
8068         if (ret_val == TAPI_API_SUCCESS)
8069                 printf("successful\n");
8070         else
8071                 printf("error=%d\n", ret_val);
8072         //WAIT FOR EVENT HERE
8073 }
8074
8075 //VOICE PATH AND USER CONFIGURATION
8076 void voicepathset()
8077 {
8078         int ret_val;
8079         int requestId = -1;
8080
8081         tapi_sound_audio_path_t vc_path;
8082         //VOICE PATH
8083         vc_path = TAPI_SOUND_HANDSET;
8084
8085         ret_val = tel_set_sound_path (vc_path, &requestId);
8086         if (ret_val == TAPI_API_SUCCESS)
8087                 printf("successful\n");
8088         else
8089                 printf("error=%d\n", ret_status);
8090         //WAIT FOR EVENT HERE
8091 }
8092
8093
8094 //USER CONFIGURATION
8095 void usr_configset()
8096 {
8097         int ret_val;
8098         Int requestId = -1;
8099         tapi_sound_user_sound_mask_t snd_mask;
8100         tapi_sound_user_sound_value_t snd_value;
8101
8102         snd_mask = TAPI_SOUND_USER_MASK_ONE_MIN_ALERT;
8103         snd_value = TAPI_SOUND_ON;
8104         printf("tapi_sound_usr_configuration_set\n");
8105         ret_val = tapi_sound_usr_configuration_set(snd_mask,snd_value, &requestId);
8106         if (ret_val == TAPI_API_SUCCESS)
8107                 printf("successful\n");
8108         else
8109                 printf("error=%d\n", ret_status);
8110         //WAIT FOR EVENT HERE
8111 }
8112
8113 void usr_configget()
8114 {
8115         int ret_val;
8116         tapi_sound_user_sound_mask_t snd_mask;
8117
8118         snd_mask = TAPI_SOUND_USER_MASK_SERVICE_CHANGE_ALERT;
8119         printf("tel_get_sound_mute_status \n");
8120         ret_val = tel_get_sound_mute_status(snd_mask, &requestId);
8121         if (ret_val == TAPI_API_SUCCESS)
8122                 printf("successful\n");
8123         else
8124                 printf("error=%d\n", ret_status);
8125         //WAIT FOR EVENT HERE
8126 }
8127
8128 //MIC MUTE CONT\ROL
8129 void micmute_controlset()
8130 {
8131         int ret_val;
8132         tapi_sound_mic_mute_t set_micmute;
8133
8134         set_micmute = TAPI_SOUND_MIC_MUTE;
8135
8136         printf(" tel_set_sound_mute_status \n");
8137         ret_val = tel_set_sound_mute_status (set_micmute, &requestId);
8138         if (ret_val == TAPI_API_SUCCESS)
8139                 printf("successful\n");
8140         else
8141                 printf("error=%d\n", ret_status);
8142         //WAIT FOR EVENT HERE
8143 }
8144
8145
8146 //CALL BACK TO BE USED
8147 static void app_callback (TelTapiEvent_t *event)
8148 {
8149         int eventClass;
8150         int eventType;
8151         int requestId;
8152         int status;
8153         void* EventData = NULL;
8154
8155         unsigned int temp_handle = -1;
8156         //
8157         eventClass = event->EventClass;
8158         eventType = event->EventType;
8159         requestId = event->RequestId;
8160         status = event->Status;
8161         EventData = event->pData;
8162
8163         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d]\n", eventClass, eventType , requestId, status );
8164
8165         if (status != 0)
8166         {
8167                 //TEST_DEBUG("******This is nonzero status. ******\n");
8168                 return;
8169         }
8170
8171
8172         switch (eventClass)
8173         {
8174                 case TAPI_EVENT_CLASS_SOUND:
8175                         switch (eventType)
8176                         {
8177                                 case TAPI_EVENT_SOUND_VOLUMECTRL_RSP :
8178                                         printf("***  TAPI_EVENT_SOUND_VOLUMECTRL_RSP received : %x ****\n", eventType);
8179                                         tapi_sound_volumn_ctrl_res vlm_ctrl_info;
8180                                         int index;
8181
8182                                         memcpy(&vlm_ctrl_info, event->pData,
8183                                                         sizeof(tapi_sound_volumn_ctrl_res));
8184                                         break;
8185
8186                                 case TAPI_EVENT_SOUND_AUDIOPATHCTRL_NOTI:
8187                                         tapi_sound_audio_path_t AudioPath = 0;
8188                                         int OldSndOutPath = MM_SOUND_PATH_NONE;
8189                                         AudioPath = *((tapi_sound_audio_path_t *)(event->pData));
8190                                         printf("***  TAPI_EVENT_SOUND_AUDIOPATHCTRL_NOTI received : %x ****\n", eventType);
8191                                         break;
8192
8193                                 case TAPI_EVENT_SOUND_AUDIOSOURCECTRL_NOTI:
8194                                         tapi_sound_audio_source_type_t *pAudioSrcCtrl = NULL;
8195                                         pAudioSrcCtrl = (tapi_sound_audio_source_type_t*)(event->pData);
8196                                         printf("***  TAPI_EVENT_SOUND_AUDIOSOURCECTRL_NOTI received : %x ****\n", eventType);
8197                                         break;
8198
8199                                 case TAPI_EVENT_SOUND_ERROR_IND:
8200                                         tapi_phone_err_t errorCause;
8201                                         errorCause = *(( tapi_phone_err_t *)(event->pData));
8202                                         printf("***  TAPI_EVENT_SOUND_ERROR_IND received : %x ****\n", eventType);
8203                                         break;
8204
8205                                 case TAPI_EVENT_SOUND_MICMUTECTRL_RSP:
8206                                         tapi_sound_mic_mute_t *mute_status = NULL;
8207                                         mute_status = (tapi_sound_audio_source_type_t*)(event->pData);
8208
8209                                         printf("***  TAPI_EVENT_SOUND_MICMUTECTRL_RSP received : %x ****\n", eventType);
8210                                         break;
8211
8212                                 default:
8213                                         printf("***  Default Event  %x ****\n", eventType);
8214                                         break;
8215                         }
8216                         //...
8217                         break;
8218
8219                 default:
8220                         printf("*** Other TAPI EVENT received : class : %x ****\n", eventClass);
8221                         break;
8222         }
8223 }
8224 @endcode
8225 @}
8226
8227
8228         <h2 class="pg">SAT (SIM Application Toolkit)</h2>
8229 @defgroup Use_Cases7_1 Event register and deregister
8230 @ingroup Use_Cases7_SAT
8231 @{
8232
8233                 <h3 class="pg">Event register and deregister</h3>
8234 To receive asynchronous event notifications for SAT APIs, the registration of related events with their associated call backs is required. When an asynchronous API is called, the confirmation is returned as an asynchronous event notification which invokes the callback function along with the event data.
8235
8236 SAMPLE CODE
8237 @code
8238 // REGISTER EVENT
8239 unsigned int subscription_id = 0;
8240 int api_err;
8241
8242 api_err = tel_init();
8243 if (api_err != TAPI_API_SUCCESS)
8244 {
8245         TEST_DEBUG("tel_init Failed - api_err = %d \n", api_err);
8246 }
8247
8248 api_err = tel_register_event(TAPI_EVENT_SAT_MENU_SELECTION_CNF, &subscription_id, (TelAppCallback)&app_callback);
8249 printf("SAT Event registration is Done: sub id is %d, api_err is %d\n",subscription_id,api_err);
8250
8251 tel_register_app_name("com.samsung.appname");
8252
8253 // DEREGISTER EVENT
8254 api_err = tel_deregister_event(subscription_id);
8255 if (api_err != TAPI_API_SUCCESS)
8256 {
8257         printf("Event Class Unregeration Fail\n");
8258 }
8259
8260 api_err = tel_deinit();
8261 if (api_err != TAPI_API_SUCCESS)
8262 {
8263         printf("tel_deinit Fail\n");
8264 }
8265
8266 static void app_callback(TelTapiEvent_t *event)
8267 {
8268         //CALL BACK FUNTION TO BE CALLED
8269         switch (event->EventType)
8270         {
8271                 case TAPI_EVENT_SAT_DISPLAY_TEXT_IND:
8272                         TelSatDisplayTextInd_t *event_data;
8273                         event_data = (TelSatDisplayTextInd_t*)event->pData;
8274                         break;
8275                 case TAPI_EVENT_SAT_GET_INKEY_IND:
8276                         TelSatGetInkeyIndInfo_t *event_data;
8277                         event_data = (TelSatGetInkeyIndInfo_t *)event->pData;
8278                         break;
8279                 case TAPI_EVENT_SAT_GET_INPUT_IND:
8280                         TelSatGetInputInd_t *event_data;
8281                         event_data = (TelSatGetInputInd_t *)event->pData;
8282                         break;
8283
8284                 case TAPI_EVENT_SAT_UI_PLAY_TONE_IND:
8285                         TelSatPlayToneInd_t *event_data;
8286                         event_data = (TelSatPlayToneInd_t *)event->pData;
8287                         break;
8288
8289                 case TAPI_EVENT_SAT_PLAY_TONE_IND:
8290                         TelSatPlayToneInd_t *event_data;
8291                         event_data = (TelSatPlayToneInd_t *)event->pData;
8292                         break;
8293
8294                 case TAPI_EVENT_SAT_UI_REFRESH_IND:
8295                         TelSatRefreshIndUiInfo_t *event_data;
8296                         event_data = (TelSatRefreshIndUiInfo_t *)event->pData;
8297                         break;
8298
8299                 case TAPI_EVENT_SAT_SETUP_MENU_IND:
8300                         TelSatSetupMenuInfo_t *event_data;
8301                         event_data = (TelSatSetupMenuInfo_t *)event->pData;
8302                         break;
8303
8304                 case TAPI_EVENT_SAT_UI_SETUP_MENU_IND:
8305                         TelSatSetupMenuInfo_t *event_data;
8306                         event_data = (TelSatSetupMenuInfo_t *)event->pData;
8307                         break;
8308
8309                 case TAPI_EVENT_SAT_SELECT_ITEM_IND:
8310                         TelSatSelectItemInd_t *event_data;
8311                         event_data = (TelSatSelectItemInd_t *)event->pData;
8312                         break;
8313
8314                 case TAPI_EVENT_SAT_UI_SEND_SMS_IND:
8315                         TelSatSendSmsIndUiInfo_t *event_data;
8316                         event_data = (TelSatSendSmsIndUiInfo_t *)event->pData;
8317                         break;
8318
8319                 case TAPI_EVENT_SAT_UI_SEND_SS_IND:
8320                         TelSatSendSsIndUiInfo_t *event_data;
8321                         event_data = (TelSatSendSsIndUiInfo_t *)event->pData;
8322                         break;
8323
8324                 case TAPI_EVENT_SAT_UI_SEND_USSD_IND:
8325                         TelSatSendUssdIndUiInfo_t *event_data;
8326                         event_data = (TelSatSendUssdIndUiInfo_t *)event->pData;
8327                         break;
8328
8329                 case TAPI_EVENT_SAT_UI_SETUP_CALL_IND:
8330                         TelSatSetupCallIndUiInfo_t *event_data;
8331                         event_data = (TelSatSetupCallIndUiInfo_t *)event->pData;
8332                         break;
8333
8334                 case TAPI_EVENT_SAT_PROVIDE_LOCAL_INFO_IND:
8335                         TelSatProvideLocalInfoInd_t *event_data;
8336                         event_data = (TelSatProvideLocalInfoInd_t *)event->pData;
8337                         break;
8338
8339                 case TAPI_EVENT_SAT_SETUP_IDLE_MODE_TEXT_IND:
8340                         TelSatSetupIdleModeTextInd_t *event_data;
8341                         event_data = (TelSatSetupIdleModeTextInd_t *)event->pData;
8342                         break;
8343
8344                 case TAPI_EVENT_SAT_UI_SEND_DTMF_IND:
8345                         TelSatSendDtmfIndUiInfo_t *event_data;
8346                         event_data = (TelSatSendDtmfIndUiInfo_t *)event->pData;
8347                         break;
8348
8349                 case TAPI_EVENT_SAT_LANGUAGE_NOTIFICATION_IND:
8350                         TelSatLanguageNotiInfoInd_t *event_data;
8351                         event_data = (TelSatLanguageNotiInfoInd_t *)event->pData;
8352                         break;
8353
8354                 case TAPI_EVENT_SAT_UI_LAUNCH_BROWSER_IND:
8355                         TelSatLaunchBrowserIndUiInfo_t *event_data;
8356                         event_data = (TelSatLaunchBrowserIndUiInfo_t *)event->pData;
8357                         break;
8358
8359                 case TAPI_EVENT_SAT_END_PROACTIVE_SESSION_IND:
8360                         TelSatEndProactiveSessionIndInfo_t *event_data;
8361                         event_data = (TelSatEndProactiveSessionIndInfo_t *)event->pData;
8362                         break;
8363
8364                 case TAPI_EVENT_SAT_MENU_SELECTION_CNF:
8365                         TelSatEnvelopeResp_t *event_data;
8366                         event_data = (TelSatEnvelopeResp_t *)event->pData;
8367                         break;
8368
8369                 case TAPI_EVENT_SAT_CALL_CONTROL_IND:
8370                         TelSatCallCtrlIndData_t *event_data;
8371                         event_data = (TelSatCallCtrlIndData_t *)event->pData;
8372                         break;
8373
8374                 case TAPI_EVENT_SAT_MO_SMS_CONTROL_IND:
8375                         TelSatMoSmCtrlIndData_t *event_data;
8376                         event_data = (TelSatMoSmCtrlIndData_t *)event->pData;
8377                         break;
8378
8379                 case TAPI_EVENT_SAT_EVENT_DOWNLOAD_CNF:
8380                         TelSatEnvelopeResp_t *event_data;
8381                         event_data = (TelSatEnvelopeResp_t *)event->pData;
8382                         break;
8383
8384                 case TAPI_EVENT_SAT_SMS_REFRESH_IND:
8385                 case TAPI_EVENT_SAT_PB_REFRESH_IND:
8386                 case TAPI_EVENT_SAT_IDLE_REFRESH_IND:
8387                         TelSatRefreshInd_t *event_data;
8388                         event_data = (TelSatRefreshInd_t *)event->pData;
8389                         break;
8390
8391                 case TAPI_EVENT_SAT_SEND_SMS_IND:
8392                         TelSatSendSmsIndSmsData_t *event_data;
8393                         event_data = (TelSatSendSmsIndSmsData_t *)event->pData;
8394                         break;
8395
8396                 case TAPI_EVENT_SAT_SETUP_CALL_IND:
8397                         TelSatSetupCallIndCallData_t *event_data;
8398                         event_data = (TelSatSetupCallIndCallData_t *)event->pData;
8399                         break;
8400
8401                 case TAPI_EVENT_SAT_SEND_SS_IND:
8402                         TelSatSendSsIndSsData_t *event_data;
8403                         event_data = (TelSatSendSsIndSsData_t *)event->pData;
8404                         break;
8405
8406                 case TAPI_EVENT_SAT_SEND_USSD_IND:
8407                         TelSatSendUssdIndUssdData_t *event_data;
8408                         event_data = (TelSatSendUssdIndUssdData_t *)event->pData;
8409                         break;
8410
8411                 case TAPI_EVENT_SAT_SEND_DTMF_IND:
8412                         TelSatSendDtmfIndDtmfData_t *event_data;
8413                         event_data = (TelSatSendDtmfIndDtmfData_t *)event->pData;
8414                         break;
8415
8416                 case TAPI_EVENT_SAT_LAUNCH_BROWSER_IND:
8417                         TelSatLaunchBrowserIndBrowserData_t *event_data;
8418                         event_data = (TelSatLaunchBrowserIndBrowserData_t *)event->pData;
8419                         break;
8420
8421                 case TAPI_EVENT_SAT_END_OF_APP_EXEC_IND:
8422                         TelSatProactiveCmdEndIndInfo_t *event_data;
8423                         event_data = (TelSatProactiveCmdEndIndInfo_t *)event->pData;
8424                         break;
8425
8426                 default:
8427                         break;
8428         }
8429 }
8430 @endcode
8431 @}
8432 @defgroup Use_Cases7_2 Main Menu Information
8433 @ingroup Use_Cases7_SAT
8434 @{
8435
8436
8437                 <h3 class="pg">Main Menu Information</h3>
8438 <strong>[Note] Telephony Emulator does not support this feature.</strong>
8439
8440 Telephony provides APIs for retreiving SAT Main Menu Information.
8441
8442 <strong>This API is permitted for Samsung in-house applications only</strong>
8443
8444 @code
8445 int tel_get_sat_main_menu_info(TelSatSetupMenuInfo_t* pMainMenu)
8446 @endcode
8447
8448 SAMPLE CODE:
8449 @code
8450 //SAT MAIN MENU INFORMATION
8451 #include <stdio.h>
8452 #include <TapiCommon.h>
8453 #include <ITapiSat.h>
8454
8455 void mainmenuinformation()
8456 {
8457         int i = 0;
8458         int ReturnStatus;
8459         TelSatSetupMenuInfo_t SatMainMenuInfo;
8460
8461         ReturnStatus = tel_get_sat_main_menu_info(&SatMainMenuInfo);
8462         if (ReturnStatus == TAPI_API_SUCCESS)
8463         {
8464                 printf(" SAT Main Menu Information \n");
8465                 printf("Main Menu Title  :%s\n", satMainMenuInfo.satMainTitle);
8466                 printf("Number of SAT Menu Items :%d\n", satMainMenuNum);
8467                 printf("Sat Menu Items are:\n");
8468                 for (i=0; i<SatMainMenuInfo.satMainMenuNum; i++)
8469                         printf(" %s \n", SatMainMenuInfo.satMainMenuItem[i]);
8470         }
8471         else
8472                 printf("ReturnStatus =%d\n", ReturnStatus);
8473 }
8474 @endcode
8475 @}
8476 @defgroup Use_Cases7_3 Envelope Commands
8477 @ingroup Use_Cases7_SAT
8478 @{
8479
8480
8481                 <h3 class="pg">Envelope Commands</h3>
8482 <strong>[Note] Telephony Emulator does not support this feature.</strong>
8483
8484 This API sends a USIM application toolkit command to the USIM, using the envelope mechanism of USIM application toolkit. (See GSM TS 31.111)
8485
8486 <strong>These APIs are permitted for Samsung in-house applications only</strong>
8487
8488 @code
8489 int tel_select_sat_menu(TelSatMenuSelectionReqInfo_t* pMenuSelect, int* pRequestId);
8490 int tel_download_sat_event(TelSatEventDownloadReqInfo_t*  pEventData, int* pRequestId);
8491 @endcode
8492
8493 SAMPLE CODE:
8494 @code
8495 //MENU SELECTION ENVELOPE
8496 #include <stdio.h>
8497 #include <TapiCommon.h>
8498 #include <ITapiSat.h>
8499
8500 //Precondition
8501 //SUBSCRIBE TO SAT EVENT(TAPI_EVENT_SAT_MENU_SELECTION_CNF) AS MENTIONED IN //Event Register and Deregister
8502
8503 void satmenuselectionenvelope()
8504 {
8505         int RequestId = -1;
8506         int ReturnStatus;
8507         TelSatMenuSelectionReqInfo_t SatMenuSelect;
8508
8509         SatMenuSelect.itemIdentifier = 1;
8510         SatMenuSelect.bIsHelpRequested = FALSE;
8511
8512         ReturnStatus = tel_select_sat_menu(&SatMenuSelect, &RequestId);
8513         if (ReturnStatus != TAPI_API_SUCCESS)
8514         {
8515                 printf("ReturnStatus =%d\n", ReturnStatus);
8516         }
8517         else
8518         {
8519                 //WAIT FOR TAPI_EVENT_SAT_MENU_SELECTION_CNF EVENT HERE
8520         }
8521 }
8522
8523 //CALLBACK FUNCTION TO BE USED
8524 static void SatAppCallback (TelTapiEvent_t *event)
8525 {
8526         int EventClass = event->EventClass;
8527         int EventType = event->EventType;
8528         int RequestId = event->RequestId;
8529         void* EventData = event->pData;
8530         int Status = event->Status;
8531
8532         if (EventType == TAPI_EVENT_SAT_MENU_SELECTION_CNF)
8533         {
8534                 printf(" TAPI_EVENT_SAT_MENU_SELECTION_CNF Event Received \n");
8535         }
8536 }
8537 @endcode
8538
8539 @code
8540 //EVENT DOWNLOAD ENVELOPE
8541 #include <stdio.h>
8542 #include <TapiCommon.h>
8543 #include <ITapiSat.h>
8544
8545
8546 //Precondition
8547 //SUBSCRIBE TO SAT EVENT(TAPI_EVENT_SAT_EVENT_DOWNLOAD_CNF) AS MENTIONED IN //Event Register and Deregister
8548 void eventdownloadenvelope()
8549 {
8550         int RequestId = -1;
8551         int ReturnStatus;
8552         TelSatEventDownloadReqInfo_t SatEventData;
8553
8554         SatEventData.eventDownloadType = TAPI_EVENT_SAT_DW_TYPE_IDLE_SCREEN_AVAILABLE;
8555
8556         SatEventData.u.bIdleScreenAvailable = TRUE;
8557
8558         ReturnStatus = tel_download_sat_event(&SatEventData, &RequestId);
8559         if (ReturnStatus != TAPI_API_SUCCESS)
8560         {
8561                 printf("ReturnStatus =%d\n", ReturnStatus);
8562         }
8563         else
8564         {
8565                 //WAIT FOR TAPI_EVENT_SAT_EVENT_DOWNLOAD_CNF EVENT HERE
8566         }
8567 }
8568
8569 //CALLBACK FUNCTION TO BE USED
8570 static void  SatAppCallback  (TelTapiEvent_t *event)
8571 {
8572         int EventClass = event->EventClass;
8573         int EventType = event->EventType;
8574         int RequestId = event->RequestId;
8575         void* EventData = event->pData;
8576         int Status = event->Status;
8577
8578         if (EventType == TAPI_EVENT_SAT_EVENT_DOWNLOAD_CNF)
8579         {
8580                 printf("TAPI_EVENT_SAT_EVENT_DOWNLOAD_CNF Event Received \n");
8581                 //Extract Event Data here
8582         }
8583 }
8584 @endcode
8585 @}
8586 @defgroup Use_Cases7_4 Application Execution result
8587 @ingroup Use_Cases7_SAT
8588 @{
8589
8590
8591                 <h3 class="pg">Application Execution result</h3>
8592 <strong>[Note] Telephony Emulator does not support this feature.</strong>
8593
8594 Telephony provides this API to get the Application execution result.
8595
8596 <strong>This API is permitted for Samsung in-house applications only</strong>
8597
8598 @code
8599 Int tel_send_sat_app_exec_result(TelSatAppsRetInfo_t* pAppRetInfo);
8600 @endcode
8601
8602 SAMPLE CODE:
8603 @code
8604 //SAT MAIN MENU TITLE
8605 #include <stdio.h>
8606 #include <TapiCommon.h>
8607 #include <ITapiSat.h>
8608
8609 void sendappexecutionresult()
8610 {
8611         int ReturnStatus;
8612         TelSatAppsRetInfo_t SatAppRetInfo;
8613
8614         SatAppRetInfo.commandType = TAPI_SAT_CMD_TYPE_SETUP_IDLE_MODE_TEXT;
8615         SatAppRetInfo.appsRet.setupIdleModeText.resp = TAPI_SAT_R_SUCCESS;
8616
8617         ReturnStatus = tel_send_sat_app_exec_result(&SatAppRetInfo);
8618         if (ReturnStatus == TAPI_API_SUCCESS)
8619         {
8620                 printf(" Sending Application Execution Result Successful \n");
8621         }
8622         else
8623                 printf("ReturnStatus =%d\n", ReturnStatus);
8624 }
8625 @endcode
8626 @}
8627 @defgroup Use_Cases7_5  UI /User Confirmation
8628 @ingroup Use_Cases7_SAT
8629 @{
8630
8631
8632                 <h3 class="pg">UI /User Confirmation </h3>
8633 <strong>[Note] Telephony Emulator does not support this feature.</strong>
8634
8635 Send user’s confirmation message to the USIM application
8636
8637 <strong>These APIs are permitted for Samsung in-house applications only</strong>
8638
8639 @code
8640 int tel_send_sat_ui_display_status(int commandId, TelSatUiDisplayStatusType_t status);
8641 int tel_send_sat_ui_user_confirm(TelSatUiUserConfirmInfo_t * pUserConfirmData) ;
8642 @endcode
8643
8644 SAMPLE CODE:
8645 @code
8646 //UI DISPLAY STATUS
8647 #include <stdio.h>
8648 #include <TapiCommon.h>
8649 #include <ITapiSat.h>
8650
8651 void senduidisplaystatus()
8652 {
8653         int ReturnStatus;
8654         TelSatUiDisplayStatusType_t DisplatStatus;
8655         int CommandId;
8656
8657         DisplatStatus = TAPI_SAT_DISPLAY_SUCCESS;
8658         CommandId = commandId; //Command Id of the Proactive Command
8659
8660         ReturnStatus = tel_send_ui_display_status(CommandId, DisplayStatus);
8661         if (ReturnStatus == TAPI_API_SUCCESS)
8662                 printf(" Sending UI Display Status Successful \n");
8663         else
8664                 printf("ReturnStatus =%d\n", ReturnStatus);
8665 }
8666 @endcode
8667
8668 @code
8669 //USER CONFIRMATION
8670 #include <stdio.h>
8671 #include <TapiCommon.h>
8672 #include <ITapiSat.h>
8673
8674 void senduiuserconfirm()
8675 {
8676         int ReturnStatus;
8677         TelSatUiUserConfirmInfo_t UserConfirmData;
8678
8679         UserConfirmData.commandId = commandId ; //Command Id of the Proactive Command
8680
8681         UserConfirmData.commandType = TAPI_SAT_CMD_TYPE_PLAY_TONE;
8682         UserConfirmData.keyType = TAPI_SAT_USER_CONFIRM_YES;
8683
8684         UserConfirmData.pAdditionalData = NULL;
8685         UserConfirmData.dataLen = 0;
8686
8687         ReturnStatus = tel_send_sat_ui_user_confirm(&UserConfirmData);
8688         if (ReturnStatus == TAPI_API_SUCCESS)
8689                 printf(" Sending User Confirmation Data Successful \n");
8690         else
8691                 printf("ReturnStatus =%d\n", ReturnStatus);
8692 }
8693 @endcode
8694 @}
8695
8696
8697         <h2 class="pg">GPRS</h2>
8698 @defgroup Use_Cases8_1 Event Register and Deregister
8699 @ingroup Use_Cases8_GPRS
8700 @{
8701
8702                 <h3 class="pg">Event Register and Deregister</h3>
8703 To receive asynchronous event notifications for GPRS APIs, the registration of related events with their associated call backs is required. When an asynchronous API is called, the confirmation is returned as an asynchronous event notification which invokes the callback function along with the event data.
8704
8705 SAMPLE CODE:
8706 @code
8707 // REGISTER EVENT
8708 unsigned int subscription_id = 0;
8709 int api_err;
8710
8711 api_err = tel_init();
8712 if (api_err != 0)
8713 {
8714       printf ("tel_init Failed - api_err = %d \n", api_err);
8715 }
8716
8717 api_err = tel_register_event(TAPI_EVENT_PS_PDP_ACT_RSP, &subscription_id , (TelAppCallback)&app_callback);
8718 printf("Power Event registeration is Done: sub id is %d, api_err is %d\n", subscription_id, api_err);
8719
8720 tel_register_app_name("com.samsung.appname");
8721
8722 void app_callback(TelTapiEvent_t *event)
8723 {
8724         //callback function to be called
8725 }
8726 @endcode
8727 @}
8728 @defgroup Use_Cases8_2 Pdp Activation
8729 @ingroup Use_Cases8_GPRS
8730 @{
8731
8732
8733                 <h3 class="pg">Pdp Activation</h3>
8734 This API is used to start a GPRS session successfully.
8735
8736 @code
8737 int tel_activate_gprs_pdp (const tapi_ps_net_start_req_t *pNet_start_req_info,int * pRequestID);
8738 @endcode
8739
8740 <strong>This API is restricted for direct use. Use the Data Network API instead.</strong>
8741
8742 SAMPLE CODE
8743 @code
8744 #include<stdio.h>
8745 #include <TapiCommon.h>
8746 #include <ITapiPS.h>
8747
8748 int ret_status;
8749 tapi_ps_net_start_req_t start_req;
8750 int request_id = 0;
8751
8752 #define CONTEXT_ID 1
8753 #define APN_ADDRESS "nate.sktelecom.com"
8754
8755 void gprsstart()
8756 {
8757         int ret_status;
8758         tapi_ps_net_start_req_t start_req;
8759         int request_id = 0;
8760
8761         start_req.cont_id = CONTEXT_ID;
8762         strcpy(start_req.pdp_info.apn , APN_ADDRESS);
8763
8764         ret_status = tel_activate_gprs_pdp (&start_req, &request_id);
8765         if (ret_status == TAPI_API_SUCCESS)
8766         {
8767                 printf("/n/  gprs mode Started successfully \\n");
8768         }
8769         else
8770         {
8771                 printf("/n/ gprs mode not started \\n");
8772         }
8773 }
8774 //WAIT FOR EVENT HERE
8775
8776 //CALLBACK FUNCTION TO BE USED
8777 void  ps_app_callback  (TelTapiEvent_t *event)
8778 {
8779         int eventClass;
8780         int eventType;
8781         int requestId;
8782         int status;
8783         void *EventData = NULL;
8784
8785         eventClass = event->EventClass;
8786         eventType = event->EventType;
8787         requestId = event->RequestId;
8788         status = event->Status;
8789         EventData = event->pData;
8790         printf(" app _callback is called \n");
8791
8792         switch (eventClass)
8793         {
8794                 case TAPI_EVENT_CLASS_DATA:
8795                         switch (eventType)
8796                         {
8797                                 case TAPI_EVENT_PS_PDP_ACT_RSP:
8798                                         tapi_ps_net_activation_rsp_t  pdp_ip_resp;
8799                                         memcpy(&pdp_ip_resp, psEvent->pData, sizeof(tapi_ps_net_activation_rsp_t));
8800                                         printf("TAPI_EVENT_PS_PDP_ACT_RSP\n");
8801                                         break;
8802
8803                                 case TAPI_EVENT_PS_PDP_ACT_IPCONFIG_INFO:
8804                                         tapi_ps_net_start_rsp_t  pdp_ip_resp;
8805                                         memcpy(&pdp_ip_resp, psEvent->pData, sizeof(tapi_ps_net_start_rsp_t));
8806
8807                                 case TAPI_EVENT_PS_STATUS:
8808                                         tapi_ps_attach_response_t res;
8809                                         memcpy(&res, psEvent->pData, sizeof(tapi_ps_attach_response_t));
8810                         }
8811         }
8812 }
8813 @endcode
8814 @}
8815 @defgroup Use_Cases8_3 Check PDP Signal line On
8816 @ingroup Use_Cases8_GPRS
8817 @{
8818
8819
8820                 <h3 class="pg">Check PDP Signal line On</h3>
8821 This API is used to check whether the PDP siganl line is on or not.
8822
8823 Precondition:
8824 @n GPRS session should be started before running this API.
8825
8826 @code
8827 int tel_control_gprs_btdun_pin (tapi_ps_btdun_pincontrol pincontrol,int * pRequestID);
8828 @endcode
8829
8830 <strong>This API is restricted for direct use. Use the Data Network API instead.</strong>
8831
8832 SAMPLE CODE
8833 @code
8834 #include <stdio.h>
8835 #include <TapiCommon.h>
8836 #include <ITapiPS.h>
8837
8838 void pdpbtduncontrolget()
8839 {
8840         int ret_status;
8841         int request_id = 0;
8842         tapi_ps_btdun_pincontrol bt_control;
8843
8844         bt_control.signal = GPRS_SIGNAL_DCD ;
8845         bt_control.status = GPRS_SIGNAL_STATUS_OFF;
8846
8847         ret_status = tel_control_gprs_btdun_pin(bt_control, &request_id) ;
8848         if (ret_status == TAPI_API_SUCCESS)
8849         {
8850                 printf("/n/  Successful \\n");
8851         }
8852         else
8853         {
8854                 printf("/n/error:%d \n", ret_status);
8855         }
8856 }
8857 //WAIT FOR EVENT HERE
8858
8859 //CALLBACK FUNCTION TO BE USED
8860 void  ps_app_callback  (TelTapiEvent_t *event)
8861 {
8862         int eventClass;
8863         int eventType;
8864         int requestId;
8865         int status;
8866         void *EventData = NULL;
8867
8868         eventClass = event->EventClass;
8869         eventType = event->EventType;
8870         requestId = event->RequestId;
8871         status = event->Status;
8872         EventData = event->pData;
8873         printf(" app _callback is called \n");
8874
8875         switch (eventClass)
8876         {
8877                 case TAPI_EVENT_CLASS_DATA:
8878                         switch (eventType)
8879                         {
8880                                 case TAPI_EVENT_PS_BTDUN_PINCONTROL_NOTI:
8881                                         tapi_ps_btdun_pincontrol pincontrol;
8882                                         memcpy(&pincontrol, psEvent->pData, sizeof(tapi_ps_btdun_pincontrol));
8883                                         printf("TAPI_EVENT_PS_BTDUN_PINCONTROL_NOTI\n");
8884                                         break;
8885                         }
8886         }
8887 }
8888 @endcode
8889 @}
8890 @defgroup Use_Cases8_4 Set PDP deactivation
8891 @ingroup Use_Cases8_GPRS
8892 @{
8893
8894
8895                 <h3 class="pg">Set PDP deactivation</h3>
8896 This API is used to deactivate the PDP service.
8897
8898 Precondition:
8899 @n GPRS session must be started before executing this API.
8900
8901 @code
8902 int     tel_deactivate_gprs_pdp (const tapi_ps_net_stop_req_t *net_stop_req_info,int * pRequestID);
8903 @endcode
8904
8905 <strong>This API is restricted for direct use. Use the Data Network API instead.</strong>
8906
8907 SAMPLE CODE
8908 @code
8909 #include <stdio.h>
8910 #include <TapiCommon.h>
8911 #include <ITapiPS.h>
8912
8913 #define CONTEXT_ID 1
8914
8915 void setpdpdeactivation()
8916 {
8917         int ret_status;
8918         tapi_ps_net_stop_req_t end_req;
8919         int request_id = 0;
8920
8921         memset(&end_req, 0, sizeof(tapi_ps_net_stop_req_t));
8922
8923         end_req.cont_id = CONTEXT_ID;
8924
8925         ret_status = tel_deactivate_gprs_pdp (&end_req, &request_id);
8926         if (ret_status == TAPI_API_SUCCESS)
8927         {
8928                 printf("/n/ gprs active session ended successfully \\n");
8929         }
8930         else
8931         {
8932                 printf("/n/  gprs active session not ended  \\n");
8933         }
8934 }
8935 //WAIT FOR EVENT HERE
8936
8937 //CALLBACK FUNCTION TO BE USED
8938 void  ps_app_callback (TelTapiEvent_t *event)
8939 {
8940         int eventClass;
8941         int eventType;
8942         int requestId;
8943         int status;
8944         void *EventData = NULL;
8945
8946         eventClass = event->EventClass;
8947         eventType = event->EventType;
8948         requestId = event->RequestId;
8949         status = event->Status;
8950         EventData = event->pData;
8951         printf(" app _callback is called \n");
8952
8953         switch (eventClass)
8954         {
8955                 case TAPI_EVENT_CLASS_DATA:
8956                         switch (eventType)
8957                         {
8958                                 case TAPI_EVENT_PS_PDP_DEACT_IND:
8959                                         tapi_ps_net_stop_rsp_t* pdp_stop_resp;
8960                                         memcpy(pdp_stop_resp, psEvent->pData, sizeof(tapi_ps_net_stop_rsp_t));
8961                                         printf("TAPI_EVENT_PS_PDP_DEACT_IND\n");
8962                                         break;
8963
8964                                 case TAPI_EVENT_PS_CALL_STATISTICS:
8965                                         tapi_ps_call_statistics_t call_stats;
8966                                         memcpy(&call_stats, psEvent->pData,
8967                                                         sizeof(tapi_ps_call_statistics_t));
8968                                         break;
8969                         }
8970                         break;
8971         }
8972         break;
8973 }
8974 @endcode
8975 @}
8976 @defgroup Use_Cases8_5 DataEnterDormantState
8977 @ingroup Use_Cases8_GPRS
8978 @{
8979
8980
8981                 <h3 class="pg">DataEnterDormantState</h3>
8982 This API is used to set the modem’s data channels to the dormant state for power saving when there is no data flowing for certain time.
8983
8984 Precondition:
8985 @n GPRS session must be started before executing this API.
8986
8987 @code
8988 int     tel_set_gprs_dormant (int * pRequestID);
8989 @endcode
8990
8991 <strong>This API is restricted for direct use. Use the Data Network API instead.</strong>
8992
8993 SAMPLE CODE
8994 @code
8995 #include <stdio.h>
8996 #include <TapiCommon.h>
8997 #include <ITapiPS.h>
8998
8999 void enterdormantstate()
9000 {
9001         int ret_status;
9002         int request_id = 0;
9003
9004         ret_status = TelTapiDataEnterDormantState(&request_id);
9005         if (ret_status == TAPI_API_SUCCESS)
9006         {
9007                 printf("/n/ Entered Dormant State successfully \\n");
9008         }
9009         else
9010         {
9011                 printf("/nerror:%d  \\n", ret_status);
9012         }
9013 }
9014 //WAIT FOR EVENT HERE
9015
9016 //CALLBACK FUNCTION TO BE USED
9017 void  ps_app_callback  (TelTapiEvent_t *event)
9018 {
9019         int eventClass;
9020         int eventType;
9021         int  requestId;
9022         int  status;
9023         void  *EventData = NULL;
9024
9025         eventClass = event->EventClass;
9026         eventType = event->EventType;
9027         requestId = event->RequestId;
9028         status = event->Status;
9029         EventData = event->pData;
9030         printf(" app _callback is called \n");
9031
9032         switch (eventClass)
9033         {
9034                 case TAPI_EVENT_CLASS_DATA:
9035                         switch (eventType)
9036                         {
9037                                 case TAPI_EVENT_PS_DATA_DORMANT_RESP:
9038                                         TelTapiGprsDataDormancy_t resp;
9039                                         memcpy(&resp, psEvent->pData, sizeof(TelTapiGprsDataDormancy_t));
9040                                         printf("TAPI_EVENT_PS_DATA_DORMANT_RESP\n");
9041                                         break;
9042                         }
9043         }
9044 }
9045 @endcode
9046 @}
9047 @defgroup Use_Cases8_6 SetPortlist
9048 @ingroup Use_Cases8_GPRS
9049 @{
9050
9051
9052                 <h3 class="pg">SetPortlist</h3>
9053 This API is used to set white or black port list
9054
9055 @code
9056 int tel_set_gprs_port_list(int *pRequestID);
9057 @endcode
9058
9059 <strong>This API is restricted for direct use. Use the Data Network API instead.</strong>
9060
9061 SAMPLE CODE
9062 @code
9063 #include <stdio.h>
9064 #include <TapiCommon.h>
9065 #include <ITapiPS.h>
9066
9067 void setportlist()
9068 {
9069         int ret_val;
9070         int requestId = 0;
9071         tapi_gprs_pdp_port_list_setting_info_t test;
9072
9073         memset(&test, 0, sizeof(tapi_gprs_pdp_port_list_setting_info_t));
9074         test.tcp_list.type = TAPI_GPRS_PORT_LIST_NOT_USE;
9075         test.tcp_list.len = 1;
9076         test.tcp_list.list[0] = 1004;
9077         test.udp_list.type = TAPI_GPRS_PORT_LIST_NOT_USE;
9078         test.udp_list.len = 1;
9079         test.udp_list.list[i] = 1111;
9080
9081         ret_val = tel_set_gprs_port_list(&test, &requestId);
9082 }
9083 //CALLBACK FUNCTION TO BE USED
9084 void  ps_app_callback  (TelTapiEvent_t *event)
9085 {
9086         int eventClass;
9087         int eventType;
9088         int requestId;
9089         int status;
9090         void *EventData = NULL;
9091
9092         eventClass = event->EventClass;
9093         eventType = event->EventType;
9094         requestId = event->RequestId;
9095         status = event->Status;
9096         EventData = event->pData;
9097         printf(" app _callback is called \n");
9098
9099         switch (eventClass)
9100         {
9101                 case TAPI_EVENT_CLASS_DATA:
9102                         switch (eventType)
9103                         {
9104                                 case TAPI_EVENT_PS_DATA_DORMANT_RESP:
9105                                         printf("TAPI_EVENT_PS_DATA_DORMANT_RESP\n");
9106                                         break;
9107                         }
9108         }
9109 }
9110 @endcode
9111 @}
9112 @defgroup Use_Cases8_7 GetPortlist
9113 @ingroup Use_Cases8_GPRS
9114 @{
9115
9116
9117                 <h3 class="pg">GetPortlist</h3>
9118 This function is used to get white or black port list from modem
9119
9120 @code
9121 int tel_get_gprs_port_list(int *pRequestID);
9122 @endcode
9123
9124 <strong>This API is restricted for direct use. Use the Data Network API instead.</strong>
9125
9126 SAMPLE CODE
9127 @code
9128 #include <stdio.h>
9129 #include <TapiCommon.h>
9130 #include <ITapiPS.h>
9131
9132 Void getportlist()
9133 {
9134         int ret_val;
9135         int requestId = 0;
9136         ret_val = tel_get_gprs_port_list(&requestId);
9137 }
9138
9139 //CALLBACK FUNCTION TO BE USED
9140 void  ps_app_callback  (TelTapiEvent_t *event)
9141 {
9142         int eventClass;
9143         int eventType;
9144         int requestId;
9145         int status;
9146         void *EventData = NULL;
9147
9148         eventClass = event->EventClass;
9149         eventType = event->EventType;
9150         requestId = event->RequestId;
9151         status = event->Status;
9152         EventData = event->pData;
9153         printf(" app _callback is called \n");
9154
9155         switch (eventClass)
9156         {
9157                 case TAPI_EVENT_CLASS_DATA:
9158                         switch (eventType)
9159                         {
9160                                 case TAPI_EVENT_PS_DATA_DORMANT_RESP:
9161                                         tapi_gprs_pdp_port_list_setting_info_t *info;
9162                                         memcpy(info, psEvent->pData, sizeof(tapi_gprs_pdp_port_list_setting_info_t));
9163                                         printf("TAPI_EVENT_PS_DATA_DORMANT_RESP\n");
9164                                         break;
9165                         }
9166         }
9167 }
9168 @endcode
9169 @}
9170
9171 @defgroup Appendixes1 Appendix A. Sample Codes
9172 @ingroup Appendix
9173 @{
9174 <h1 class="pg">Appendixes</h1>
9175         <h2 class="pg">Appendix A. Sample Codes</h2>
9176 Some reference sample code is attached to help the application developer understand the telephony Framework Module
9177
9178 How to use supplementary service APIs and handle SS events
9179 @code
9180 #include <ITapiSs.h>
9181 #include <TapiEvent.h>
9182 #include <TapiCommon.h>
9183 #include <TelUtility.h>
9184
9185 GMainLoop *nw_context_loop = NULL;
9186
9187 typedef struct
9188 {
9189         int group;
9190         int type;
9191         int len;
9192         void *dst;
9193 } data_t;
9194
9195 static int SS_Callback(int eventClass, int eventType, void * param2)
9196 {
9197         int i;
9198         printf ("\n\n\n SS_Callback is called! eventClass : %d\n, eventType : %d\n", eventClass, eventType);
9199         fflush(stdout);
9200         switch (eventType)
9201         {
9202                 case TAPI_EVENT_SS_REL_COMP_MSG_NOTIFY:
9203                         if (param2 != NULL) {
9204                                 int x = 0;
9205                                 TelSsRelCompMsgInfo_t rel_comp_msg;
9206                                 memcpy(&rel_comp_msg, (TelSsRelCompMsgInfo_t *)param2,
9207                                                 sizeof(TelSsRelCompMsgInfo_t));
9208                                 printf("Printing the Release Complete Message \n");
9209
9210                                 for (x=0; x<rel_comp_msg.RelCompMsgLen; x++)
9211                                 {
9212                                         printf("[%.2x]", rel_comp_msg.szRelCompMsg[x]);
9213                                 }
9214                         }// end if
9215                         break;
9216
9217                 case TAPI_EVENT_SS_WAITING_CNF:
9218                         printf("####    Received Event : TAPI_EVENT_SS_WAITING_CNF  ##### \n");
9219                         if (param2 == NULL) {
9220                                 printf("param2 is NULL\n");
9221                         }
9222                         else {
9223                                 TelSsInfo_t SsInfo;
9224                                 memcpy(&SsInfo, (TelSsInfo_t*)param2, sizeof(TelSsInfo_t));
9225                                 for (i=0; i<SsInfo.NumberOfRecords; i++)
9226                                 {
9227                                         printf("Number of records %d \n", SsInfo.NumberOfRecords);
9228                                         printf("Record:%d Status:%d Teleservice:%d \n",
9229                                                         i,
9230                                                         sInfo.SsRecord.WaitingRecord.rec_class[i].Status,
9231                                                         SsInfo.SsRecord.WaitingRecord.rec_class[i].TeleCommService);
9232                                         if (SsInfo.SsRecord.WaitingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
9233                                                 printf("####    Status: Active      #### \n");
9234                                         else
9235                                                 printf("####     Status: Not Active   #### \n");
9236                                 } //end for
9237                         }//end else
9238                         break;
9239
9240                 case TAPI_EVENT_SS_WAITING_QUERYSTATUS_CNF:
9241                         printf("####    Received vent :TAPI_EVENT_SS_WAITING_QUERYSTATUS_CNF  ##### \n");
9242                         if (param2 == NULL) {
9243                                 printf("\n paran 2 is NULL\n");
9244                                 break;
9245                         }
9246                         TelSsInfo_t SsInfo;
9247                         memcpy(&SsInfo, (TelSsInfo_t*)param2, sizeof(TelSsInfo_t));
9248                         for (i=0; i<SsInfo.NumberOfRecords; i++) {
9249                                 printf("Number of records %d \n",SsInfo.NumberOfRecords);
9250                                 printf("Record:%d Status:%d Teleservice:%d \n",
9251                                                 i,
9252                                                 SsInfo.SsRecord.WaitingRecord.rec_class[i].Status,
9253                                                 SsInfo.SsRecord.WaitingRecord.rec_class[i].TeleCommService);
9254
9255                                 if (SsInfo.SsRecord.WaitingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
9256                                         printf("####    Status: Active      #### \n");
9257                                 else
9258                                         printf("####     Status: Not Active   #### \n");
9259                         }//end for
9260                         break;
9261
9262                 case TAPI_EVENT_SS_BARRING_QUERYSTATUS_CNF:
9263                         printf("####    Received Event :TAPI_EVENT_SS_BARRING_QUERYSTATUS_CNF  ##### \n");
9264                         break;
9265
9266                 case TAPI_EVENT_SS_BARRING_CNF:
9267                         printf("####    Received Event :TAPI_EVENT_SS_BARRING_CNF   ##### \n");
9268                         break;
9269
9270                 case TAPI_EVENT_SS_BARRING_CHANGEPASS_CNF:
9271                         printf("####    Received Event : TAPI_EVENT_SS_BARRING_CHANGEPASS_CNF  ##### \n");
9272                         printf("Call barring Password Changed successfully\n");
9273                         break;
9274
9275                 case TAPI_EVENT_SS_FORWARD_CNF:
9276                         printf("####    Received Event :TAPI_EVENT_SS_FORWARD_CNF  ##### \n");
9277                         if (param2 != NULL) {
9278                                 TelSsInfo_t SsInfo;
9279                                 memset(&SsInfo, 0, sizeof(TelSsInfo_t));
9280                                 memcpy(&SsInfo, (TelSsInfo_t*)param2, sizeof(TelSsInfo_t));
9281                                 printf("Number of records %d \n", SsInfo.NumberOfRecords);
9282                                 for (i=0; i<SsInfo.NumberOfRecords; i++)
9283                                 {
9284                                         printf("Number of records %d\n", SsInfo.NumberOfRecords);
9285                                         printf("Record:%d Status:%d Teleservice:%d \n",
9286                                                         i,
9287                                                         SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status,
9288                                                         SsInfo.SsRecord.ForwardingRecord.rec_class[i].TeleCommService);
9289                                         if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_REGISTERED)
9290                                                 printf("####    Status: Registered      #### \n");
9291                                         else if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
9292                                                 printf("####     Status: Active   #### \n");
9293                                         else
9294                                                 printf("####    Status: Not Registered /Not Active     ####\n");
9295                                 }//end for
9296                         }
9297                         else
9298                         {
9299                                 printf("param2 is NULL\n");
9300                         }
9301                         break;
9302
9303                 case TAPI_EVENT_SS_FORWARD_QUERYSTATUS_CNF:
9304                         printf("####    Received Event : TAPI_EVENT_SS_FORWARD_QUERYSTATUS_CNF  ##### \n");
9305                         if (param2 != NULL) {
9306                                 TelSsInfo_t SsInfo;
9307                                 memcpy(&SsInfo, (TelSsInfo_t*)param2, sizeof(TelSsInfo_t));
9308                                 for (i=0; i<SsInfo.NumberOfRecords; i++)
9309                                 {
9310                                         printf("Number of records %d \n", SsInfo.NumberOfRecords);
9311                                         printf("Record:%d Status:%d Teleservice:%d \n",
9312                                                         i,
9313                                                         SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status,
9314                                                         SsInfo.SsRecord.ForwardingRecord.rec_class[i].TeleCommService);
9315                                         if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_REGISTERED)
9316                                                 printf("####    Status: Registered      #### \n");
9317                                         else if (SsInfo.SsRecord.ForwardingRecord.rec_class[i].Status == TAPI_SS_STATUS_ACTIVE)
9318                                                 printf("####     Status: Active   #### \n");
9319                                         else
9320                                                 printf("####    Status: Not Registered /Not Active     #### \n");
9321                                 }//end for
9322                         }//end if
9323                         else
9324                         {
9325                                 printf("param 2 is NULL\n");
9326                         }
9327                         break;
9328
9329                 case TAPI_EVENT_SS_CLI_QUERYSTATUS_CNF:
9330                         printf("####    Received Event : TAPI_EVENT_SS_IDENTIFY_IND #### \n");
9331                         if (param2 != NULL) {
9332                                 TelSsInfo_t SsInfo;
9333                                 memcpy(&SsInfo, (TelSsInfo_t*)param2, sizeof(TelSsInfo_t));
9334                                 printf("Status :%d   CLI Service : %d \n",
9335                                                 SsInfo.SsRecord.CliRecord.CliStatus,
9336                                                 SsInfo.SsRecord.CliRecord.IdentificationType);
9337                                 if (SsInfo.SsRecord.CliRecord.CliStatus == 1)
9338                                         printf(" #####    Status : Not Provisioned   #####\n");
9339                                 else if (SsInfo.SsRecord.CliRecord.CliStatus == 2)
9340                                         printf(" #####    Status :  Provisioned  but Deactivated #####\n");
9341                                 else if (SsInfo.SsRecord.CliRecord.CliStatus == 3)
9342                                         printf(" #####    Status : Provisioned  and Activated   #####\n");
9343                                 else if (SsInfo.SsRecord.CliRecord.CliStatus == 4)
9344                                         printf(" #####    Status : Unknown   #####\n");
9345                                 else if (SsInfo.SsRecord.CliRecord.CliStatus == 5)
9346                                         printf(" #####    Status : Temporarily Restricted  #####\n");
9347                                 else if (SsInfo.SsRecord.CliRecord.CliStatus == 6)
9348                                         printf(" #####    Status : Temporarily Allowed  #####\n");
9349                         }
9350                         else
9351                         {
9352                                 printf("param 2 is NULL\n");
9353                         }
9354                         break;
9355
9356                 default:
9357                         printf("\n\nDID NOT GET THE EVENT\n");
9358                         break;
9359         }//end switch
9360         g_main_loop_quit(nw_context_loop);
9361         return 0;
9362 }//end call back
9363
9364 static void app_callback (TelTapiEvent_t *event)
9365 {
9366         int eventClass;
9367         int eventType;
9368         int requestId;
9369         int status;
9370         void* EventData = NULL;
9371
9372         eventClass = event->EventClass;
9373         eventType = event->EventType;
9374         requestId = event->RequestId;
9375         status = event->Status;
9376         EventData = event->pData;
9377         //TEST_DEBUG("Class:[%d], Event Type:[%d], RequestId:[%d], Status:[%d] \n", eventClass, eventType , requestId, status );
9378         if (status != 0)
9379         {
9380                 //TEST_DEBUG("******This is nonzero status. ******\n");
9381                 return;
9382         }
9383         SS_Callback((int)eventClass, (int)eventType, EventData);
9384 }
9385
9386 ss_test_subscribe_tapi_events()
9387 {
9388         //REGISTER EVENT
9389         unsigned int subscription_id = 0;
9390         TapiResult_t api_err;
9391
9392         api_err = TelTapiInit();
9393         if (api_err != TAPI_API_SUCCESS)
9394         {
9395                 printf("TelTapiInit Failed - api_err = %d \n", api_err);
9396         }
9397         api_err = TelTapiRegisterEvent(TAPI_EVENT_SS_WAITING_CNF, &subscription_id, (TelAppCallback)&app_callback);
9398         printf("SS Class registeration is Done: sub id is %d, api_err is %d\n",subscription_id,api_err);
9399         fflush(stdout);
9400 }
9401
9402 noti_finish()
9403 {
9404         //DEREGISTER EVENT
9405         unsigned int subscription_id = 0;
9406         TapiResult_t api_err;
9407
9408         api_err = tel_deregister_event(subscription_id);
9409         if (api_err != TAPI_API_SUCCESS)
9410         {
9411                 printf("Event Class Unregeration Fail\n");
9412         }
9413 }
9414
9415 tapi_ss_call_barr()
9416 {
9417         TapiResult_t ret_status;
9418         TelSsCallBarringInfo_t pBarringInfo;
9419         int pRequestId = 0;
9420         char *bar_pwd = "0000";
9421
9422         printf("Before copying ,,,length is %d\n", strlen(pBarringInfo.szPassword));
9423         printf("len initially is %d\n", strlen(bar_pwd));
9424
9425         pBarringInfo.Mode = TAPI_SS_CALL_BAR_ACTIVATE;
9426         pBarringInfo.Type = TAPI_CALL_BARRING_ALL_OUTGOING_CALLS;//TAPI_CALL_BARRING_ALL_OUTGOING_INTERN_CALL;
9427         pBarringInfo.CallType = TAPI_CALL_TYPE_VOICE_EV;
9428         strcpy(pBarringInfo.szPassword, bar_pwd);
9429         printf("length is %d\n", strlen(pBarringInfo.szPassword));
9430         ret_status = tel_set_ss_barring(&pBarringInfo, &pRequestId);
9431         if (ret_status != TAPI_API_SUCCESS) {
9432                 return;
9433         }
9434
9435         nw_context_loop = g_main_loop_new(NULL, FALSE);
9436         g_main_loop_run(nw_context_loop);
9437
9438
9439         //now , get the status
9440         TelSsCallBarType_t BarType = TAPI_CALL_BARRING_ALL_OUTGOING_INTERN_CALL;
9441         TelSsCallType_t CallType = TAPI_CALL_TYPE_VOICE_EV;
9442         ret_status = tel_get_ss_barring_status(BarType,CallType, &pRequestId);
9443         if (ret_status != TAPI_API_SUCCESS) {
9444                 return ;
9445         }
9446
9447         nw_context_loop = g_main_loop_new(NULL, FALSE);
9448         g_main_loop_run(nw_context_loop);
9449 }
9450
9451 tapi_ss_call_fwd()
9452 {
9453         TapiResult_t ret_status;
9454         TelSsForwardInfo_t pForwardInfo;
9455         int len;
9456         int pRequestId = 0;
9457         char *cf_number = "9986529874";
9458
9459         pForwardInfo.Mode = TAPI_CALL_FORWARD_MODE_ENABLE_EV;
9460         pForwardInfo.Type = TAPI_CS_FORWARD_TYPE_VOICE_EV;
9461         pForwardInfo.Condition = TAPI_SS_FORWARD_WHEN_UNCONDITIONAL_EV;
9462         pForwardInfo.NoReplyConditionTimer = 10;
9463
9464         len = strlen(cf_number);
9465         printf("Length of CF number :%d \n", len);
9466         memcpy(&(pForwardInfo.szPhoneNumber), cf_number, len);
9467         ret_status = tel_set_ss_forward(&pForwardInfo, &pRequestId);
9468         if (ret_status != TAPI_API_SUCCESS) {
9469                 return ;
9470         }
9471
9472         nw_context_loop = g_main_loop_new(NULL, FALSE);
9473         g_main_loop_run(nw_context_loop);
9474
9475         //now , get call forward status
9476         TelSsForwardType_t Type = TAPI_CS_FORWARD_TYPE_VOICE_EV;
9477         TelSsForwardWhen_t Condition = TAPI_SS_FORWARD_WHEN_UNCONDITIONAL_EV;
9478
9479         // Calling TAPI SS Call Frwd Query Req Status Api
9480         ret_status = tel_get_ss_forward_status(Type,Condition, &pRequestId);
9481         if (ret_status != TAPI_API_SUCCESS) {
9482                 return ;
9483         }
9484
9485         nw_context_loop = g_main_loop_new(NULL, FALSE);
9486         g_main_loop_run(nw_context_loop);
9487 }
9488
9489 tapi_ss_call_wait()
9490 {
9491         //set and get call waiting
9492         TapiResult_t ret_status;
9493         TelSsWaitingInfo_t waitInfo;
9494         int RequestID;
9495
9496         waitInfo.Mode = TAPI_SS_CW_ACTIVATE;
9497         waitInfo.CallType = TAPI_CALL_TYPE_VOICE_EV;
9498
9499         //set call wait
9500         ret_status = tel_set_ss_waiting(&waitInfo, &RequestID);
9501         if (ret_status != TAPI_API_SUCCESS) {
9502                 return;
9503         }
9504
9505         nw_context_loop = g_main_loop_new(NULL, FALSE);
9506         g_main_loop_run(nw_context_loop);
9507
9508         sleep(4);
9509
9510         //now get call wait
9511         TelSsCallType_t CallType = TAPI_CALL_TYPE_VOICE_EV;
9512         ret_status = tel_get_ss_waiting_status(CallType, &RequestID);
9513         if (ret_status != TAPI_API_SUCCESS) {
9514                 return;
9515         }
9516         nw_context_loop = g_main_loop_new(NULL, FALSE);
9517         g_main_loop_run(nw_context_loop);
9518 }
9519
9520 ss_test()
9521 {
9522         ss_test_subscribe_tapi_events();
9523         tapi_ss_call_barr();
9524         tapi_ss_call_fwd();
9525         tapi_ss_call_wait();
9526         noti_finish();
9527 }
9528
9529 int main(int argc, char *argv[])
9530 {
9531         ss_test();
9532         return 0;
9533 }
9534 @endcode
9535 @}
9536 @defgroup Appendixes2 Appendix   B. Error Code
9537 @ingroup Appendix
9538 @{
9539
9540         <h2 class="pg">Appendix B. Error Code</h2>
9541 <table>
9542 <tr><td>Error Num.</td>
9543 <td>Error Code</td>
9544 <td>Error Description</td></tr>
9545 <tr><td>0</td>
9546 <td>TAPI_API_SUCCESS</td>
9547 <td>No Error occurred</td></tr>
9548 <tr><td>-1</td>
9549 <td>TAPI_API_INVALID_INPUT</td>
9550 <td>Input values are not correct in TAPI Library</td></tr>
9551 <tr><td>-2</td>
9552 <td>TAPI_API_INVALID_PTR</td>
9553 <td>invalid pointer</td></tr>
9554 <tr><td>-3</td>
9555 <td>TAPI_API_NOT_SUPPORTED</td>
9556 <td>The feature corresponding to requested API is not supported. This may be due to market/network/vendor reasons such as the feature is not available in the network.</td></tr>
9557 <tr><td>-4</td>
9558 <td>TAPI_API_DEPRICATED </td>
9559 <td>This API is deprecated and will be so in future also </td></tr>
9560 <tr><td>-5</td>
9561 <td>TAPI_API_SYSTEM_OUT_OF_MEM</td>
9562 <td>Out of memory</td></tr>
9563 <tr><td>-6</td>
9564 <td>TAPI_API_SYSTEM_RPC_LINK_DOWN</td>
9565 <td>RPC link down</td></tr>
9566 <tr><td>-7</td>
9567 <td>TAPI_API_SERVICE_NOT_READY          </td>
9568 <td>Phone was powered on, but yet to receive the power up completed notification </td></tr>
9569 <tr><td>-8</td>
9570 <td>TAPI_API_SERVER_FAILURE</td>
9571 <td>error occurred in Telephony server</td></tr>
9572 <tr><td>-9</td>
9573 <td>TAPI_API_OEM_PLUGIN_FAILURE</td>
9574 <td>Plug-in layer failure</td></tr>
9575 <tr><td>-10</td>
9576 <td>TAPI_API_TRANSPORT_LAYER_FAILURE</td>
9577 <td>Transport layer Failure</td></tr>
9578 <tr><td>-11</td>
9579 <td>TAPI_API_INVALID_DATA_LEN</td>
9580 <td>Invalid data length</td></tr>
9581 </table>
9582 @}
9583 */
9584 /**
9585 * @defgroup  TELEPHONY
9586  @{
9587 *       @defgroup Appendix Reference
9588 *       @defgroup TELEPHONY_USECASES Use Cases
9589         @{
9590 *               @defgroup Use_Cases1_COMMON COMMON
9591 *               @defgroup Use_Cases2_CALL CALL
9592 *               @defgroup Use_Cases3_SUPPLEMENTARY_SERVICE SUPPLEMENTARY_SERVICE
9593 *               @defgroup Use_Cases4_SMS SMS
9594 *               @defgroup Use_Cases5_NETWORK NETWORK_Registration_and_Configuration
9595 *               @defgroup Use_Cases6_SOUND SOUND
9596 *               @defgroup Use_Cases7_SAT SAT
9597 *               @defgroup Use_Cases8_GPRS GPRS
9598         @}
9599  @}
9600 */