static void _launch_video_call( struct tnoti_call_status_incoming* incoming ) { char id[2] = {0, }; char cli[2] = {0, }; char forward[2] = {0, }; char number[83] = {0, }; int ret = 0; bundle *kb = 0; dbg("Func Entrance"); snprintf( id, 2, "%d", incoming->id ); dbg("id : [%s]", id ); snprintf( number, 83, "%s", incoming->cli.number ); dbg("number : [%s]", number ); snprintf( cli, 2, "%d", incoming->cli.mode ); dbg("cli : [%s]", id ); snprintf( forward, 2, "%d", incoming->forward ); dbg("forward : [%s]", forward ); kb = bundle_create(); bundle_add(kb, "KEY_CALL_TYPE", "mt"); bundle_add(kb, "KEY_CALL_HANDLE", id); bundle_add(kb, "KEY_CALLING_PARTY_NUMBER", number); bundle_add(kb, "KEY_CLI_CAUSE", cli); bundle_add(kb, "KEY_FORWARDED", forward); ret = aul_launch_app("com.samsung.vtmain", kb); bundle_free(kb); dbg("VT AUL return %d",ret); }
SLPAPI int aul_forward_app(const char* pkgname, bundle *kb) { char *caller; int ret; bundle *dupb; bundle *outb; char tmp_pid[MAX_PID_STR_BUFSZ]; if(pkgname == NULL || kb == NULL) return AUL_R_EINVAL; caller = (char *)bundle_get_val(kb, AUL_K_CALLER_PID); if(caller == NULL) { _E("original msg doest not have caller pid"); return AUL_R_EINVAL; } bundle_del(kb, AUL_K_ORG_CALLER_PID); bundle_add(kb, AUL_K_ORG_CALLER_PID, caller); dupb = bundle_dup(kb); if(dupb == NULL) { _E("bundle duplicate fail"); return AUL_R_EINVAL; } if(bundle_get_val(kb, AUL_K_WAIT_RESULT) != NULL) { ret = app_request_to_launchpad(APP_START_RES, pkgname, kb); if(ret < 0) goto end; } else { ret = app_request_to_launchpad(APP_START, pkgname, kb); goto end; } // bundle_iterate(dupb, __iterate, NULL); snprintf(tmp_pid, MAX_PID_STR_BUFSZ,"%d",ret); ret = aul_create_result_bundle(dupb, &outb); if(ret < 0) return ret; bundle_del(outb, AUL_K_FWD_CALLEE_PID); bundle_add(outb, AUL_K_FWD_CALLEE_PID, tmp_pid); // bundle_iterate(outb, __iterate, NULL); ret = aul_send_result(outb, 1); bundle_free(outb); end: bundle_free(dupb); return ret; }
int wlan_manager_network_syspopup_message(const char *title, const char *content, const char *type) { int ret = 0; bundle *b = bundle_create(); bundle_add(b, "_SYSPOPUP_TITLE_", title); bundle_add(b, "_SYSPOPUP_CONTENT_", content); bundle_add(b, "_SYSPOPUP_TYPE_", type); ret = syspopup_launch("net-popup", b); bundle_free(b); return ret; }
SLPAPI int aul_create_result_bundle(bundle *inb, bundle **outb) { const char *pid_str; *outb = NULL; if(inb == NULL){ _E("return msg create fail"); return AUL_R_EINVAL; } *outb = bundle_create(); if (*outb == NULL) { _E("return msg create fail"); return AUL_R_ERROR; } if(bundle_get_val(inb, AUL_K_WAIT_RESULT) != NULL) { bundle_add(*outb, AUL_K_SEND_RESULT, "1"); _D("original msg is msg with result"); } else { _D("original msg is not msg with result"); } pid_str = bundle_get_val(inb, AUL_K_ORG_CALLER_PID); if(pid_str) { bundle_add(*outb, AUL_K_ORG_CALLER_PID, pid_str); goto end; } pid_str = bundle_get_val(inb, AUL_K_CALLER_PID); if (pid_str == NULL) { _E("original msg doest not have caller pid"); bundle_free(*outb); *outb = NULL; return AUL_R_EINVAL; } bundle_add(*outb, AUL_K_CALLER_PID, pid_str); end: return AUL_R_OK; }
int main(int argc, char **argv) { banner(); check_root(); if (!parse_options(argc, argv)) return EXIT_FAILURE; return bundle_add(); }
static int __send_to_cancel(int pid) { /* Say "Your result request is cancel!" to caller */ bundle *kb; int ret; char tmp_pid[MAX_PID_STR_BUFSZ]; kb = bundle_create(); if (kb == NULL) return AUL_R_ERROR; bundle_add(kb, AUL_K_SEND_RESULT, "1"); snprintf(tmp_pid, MAX_PID_STR_BUFSZ, "%d", pid); bundle_add(kb, AUL_K_CALLER_PID, tmp_pid); ret = app_send_cmd(LAUNCHPAD_PID, APP_CANCEL, kb); bundle_free(kb); return ret; }
SLPAPI int aul_open_service(const char *svcname, bundle *kb, aul_service_res_fn cbfunc, void *userdata) { char defapp[MAX_LOCAL_BUFSZ]; int must_free = 0; int ret = AUL_R_ERROR; ail_appinfo_h handle; ail_error_e ail_ret; if (svcname == NULL) return AUL_R_EINVAL; if (!is_supported_svc(svcname)) return AUL_R_EINVAL; if (kb == NULL) { kb = bundle_create(); must_free = 1; } bundle_add(kb, AUL_K_SERVICE_NAME, svcname); retry: if (aul_get_defapp_for_service(svcname, defapp, sizeof(defapp)) < 0) { _D("service : %s, no default app", svcname); if (must_free) { bundle_free(kb); kb = NULL; } return ret; } else { ail_ret = ail_package_get_appinfo(defapp, &handle); if (ail_ret == AIL_ERROR_OK) { ail_destroy_appinfo(handle); _D("svcname: %s, defapp : %s", svcname, defapp); if (cbfunc) { _D("svcname: %s, defapp : %s - with result", svcname, defapp); ret = aul_launch_app_with_result(defapp, kb, cbfunc, userdata); } else { _D("svcname: %s, defapp : %s - no result", svcname, defapp); ret = aul_launch_app(defapp, kb); } } else if (ail_ret == AIL_ERROR_NO_DATA) { _D("defapp %s for svcname: %s does NOT exist", defapp, svcname); svc_delete_with_pkgname(defapp); ail_destroy_appinfo(handle); goto retry; } else { _E("ail_get_appinfo with %s failed", defapp); if (must_free) { bundle_free(kb); kb = NULL; } return ret; } } if (must_free) bundle_free(kb); return ret; }
static void _launch_voice_call( struct tnoti_call_status_incoming* incoming ) { char id[2] = {0, }; char cli[2] = {0, }; char forward[2] = {0, }; char active_line[2] = {0, }; char cna[2] = {0, }; char number[83] = {0, }; char name[83] = {0, }; // int ret = 0; bundle *kb = 0; snprintf( id, 2, "%d", incoming->id ); dbg("id : [%s]", id ); snprintf( cli, 2, "%d", incoming->cli.mode ); dbg("cli : [%s]", id ); snprintf( number, 83, "%s", incoming->cli.number ); dbg("number : [%s]", number ); snprintf( forward, 2, "%d", incoming->forward ); dbg("forward : [%s]", forward ); snprintf( active_line, 2, "%d", incoming->active_line ); dbg("active_line : [%s]", active_line ); if ( incoming->cna.mode == CALL_CNA_MODE_PRESENT ) snprintf( cna, 2, "%d", 0 ); else snprintf( cna, 2, "%d", 1 ); dbg("cna : [%s]", cna ); snprintf( name, 83, "%s", incoming->cna.name ); dbg("name : [%s]", name ); kb = bundle_create(); #if 0 /* AUL */ bundle_add(kb, "launch-type", "MT"); bundle_add(kb, "handle", id); bundle_add(kb, "number", number); bundle_add(kb, "name_mode", cna); bundle_add(kb, "name", name); bundle_add(kb, "clicause", cli); bundle_add(kb, "fwded", forward); bundle_add(kb, "activeline", active_line); ret = aul_launch_app("com.samsung.call", kb); dbg("aul_launch_app [ voice call ] : %d", ret ); #else /* AppSvc */ appsvc_set_operation(kb, APPSVC_OPERATION_CALL); appsvc_set_uri(kb,"tel:MT"); appsvc_add_data(kb, "launch-type", "MT"); appsvc_add_data(kb, "handle", id); appsvc_add_data(kb, "number", number); appsvc_add_data(kb, "name_mode", cna); appsvc_add_data(kb, "name", name); appsvc_add_data(kb, "clicause", cli); appsvc_add_data(kb, "fwded", forward); appsvc_add_data(kb, "activeline", active_line); appsvc_run_service(kb, 0, NULL, NULL); #endif bundle_free(kb); }
int _bt_launch_system_popup(bt_app_event_type_t event_type, bt_app_sys_popup_params_t *popup_params, void *cb, void *data) { int ret = 0; bundle *b = NULL; char event_str[BT_SYSPOPUP_EVENT_LEN_MAX] = { 0 }; struct bt_appdata *ad = app_state; DBG("+\n"); if(cb == NULL) return -1; b = bundle_create(); if(b == NULL) return -1; bundle_add(b, "title", popup_params->title); bundle_add(b, "type", popup_params->type); bundle_add(b, "file", popup_params->file); bundle_add(b, "device_name", popup_params->device_name); switch (event_type) { case BT_APP_EVENT_CONFIRM_MODE_REQUEST: strncpy(event_str, "app-confirm-request", sizeof(event_str)); break; case BT_APP_EVENT_FILE_RECIEVED: strncpy(event_str, "file-recieved", sizeof(event_str)); break; case BT_APP_EVENT_INFORMATION: strncpy(event_str, "bt-information", sizeof(event_str)); break; default: break; } bundle_add(b, "event-type", event_str); /*The system popup launch function is not able to launch second popup * if first popup is being processed still, this due to the check * in AUL module to restrict multiple launching of syspopup, * to solve this problem after discussion it is decided that if * the popup launch fails then it will be retried * after small timeout. */ ret = syspopup_launch("bt-syspopup", b); if (0 > ret) { ERR("Popup launch failed...retry = %d\n", ret); g_timeout_add(BT_POPUP_SYSPOPUP_TIMEOUT_FOR_MULTIPLE_POPUPS, (GSourceFunc) __bt_system_popup_timer_cb, b); } else { bundle_free(b); } ad->popups.popup_cb = (bt_app_cb) cb; ad->popups.popup_cb_data = data; ad->popups.syspopup_request = TRUE; DBG("-\n"); return 0; }