EAPI DBusPendingCall * e_dbus_method_call_send(E_DBus_Connection *conn, DBusMessage *msg, E_DBus_Unmarshal_Func unmarshal_func, E_DBus_Callback_Func cb_func, E_DBus_Free_Func free_func, int timeout, void *data) { E_DBus_Callback *cb; cb = e_dbus_callback_new(cb_func, unmarshal_func, free_func, data); return e_dbus_message_send(conn, msg, cb_method_call, timeout, cb); }
Eina_Bool logind_init(E_DBus_Connection *conn) { #if HAVE_LIBSYSTEMD_LOGIN char *id; DBG("Requesting systemd-login session via library"); if (sd_pid_get_session (empower_pid, &id) < 0) return EINA_FALSE; _logind_session_id = eina_stringshare_add(id); free(id); return EINA_TRUE; #else DBusMessage *msg; DBusMessageIter itr; DBG("Requesting systemd-login session via dbus"); msg = dbus_message_new_method_call(LOGIND_BUS, LOGIND_PATH, LOGIND_INTERFACE, "GetSessionByPID"); if (!msg) return EINA_FALSE; dbus_message_iter_init_append(msg, &itr); dbus_message_iter_append_basic(&itr, DBUS_TYPE_UINT32, &empower_pid); e_dbus_message_send(conn, msg, _logind_session_id_done, 5000, NULL); return EINA_TRUE; #endif }
static void _dialog_ok_cb(void *data, E_Dialog *dialog) { E_Connman_Agent *agent = data; E_Connman_Agent_Input *input; Evas_Object *toolbook, *list; DBusMessageIter iter, dict; Eina_List *input_list, *l; DBusMessage *reply; toolbook = agent->dialog->content_object; /* fugly - no toolbook page get */ list = evas_object_data_get(toolbook, "mandatory"); if ((!list) || (!evas_object_visible_get(list))) { list = evas_object_data_get(toolbook, "alternate"); if ((!list) || (!evas_object_visible_get(list))) { ERR("Couldn't get user input."); e_object_del(E_OBJECT(dialog)); return; } } agent->canceled = EINA_FALSE; input_list = evas_object_data_get(list, "input_list"); reply = dbus_message_new_method_return(agent->msg); dbus_message_iter_init_append(reply, &iter); dbus_message_iter_open_container( &iter, DBUS_TYPE_ARRAY, DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict); EINA_LIST_FOREACH(input_list, l, input) _dict_append_basic(&dict, input->key, input->value); dbus_message_iter_close_container(&iter, &dict); dbus_message_set_no_reply(reply, EINA_TRUE); e_dbus_message_send(agent->conn, reply, NULL, -1, NULL); e_object_del(E_OBJECT(dialog)); }
static DBusPendingCall * _dbus_send_msg(const char *path, const char *method, E_DBus_Method_Return_Cb _cb, void *data) { DBusMessage *msg; DBusPendingCall *pnd; if (!active) return NULL; msg = dbus_message_new_method_call(bus_name, path, mpris_interface, method); pnd = e_dbus_message_send(conn, msg, _cb, -1, data); dbus_message_unref(msg); return pnd; }
static void _message(E_DBus_Connection *conn, char *name, char *image) { DBusMessage *msg; DBusMessageIter iter; msg = dbus_message_new_method_call( "org.enlightenment.wm.service", "/org/enlightenment/Remote/RemoteObject", "org.enlightenment.Remote.Wallpaper",name); if( image != NULL) { dbus_message_iter_init_append(msg, &iter); dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &image); } e_dbus_message_send(conn, msg, cb_reply, 10, NULL); dbus_message_unref(msg); }
static DBusPendingCall * _dbus_send_msg_int(const char *path, const char *method, E_DBus_Method_Return_Cb _cb, void *data, int num) { DBusMessage *msg; DBusPendingCall *pnd; if (!active) return NULL; msg = dbus_message_new_method_call(bus_name, path, mpris_interface, method); dbus_message_append_args(msg, DBUS_TYPE_INT32, &num, DBUS_TYPE_INVALID); pnd = e_dbus_message_send(conn, msg, _cb, -1, data); dbus_message_unref(msg); return pnd; }
int _bt_ipc_send_obex_message(uint8_t *address, const uint8_t *files, uint32_t length) { int result = 0; uint32_t i, count = 1; E_DBus_Connection *conn = NULL; LOGD("[%s(): %d] BEGIN>>>>", __FUNCTION__, __LINE__); if (address == NULL || files == NULL) { LOGD("invalid param [%p] [%p]", address, files); return 0; } /* count files */ for (i = 0; i < length; i++) { if (files[i] == '?') { count++; } } if (e_dbus_init() > 0) { if ((conn = e_dbus_bus_get(DBUS_BUS_SYSTEM)) != NULL) { DBusMessage *msg = NULL; if (e_dbus_request_name(conn, "User.Bluetooth.UG", 0, NULL, NULL) != NULL) { if ((msg = dbus_message_new_signal("/org/projectx/connect_device", "User.Bluetooth.UG", "Send")) != NULL) { int reserved = 0; char *type = "nfc"; LOGD("msg [%p], reserved [%d], address [%02X:%02X:%02X:%02X:%02X:%02X], count [%d], files [%s]", msg, reserved, address[0], address[1], address[2], address[3], address[4], address[5], count, files); if (dbus_message_append_args(msg, DBUS_TYPE_INT32, &reserved, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &address, 6, DBUS_TYPE_INT32, &count, DBUS_TYPE_STRING, &files, DBUS_TYPE_STRING, &type, DBUS_TYPE_INVALID)) { e_dbus_message_send(conn, msg, NULL, -1, NULL); LOGD("Send success"); } else { LOGE("Connect sending failed"); result = -1; } dbus_message_unref(msg); } else { LOGE("dbus_message_new_signal failed"); result = -1; } } else { LOGE("e_dbus_request_name failed"); result = -1; } } else { LOGE("e_dbus_bus_get failed"); result = -1; } e_dbus_shutdown(); } else { LOGE("e_dbus_init failed"); result = -1; } LOGD("[%s(): %d] END>>>>", __FUNCTION__, __LINE__); return result; }