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); }
int net_nfc_app_util_launch_se_transaction_app(uint8_t *aid, uint32_t aid_len, uint8_t *param, uint32_t param_len) { char aid_string[1024] = { 0, }; char param_string[1024] = { 0, }; bundle *bd = NULL; /* initialize and make list */ if (net_nfc_util_access_control_is_initialized() == false) { net_nfc_util_access_control_initialize(); } net_nfc_util_access_control_update_list(); /* convert aid to aid string */ net_nfc_app_util_encode_base64(aid, aid_len, aid_string, sizeof(aid_string)); DEBUG_MSG("aid_string : %s", aid_string); net_nfc_app_util_encode_base64(param, param_len, param_string, sizeof(param_string)); DEBUG_MSG("param_string : %s", param_string); /* launch */ bd = bundle_create(); appsvc_set_operation(bd, "http://tizen.org/appcontrol/operation/nfc_se_transaction"); appsvc_set_uri(bd, aid_string); appsvc_add_data(bd, "data", param_string); g_idle_add((GSourceFunc)_invoke_get_list, (gpointer)bd); return 0; }
static int sendResponMessage(void *data){ app_data *appdata = data; bundle *resp_dir = bundle_create(); RETVM_IF(bundle_add_str(resp_dir, "folder_path", send_folders) != 0, SVC_RES_FAIL, "Failed to add data by key to bundle"); _app_send_response(appdata, resp_dir); bundle_free(resp_dir); return SVC_RES_OK; }
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; }
CURLcode Curl_conncache_add_conn(struct conncache *connc, struct connectdata *conn) { CURLcode result; struct connectbundle *bundle; struct connectbundle *new_bundle = NULL; struct SessionHandle *data = conn->data; bundle = Curl_conncache_find_bundle(conn, data->state.conn_cache); if(!bundle) { char *key; int rc; result = bundle_create(data, &new_bundle); if(result) return result; key = hashkey(conn); if(!key) { bundle_destroy(new_bundle); return CURLE_OUT_OF_MEMORY; } rc = conncache_add_bundle(data->state.conn_cache, key, new_bundle); free(key); if(!rc) { bundle_destroy(new_bundle); return CURLE_OUT_OF_MEMORY; } bundle = new_bundle; } result = bundle_add_conn(bundle, conn); if(result) { if(new_bundle) conncache_remove_bundle(data->state.conn_cache, new_bundle); return result; } conn->connection_id = connc->next_connection_id++; connc->num_connections++; DEBUGF(infof(conn->data, "Added connection %ld. " "The cache now contains %" CURL_FORMAT_CURL_OFF_TU " members\n", conn->connection_id, (curl_off_t) connc->num_connections)); return CURLE_OK; }
CURLcode Curl_conncache_add_conn(struct conncache *connc, struct connectdata *conn) { CURLcode result = CURLE_OK; struct connectbundle *bundle; struct connectbundle *new_bundle = NULL; struct Curl_easy *data = conn->data; /* *find_bundle() locks the connection cache */ bundle = Curl_conncache_find_bundle(conn, data->state.conn_cache); if(!bundle) { int rc; char key[128]; result = bundle_create(data, &new_bundle); if(result) { goto unlock; } hashkey(conn, key, sizeof(key)); rc = conncache_add_bundle(data->state.conn_cache, key, new_bundle); if(!rc) { bundle_destroy(new_bundle); result = CURLE_OUT_OF_MEMORY; goto unlock; } bundle = new_bundle; } bundle_add_conn(bundle, conn); conn->connection_id = connc->next_connection_id++; connc->num_conn++; DEBUGF(infof(conn->data, "Added connection %ld. " "The cache now contains %zu members\n", conn->connection_id, connc->num_conn)); unlock: CONN_UNLOCK(data); return result; }
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; }
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; }
bundle *_get_appsvc(const char *pkg) { int r; bundle *b; b = bundle_create(); if (!b) { ERR("bundle_create failed"); return NULL; } r = appsvc_set_pkgname(b, pkg); appsvc_set_operation(b, APPSVC_OPERATION_DEFAULT); if (r) { bundle_free(b); ERR("appsvc_set_pkgname failed (%d)", r); return NULL; } return b; }
static int _on_proxy_client_msg_received_cb(void *data, bundle *const rec_msg) { dlog_print(DLOG_INFO ,"tdlna", "_on_proxy_client_msg_received_cb 실행"); int result = SVC_RES_FAIL; RETVM_IF(!data, result, "Data is NULL"); app_data *app = data; req_operation req_operation = REQ_OPER_NONE; bundle *resp_msg = bundle_create(); RETVM_IF(!resp_msg, result, "Failed to create bundle"); result = _app_process_received_message(rec_msg, resp_msg, &req_operation); if (result != SVC_RES_OK) { ERR("Failed to generate response bundle"); bundle_free(resp_msg); return result; } result = _app_execute_operation(app, req_operation); if(result == SVC_RES_OK) { result = _app_send_response(app, resp_msg); if (result != SVC_RES_OK) { ERR("Failed to send message to remote application"); } } else { ERR("Failed to execute operation"); } bundle_free(resp_msg); return result; }
void _send_values(const char* sensor_name, const float val1, const float val2, const float val3) { int error = MESSAGE_PORT_ERROR_NONE; char str[100]; bundle *b = bundle_create(); sprintf (str, "%.4f %.4f %.4f", val1, val2, val3); LOGE("%s", str); bundle_add_str(b, sensor_name, str); error = message_port_send_message(REMOTE_APP_ID, REMOTE_PORT, b); if (error != MESSAGE_PORT_ERROR_NONE) { LOGE("message_port_check_remote_port error : %d", error); } else { LOGE("Send message done"); } bundle_free(b); }
int net_nfc_app_util_appsvc_launch(const char *operation, const char *uri, const char *mime, const char *data) { int result = -1; bundle *bd = NULL; bd = bundle_create(); if (bd == NULL) return result; if (operation != NULL) { appsvc_set_operation(bd, operation); } if (uri != NULL) { appsvc_set_uri(bd, uri); } if (mime != NULL) { appsvc_set_mime(bd, mime); } if (data != NULL) { appsvc_add_data(bd, "data", data); } result = appsvc_run_service(bd, 0, NULL, NULL); bundle_free(bd); return result; }
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 int _app_execute_operation(app_data *appdata, req_operation operation_type) { dlog_print(DLOG_INFO ,"tdlna", "_app_execute_operation 실행"); bundle *resp_msg = bundle_create(); RETVM_IF(!appdata, SVC_RES_FAIL, "Application data is NULL"); char *resp_key_val = NULL; char respStr[50]; switch (operation_type) { case REQ_OPER_STATE: dlog_print(DLOG_INFO, "tdlna", "현재 상태 얻기"); if ((appdata->run_tdlna) == 0) { // 서비스가 꺼져있는 상태라면 dlog_print(DLOG_INFO, "tdlna", "서비스 상태 조회 %d", appdata->run_tdlna); resp_key_val = "STATE:OFF"; } else { resp_key_val = "STATE:ON"; dlog_print(DLOG_INFO, "tdlna", "서비스 상태 조회 %d", appdata->run_tdlna); } break; case REQ_OPER_FOLDER: dlog_print(DLOG_INFO, "tdlna", "미디어 정보 얻기"); send_folders[0] = '\0';//초기화 if(media_Directory(appdata)){//미디어 폴더 경로를 sendFolder함수로 전달해줌 //폴더검색후 sendResponMessage(appdata); dlog_print(DLOG_INFO,"tdlna","미디어 폴더 전송:%s",send_folders); } resp_key_val = "미디어 폴더 요청"; break; case REQ_OPER_META_GET_APP: dlog_print(DLOG_INFO,"tdlna","메타정보 가져오기 실행 "); //------------------------------------------------------------------------------------------------------김태형~~!!! char* testDir; mediaDirectory_folder(&testDir,2); dlog_print(DLOG_INFO,"tdlna","비디오 폴더 이어붙인것:%s",testDir); //------------------------------------------------------------------------------------------------------- // _media_search(appdata); // Meta_Get_from_path(appdata,"/opt/usr/media/DCIM/Camera/%"); // int videoC = 0,imageC=0,musicC = 0 ; // media_Count(&videoC,&imageC,&musicC,"/opt/usr/media/DCIM/Camera/%"); break; case REQ_OPER_DLNA_APP://실행 요청시 dlog_print(DLOG_INFO,"tdlna","dlna on 처리"); if(!(appdata->run_tdlna)){ // 서비스가 꺼져있는 상태라면 if(appdata->tdlna_td != 0){ dlog_print(DLOG_ERROR,"tdlna", "이전 실행된 서비스가 정상적으로 종료되지 않았습니다."); return 0; } if(serviceOn(appdata)){ dlog_print(DLOG_INFO,"tdlna","★ 서비스 ON ★ %d", appdata->run_tdlna); resp_key_val = "DLNA:ON"; }else{ dlog_print(DLOG_INFO,"tdlna","★ 실행 실패! ★ %d", appdata->run_tdlna); resp_key_val = "DLNA:Failed"; } } else{ resp_key_val = "DLNA:RUNNING"; dlog_print(DLOG_INFO,"tdlna","★ 이미 실행중 ★ %d", appdata->run_tdlna); } break; case REQ_OPER_DLNA_APP_OFF://종료 요청시 if (!(appdata->run_tdlna)) {// 서비스가 꺼져있는 상태라면 resp_key_val = "DLNA:OFF"; dlog_print(DLOG_INFO, "tdlna", "★ 이미 종료상태★ %d",appdata->run_tdlna); } else { serviceOff(appdata); resp_key_val = "DLNA:OFF"; dlog_print(DLOG_INFO, "tdlna", "★ 서비스 OFF ★ %d",appdata->run_tdlna); } break; case REQ_OPER_DEVICE_ID://tDlnaName 주기 if(deviceName){ strcpy(appdata->deviceName, deviceName); setDeviceProperty(appdata);//tdlnamain으로 전달 sprintf(respStr, "%s%s", "tDlnaName/", deviceName); }else sprintf(respStr, "%s%s", "tDlnaName/", "nameError!"); resp_key_val = respStr; dlog_print(DLOG_INFO, "tdlna", "resp_key_val값 가져오기 %s",resp_key_val); break; case REQ_SHARED_FOLDER: resp_key_val = "공유폴더!"; dlog_print(DLOG_INFO, "tdlna", "%s 폴더 공유 실행",shared_folder); insertSharingList(); // _META *test; // int testC=0; // testC= Meta_Get_from_path(appdata,shared_folder,2,&test); // dlog_print(DLOG_INFO, "tdlna", "리스트갯수:%d",testC); // dlog_print(DLOG_INFO, "tdlna", "리스트 1 :%s",test[1].path); // free(test); break; case REQ_UNSHARED_FOLDER: resp_key_val = "공유해제 폴더!"; dlog_print(DLOG_INFO, "tdlna", "%s 폴더 공유 해제 실행",shared_folder); deleteSharingList(); //공유 해제 폴더 처리 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ break; default: DBG("Unknown request id"); return SVC_RES_FAIL; break; } RETVM_IF(bundle_add_str(resp_msg, "server", resp_key_val) != 0, SVC_RES_FAIL, "Failed to add data by key to bundle"); _app_send_response(appdata, resp_msg); bundle_free(resp_msg); return SVC_RES_OK; }
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; }
int _bt_set_notification_app_launch(notification_h noti, bt_qp_launch_type_t type, const char *transfer_type, const char *filename, const char *progress_cnt) { DBG("+\n"); if (!noti) return -1; if (!transfer_type) return -1; notification_error_e ret = NOTIFICATION_ERROR_NONE; bundle *b = NULL; b = bundle_create(); if (!b) return -1; if (type == CREATE_PROGRESS) { int group_id = 0; int priv_id = 0; double percentage = 0; char progress[BT_PERCENT_STR_LEN] = { 0 }; char priv_id_str[BT_PRIV_ID_STR_LEN] = { 0 }; if (!filename) { bundle_free(b); return -1; } ret = notification_get_progress(noti, &percentage); if (ret != NOTIFICATION_ERROR_NONE) ERR("Fail to notification_update_progress\n"); else snprintf(progress, BT_PERCENT_STR_LEN, "%d", (int)percentage); ret = notification_get_id(noti, &group_id, &priv_id); if (ret != NOTIFICATION_ERROR_NONE) ERR("Fail to notification_update_progress\n"); else snprintf(priv_id_str, BT_PRIV_ID_STR_LEN, "%d", priv_id); appsvc_set_pkgname(b, UI_PACKAGE); appsvc_add_data(b, "launch-type", "ongoing"); appsvc_add_data(b, "percentage", progress); appsvc_add_data(b, "filename", filename); appsvc_add_data(b, "transfer_type", transfer_type); appsvc_add_data(b, "transfer_id", priv_id_str); if (g_strcmp0(transfer_type, NOTI_TR_TYPE_OUT) == 0) { if (!progress_cnt) { bundle_free(b); return -1; } appsvc_add_data(b, "progress_cnt", progress_cnt); } } else if (type == CREATE_TR_LIST) { appsvc_set_pkgname(b, UI_PACKAGE); appsvc_add_data(b, "launch-type", "transfer_list"); appsvc_add_data(b, "transfer_type", transfer_type); } else { bundle_free(b); return -1; } ret = notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, NULL, b); if (ret != NOTIFICATION_ERROR_NONE) { ERR("Fail to notification_set_execute_option\n"); } bundle_free(b); DBG("-\n"); return ret; }