4 * Copyright (c) 2014 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"
32 #include "tapi_private.h"
34 extern TelSatEventDownloadType_t g_event_list[TAPI_SAT_EVENT_LIST_MAX_COUNT];
37 static GVariant *_tapi_sat_gen_app_exec_result_data(TelSatAppsRetInfo_t *result_info)
39 GVariant *result = NULL;
41 switch (result_info->commandType) {
42 case TAPI_SAT_CMD_TYPE_SETUP_MENU: {
44 dbg("setup menu : result format (i)");
46 exec_result = result_info->appsRet.setupMenu.resp;
47 result = g_variant_new("(i)", exec_result);
51 case TAPI_SAT_CMD_TYPE_REFRESH: {
52 gint app_type, exec_result;
53 dbg("refresh : result format (ii)");
55 app_type = result_info->appsRet.refresh.appType;
56 exec_result = result_info->appsRet.refresh.resp;
57 result = g_variant_new("(ii)", app_type, exec_result);
61 case TAPI_SAT_CMD_TYPE_SETUP_CALL: {
62 gint exec_result, me_problem, call_ctrl_problem, call_cause;
63 dbg("setup call : result format (iiii)");
65 exec_result = result_info->appsRet.setupCall.resp;
66 me_problem = result_info->appsRet.setupCall.meProblem;
67 call_ctrl_problem = result_info->appsRet.setupCall.permanentCallCtrlProblem;
68 call_cause = result_info->appsRet.setupCall.tapiCause;
69 result = g_variant_new("(iiii)", exec_result, me_problem, call_ctrl_problem, call_cause);
73 case TAPI_SAT_CMD_TYPE_SEND_SS: {
75 gint exec_result, me_problem, ss_cause, call_ctrl_problem, ss_str_len;
76 GVariantBuilder builder;
77 GVariant *ss_str = NULL;
78 dbg("send ss : result format (iiivii)");
80 exec_result = result_info->appsRet.sendSs.resp;
81 me_problem = result_info->appsRet.sendSs.meProblem;
82 ss_cause = result_info->appsRet.sendSs.ssCause;
83 call_ctrl_problem = result_info->appsRet.sendSs.additionalCallCtrlProblemInfo;
84 ss_str_len = result_info->appsRet.sendSs.ssString.stringLen;
86 g_variant_builder_init(&builder, G_VARIANT_TYPE("ay"));
87 for (ss_index = 0; ss_index < ss_str_len; ss_index++) {
88 dbg("index(%d) data(%d)", ss_index, result_info->appsRet.sendSs.ssString.string[ss_index]);
89 g_variant_builder_add(&builder, "y", result_info->appsRet.sendSs.ssString.string[ss_index]);
91 ss_str = g_variant_builder_end(&builder);
93 result = g_variant_new("(iiivii)", exec_result, me_problem, ss_cause, ss_str, ss_str_len, call_ctrl_problem);
97 case TAPI_SAT_CMD_TYPE_SEND_USSD: {
99 gint exec_result, me_problem, ss_cause, ussd_str_len;
100 GVariantBuilder builder;
101 GVariant *ussd_str = NULL;
103 dbg("send ussd : result format (iiivi)");
105 exec_result = result_info->appsRet.sendUssd.resp;
106 me_problem = result_info->appsRet.sendUssd.meProblem;
107 ss_cause = result_info->appsRet.sendUssd.ssCause;
108 ussd_str_len = result_info->appsRet.sendUssd.ussdString.stringLen;
110 g_variant_builder_init(&builder, G_VARIANT_TYPE("ay"));
111 for (ussd_index = 0; ussd_index < ussd_str_len; ussd_index++) {
112 dbg("index(%d) data(%d)", ussd_index, result_info->appsRet.sendUssd.ussdString.string[ussd_index]);
113 g_variant_builder_add(&builder, "y", result_info->appsRet.sendUssd.ussdString.string[ussd_index]);
115 ussd_str = g_variant_builder_end(&builder);
117 result = g_variant_new("(iiivi)", exec_result, me_problem, ss_cause, ussd_str, ussd_str_len);
121 case TAPI_SAT_CMD_TYPE_SEND_SMS: {
123 dbg("send sms: result format (i)");
125 exec_result = result_info->appsRet.sendSms.resp;
126 result = g_variant_new("(i)", exec_result);
130 case TAPI_SAT_CMD_TYPE_SEND_DTMF: {
132 dbg("send DTMF: result format (i)");
134 exec_result = result_info->appsRet.sendDtmf.resp;
135 result = g_variant_new("(i)", exec_result);
139 case TAPI_SAT_CMD_TYPE_LAUNCH_BROWSER: {
140 gint exec_result, browser_problem;
141 dbg("launch browser: result format (ii)");
143 exec_result = result_info->appsRet.launchBrowser.resp;
144 browser_problem = result_info->appsRet.launchBrowser.browserProblem;
145 result = g_variant_new("(ii)", exec_result, browser_problem);
149 case TAPI_SAT_CMD_TYPE_SETUP_IDLE_MODE_TEXT: {
151 dbg("setup idle mode text: result format (i)");
153 exec_result = result_info->appsRet.setupIdleModeText.resp;
154 result = g_variant_new("(i)", exec_result);
156 case TAPI_SAT_CMD_TYPE_LANGUAGE_NOTIFICATION: {
158 dbg("language notification: result format (i)");
160 exec_result = result_info->appsRet.languageNoti.resp;
161 result = g_variant_new("(i)", exec_result);
165 case TAPI_SAT_CMD_TYPE_PROVIDE_LOCAL_INFO: {
167 dbg("provide local info: result format (i)");
169 exec_result = result_info->appsRet.provideLocalInfo.resp;
170 result = g_variant_new("(i)", exec_result);
174 case TAPI_SAT_CMD_TYPE_PLAY_TONE: {
176 dbg("play tone: result format (i)");
178 exec_result = result_info->appsRet.playTone.resp;
179 result = g_variant_new("(i)", exec_result);
183 case TAPI_SAT_CMD_TYPE_DISPLAY_TEXT: {
184 gint exec_result, me_problem;
185 dbg("display text: result format (ii)");
187 exec_result = result_info->appsRet.displayText.resp;
188 me_problem = result_info->appsRet.displayText.meProblem;
189 result = g_variant_new("(ii)", exec_result, me_problem);
194 dbg("unhandled command type(0x%x", result_info->commandType);
195 result = g_variant_new("()");
202 static GVariant *_tapi_sat_gen_event_download_data(const TelSatEventDownloadReqInfo_t *pEventData)
204 GVariant *result = NULL;
206 switch (pEventData->eventDownloadType) {
207 case TAPI_EVENT_SAT_DW_TYPE_IDLE_SCREEN_AVAILABLE: {
208 gboolean idle_screen;
209 dbg("idle screen available (%d)", pEventData->u.bIdleScreenAvailable);
211 idle_screen = pEventData->u.bIdleScreenAvailable;
212 result = g_variant_new("(b)", idle_screen);
216 case TAPI_EVENT_SAT_DW_TYPE_LANGUAGE_SELECTION: {
217 gint selected_language;
218 dbg("selected language (%d)", pEventData->u.languageSelectionEventReqInfo.language);
220 selected_language = pEventData->u.languageSelectionEventReqInfo.language;
221 result = g_variant_new("(i)", selected_language);
225 case TAPI_EVENT_SAT_DW_TYPE_BROWSER_TERMINATION: {
226 gint browser_termination_cause;
227 dbg("Cause of browser termination (%d)", pEventData->u.browserTerminationEventReqInfo.browserTerminationCause);
229 browser_termination_cause = pEventData->u.browserTerminationEventReqInfo.browserTerminationCause;
230 result = g_variant_new("(i)", browser_termination_cause);
234 case TAPI_EVENT_SAT_DW_TYPE_DATA_AVAILABLE: {
235 result = g_variant_new("(yiiy)",
236 pEventData->u.dataAvailableEventReqInfo.channelStatus.channelId,
237 pEventData->u.dataAvailableEventReqInfo.channelStatus.status,
238 pEventData->u.dataAvailableEventReqInfo.channelStatus.channelInfo,
239 pEventData->u.dataAvailableEventReqInfo.channelDataLen.channelDataLen);
242 case TAPI_EVENT_SAT_DW_TYPE_CHANNEL_STATUS: {
243 result = g_variant_new("(yii)",
244 pEventData->u.dataAvailableEventReqInfo.channelStatus.channelId,
245 pEventData->u.dataAvailableEventReqInfo.channelStatus.status,
246 pEventData->u.dataAvailableEventReqInfo.channelStatus.channelInfo);
250 dbg("not support download event (%d)", pEventData->eventDownloadType);
251 result = g_variant_new("()");
258 static void on_response_menu_selection_envelop(GObject *source_object, GAsyncResult *res, gpointer user_data)
260 GError *error = NULL;
261 GDBusConnection *conn = NULL;
263 GVariant *dbus_result;
264 struct tapi_resp_data *evt_cb_data = user_data;
269 conn = G_DBUS_CONNECTION(source_object);
270 dbus_result = g_dbus_connection_call_finish(conn, res, &error);
271 TAPI_RESP_CHECK_ERROR(error, evt_cb_data);
273 g_variant_get(dbus_result, "(ii)", &result, &envelop_rsp);
274 dbg("menu selection envelop result(%d) envelop response(%d)", result, envelop_rsp);
276 TAPI_INVOKE_RESP_CALLBACK(evt_cb_data, result, &envelop_rsp);
278 g_variant_unref(dbus_result);
282 static void on_response_download_event_envelop(GObject *source_object, GAsyncResult *res, gpointer user_data)
284 GError *error = NULL;
285 GDBusConnection *conn = NULL;
287 GVariant *dbus_result;
288 struct tapi_resp_data *evt_cb_data = user_data;
293 conn = G_DBUS_CONNECTION(source_object);
294 dbus_result = g_dbus_connection_call_finish(conn, res, &error);
295 TAPI_RESP_CHECK_ERROR(error, evt_cb_data);
297 g_variant_get(dbus_result, "(ii)", &result, &envelop_rsp);
298 dbg("download event envelop result(%d) envelop response(%d)", result, envelop_rsp);
300 TAPI_INVOKE_RESP_CALLBACK(evt_cb_data, result, &envelop_rsp);
302 g_variant_unref(dbus_result);
309 * To send envelope command (MENU SELECTION) to USIM.
311 * @return values in enum TapiResult_t.
312 * @param[in] TelSatMenuSelectionReqInfo_t menu selection evelope data.
313 * @Interface Asynchronous.
315 * @Refer TelSatMenuSelectionReqInfo_t
318 EXPORT_API int tel_select_sat_menu(TapiHandle *handle, const TelSatMenuSelectionReqInfo_t *pMenuSelect, tapi_response_cb callback, void *user_data)
322 GVariant *inparam = NULL;
323 struct tapi_resp_data *evt_cb_data = NULL;
325 dbg("Func Entrance ");
327 TAPI_RET_ERR_NUM_IF_NOT_SUPPORTED(TELEPHONY_FEATURE);
328 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
329 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
330 TAPI_RET_ERR_NUM_IF_FAIL(pMenuSelect, TAPI_API_INVALID_PTR);
332 /* LCOV_EXCL_START */
333 TAPI_MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
335 item_id = pMenuSelect->itemIdentifier;
336 help_req = ((pMenuSelect->bIsHelpRequested != 0) ? TRUE : FALSE);
337 dbg("item id(%d) help request(%d)", item_id, help_req);
338 inparam = g_variant_new("(ib)", item_id, help_req);
340 g_dbus_connection_call(handle->dbus_connection, DBUS_TELEPHONY_SERVICE, handle->path,
341 DBUS_TELEPHONY_SAT_INTERFACE, "SelectMenu", inparam, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT,
342 handle->ca, on_response_menu_selection_envelop, evt_cb_data);
344 return TAPI_API_SUCCESS;
350 * API to send event download to SIM.
352 * @return values in enum TapiResult_t.
353 * @param[in] TelSatEventDownloadReqInfo_t event download data.
354 * @Interface Asynchronous.
356 * @Refer TelSatEventDownloadReqInfo_t
358 EXPORT_API int tel_download_sat_event(TapiHandle *handle, const TelSatEventDownloadReqInfo_t *pEventData, tapi_response_cb callback, void *user_data)
360 gboolean evt_check = FALSE;
362 gint event_download_type, src_dev, dest_dev;
363 GVariant *download_data = NULL;
365 GVariant *inparam = NULL;
366 struct tapi_resp_data *evt_cb_data = NULL;
368 dbg("Func Entrance ");
370 TAPI_RET_ERR_NUM_IF_NOT_SUPPORTED(TELEPHONY_FEATURE);
371 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
372 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
373 TAPI_RET_ERR_NUM_IF_FAIL(pEventData, TAPI_API_INVALID_PTR);
375 /* LCOV_EXCL_START */
376 for (g_index = 0; g_event_list[g_index] > 0; g_index++) {
377 if (pEventData->eventDownloadType == TAPI_EVENT_SAT_DW_TYPE_BROWSER_TERMINATION
378 || pEventData->eventDownloadType == TAPI_EVENT_SAT_DW_TYPE_DATA_AVAILABLE
379 || pEventData->eventDownloadType == TAPI_EVENT_SAT_DW_TYPE_CHANNEL_STATUS
380 || g_event_list[g_index] == pEventData->eventDownloadType) {
381 dbg("event (%d) shoud be passed to sim", pEventData->eventDownloadType);
387 dbg("sim does not request event(%d)", pEventData->eventDownloadType);
388 return TAPI_API_SAT_EVENT_NOT_REQUIRED_BY_USIM;
391 event_download_type = pEventData->eventDownloadType;
392 src_dev = TAPI_SAT_DEVICE_ID_ME;
393 dest_dev = TAPI_SAT_DEVICE_ID_SIM;
394 download_data = _tapi_sat_gen_event_download_data(pEventData);
395 TAPI_RET_ERR_NUM_IF_FAIL(download_data, TAPI_API_INVALID_PTR);
397 TAPI_MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
399 dbg("event type(%d)", event_download_type);
400 inparam = g_variant_new("(iiiv)", event_download_type, src_dev, dest_dev, download_data);
402 g_dbus_connection_call(handle->dbus_connection, DBUS_TELEPHONY_SERVICE, handle->path,
403 DBUS_TELEPHONY_SAT_INTERFACE, "DownloadEvent", inparam, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT,
404 handle->ca, on_response_download_event_envelop, evt_cb_data);
406 return TAPI_API_SUCCESS;
412 * API to get main menu information.
414 * @return values in enum TapiResult_t.
415 * @param[out] TelSatSetupMenuInfo_t main menu data.
416 * @Interface Synchronous.
418 * @Refer TelSatSetupMenuInfo_t
420 EXPORT_API int tel_get_sat_main_menu_info(TapiHandle *handle, TelSatSetupMenuInfo_t *pMainMenu)
423 GVariant *rst = NULL;
426 gint result, command_id, item_cnt;
427 gboolean b_present, b_helpinfo, b_updated;
428 GVariant *items = NULL;
431 dbg("Func Entrance ");
433 TAPI_RET_ERR_NUM_IF_NOT_SUPPORTED(TELEPHONY_FEATURE);
434 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
435 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
436 TAPI_RET_ERR_NUM_IF_FAIL(pMainMenu, TAPI_API_INVALID_PTR);
438 /* LCOV_EXCL_START */
439 memset(pMainMenu, 0, sizeof(TelSatSetupMenuInfo_t));
442 rst = g_dbus_connection_call_sync(handle->dbus_connection, DBUS_TELEPHONY_SERVICE , handle->path,
443 DBUS_TELEPHONY_SAT_INTERFACE, "GetMainMenuInfo", NULL, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca, &error);
447 dbg("error to get main menu(%s)", error->message);
450 return TAPI_API_OPERATION_FAILED;
453 dbg("menu_info type_format(%s)", g_variant_get_type_string(rst));
455 g_variant_get(rst, "(iibs@vibb)", &result, &command_id, &b_present, &title, &items, &item_cnt,
456 &b_helpinfo, &b_updated);
458 g_variant_unref(rst);
460 pMainMenu->commandId = command_id;
461 pMainMenu->bIsMainMenuPresent = (b_present ? 1 : 0);
462 snprintf(pMainMenu->satMainTitle, TAPI_SAT_DEF_TITLE_LEN_MAX + 1, "%s", title);
465 pMainMenu->satMainMenuNum = item_cnt;
466 if (items && item_cnt > 0) {
472 unbox = g_variant_get_variant(items);
473 dbg("items(%p) items type_format(%s)", items, g_variant_get_type_string(unbox));
475 g_variant_get(unbox, "a(si)", &iter);
476 while (g_variant_iter_loop(iter, "(si)", &item_str, &item_id)) {
477 pMainMenu->satMainMenuItem[sat_index].itemId = item_id;
478 snprintf(pMainMenu->satMainMenuItem[sat_index].itemString, TAPI_SAT_DEF_ITEM_STR_LEN_MAX + 6, "%s", item_str);
479 dbg("item index(%d) id(%d) str(%s)", sat_index, pMainMenu->satMainMenuItem[sat_index].itemId, pMainMenu->satMainMenuItem[sat_index].itemString);
482 g_variant_iter_free(iter);
484 pMainMenu->bIsSatMainMenuHelpInfo = (b_helpinfo ? 1 : 0);
485 pMainMenu->bIsUpdatedSatMainMenu = (b_updated ? 1 : 0);
487 dbg("result (%d)", result);
488 dbg("command id (%d)", pMainMenu->commandId);
489 dbg("menu present (%d)", pMainMenu->bIsMainMenuPresent);
490 dbg("menu title (%s)", pMainMenu->satMainTitle);
491 dbg("item cnt (%d)", pMainMenu->satMainMenuNum);
492 dbg("menu help info (%d)", pMainMenu->bIsSatMainMenuHelpInfo);
493 dbg("menu updated (%d)", pMainMenu->bIsUpdatedSatMainMenu);
495 return TAPI_API_SUCCESS;
501 * API to send UI display status.
503 * @return values in enum TapiResult_t.
504 * @param[in] TelSatUiDisplayStatusType_t display status data.
505 command_id command identifier
506 * @Interface Asynchronous.
508 * @Refer TelSatUiDisplayStatusType_t
510 EXPORT_API int tel_send_sat_ui_display_status(TapiHandle *handle, int commandId, TelSatUiDisplayStatusType_t status)
513 GVariant *rst = NULL;
515 gint result, command_id;
516 gboolean display_status;
517 GVariant *inparam = NULL;
519 dbg("Func Entrance ");
521 TAPI_RET_ERR_NUM_IF_NOT_SUPPORTED(TELEPHONY_FEATURE);
522 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
523 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
525 /* LCOV_EXCL_START */
526 command_id = commandId;
527 display_status = ((status == TAPI_SAT_DISPLAY_SUCCESS) ? TRUE : FALSE);
528 dbg("command id(%d) display status(%d)", command_id, display_status);
529 inparam = g_variant_new("(ib)", command_id, display_status);
532 rst = g_dbus_connection_call_sync(handle->dbus_connection, DBUS_TELEPHONY_SERVICE , handle->path,
533 DBUS_TELEPHONY_SAT_INTERFACE, "SendUiDisplayStatus", inparam, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca, &error);
537 dbg("error to send ui display status(%s)", error->message);
540 return TAPI_API_OPERATION_FAILED;
543 dbg("send ui display status format(%s)", g_variant_get_type_string(rst));
545 g_variant_get(rst, "(i)", &result);
547 result = TAPI_API_SUCCESS;
549 result = TAPI_API_OPERATION_FAILED;
551 g_variant_unref(rst);
552 dbg("result (%d)", result);
560 * API to send UI user confirmation data.
562 * @return values in enum TapiResult_t.
563 * @param[in] command_id command identifier
564 command_type command type
565 key_type user confirmation value
566 addtional_data addtional data
568 * @Interface Asynchronous.
572 EXPORT_API int tel_send_sat_ui_user_confirm(TapiHandle *handle, TelSatUiUserConfirmInfo_t *pUserConfirmData)
575 GVariant *rst = NULL;
576 GVariantBuilder builder;
577 GVariant *inner_gv = NULL;
581 gint result, command_id, command_type, key_type, data_len;
582 GVariant *inparam = NULL;
584 dbg("Func Entrance ");
586 TAPI_RET_ERR_NUM_IF_NOT_SUPPORTED(TELEPHONY_FEATURE);
587 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
588 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
589 TAPI_RET_ERR_NUM_IF_FAIL(pUserConfirmData, TAPI_API_INVALID_PTR);
591 /* LCOV_EXCL_START */
592 command_id = pUserConfirmData->commandId;
593 command_type = pUserConfirmData->commandType;
594 key_type = pUserConfirmData->keyType;
595 data = (gchar *)pUserConfirmData->pAdditionalData;
596 data_len = pUserConfirmData->dataLen;
598 g_variant_builder_init(&builder, G_VARIANT_TYPE("ay"));
599 for (sat_index = 0; sat_index < data_len; sat_index++) {
600 dbg("index(%d) data(%d)", sat_index, data[sat_index]);
601 g_variant_builder_add(&builder, "y", data[sat_index]);
603 inner_gv = g_variant_builder_end(&builder);
605 dbg("command id(%d) command type(%d) key type(%d) data len(%d)",
606 command_id, command_type, key_type, data_len);
607 inparam = g_variant_new("(iiiv)", command_id, command_type, key_type, inner_gv);
610 rst = g_dbus_connection_call_sync(handle->dbus_connection, DBUS_TELEPHONY_SERVICE , handle->path,
611 DBUS_TELEPHONY_SAT_INTERFACE, "SendUserConfirm", inparam, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca, &error);
615 dbg("error to send ui user confirm(%s)", error->message);
618 return TAPI_API_OPERATION_FAILED;
621 dbg("send ui user confirm format(%s)", g_variant_get_type_string(rst));
623 g_variant_get(rst, "(i)", &result);
625 result = TAPI_API_SUCCESS;
627 result = TAPI_API_OPERATION_FAILED;
629 g_variant_unref(rst);
630 dbg("result (%d)", result);
638 * API to send application excution result.
640 * @return values in enum TapiResult_t.
641 * @param[in] TelSatAppsRetInfo_t application result information data.
642 * @Interface Asynchronous.
644 * @Refer TelSatAppsRetInfo_t
646 EXPORT_API int tel_send_sat_app_exec_result(TapiHandle *handle, TelSatAppsRetInfo_t *pAppRetInfo)
649 GVariant *rst = NULL;
651 gint result, command_id, command_type;
652 GVariant *app_exec_result = NULL;
653 GVariant *inparam = NULL;
655 dbg("Func Entrance ");
657 TAPI_RET_ERR_NUM_IF_NOT_SUPPORTED(TELEPHONY_FEATURE);
658 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
659 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
660 TAPI_RET_ERR_NUM_IF_FAIL(pAppRetInfo, TAPI_API_INVALID_PTR);
662 /* LCOV_EXCL_START */
663 command_id = pAppRetInfo->commandId;
664 command_type = pAppRetInfo->commandType;
665 app_exec_result = _tapi_sat_gen_app_exec_result_data(pAppRetInfo);
666 TAPI_RET_ERR_NUM_IF_FAIL(app_exec_result, TAPI_API_INVALID_PTR);
668 dbg("command id(%d) command type(%d) exec_result(%s)", command_id, command_type, g_variant_get_type_string(app_exec_result));
669 inparam = g_variant_new("(iiv)", command_id, command_type, app_exec_result);
672 dbg("test (%s)", g_variant_get_type_string(inparam));
673 rst = g_dbus_connection_call_sync(handle->dbus_connection, DBUS_TELEPHONY_SERVICE , handle->path,
674 DBUS_TELEPHONY_SAT_INTERFACE, "SendAppExecResult", inparam, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca, &error);
678 dbg("error to send app execution result(%s)", error->message);
681 return TAPI_API_OPERATION_FAILED;
684 dbg("send app execution result format(%s)", g_variant_get_type_string(rst));
686 g_variant_get(rst, "(i)", &result);
688 result = TAPI_API_SUCCESS;
690 result = TAPI_API_OPERATION_FAILED;
692 g_variant_unref(rst);
693 dbg("result (%d)", result);