75e237042978baf40716341f587a9ce2440b5175
[framework/telephony/libslp-tapi.git] / wearable / src / tapi_ss.c
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 #include <stdio.h>
23 #include <string.h>
24 #include <stdlib.h>
25
26 #include "tapi_common.h"
27 #include "TapiUtility.h"
28 #include "TelSs.h"
29
30 #include "common.h"
31 #include "tapi_log.h"
32 #include "ITapiSs.h"
33
34 static void on_response_get_ss_barring_status(GObject *source_object, GAsyncResult *res, gpointer user_data)
35 {
36         GError *error = 0;
37         GDBusConnection *conn = 0;
38         struct tapi_resp_data *evt_cb_data = user_data;
39         int result = -1, i = 0;
40         TelSsBarringResp_t resp;
41
42         GVariant *dbus_result = 0, *value = 0;
43         GVariantIter *iter = 0;
44         GVariantIter *iter_row = 0;
45         const gchar *key = 0;
46
47         memset(&resp, '\0', sizeof(TelSsBarringResp_t));
48
49         conn = G_DBUS_CONNECTION (source_object);
50         dbus_result = g_dbus_connection_call_finish(conn, res, &error);
51         CHECK_DEINIT(error);
52
53         if (!dbus_result) {
54                 if (evt_cb_data->cb_fn) {
55                         evt_cb_data->cb_fn(evt_cb_data->handle, -1, NULL, evt_cb_data->user_data);
56                 }
57
58                 if (error)
59                         g_error_free(error);
60
61                 g_free(evt_cb_data);
62                 return;
63         }
64
65         g_variant_get (dbus_result, "(aa{sv}i)", &iter, &result);
66
67         resp.record_num = g_variant_iter_n_children(iter);
68
69         while ( g_variant_iter_next(iter, "a{sv}", &iter_row ) ) {
70                 while ( g_variant_iter_loop( iter_row, "{sv}", &key, &value ) ) {
71
72                         if ( !g_strcmp0(key, "ss_class") ) {
73                                 resp.record[i].Class = g_variant_get_int32(value);
74                         }
75
76                         if ( !g_strcmp0(key, "ss_status") ) {
77                                 resp.record[i].Status = g_variant_get_int32(value);
78                         }
79
80                         if ( !g_strcmp0(key, "barring_mode") ) {
81                                 resp.record[i].Flavour = g_variant_get_int32(value);
82                         }
83
84                 }
85                 i++;
86                 g_variant_iter_free(iter_row);
87         }
88         g_variant_iter_free(iter);
89
90         if (evt_cb_data->cb_fn) {
91                 evt_cb_data->cb_fn(evt_cb_data->handle, result, &resp, evt_cb_data->user_data);
92         }
93
94         g_free(evt_cb_data);
95 }
96
97 static void on_response_change_ss_barring_password(GObject *source_object, GAsyncResult *res, gpointer user_data)
98 {
99         GError *error = 0;
100         GDBusConnection *conn = 0;
101         struct tapi_resp_data *evt_cb_data = user_data;
102         int result = -1;
103
104         GVariant *dbus_result = 0;
105
106         conn = G_DBUS_CONNECTION (source_object);
107         dbus_result = g_dbus_connection_call_finish(conn, res, &error);
108         CHECK_DEINIT(error);
109
110         if (!dbus_result) {
111                 if (evt_cb_data->cb_fn) {
112                         evt_cb_data->cb_fn(evt_cb_data->handle, -1, NULL, evt_cb_data->user_data);
113                 }
114
115                 if (error)
116                         g_error_free(error);
117
118                 g_free(evt_cb_data);
119                 return;
120         }
121
122         g_variant_get (dbus_result, "(i)",  &result);
123
124         if (evt_cb_data->cb_fn) {
125                 evt_cb_data->cb_fn(evt_cb_data->handle, result, NULL, evt_cb_data->user_data);
126         }
127
128         g_free(evt_cb_data);
129 }
130
131 static void on_response_get_ss_forward_status(GObject *source_object, GAsyncResult *res, gpointer user_data)
132 {
133         GError *error = 0;
134         GDBusConnection *conn = 0;
135         struct tapi_resp_data *evt_cb_data = user_data;
136         int result = -1, i = 0;
137         TelSsForwardResp_t resp;
138
139         GVariant *dbus_result = 0, *value = 0;
140         GVariantIter *iter = 0;
141         GVariantIter *iter_row = 0;
142         const gchar *key = 0;
143
144
145         memset(&resp, '\0', sizeof(TelSsForwardResp_t));
146
147         conn = G_DBUS_CONNECTION (source_object);
148         dbus_result = g_dbus_connection_call_finish(conn, res, &error);
149         CHECK_DEINIT(error);
150
151         if (!dbus_result) {
152                 if (evt_cb_data->cb_fn) {
153                         evt_cb_data->cb_fn(evt_cb_data->handle, -1, NULL, evt_cb_data->user_data);
154                 }
155
156                 if (error)
157                         g_error_free(error);
158
159                 g_free(evt_cb_data);
160                 return;
161         }
162
163         g_variant_get (dbus_result, "(aa{sv}i)", &iter, &result);
164
165         resp.record_num = g_variant_iter_n_children(iter);
166
167         while ( g_variant_iter_next(iter, "a{sv}", &iter_row ) ) {
168                 while ( g_variant_iter_loop( iter_row, "{sv}", &key, &value ) ) {
169
170                         if ( !g_strcmp0(key, "ss_class") ) {
171                                 resp.record[i].Class = g_variant_get_int32(value);
172                         }
173
174                         if ( !g_strcmp0(key, "ss_status") ) {
175                                 resp.record[i].Status = g_variant_get_int32(value);
176                         }
177
178                         if ( !g_strcmp0(key, "forwarding_mode") ) {
179                                 resp.record[i].ForwardCondition = g_variant_get_int32(value);
180                         }
181
182                         if ( !g_strcmp0(key, "number_present") ) {
183                                 resp.record[i].bCallForwardingNumberPresent = g_variant_get_int32(value);
184                         }
185
186                         if ( !g_strcmp0(key, "no_reply_time") ) {
187                                 resp.record[i].NoReplyWaitTime = g_variant_get_int32(value);
188                         }
189
190                         if ( !g_strcmp0(key, "type_of_number") ) {
191                                 resp.record[i].Ton = g_variant_get_int32(value);
192                         }
193
194                         if ( !g_strcmp0(key, "number_plan_identity") ) {
195                                 resp.record[i].Npi = g_variant_get_int32(value);
196                         }
197
198                         if ( !g_strcmp0(key, "forwarding_number") ) {
199                                 strncpy((char *)resp.record[i].szCallForwardingNumber, g_variant_get_string(value, 0), TAPI_CALL_DIALDIGIT_LEN_MAX );
200                         }
201
202                 }
203                 i++;
204                 g_variant_iter_free(iter_row);
205         }
206         g_variant_iter_free(iter);
207
208         if (evt_cb_data->cb_fn) {
209                 evt_cb_data->cb_fn(evt_cb_data->handle, result, &resp, evt_cb_data->user_data);
210         }
211
212         g_free(evt_cb_data);
213 }
214
215 static void on_response_get_ss_waiting_status(GObject *source_object, GAsyncResult *res, gpointer user_data)
216 {
217         GError *error = 0;
218         GDBusConnection *conn = 0;
219         struct tapi_resp_data *evt_cb_data = user_data;
220         int result = -1, i = 0;
221         TelSsWaitingResp_t resp;
222
223         GVariant *dbus_result = 0, *value = 0;
224         GVariantIter *iter = 0;
225         GVariantIter *iter_row = 0;
226         const gchar *key = 0;
227
228
229         memset(&resp, '\0', sizeof(TelSsWaitingResp_t));
230
231         conn = G_DBUS_CONNECTION (source_object);
232         dbus_result = g_dbus_connection_call_finish(conn, res, &error);
233         CHECK_DEINIT(error);
234
235         if (!dbus_result) {
236                 if (evt_cb_data->cb_fn) {
237                         evt_cb_data->cb_fn(evt_cb_data->handle, -1, NULL, evt_cb_data->user_data);
238                 }
239
240                 if (error)
241                         g_error_free(error);
242
243                 g_free(evt_cb_data);
244                 return;
245         }
246
247         g_variant_get (dbus_result, "(aa{sv}i)", &iter, &result);
248
249         resp.record_num = g_variant_iter_n_children(iter);
250
251         while ( g_variant_iter_next(iter, "a{sv}", &iter_row ) ) {
252                 while ( g_variant_iter_loop( iter_row, "{sv}", &key, &value ) ) {
253
254                         if ( !g_strcmp0(key, "ss_class") ) {
255                                 resp.record[i].Class = g_variant_get_int32(value);
256                         }
257
258                         if ( !g_strcmp0(key, "ss_status") ) {
259                                 resp.record[i].Status = g_variant_get_int32(value);
260                         }
261                 }
262                 i++;
263                 g_variant_iter_free(iter_row);
264         }
265         g_variant_iter_free(iter);
266
267         if (evt_cb_data->cb_fn) {
268                 evt_cb_data->cb_fn(evt_cb_data->handle, result, &resp, evt_cb_data->user_data);
269         }
270
271         g_free(evt_cb_data);
272 }
273
274 static void on_response_set_ss_cli_status(GObject *source_object, GAsyncResult *res, gpointer user_data)
275 {
276         GError *error = 0;
277         GDBusConnection *conn = 0;
278         struct tapi_resp_data *evt_cb_data = user_data;
279         int result = -1;
280         int data = 0;
281
282         GVariant *dbus_result = 0;
283
284         conn = G_DBUS_CONNECTION (source_object);
285         dbus_result = g_dbus_connection_call_finish(conn, res, &error);
286         CHECK_DEINIT(error);
287
288         if (!dbus_result) {
289                 if (evt_cb_data->cb_fn) {
290                         evt_cb_data->cb_fn(evt_cb_data->handle, -1, NULL, evt_cb_data->user_data);
291                 }
292
293                 if (error)
294                         g_error_free(error);
295
296                 g_free(evt_cb_data);
297                 return;
298         }
299
300         g_variant_get (dbus_result, "(i)",  &result);
301
302         if (evt_cb_data->cb_fn) {
303                 evt_cb_data->cb_fn(evt_cb_data->handle, result, &data, evt_cb_data->user_data);
304         }
305
306         g_free(evt_cb_data);
307 }
308
309 static void on_response_get_ss_cli_status(GObject *source_object, GAsyncResult *res, gpointer user_data)
310 {
311         GError *error = 0;
312         GDBusConnection *conn = 0;
313         struct tapi_resp_data *evt_cb_data = user_data;
314         int result = -1;
315         TelSsCliResp_t resp;
316
317         GVariant *dbus_result = 0;
318
319         memset(&resp, '\0', sizeof(TelSsCliResp_t));
320
321         conn = G_DBUS_CONNECTION (source_object);
322         dbus_result = g_dbus_connection_call_finish(conn, res, &error);
323         CHECK_DEINIT(error);
324
325         if (!dbus_result) {
326                 if (evt_cb_data->cb_fn) {
327                         evt_cb_data->cb_fn(evt_cb_data->handle, -1, NULL, evt_cb_data->user_data);
328                 }
329
330                 if (error)
331                         g_error_free(error);
332
333                 g_free(evt_cb_data);
334                 return;
335         }
336
337         g_variant_get (dbus_result, "(iii)",  &result, &resp.Type, &resp.Status);
338
339         dbg("Type(%d), Status(%d)", resp.Type, resp.Status);
340         if (evt_cb_data->cb_fn) {
341                 evt_cb_data->cb_fn(evt_cb_data->handle, result, &resp, evt_cb_data->user_data);
342         }
343
344         g_free(evt_cb_data);
345 }
346
347 static void on_response_send_ss_ussd_request(GObject *source_object, GAsyncResult *res, gpointer user_data)
348 {
349         GError *error = 0;
350         GDBusConnection *conn = 0;
351         struct tapi_resp_data *evt_cb_data = user_data;
352         int result = -1;
353         char *tmp_str = 0;
354         TelSsUssdResp_t resp;
355
356         GVariant *dbus_result = 0;
357
358         memset(&resp, '\0', sizeof(TelSsUssdResp_t));
359
360         conn = G_DBUS_CONNECTION (source_object);
361         dbus_result = g_dbus_connection_call_finish(conn, res, &error);
362         CHECK_DEINIT(error);
363
364         if (!dbus_result) {
365                 if (evt_cb_data->cb_fn) {
366                         evt_cb_data->cb_fn(evt_cb_data->handle, -1, NULL, evt_cb_data->user_data);
367                 }
368
369                 if (error)
370                         g_error_free(error);
371
372                 g_free(evt_cb_data);
373                 return;
374         }
375
376         g_variant_get (dbus_result, "(iiiiis)",  &result, &resp.Type, &resp.Status, &resp.Dcs, &resp.Length, &tmp_str);
377
378         if (!result) {
379                 memcpy( resp.szString, tmp_str, resp.Length );
380                 g_free(tmp_str);
381         }
382
383         if (evt_cb_data->cb_fn) {
384                 evt_cb_data->cb_fn(evt_cb_data->handle, result, &resp, evt_cb_data->user_data);
385         }
386
387         g_free(evt_cb_data);
388 }
389
390 EXPORT_API int tel_set_ss_barring(TapiHandle *handle, TelSsBarringInfo_t *info, tapi_response_cb callback, void *user_data)
391 {
392         struct tapi_resp_data *evt_cb_data = 0;
393         GVariant *param = 0;
394         gchar *method = 0;
395
396         dbg("Func Entrance ");
397
398         TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
399         TAPI_RET_ERR_NUM_IF_FAIL(info, TAPI_API_INVALID_PTR);
400
401         MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
402
403         param = g_variant_new("(iis)", info->Class, info->Type, info->szPassword);
404
405         if ( info->Mode == TAPI_SS_CB_MODE_ACTIVATE ) {
406                 dbg("[ check ] barring activate");
407                 method = "ActivateBarring";
408
409         } else {
410                 dbg("[ check ] barring deactivate");
411                 method = "DeactivateBarring";
412
413         }
414
415         g_dbus_connection_call(handle->dbus_connection,
416                         DBUS_TELEPHONY_SERVICE, handle->path, DBUS_TELEPHONY_SS_INTERFACE,
417                         method, param, 0,
418                         G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca,
419                         on_response_get_ss_barring_status, evt_cb_data );
420
421         return TAPI_API_SUCCESS;
422 }
423
424 EXPORT_API int tel_get_ss_barring_status(TapiHandle *handle, TelSsClass_t class, TelSsBarringType_t type, tapi_response_cb callback, void *user_data)
425 {
426         struct tapi_resp_data *evt_cb_data = 0;
427         GVariant *param = 0;
428
429         dbg("Func Entrance ");
430
431         TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
432         TAPI_RET_ERR_NUM_IF_FAIL(callback, TAPI_API_INVALID_PTR);
433
434         MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
435
436         param = g_variant_new("(ii)", class, type);
437
438         g_dbus_connection_call(handle->dbus_connection,
439                         DBUS_TELEPHONY_SERVICE, handle->path, DBUS_TELEPHONY_SS_INTERFACE,
440                         "GetBarringStatus", param, 0,
441                         G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca,
442                         on_response_get_ss_barring_status, evt_cb_data );
443
444         return TAPI_API_SUCCESS;
445 }
446
447 /**********************************************************************************************
448  *
449  * This function is used to change call barring password.
450  *
451  * @param       pOldPassword[IN] of type char* Specifies the Old Call Barring Password.
452  * @param       pNewPassword[IN] of type char* Specifies the New Call Barring Password.
453  * @param       pNewPasswordAgain[IN] of type char* Specifies the New Call Barring Password for Confirm.
454  * @return      enum type TapiResult_t Specifies the API's Return result.
455  * @remark
456  *
457  ***********************************************************************************************/
458 EXPORT_API int tel_change_ss_barring_password(TapiHandle *handle,
459                 const char *old_password,
460                 const char *new_password,
461                 const char *new_password_again,
462                 tapi_response_cb callback, void *user_data)
463 {
464         struct tapi_resp_data *evt_cb_data = 0;
465         GVariant *param = 0;
466
467         dbg("Func Entrance ");
468
469         TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
470         TAPI_RET_ERR_NUM_IF_FAIL(old_password, TAPI_API_INVALID_PTR);
471         TAPI_RET_ERR_NUM_IF_FAIL(new_password, TAPI_API_INVALID_PTR);
472         TAPI_RET_ERR_NUM_IF_FAIL(new_password_again, TAPI_API_INVALID_PTR);
473
474         MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
475
476         param = g_variant_new("(sss)", old_password, new_password, new_password_again);
477
478         g_dbus_connection_call(handle->dbus_connection,
479                         DBUS_TELEPHONY_SERVICE, handle->path, DBUS_TELEPHONY_SS_INTERFACE,
480                         "ChangeBarringPassword", param, 0,
481                         G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca,
482                         on_response_change_ss_barring_password, evt_cb_data );
483
484         return TAPI_API_SUCCESS;
485 }
486
487 /**********************************************************************************************
488  *
489  * This function is used to Activate or Deactivate the call forwarding feature.
490  *
491  * @param       forwardInfo[IN] of type TelSsForwardInfo_t which specifies the Teleservice and CF flavour, Forwarded to number.
492  * @return      enum type TapiResult_t Specifies the API's Return result.
493  * @remark
494  *
495  ***********************************************************************************************/
496 EXPORT_API int tel_set_ss_forward(TapiHandle *handle, const TelSsForwardInfo_t *info, tapi_response_cb callback, void *user_data)
497 {
498         struct tapi_resp_data *evt_cb_data = 0;
499         GVariant *param = 0;
500         gchar *method = 0;
501
502         dbg("Func Entrance ");
503
504         TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
505         TAPI_RET_ERR_NUM_IF_FAIL(info, TAPI_API_INVALID_PTR);
506
507         MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
508
509         param = g_variant_new("(iiiiis)", info->Class, info->Condition,
510                         info->NoReplyConditionTimer, info->Ton, info->Npi, info->szPhoneNumber);
511
512         switch ( info->Mode ) {
513                 case TAPI_SS_CF_MODE_DISABLE_EV: {
514                         dbg("[ check ] forwarding deactivate");
515                         method = "DeactivateForwarding";
516                 } break;
517
518                 case TAPI_SS_CF_MODE_ENABLE_EV: {
519                         dbg("[ check ] forwarding activate");
520                         method = "ActivateForwarding";
521                 } break;
522
523                 case TAPI_SS_CF_MODE_REGISTRATION_EV: {
524                         dbg("[ check ] forwarding registration");
525                         method = "RegisterForwarding";
526                 } break;
527
528                 case TAPI_SS_CF_MODE_ERASURE_EV: {
529                         dbg("[ check ] forwarding deregistration");
530                         method = "DeregisterForwarding";
531                 } break;
532
533                 default:
534                         dbg("[ error ] invalid input : (0x%x)", info->Mode);
535                         return TAPI_API_INVALID_INPUT;
536         }
537
538         g_dbus_connection_call(handle->dbus_connection,
539                         DBUS_TELEPHONY_SERVICE, handle->path, DBUS_TELEPHONY_SS_INTERFACE,
540                         method, param, 0,
541                         G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca,
542                         on_response_get_ss_forward_status, evt_cb_data );
543
544         return TAPI_API_SUCCESS;
545 }
546
547 /**********************************************************************************************
548  *
549  * This function is used to interrogate the status of call forwarding feature.
550  *
551  * @param       forwardType[IN] of type TelSsForwardType_t which specifies the telecommunication service.
552  * @param       condition[IN]   is of type TelSsForwardWhen_t specified the CF flavour
553  * @return      enum type TapiResult_t Specifies the API's Return result.
554  * @remark
555  *
556  ***********************************************************************************************/
557 EXPORT_API int tel_get_ss_forward_status(TapiHandle *handle, TelSsClass_t class, TelSsForwardWhen_t condition, tapi_response_cb callback, void *user_data)
558 {
559         struct tapi_resp_data *evt_cb_data = 0;
560         GVariant *param = 0;
561
562         dbg("Func Entrance ");
563
564         TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
565         TAPI_RET_ERR_NUM_IF_FAIL(callback, TAPI_API_INVALID_PTR);
566
567         MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
568
569         param = g_variant_new("(ii)", class, condition);
570
571         g_dbus_connection_call(handle->dbus_connection,
572                         DBUS_TELEPHONY_SERVICE, handle->path, DBUS_TELEPHONY_SS_INTERFACE,
573                         "GetForwardingStatus", param, 0,
574                         G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca,
575                         on_response_get_ss_forward_status, evt_cb_data );
576
577         return TAPI_API_SUCCESS;
578 }
579
580 /**********************************************************************************************
581  *
582  * This function is used to Activate or dectivate call waiting feature.
583  *
584  * @param       waitInfo[IN] of type TelSsWaitingInfo_t which specifies the telecommunication service and mode.
585  * @return      enum type TapiResult_t Specifies the API's Return result.
586  * @remark
587  *
588  ***********************************************************************************************/
589 EXPORT_API int tel_set_ss_waiting(TapiHandle *handle, const TelSsWaitingInfo_t *info, tapi_response_cb callback, void *user_data)
590 {
591         struct tapi_resp_data *evt_cb_data = 0;
592         GVariant *param = 0;
593         gchar *method = 0;
594
595         dbg("Func Entrance ");
596
597         TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
598         TAPI_RET_ERR_NUM_IF_FAIL(info, TAPI_API_INVALID_PTR);
599
600         MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
601
602         param = g_variant_new("(i)", info->Class);
603
604         if ( info->Mode == TAPI_SS_CW_MODE_ACTIVATE ) {
605                 dbg("[ check ] waiting activate");
606                 method = "ActivateWaiting";
607         } else {
608                 dbg("[ check ] waiting deactivate");
609                 method = "DeactivateWaiting";
610         }
611
612         g_dbus_connection_call(handle->dbus_connection,
613                         DBUS_TELEPHONY_SERVICE, handle->path, DBUS_TELEPHONY_SS_INTERFACE,
614                         method, param, 0,
615                         G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca,
616                         on_response_get_ss_waiting_status, evt_cb_data );
617
618         return TAPI_API_SUCCESS;
619 }
620
621 /**********************************************************************************************
622  *
623  * This function is used to interrogate the status of call waiting feature.
624  *
625  * @param       CallType[IN] of type TelSsCallType_t which specifies the telecommunication service .
626  * @return      enum type TapiResult_t Specifies the API's Return result.
627  * @remark
628  *
629  ***********************************************************************************************/
630
631 EXPORT_API int tel_get_ss_waiting_status(TapiHandle *handle, const TelSsClass_t class, tapi_response_cb callback, void *user_data)
632 {
633         struct tapi_resp_data *evt_cb_data = 0;
634         GVariant *param = 0;
635
636         dbg("Func Entrance ");
637
638         TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
639         TAPI_RET_ERR_NUM_IF_FAIL(callback, TAPI_API_INVALID_PTR);
640
641         MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
642
643         param = g_variant_new("(i)", class);
644
645         g_dbus_connection_call(handle->dbus_connection,
646                         DBUS_TELEPHONY_SERVICE, handle->path, DBUS_TELEPHONY_SS_INTERFACE,
647                         "GetWaitingStatus", param, 0,
648                         G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca,
649                         on_response_get_ss_waiting_status, evt_cb_data );
650
651         return TAPI_API_SUCCESS;
652 }
653
654 /**********************************************************************************************
655  *
656  * This function is used to set the status of CLI services feature.
657  *
658  * @param       CliType[IN] of type TelSsCliType_t which specifies the CLI service .
659  * @return      enum type TapiResult_t Specifies the API's Return result.
660  * @remark
661  *
662  ***********************************************************************************************/
663 EXPORT_API int tel_set_ss_cli_status(TapiHandle *handle, TelSsCliType_t type, TelSsCliStatus_t status, tapi_response_cb callback, void *user_data)
664 {
665         struct tapi_resp_data *evt_cb_data = 0;
666         GVariant *param = 0;
667
668         dbg("Func Entrance ");
669
670         TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
671         TAPI_RET_ERR_NUM_IF_FAIL(callback, TAPI_API_INVALID_PTR);
672
673         MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
674
675         param = g_variant_new("(ii)", type, status);
676
677         g_dbus_connection_call(handle->dbus_connection,
678                         DBUS_TELEPHONY_SERVICE, handle->path, DBUS_TELEPHONY_SS_INTERFACE,
679                         "SetCLIStatus", param, 0,
680                         G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca,
681                         on_response_set_ss_cli_status, evt_cb_data );
682
683         return TAPI_API_SUCCESS;
684 }
685
686 /**********************************************************************************************
687  *
688  * This function is used to interrogate the status of CLI services feature.
689  *
690  * @param       CliType[IN] of type TelSsCliType_t which specifies the CLI service .
691  * @return      enum type TapiResult_t Specifies the API's Return result.
692  * @remark
693  *
694  ***********************************************************************************************/
695 EXPORT_API int tel_get_ss_cli_status(TapiHandle *handle, TelSsCliType_t type, tapi_response_cb callback, void *user_data)
696 {
697         struct tapi_resp_data *evt_cb_data = 0;
698         GVariant *param = 0;
699
700         dbg("Func Entrance ");
701
702         TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
703         TAPI_RET_ERR_NUM_IF_FAIL(callback, TAPI_API_INVALID_PTR);
704
705         MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
706
707         param = g_variant_new("(i)", type);
708
709         g_dbus_connection_call(handle->dbus_connection,
710                         DBUS_TELEPHONY_SERVICE, handle->path, DBUS_TELEPHONY_SS_INTERFACE,
711                         "GetCLIStatus", param, 0,
712                         G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca,
713                         on_response_get_ss_cli_status, evt_cb_data );
714
715         return TAPI_API_SUCCESS;
716 }
717
718 /**********************************************************************************************
719  *
720  * This function is used to send a USSD string and also the User response for a NW intiated USSD.
721  *
722  * @param       pAppMsg[IN] of type TelSsUssdMsgInfo_t which specifies the USSD String,length of the string, format of the string.
723  * @return      enum type TapiResult_t Specifies the API's Return result.
724  * @remark      TelSsUssdMsgInfo_t ->IndType is not used while calling this function, This is used for sending the response.
725  *                      Limo standard defines only one structure for Request and response.
726  *
727  ***********************************************************************************************/
728 EXPORT_API int tel_send_ss_ussd_request(TapiHandle *handle, const TelSsUssdMsgInfo_t *info, tapi_response_cb callback, void *user_data)
729 {
730         struct tapi_resp_data *evt_cb_data = 0;
731         GVariant *param = 0;
732
733         dbg("Func Entrance ");
734
735         TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
736         TAPI_RET_ERR_NUM_IF_FAIL(info, TAPI_API_INVALID_PTR);
737
738         MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
739
740         param = g_variant_new("(iiis)", info->Type, info->Dcs, info->Length, info->szString);
741
742         g_dbus_connection_call(handle->dbus_connection,
743                         DBUS_TELEPHONY_SERVICE, handle->path, DBUS_TELEPHONY_SS_INTERFACE,
744                         "SendUSSD", param, 0,
745                         G_DBUS_CALL_FLAGS_NONE, G_MAXINT, handle->ca,
746                         on_response_send_ss_ussd_request, evt_cb_data );
747
748         return TAPI_API_SUCCESS;
749 }
750
751 /**********************************************************************************************
752  *
753  * This function is used to Sets AOC information.
754  *
755  * @param       AocType[IN] of type TelSsAocType_t which specifies the which AOC type to read.
756  * @return      enum type TapiResult_t Specifies the API's Return result.
757  * @remark
758  *
759  ***********************************************************************************************/
760 EXPORT_API int tel_get_ss_aoc_info(TapiHandle *handle, TelSsAocType_t AocType, tapi_response_cb callback, void *user_data)
761 {
762         return 0;
763 }
764
765 /**********************************************************************************************
766  *
767  * This function is used to Sets AOC information.
768  *
769  * @param       AocSetInfo[IN] of type TelCallAocInfo_t which specifies the AOC info parameters .
770  * @return      enum type TapiResult_t Specifies the API's Return result.
771  * @remark
772  *
773  ***********************************************************************************************/
774 EXPORT_API int tel_set_ss_aoc_info(TapiHandle *handle, TelCallAocInfo_t *AocSetInfo, tapi_response_cb callback, void *user_data)
775 {
776         return 0;
777 }
778
779 /*      EOF  */