4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Ja-young Gu <jygu@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
25 #include "tapi_common.h"
26 #include "TapiUtility.h"
33 extern TelSatEventDownloadType_t g_event_list[TAPI_SAT_EVENT_LIST_MAX_COUNT];
35 static GVariant* _tapi_sat_gen_app_exec_result_data(TelSatAppsRetInfo_t *result_info)
37 GVariant *result = NULL;
39 switch(result_info->commandType)
41 case TAPI_SAT_CMD_TYPE_SETUP_MENU:{
43 dbg("setup menu : result format (i)");
45 exec_result = result_info->appsRet.setupMenu.resp;
46 result = g_variant_new("(i)", exec_result);
48 case TAPI_SAT_CMD_TYPE_REFRESH:{
49 gint app_type, exec_result;
50 dbg("refresh : result format (ii)");
52 app_type = result_info->appsRet.refresh.appType;
53 exec_result = result_info->appsRet.refresh.resp;
54 result = g_variant_new("(ii)", app_type, exec_result);
56 case TAPI_SAT_CMD_TYPE_SETUP_CALL:{
57 gint exec_result, me_problem, call_ctrl_problem, call_cause;
58 dbg("setup call : result format (iiii)");
60 exec_result = result_info->appsRet.setupCall.resp;
61 me_problem = result_info->appsRet.setupCall.meProblem;
62 call_ctrl_problem = result_info->appsRet.setupCall.permanentCallCtrlProblem;
63 call_cause = result_info->appsRet.setupCall.tapiCause;
64 result = g_variant_new("(iiii)", exec_result, me_problem, call_ctrl_problem, call_cause);
66 case TAPI_SAT_CMD_TYPE_SEND_SS:{
68 gint exec_result, me_problem, ss_cause, call_ctrl_problem, ss_str_len;
69 GVariantBuilder *builder = NULL;
70 GVariant *ss_str = NULL;
71 dbg("send ss : result format (iiivii)");
73 exec_result = result_info->appsRet.sendSs.resp;
74 me_problem = result_info->appsRet.sendSs.meProblem;
75 ss_cause = result_info->appsRet.sendSs.ssCause;
76 call_ctrl_problem = result_info->appsRet.sendSs.additionalCallCtrlProblemInfo;
77 ss_str_len = result_info->appsRet.sendSs.ssString.stringLen;
79 builder = g_variant_builder_new(G_VARIANT_TYPE ("ay"));
80 for (index = 0; index < ss_str_len; index++) {
81 dbg("index(%d) data(%d)", index, result_info->appsRet.sendSs.ssString.string[index]);
82 g_variant_builder_add(builder, "y", result_info->appsRet.sendSs.ssString.string[index]);
84 ss_str = g_variant_builder_end(builder);
86 result = g_variant_new("(iiivii)", exec_result, me_problem, ss_cause, ss_str, ss_str_len, call_ctrl_problem);
88 case TAPI_SAT_CMD_TYPE_SEND_USSD:{
90 gint exec_result, me_problem, ss_cause, ussd_str_len;
91 GVariantBuilder *builder = NULL;
92 GVariant *ussd_str = NULL;
94 dbg("send ussd : result format (iiivi)");
96 exec_result = result_info->appsRet.sendUssd.resp;
97 me_problem = result_info->appsRet.sendUssd.meProblem;
98 ss_cause = result_info->appsRet.sendUssd.ssCause;
99 ussd_str_len = result_info->appsRet.sendUssd.ussdString.stringLen;
101 builder = g_variant_builder_new(G_VARIANT_TYPE ("ay"));
102 for (index = 0; index < ussd_str_len; index++) {
103 dbg("index(%d) data(%d)", index, result_info->appsRet.sendUssd.ussdString.string[index]);
104 g_variant_builder_add(builder, "y", result_info->appsRet.sendUssd.ussdString.string[index]);
106 ussd_str = g_variant_builder_end(builder);
108 result = g_variant_new("(iiivi)", exec_result, me_problem, ss_cause, ussd_str, ussd_str_len);
110 case TAPI_SAT_CMD_TYPE_SEND_SMS:{
112 dbg("send sms: result format (i)");
114 exec_result = result_info->appsRet.sendSms.resp;
115 result = g_variant_new("(i)", exec_result);
117 case TAPI_SAT_CMD_TYPE_SEND_DTMF:{
119 dbg("send DTMF: result format (i)");
121 exec_result = result_info->appsRet.sendDtmf.resp;
122 result = g_variant_new("(i)", exec_result);
124 case TAPI_SAT_CMD_TYPE_LAUNCH_BROWSER:{
125 gint exec_result, browser_problem;
126 dbg("launch browser: result format (ii)");
128 exec_result = result_info->appsRet.launchBrowser.resp;
129 browser_problem = result_info->appsRet.launchBrowser.browserProblem;
130 result = g_variant_new("(ii)", exec_result, browser_problem);
132 case TAPI_SAT_CMD_TYPE_SETUP_IDLE_MODE_TEXT:{
134 dbg("setup idle mode text: result format (i)");
136 exec_result = result_info->appsRet.setupIdleModeText.resp;
137 result = g_variant_new("(i)", exec_result);
139 case TAPI_SAT_CMD_TYPE_LANGUAGE_NOTIFICATION:{
141 dbg("language notification: result format (i)");
143 exec_result = result_info->appsRet.languageNoti.resp;
144 result = g_variant_new("(i)", exec_result);
146 case TAPI_SAT_CMD_TYPE_PROVIDE_LOCAL_INFO:{
148 dbg("provide local info: result format (i)");
150 exec_result = result_info->appsRet.provideLocalInfo.resp;
151 result = g_variant_new("(i)", exec_result);
153 case TAPI_SAT_CMD_TYPE_PLAY_TONE:{
155 dbg("play tone: result format (i)");
157 exec_result = result_info->appsRet.playTone.resp;
158 result = g_variant_new("(i)", exec_result);
160 case TAPI_SAT_CMD_TYPE_DISPLAY_TEXT:{
161 gint exec_result, me_problem;
162 dbg("display text: result format (ii)");
164 exec_result = result_info->appsRet.displayText.resp;
165 me_problem = result_info->appsRet.displayText.meProblem;
166 result = g_variant_new("(ii)", exec_result, me_problem);
169 dbg("unhandled command type(0x%x", result_info->commandType);
170 result = g_variant_new("()");
177 static GVariant* _tapi_sat_gen_event_download_data(const TelSatEventDownloadReqInfo_t *pEventData)
179 GVariant *result = NULL;
181 switch(pEventData->eventDownloadType)
183 case TAPI_EVENT_SAT_DW_TYPE_IDLE_SCREEN_AVAILABLE:{
184 gboolean idle_screen;
185 dbg("idle screen available (%d)", pEventData->u.bIdleScreenAvailable);
187 idle_screen = pEventData->u.bIdleScreenAvailable;
188 result = g_variant_new("(b)", idle_screen);
190 case TAPI_EVENT_SAT_DW_TYPE_LANGUAGE_SELECTION:{
191 gint selected_language;
192 dbg("selected language (%d)", pEventData->u.languageSelectionEventReqInfo.language);
194 selected_language = pEventData->u.languageSelectionEventReqInfo.language;
195 result = g_variant_new("(i)", selected_language);
197 case TAPI_EVENT_SAT_DW_TYPE_BROWSER_TERMINATION:{
198 gint browser_termination_cause;
199 dbg("Cause of browser termination (%d)", pEventData->u.browserTerminationEventReqInfo.browserTerminationCause);
201 browser_termination_cause = pEventData->u.browserTerminationEventReqInfo.browserTerminationCause;
202 result = g_variant_new("(i)", browser_termination_cause);
204 case TAPI_EVENT_SAT_DW_TYPE_DATA_AVAILABLE:
205 case TAPI_EVENT_SAT_DW_TYPE_CHANNEL_STATUS:
207 dbg("not support download event (%d)", pEventData->eventDownloadType);
208 result = g_variant_new("()");
215 static void on_response_menu_selection_envelop(GObject *source_object, GAsyncResult *res, gpointer user_data)
217 GError *error = NULL;
218 GDBusConnection *conn = NULL;
221 struct tapi_resp_data *evt_cb_data = user_data;
226 conn = G_DBUS_CONNECTION (source_object);
227 rst = g_dbus_connection_call_finish(conn, res, &error);
231 evt_cb_data->cb_fn(evt_cb_data->handle, result, &envelop_rsp, evt_cb_data->user_data);
233 g_error_free (error);
238 g_variant_get (rst, "(ii)", &result, &envelop_rsp);
239 dbg("menu selection envelop result(%d) envelop response(%d)", result, envelop_rsp);
241 if (evt_cb_data->cb_fn) {
242 evt_cb_data->cb_fn(evt_cb_data->handle, result, &envelop_rsp, evt_cb_data->user_data);
245 g_variant_unref(rst);
249 static void on_response_download_event_envelop(GObject *source_object, GAsyncResult *res, gpointer user_data)
251 GError *error = NULL;
252 GDBusConnection *conn = NULL;
255 struct tapi_resp_data *evt_cb_data = user_data;
260 conn = G_DBUS_CONNECTION (source_object);
261 rst = g_dbus_connection_call_finish(conn, res, &error);
265 evt_cb_data->cb_fn(evt_cb_data->handle, result, &envelop_rsp, evt_cb_data->user_data);
267 g_error_free (error);
272 g_variant_get (rst, "(ii)", &result, &envelop_rsp);
273 dbg("download event envelop result(%d) envelop response(%d)", result, envelop_rsp);
275 if (evt_cb_data->cb_fn) {
276 evt_cb_data->cb_fn(evt_cb_data->handle, result, &envelop_rsp, evt_cb_data->user_data);
279 g_variant_unref(rst);
285 * To send envelope command (MENU SELECTION) to USIM.
287 * @return values in enum TapiResult_t.
288 * @param[in] TelSatMenuSelectionReqInfo_t menu selection evelope data.
289 * @Interface Asynchronous.
291 * @Refer TelSatMenuSelectionReqInfo_t
294 EXPORT_API int tel_select_sat_menu(TapiHandle *handle, const TelSatMenuSelectionReqInfo_t *pMenuSelect, tapi_response_cb callback, void *user_data)
298 GVariant *inparam = NULL;
299 struct tapi_resp_data *evt_cb_data = NULL;
301 dbg("Func Entrance ");
303 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
304 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
305 TAPI_RET_ERR_NUM_IF_FAIL(pMenuSelect, TAPI_API_INVALID_PTR);
307 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
309 item_id = pMenuSelect->itemIdentifier;
310 help_req = ( (pMenuSelect->bIsHelpRequested != 0) ? TRUE : FALSE);
311 dbg("item id(%d) help request(%d)", item_id, help_req);
312 inparam = g_variant_new("(ib)", item_id, help_req);
314 g_dbus_connection_call(handle->dbus_connection, DBUS_TELEPHONY_SERVICE, handle->path,
315 DBUS_TELEPHONY_SAT_INTERFACE, "SelectMenu", inparam, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT,
316 handle->ca, on_response_menu_selection_envelop, evt_cb_data);
318 g_variant_unref(inparam);
320 return TAPI_API_SUCCESS;
325 * API to send event download to SIM.
327 * @return values in enum TapiResult_t.
328 * @param[in] TelSatEventDownloadReqInfo_t event download data.
329 * @Interface Asynchronous.
331 * @Refer TelSatEventDownloadReqInfo_t
333 EXPORT_API int tel_download_sat_event(TapiHandle *handle, const TelSatEventDownloadReqInfo_t *pEventData, tapi_response_cb callback, void *user_data)
335 gboolean evt_check = FALSE;
337 gint event_download_type, src_dev, dest_dev;
338 GVariant *download_data = NULL;
340 GVariant *inparam = NULL;
341 struct tapi_resp_data *evt_cb_data = NULL;
343 dbg("Func Entrance ");
345 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
346 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
347 TAPI_RET_ERR_NUM_IF_FAIL(pEventData, TAPI_API_INVALID_PTR);
349 for(g_index = 0; g_event_list[g_index] > 0; g_index++){
350 if(pEventData->eventDownloadType == TAPI_EVENT_SAT_DW_TYPE_BROWSER_TERMINATION || g_event_list[g_index] == pEventData->eventDownloadType ){
351 dbg("event (%d) shoud be passed to sim");
357 dbg("sim does not request event(%d)", pEventData->eventDownloadType);
358 return TAPI_API_SAT_EVENT_NOT_REQUIRED_BY_USIM;
361 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
363 event_download_type = pEventData->eventDownloadType;
364 src_dev = TAPI_SAT_DEVICE_ID_ME;
365 dest_dev = TAPI_SAT_DEVICE_ID_SIM;
366 download_data = _tapi_sat_gen_event_download_data(pEventData);
367 TAPI_RET_ERR_NUM_IF_FAIL(download_data, TAPI_API_INVALID_PTR);
369 dbg("event type(%d)", event_download_type);
370 inparam = g_variant_new("(iiiv)", event_download_type, src_dev, dest_dev, download_data);
372 g_dbus_connection_call(handle->dbus_connection, DBUS_TELEPHONY_SERVICE, handle->path,
373 DBUS_TELEPHONY_SAT_INTERFACE, "DownloadEvent", inparam, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT,
374 handle->ca, on_response_download_event_envelop, evt_cb_data);
376 g_variant_unref(inparam);
378 return TAPI_API_SUCCESS;
383 * API to get main menu information.
385 * @return values in enum TapiResult_t.
386 * @param[out] TelSatSetupMenuInfo_t main menu data.
387 * @Interface Synchronous.
389 * @Refer TelSatSetupMenuInfo_t
391 EXPORT_API int tel_get_sat_main_menu_info(TapiHandle *handle, TelSatSetupMenuInfo_t *pMainMenu)
394 GVariant *rst = NULL;
397 gint result, command_id, item_cnt;
398 gboolean b_present, b_helpinfo, b_updated;
399 GVariant *items = NULL;
400 #if defined(TIZEN_SUPPORT_SAT_ICON)
401 GVariant *icon_id = NULL;
402 GVariant *icon_list = NULL;
403 int index = 0, icon_index = 0;
404 /* Used to get icon data */
407 gint icon_quali, icon_identifier, width, height, ics, icon_data_len;
408 gchar *icon_data = NULL;
409 /* Used to get icon list data */
410 GVariant *unbox_list, *unbox_list_info ;
411 GVariantIter *iter, *iter2;
412 GVariant *icon_list_info;
413 gboolean is_list_exist;
414 gint icon_list_quali, list_cnt, icon_list_identifier, list_width, list_height, list_ics, icon_list_data_len;
415 gchar *icon_list_data = NULL;
419 dbg("Func Entrance ");
421 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
422 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
423 TAPI_RET_ERR_NUM_IF_FAIL(pMainMenu, TAPI_API_INVALID_PTR);
425 memset(pMainMenu, 0, sizeof(TelSatSetupMenuInfo_t));
428 rst = g_dbus_connection_call_sync(handle->dbus_connection, DBUS_TELEPHONY_SERVICE , handle->path,
429 DBUS_TELEPHONY_SAT_INTERFACE, "GetMainMenuInfo", NULL, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca, &error);
432 dbg( "error to get main menu(%s)", error->message);
433 g_error_free (error);
434 return TAPI_API_OPERATION_FAILED;
437 dbg("menu_info type_format(%s)", g_variant_get_type_string(rst));
439 #if defined(TIZEN_SUPPORT_SAT_ICON)
440 g_variant_get(rst, "(iibs@vibb@v@v)", &result, &command_id, &b_present, &title, &items, &item_cnt,
441 &b_helpinfo, &b_updated, &icon_id, &icon_list);
443 g_variant_get(rst, "(iibs@vibb)", &result, &command_id, &b_present, &title, &items, &item_cnt,
444 &b_helpinfo, &b_updated);
447 pMainMenu->commandId = command_id;
448 pMainMenu->bIsMainMenuPresent = (b_present ? 1 : 0);
450 if(strlen(title) > TAPI_SAT_DEF_TITLE_LEN_MAX+1){
451 memcpy(pMainMenu->satMainTitle, title, TAPI_SAT_DEF_TITLE_LEN_MAX+1);
454 memcpy(pMainMenu->satMainTitle, title, strlen(title));
457 pMainMenu->satMainMenuNum = item_cnt;
458 if(items && item_cnt > 0){
464 unbox = g_variant_get_variant(items);
465 dbg("items(%p) items type_format(%s)", items, g_variant_get_type_string(unbox));
467 g_variant_get(unbox, "a(si)", &iter);
468 while(g_variant_iter_loop(iter,"(si)",&item_str, &item_id)){
469 pMainMenu->satMainMenuItem[index].itemId = item_id;
471 if(strlen(item_str) > TAPI_SAT_DEF_ITEM_STR_LEN_MAX + 6){
472 memcpy(pMainMenu->satMainMenuItem[index].itemString, item_str, TAPI_SAT_DEF_ITEM_STR_LEN_MAX + 6);
475 memcpy(pMainMenu->satMainMenuItem[index].itemString, item_str, strlen(item_str));
478 dbg("item index(%d) id(%d) str(%s)",index, pMainMenu->satMainMenuItem[index].itemId, pMainMenu->satMainMenuItem[index].itemString);
479 //dbg("item index(%d) id(%d) str(%s)",index, item_id, item_str);
482 g_variant_iter_free(iter);
484 pMainMenu->bIsSatMainMenuHelpInfo = (b_helpinfo ? 1 : 0);
485 pMainMenu->bIsUpdatedSatMainMenu = (b_updated ? 1 : 0);
487 #if defined(TIZEN_SUPPORT_SAT_ICON)
489 unbox = g_variant_get_variant(icon_id);
490 g_variant_get(unbox, "a(biiiiiis)", &iter);
492 while(g_variant_iter_loop(iter,"(biiiiiis)", &is_exist, &icon_quali, &icon_identifier, &width, &height, &ics, &icon_data_len, &icon_data)){
495 pMainMenu->iconId.bIsPresent = is_exist;
496 pMainMenu->iconId.iconQualifier = icon_quali;
497 pMainMenu->iconId.iconIdentifier = icon_identifier;
498 pMainMenu->iconId.iconInfo.width = width;
499 pMainMenu->iconId.iconInfo.height = height;
500 pMainMenu->iconId.iconInfo.ics = ics;
501 if(icon_data_len > 0) {
502 pMainMenu->iconId.iconInfo.iconDataLen = icon_data_len;
503 memcpy(pMainMenu->iconId.iconInfo.iconFile, icon_data, icon_data_len);
505 dbg("icon exist(%d), icon_quali: (%d), icon_id: (%d), width: (%d), height: (%d), ics: (%d), icon_data_len: (%d)", pMainMenu->iconId.bIsPresent, pMainMenu->iconId.iconQualifier, pMainMenu->iconId.iconIdentifier, pMainMenu->iconId.iconInfo.width,
506 pMainMenu->iconId.iconInfo.height, pMainMenu->iconId.iconInfo.ics, pMainMenu->iconId.iconInfo.iconDataLen);
508 g_variant_iter_free(iter);
512 unbox_list = g_variant_get_variant(icon_list);
513 g_variant_get(unbox_list, "a(biiv)", &iter);
515 while(g_variant_iter_loop(iter,"(biiv)", &is_list_exist, &icon_list_quali, &list_cnt, &icon_list_info)){
518 pMainMenu->iconIdList.bIsPresent = is_list_exist;
519 pMainMenu->iconIdList.iconListQualifier = icon_list_quali;
520 pMainMenu->iconIdList.iconCount = list_cnt;
522 unbox_list_info = g_variant_get_variant(icon_list_info);
523 g_variant_get(unbox_list_info, "a(iiiiis)", &iter2);
525 while(g_variant_iter_loop(iter2,"(iiiiis)",&icon_list_identifier, &list_width, &list_height, &list_ics, &icon_list_data_len, &icon_list_data)){
526 pMainMenu->iconIdList.iconIdentifierList[icon_index]= icon_identifier;
527 pMainMenu->iconIdList.iconInfo[icon_index].width = list_width;
528 pMainMenu->iconIdList.iconInfo[icon_index].height = list_height;
529 pMainMenu->iconIdList.iconInfo[icon_index].ics = list_ics;
530 if(icon_list_data_len > 0) {
531 pMainMenu->iconIdList.iconInfo[icon_index].iconDataLen = icon_list_data_len;
532 memcpy(pMainMenu->iconIdList.iconInfo[icon_index].iconFile, icon_list_data, icon_list_data_len);
536 g_variant_iter_free(iter2);
538 g_variant_iter_free(iter);
541 dbg("result (%d)", result);
542 dbg("command id (%d)", pMainMenu->commandId);
543 dbg("menu present (%d)", pMainMenu->bIsMainMenuPresent);
544 dbg("menu title (%s)", pMainMenu->satMainTitle);
545 dbg("item cnt (%d)", pMainMenu->satMainMenuNum);
546 dbg("menu help info (%d)", pMainMenu->bIsSatMainMenuHelpInfo);
547 dbg("menu updated (%d)", pMainMenu->bIsUpdatedSatMainMenu);
549 return TAPI_API_SUCCESS;
554 * API to send UI display status.
556 * @return values in enum TapiResult_t.
557 * @param[in] TelSatUiDisplayStatusType_t display status data.
558 command_id command identifier
559 * @Interface Asynchronous.
561 * @Refer TelSatUiDisplayStatusType_t
563 EXPORT_API int tel_send_sat_ui_display_status(TapiHandle *handle, int commandId, TelSatUiDisplayStatusType_t status)
566 GVariant *rst = NULL;
568 gint result, command_id;
569 gboolean display_status;
570 GVariant *inparam = NULL;
572 dbg("Func Entrance ");
574 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
575 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
577 command_id = commandId;
578 display_status = ( (status == TAPI_SAT_DISPLAY_SUCCESS) ? TRUE : FALSE);
579 dbg("command id(%d) display status(%d)", command_id, display_status);
580 inparam = g_variant_new("(ib)", command_id, display_status);
583 rst = g_dbus_connection_call_sync(handle->dbus_connection, DBUS_TELEPHONY_SERVICE , handle->path,
584 DBUS_TELEPHONY_SAT_INTERFACE, "SendUiDisplayStatus", inparam, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca, &error);
587 dbg( "error to send ui display status(%s)", error->message);
588 g_error_free (error);
589 return TAPI_API_OPERATION_FAILED;
592 dbg("send ui display status format(%s)", g_variant_get_type_string(rst));
594 g_variant_get(rst, "(i)", &result);
596 result = TAPI_API_SUCCESS;
599 result = TAPI_API_OPERATION_FAILED;
601 dbg("result (%d)", result);
608 * API to send UI user confirmation data.
610 * @return values in enum TapiResult_t.
611 * @param[in] command_id command identifier
612 command_type command type
613 key_type user confirmation value
614 addtional_data addtional data
616 * @Interface Asynchronous.
620 EXPORT_API int tel_send_sat_ui_user_confirm(TapiHandle *handle, TelSatUiUserConfirmInfo_t *pUserConfirmData)
623 GVariant *rst = NULL;
624 GVariantBuilder *builder = NULL;
625 GVariant *inner_gv = NULL;
629 gint result, command_id, command_type, key_type, data_len;
630 GVariant *inparam = NULL;
632 dbg("Func Entrance ");
634 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
635 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
636 TAPI_RET_ERR_NUM_IF_FAIL(pUserConfirmData, TAPI_API_INVALID_PTR);
638 command_id = pUserConfirmData->commandId;
639 command_type = pUserConfirmData->commandType;
640 key_type = pUserConfirmData->keyType;
641 data = (gchar *)pUserConfirmData->pAdditionalData;
642 data_len = pUserConfirmData->dataLen;
644 builder = g_variant_builder_new(G_VARIANT_TYPE ("ay"));
645 for (index = 0; index < data_len; index++) {
646 dbg("index(%d) data(%d)", index, data[index]);
647 g_variant_builder_add(builder, "y", data[index]);
649 inner_gv = g_variant_builder_end(builder);
651 dbg("command id(%d) command type(%d) key type(%d) data len(%d)",
652 command_id, command_type, key_type, data_len);
653 inparam = g_variant_new("(iiiv)", command_id, command_type, key_type, inner_gv);
656 rst = g_dbus_connection_call_sync(handle->dbus_connection, DBUS_TELEPHONY_SERVICE , handle->path,
657 DBUS_TELEPHONY_SAT_INTERFACE, "SendUserConfirm", inparam, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca, &error);
660 dbg( "error to send ui user confirm(%s)", error->message);
661 g_error_free (error);
662 return TAPI_API_OPERATION_FAILED;
665 dbg("send ui user confirm format(%s)", g_variant_get_type_string(rst));
667 g_variant_get(rst, "(i)", &result);
669 result = TAPI_API_SUCCESS;
672 result = TAPI_API_OPERATION_FAILED;
674 dbg("result (%d)", result);
681 * API to send application excution result.
683 * @return values in enum TapiResult_t.
684 * @param[in] TelSatAppsRetInfo_t application result information data.
685 * @Interface Asynchronous.
687 * @Refer TelSatAppsRetInfo_t
689 EXPORT_API int tel_send_sat_app_exec_result(TapiHandle *handle, TelSatAppsRetInfo_t *pAppRetInfo)
692 GVariant *rst = NULL;
694 gint result, command_id, command_type;
695 GVariant *app_exec_result = NULL;
696 GVariant *inparam = NULL;
698 dbg("Func Entrance ");
700 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
701 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
702 TAPI_RET_ERR_NUM_IF_FAIL(pAppRetInfo, TAPI_API_INVALID_PTR);
704 command_id = pAppRetInfo->commandId;
705 command_type = pAppRetInfo->commandType;
706 app_exec_result = _tapi_sat_gen_app_exec_result_data(pAppRetInfo);
707 TAPI_RET_ERR_NUM_IF_FAIL(app_exec_result, TAPI_API_INVALID_PTR);
709 dbg("command id(%d) command type(%d) exec_result(%s)", command_id, command_type, g_variant_get_type_string(app_exec_result));
710 inparam = g_variant_new("(iiv)", command_id, command_type, app_exec_result);
713 dbg("test (%s)", g_variant_get_type_string(inparam));
714 rst = g_dbus_connection_call_sync(handle->dbus_connection, DBUS_TELEPHONY_SERVICE , handle->path,
715 DBUS_TELEPHONY_SAT_INTERFACE, "SendAppExecResult", inparam, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca, &error);
718 dbg( "error to send app execution result(%s)", error->message);
719 g_error_free (error);
720 return TAPI_API_OPERATION_FAILED;
723 dbg("send app execution result format(%s)", g_variant_get_type_string(rst));
725 g_variant_get(rst, "(i)", &result);
727 result = TAPI_API_SUCCESS;
730 result = TAPI_API_OPERATION_FAILED;
732 dbg("result (%d)", result);