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"
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;
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 g_variant_builder_init(&builder, G_VARIANT_TYPE ("ay"));
80 for (ss_index = 0; ss_index < ss_str_len; ss_index++) {
81 dbg("index(%d) data(%d)", ss_index, result_info->appsRet.sendSs.ssString.string[ss_index]);
82 g_variant_builder_add(&builder, "y", result_info->appsRet.sendSs.ssString.string[ss_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;
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 g_variant_builder_init(&builder, G_VARIANT_TYPE ("ay"));
102 for (ussd_index = 0; ussd_index < ussd_str_len; ussd_index++) {
103 dbg("index(%d) data(%d)", ussd_index, result_info->appsRet.sendUssd.ussdString.string[ussd_index]);
104 g_variant_builder_add(&builder, "y", result_info->appsRet.sendUssd.ussdString.string[ussd_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;
220 GVariant *dbus_result;
221 struct tapi_resp_data *evt_cb_data = user_data;
226 conn = G_DBUS_CONNECTION (source_object);
227 dbus_result = g_dbus_connection_call_finish(conn, res, &error);
230 g_variant_get (dbus_result, "(ii)", &result, &envelop_rsp);
231 dbg("menu selection envelop result(%d) envelop response(%d)", result, envelop_rsp);
233 if (evt_cb_data->cb_fn) {
234 evt_cb_data->cb_fn(evt_cb_data->handle, result, &envelop_rsp, evt_cb_data->user_data);
237 g_variant_unref(dbus_result);
241 static void on_response_download_event_envelop(GObject *source_object, GAsyncResult *res, gpointer user_data)
243 GError *error = NULL;
244 GDBusConnection *conn = NULL;
246 GVariant *dbus_result;
247 struct tapi_resp_data *evt_cb_data = user_data;
252 conn = G_DBUS_CONNECTION (source_object);
253 dbus_result = g_dbus_connection_call_finish(conn, res, &error);
256 g_variant_get (dbus_result, "(ii)", &result, &envelop_rsp);
257 dbg("download event envelop result(%d) envelop response(%d)", result, envelop_rsp);
259 if (evt_cb_data->cb_fn) {
260 evt_cb_data->cb_fn(evt_cb_data->handle, result, &envelop_rsp, evt_cb_data->user_data);
263 g_variant_unref(dbus_result);
269 * To send envelope command (MENU SELECTION) to USIM.
271 * @return values in enum TapiResult_t.
272 * @param[in] TelSatMenuSelectionReqInfo_t menu selection evelope data.
273 * @Interface Asynchronous.
275 * @Refer TelSatMenuSelectionReqInfo_t
278 EXPORT_API int tel_select_sat_menu(TapiHandle *handle, const TelSatMenuSelectionReqInfo_t *pMenuSelect, tapi_response_cb callback, void *user_data)
282 GVariant *inparam = NULL;
283 struct tapi_resp_data *evt_cb_data = NULL;
285 dbg("Func Entrance ");
287 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
288 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
289 TAPI_RET_ERR_NUM_IF_FAIL(pMenuSelect, TAPI_API_INVALID_PTR);
291 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
293 item_id = pMenuSelect->itemIdentifier;
294 help_req = ( (pMenuSelect->bIsHelpRequested != 0) ? TRUE : FALSE);
295 dbg("item id(%d) help request(%d)", item_id, help_req);
296 inparam = g_variant_new("(ib)", item_id, help_req);
298 g_dbus_connection_call(handle->dbus_connection, DBUS_TELEPHONY_SERVICE, handle->path,
299 DBUS_TELEPHONY_SAT_INTERFACE, "SelectMenu", inparam, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT,
300 handle->ca, on_response_menu_selection_envelop, evt_cb_data);
302 g_variant_unref(inparam);
304 return TAPI_API_SUCCESS;
309 * API to send event download to SIM.
311 * @return values in enum TapiResult_t.
312 * @param[in] TelSatEventDownloadReqInfo_t event download data.
313 * @Interface Asynchronous.
315 * @Refer TelSatEventDownloadReqInfo_t
317 EXPORT_API int tel_download_sat_event(TapiHandle *handle, const TelSatEventDownloadReqInfo_t *pEventData, tapi_response_cb callback, void *user_data)
319 gboolean evt_check = FALSE;
321 gint event_download_type, src_dev, dest_dev;
322 GVariant *download_data = NULL;
324 GVariant *inparam = NULL;
325 struct tapi_resp_data *evt_cb_data = NULL;
327 dbg("Func Entrance ");
329 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
330 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
331 TAPI_RET_ERR_NUM_IF_FAIL(pEventData, TAPI_API_INVALID_PTR);
333 for(g_index = 0; g_event_list[g_index] > 0; g_index++){
334 if(pEventData->eventDownloadType == TAPI_EVENT_SAT_DW_TYPE_BROWSER_TERMINATION || g_event_list[g_index] == pEventData->eventDownloadType ){
335 dbg("event (%d) shoud be passed to sim");
341 dbg("sim does not request event(%d)", pEventData->eventDownloadType);
342 return TAPI_API_SAT_EVENT_NOT_REQUIRED_BY_USIM;
345 MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data);
347 event_download_type = pEventData->eventDownloadType;
348 src_dev = TAPI_SAT_DEVICE_ID_ME;
349 dest_dev = TAPI_SAT_DEVICE_ID_SIM;
350 download_data = _tapi_sat_gen_event_download_data(pEventData);
351 TAPI_RET_ERR_NUM_IF_FAIL(download_data, TAPI_API_INVALID_PTR);
353 dbg("event type(%d)", event_download_type);
354 inparam = g_variant_new("(iiiv)", event_download_type, src_dev, dest_dev, download_data);
356 g_dbus_connection_call(handle->dbus_connection, DBUS_TELEPHONY_SERVICE, handle->path,
357 DBUS_TELEPHONY_SAT_INTERFACE, "DownloadEvent", inparam, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT,
358 handle->ca, on_response_download_event_envelop, evt_cb_data);
360 g_variant_unref(inparam);
362 return TAPI_API_SUCCESS;
367 * API to get main menu information.
369 * @return values in enum TapiResult_t.
370 * @param[out] TelSatSetupMenuInfo_t main menu data.
371 * @Interface Synchronous.
373 * @Refer TelSatSetupMenuInfo_t
375 EXPORT_API int tel_get_sat_main_menu_info(TapiHandle *handle, TelSatSetupMenuInfo_t *pMainMenu)
378 GVariant *rst = NULL;
381 gint result, command_id, item_cnt;
382 gboolean b_present, b_helpinfo, b_updated;
383 GVariant *items = NULL;
384 #if defined(TIZEN_SUPPORT_SAT_ICON)
385 GVariant *icon_id = NULL;
386 GVariant *icon_list = NULL;
387 int sat_index = 0, icon_index = 0;
388 /* Used to get icon data */
391 gint icon_quali, icon_identifier, width, height, ics, icon_data_len;
392 gchar *icon_data = NULL;
393 /* Used to get icon list data */
394 GVariant *unbox_list, *unbox_list_info ;
395 GVariantIter *iter, *iter2;
396 GVariant *icon_list_info;
397 gboolean is_list_exist;
398 gint icon_list_quali, list_cnt, icon_list_identifier, list_width, list_height, list_ics, icon_list_data_len;
399 gchar *icon_list_data = NULL;
403 dbg("Func Entrance ");
405 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
406 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
407 TAPI_RET_ERR_NUM_IF_FAIL(pMainMenu, TAPI_API_INVALID_PTR);
409 memset(pMainMenu, 0, sizeof(TelSatSetupMenuInfo_t));
412 rst = g_dbus_connection_call_sync(handle->dbus_connection, DBUS_TELEPHONY_SERVICE , handle->path,
413 DBUS_TELEPHONY_SAT_INTERFACE, "GetMainMenuInfo", NULL, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca, &error);
416 dbg( "error to get main menu(%s)", error->message);
417 g_error_free (error);
418 return TAPI_API_OPERATION_FAILED;
421 dbg("menu_info type_format(%s)", g_variant_get_type_string(rst));
423 #if defined(TIZEN_SUPPORT_SAT_ICON)
424 g_variant_get(rst, "(iibs@vibb@v@v)", &result, &command_id, &b_present, &title, &items, &item_cnt,
425 &b_helpinfo, &b_updated, &icon_id, &icon_list);
427 g_variant_get(rst, "(iibs@vibb)", &result, &command_id, &b_present, &title, &items, &item_cnt,
428 &b_helpinfo, &b_updated);
430 g_variant_unref(rst);
432 pMainMenu->commandId = command_id;
433 pMainMenu->bIsMainMenuPresent = (b_present ? 1 : 0);
435 if(strlen(title) > TAPI_SAT_DEF_TITLE_LEN_MAX+1){
436 memcpy(pMainMenu->satMainTitle, title, TAPI_SAT_DEF_TITLE_LEN_MAX+1);
439 memcpy(pMainMenu->satMainTitle, title, strlen(title));
443 pMainMenu->satMainMenuNum = item_cnt;
444 if(items && item_cnt > 0){
450 unbox = g_variant_get_variant(items);
451 dbg("items(%p) items type_format(%s)", items, g_variant_get_type_string(unbox));
453 g_variant_get(unbox, "a(si)", &iter);
454 while(g_variant_iter_loop(iter,"(si)",&item_str, &item_id)){
455 pMainMenu->satMainMenuItem[sat_index].itemId = item_id;
457 if(strlen(item_str) > TAPI_SAT_DEF_ITEM_STR_LEN_MAX + 6){
458 memcpy(pMainMenu->satMainMenuItem[sat_index].itemString, item_str, TAPI_SAT_DEF_ITEM_STR_LEN_MAX + 6);
461 memcpy(pMainMenu->satMainMenuItem[sat_index].itemString, item_str, strlen(item_str));
464 dbg("item index(%d) id(%d) str(%s)",sat_index, pMainMenu->satMainMenuItem[sat_index].itemId, pMainMenu->satMainMenuItem[sat_index].itemString);
465 //dbg("item index(%d) id(%d) str(%s)",index, item_id, item_str);
468 g_variant_iter_free(iter);
470 pMainMenu->bIsSatMainMenuHelpInfo = (b_helpinfo ? 1 : 0);
471 pMainMenu->bIsUpdatedSatMainMenu = (b_updated ? 1 : 0);
473 #if defined(TIZEN_SUPPORT_SAT_ICON)
475 unbox = g_variant_get_variant(icon_id);
476 g_variant_get(unbox, "a(biiiiiis)", &iter);
478 while(g_variant_iter_loop(iter,"(biiiiiis)", &is_exist, &icon_quali, &icon_identifier, &width, &height, &ics, &icon_data_len, &icon_data)){
481 pMainMenu->iconId.bIsPresent = is_exist;
482 pMainMenu->iconId.iconQualifier = icon_quali;
483 pMainMenu->iconId.iconIdentifier = icon_identifier;
484 pMainMenu->iconId.iconInfo.width = width;
485 pMainMenu->iconId.iconInfo.height = height;
486 pMainMenu->iconId.iconInfo.ics = ics;
487 if(icon_data_len > 0) {
488 pMainMenu->iconId.iconInfo.iconDataLen = icon_data_len;
489 memcpy(pMainMenu->iconId.iconInfo.iconFile, icon_data, icon_data_len);
491 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,
492 pMainMenu->iconId.iconInfo.height, pMainMenu->iconId.iconInfo.ics, pMainMenu->iconId.iconInfo.iconDataLen);
494 g_variant_iter_free(iter);
498 unbox_list = g_variant_get_variant(icon_list);
499 g_variant_get(unbox_list, "a(biiv)", &iter);
501 while(g_variant_iter_loop(iter,"(biiv)", &is_list_exist, &icon_list_quali, &list_cnt, &icon_list_info)){
504 pMainMenu->iconIdList.bIsPresent = is_list_exist;
505 pMainMenu->iconIdList.iconListQualifier = icon_list_quali;
506 pMainMenu->iconIdList.iconCount = list_cnt;
508 unbox_list_info = g_variant_get_variant(icon_list_info);
509 g_variant_get(unbox_list_info, "a(iiiiis)", &iter2);
511 while(g_variant_iter_loop(iter2,"(iiiiis)",&icon_list_identifier, &list_width, &list_height, &list_ics, &icon_list_data_len, &icon_list_data)){
512 pMainMenu->iconIdList.iconIdentifierList[icon_index]= icon_identifier;
513 pMainMenu->iconIdList.iconInfo[icon_index].width = list_width;
514 pMainMenu->iconIdList.iconInfo[icon_index].height = list_height;
515 pMainMenu->iconIdList.iconInfo[icon_index].ics = list_ics;
516 if(icon_list_data_len > 0) {
517 pMainMenu->iconIdList.iconInfo[icon_index].iconDataLen = icon_list_data_len;
518 memcpy(pMainMenu->iconIdList.iconInfo[icon_index].iconFile, icon_list_data, icon_list_data_len);
522 g_variant_iter_free(iter2);
524 g_variant_iter_free(iter);
527 dbg("result (%d)", result);
528 dbg("command id (%d)", pMainMenu->commandId);
529 dbg("menu present (%d)", pMainMenu->bIsMainMenuPresent);
530 dbg("menu title (%s)", pMainMenu->satMainTitle);
531 dbg("item cnt (%d)", pMainMenu->satMainMenuNum);
532 dbg("menu help info (%d)", pMainMenu->bIsSatMainMenuHelpInfo);
533 dbg("menu updated (%d)", pMainMenu->bIsUpdatedSatMainMenu);
535 return TAPI_API_SUCCESS;
540 * API to send UI display status.
542 * @return values in enum TapiResult_t.
543 * @param[in] TelSatUiDisplayStatusType_t display status data.
544 command_id command identifier
545 * @Interface Asynchronous.
547 * @Refer TelSatUiDisplayStatusType_t
549 EXPORT_API int tel_send_sat_ui_display_status(TapiHandle *handle, int commandId, TelSatUiDisplayStatusType_t status)
552 GVariant *rst = NULL;
554 gint result, command_id;
555 gboolean display_status;
556 GVariant *inparam = NULL;
558 dbg("Func Entrance ");
560 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
561 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
563 command_id = commandId;
564 display_status = ( (status == TAPI_SAT_DISPLAY_SUCCESS) ? TRUE : FALSE);
565 dbg("command id(%d) display status(%d)", command_id, display_status);
566 inparam = g_variant_new("(ib)", command_id, display_status);
569 rst = g_dbus_connection_call_sync(handle->dbus_connection, DBUS_TELEPHONY_SERVICE , handle->path,
570 DBUS_TELEPHONY_SAT_INTERFACE, "SendUiDisplayStatus", inparam, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca, &error);
573 dbg( "error to send ui display status(%s)", error->message);
574 g_error_free (error);
575 return TAPI_API_OPERATION_FAILED;
578 dbg("send ui display status format(%s)", g_variant_get_type_string(rst));
580 g_variant_get(rst, "(i)", &result);
582 result = TAPI_API_SUCCESS;
585 result = TAPI_API_OPERATION_FAILED;
587 g_variant_unref(rst);
588 dbg("result (%d)", result);
595 * API to send UI user confirmation data.
597 * @return values in enum TapiResult_t.
598 * @param[in] command_id command identifier
599 command_type command type
600 key_type user confirmation value
601 addtional_data addtional data
603 * @Interface Asynchronous.
607 EXPORT_API int tel_send_sat_ui_user_confirm(TapiHandle *handle, TelSatUiUserConfirmInfo_t *pUserConfirmData)
610 GVariant *rst = NULL;
611 GVariantBuilder builder;
612 GVariant *inner_gv = NULL;
616 gint result, command_id, command_type, key_type, data_len;
617 GVariant *inparam = NULL;
619 dbg("Func Entrance ");
621 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
622 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
623 TAPI_RET_ERR_NUM_IF_FAIL(pUserConfirmData, TAPI_API_INVALID_PTR);
625 command_id = pUserConfirmData->commandId;
626 command_type = pUserConfirmData->commandType;
627 key_type = pUserConfirmData->keyType;
628 data = (gchar *)pUserConfirmData->pAdditionalData;
629 data_len = pUserConfirmData->dataLen;
631 g_variant_builder_init(&builder, G_VARIANT_TYPE ("ay"));
632 for (sat_index = 0; sat_index < data_len; sat_index++) {
633 dbg("index(%d) data(%d)", sat_index, data[sat_index]);
634 g_variant_builder_add(&builder, "y", data[sat_index]);
636 inner_gv = g_variant_builder_end(&builder);
638 dbg("command id(%d) command type(%d) key type(%d) data len(%d)",
639 command_id, command_type, key_type, data_len);
640 inparam = g_variant_new("(iiiv)", command_id, command_type, key_type, inner_gv);
643 rst = g_dbus_connection_call_sync(handle->dbus_connection, DBUS_TELEPHONY_SERVICE , handle->path,
644 DBUS_TELEPHONY_SAT_INTERFACE, "SendUserConfirm", inparam, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca, &error);
647 dbg( "error to send ui user confirm(%s)", error->message);
648 g_error_free (error);
649 return TAPI_API_OPERATION_FAILED;
652 dbg("send ui user confirm format(%s)", g_variant_get_type_string(rst));
654 g_variant_get(rst, "(i)", &result);
656 result = TAPI_API_SUCCESS;
659 result = TAPI_API_OPERATION_FAILED;
661 g_variant_unref(rst);
662 dbg("result (%d)", result);
669 * API to send application excution result.
671 * @return values in enum TapiResult_t.
672 * @param[in] TelSatAppsRetInfo_t application result information data.
673 * @Interface Asynchronous.
675 * @Refer TelSatAppsRetInfo_t
677 EXPORT_API int tel_send_sat_app_exec_result(TapiHandle *handle, TelSatAppsRetInfo_t *pAppRetInfo)
680 GVariant *rst = NULL;
682 gint result, command_id, command_type;
683 GVariant *app_exec_result = NULL;
684 GVariant *inparam = NULL;
686 dbg("Func Entrance ");
688 TAPI_RET_ERR_NUM_IF_FAIL(handle, TAPI_API_INVALID_PTR);
689 TAPI_RET_ERR_NUM_IF_FAIL(handle->dbus_connection, TAPI_API_INVALID_PTR);
690 TAPI_RET_ERR_NUM_IF_FAIL(pAppRetInfo, TAPI_API_INVALID_PTR);
692 command_id = pAppRetInfo->commandId;
693 command_type = pAppRetInfo->commandType;
694 app_exec_result = _tapi_sat_gen_app_exec_result_data(pAppRetInfo);
695 TAPI_RET_ERR_NUM_IF_FAIL(app_exec_result, TAPI_API_INVALID_PTR);
697 dbg("command id(%d) command type(%d) exec_result(%s)", command_id, command_type, g_variant_get_type_string(app_exec_result));
698 inparam = g_variant_new("(iiv)", command_id, command_type, app_exec_result);
701 dbg("test (%s)", g_variant_get_type_string(inparam));
702 rst = g_dbus_connection_call_sync(handle->dbus_connection, DBUS_TELEPHONY_SERVICE , handle->path,
703 DBUS_TELEPHONY_SAT_INTERFACE, "SendAppExecResult", inparam, NULL, G_DBUS_CALL_FLAGS_NONE, TAPI_DEFAULT_TIMEOUT, handle->ca, &error);
706 dbg( "error to send app execution result(%s)", error->message);
707 g_error_free (error);
708 return TAPI_API_OPERATION_FAILED;
711 dbg("send app execution result format(%s)", g_variant_get_type_string(rst));
713 g_variant_get(rst, "(i)", &result);
715 result = TAPI_API_SUCCESS;
718 result = TAPI_API_OPERATION_FAILED;
720 g_variant_unref(rst);
721 dbg("result (%d)", result);