本文整理汇总了C++中dbus_pending_call_set_notify函数的典型用法代码示例。如果您正苦于以下问题:C++ dbus_pending_call_set_notify函数的具体用法?C++ dbus_pending_call_set_notify怎么用?C++ dbus_pending_call_set_notify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbus_pending_call_set_notify函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dbus_connection_send_with_reply
bool wxDBusConnection::SendWithReply(DBusMessage *message, int timeout_milliseconds)
{
DBusPendingCall * pcall = NULL;
m_thread->EnterCriticalSection();
bool result = (bool) dbus_connection_send_with_reply(m_connection, message, &pcall, timeout_milliseconds);
dbus_pending_call_set_notify(pcall, response_notify, (void *) this, NULL);
m_thread->LeaveCriticalSection();
m_thread->Wakeup();
return result;
}
开发者ID:AbelTian,项目名称:filezilla,代码行数:10,代码来源:wxdbusconnection.cpp
示例2: supplicant_dbus_property_get
int supplicant_dbus_property_get(const char *path, const char *interface,
const char *method,
supplicant_dbus_property_function function,
void *user_data)
{
struct property_get_data *data;
DBusMessage *message;
DBusPendingCall *call;
if (connection == NULL)
return -EINVAL;
if (path == NULL || interface == NULL || method == NULL)
return -EINVAL;
data = dbus_malloc0(sizeof(*data));
if (data == NULL)
return -ENOMEM;
message = dbus_message_new_method_call(SUPPLICANT_SERVICE, path,
DBUS_INTERFACE_PROPERTIES, "Get");
if (message == NULL) {
dbus_free(data);
return -ENOMEM;
}
dbus_message_set_auto_start(message, FALSE);
dbus_message_append_args(message, DBUS_TYPE_STRING, &interface,
DBUS_TYPE_STRING, &method, NULL);
if (dbus_connection_send_with_reply(connection, message,
&call, TIMEOUT) == FALSE) {
dbus_message_unref(message);
dbus_free(data);
return -EIO;
}
if (call == NULL) {
dbus_message_unref(message);
dbus_free(data);
return -EIO;
}
data->function = function;
data->user_data = user_data;
dbus_pending_call_set_notify(call, property_get_reply,
data, dbus_free);
dbus_message_unref(message);
return 0;
}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-connman,代码行数:55,代码来源:dbus.c
示例3: g_dbus_proxy_method_call
gboolean g_dbus_proxy_method_call(GDBusProxy *proxy, const char *method,
GDBusSetupFunction setup,
GDBusReturnFunction function, void *user_data,
GDBusDestroyFunction destroy)
{
struct method_call_data *data;
GDBusClient *client;
DBusMessage *msg;
DBusPendingCall *call;
if (proxy == NULL || method == NULL)
return FALSE;
client = proxy->client;
if (client == NULL)
return FALSE;
msg = dbus_message_new_method_call(client->service_name,
proxy->obj_path, proxy->interface, method);
if (msg == NULL)
return FALSE;
if (setup) {
DBusMessageIter iter;
dbus_message_iter_init_append(msg, &iter);
setup(&iter, user_data);
}
if (!function)
return g_dbus_send_message(client->dbus_conn, msg);
data = g_try_new0(struct method_call_data, 1);
if (data == NULL)
return FALSE;
data->function = function;
data->user_data = user_data;
data->destroy = destroy;
if (g_dbus_send_message_with_reply(client->dbus_conn, msg,
&call, METHOD_CALL_TIMEOUT) == FALSE) {
dbus_message_unref(msg);
g_free(data);
return FALSE;
}
dbus_pending_call_set_notify(call, method_call_reply, data, g_free);
dbus_pending_call_unref(call);
dbus_message_unref(msg);
return TRUE;
}
开发者ID:AwxiVYTHUIiMOol,项目名称:bluez,代码行数:55,代码来源:client.c
示例4: xconnman_set_property_bool
/** Initiate asynchronous connman property change D-Bus method call
*
* @param key property name
* @param val value to set
*
* @return TRUE if the method call was initiated, or FALSE in case of errors
*/
static gboolean xconnman_set_property_bool(const char *key, gboolean val)
{
gboolean res = FALSE;
DBusMessage *req = 0;
DBusPendingCall *pc = 0;
dbus_bool_t dta = val;
DBusMessageIter miter, viter;
mce_log(LL_DEBUG, "%s = %s", key, val ? "true" : "false");
if( !(req = dbus_message_new_method_call(CONNMAN_SERVICE,
CONNMAN_OBJECT_PATH,
CONNMAN_INTERFACE,
CONNMAN_SET_PROPERTY_REQ)) )
goto EXIT;
dbus_message_iter_init_append(req, &miter);
dbus_message_iter_append_basic(&miter, DBUS_TYPE_STRING, &key);
if( !dbus_message_iter_open_container(&miter, DBUS_TYPE_VARIANT,
DBUS_TYPE_BOOLEAN_AS_STRING,
&viter) ) {
mce_log(LL_WARN, "container open failed");
goto EXIT;
}
dbus_message_iter_append_basic(&viter, DBUS_TYPE_BOOLEAN, &dta);
if( !dbus_message_iter_close_container(&miter, &viter) ) {
mce_log(LL_WARN, "container close failed");
goto EXIT;
}
if( !dbus_connection_send_with_reply(connman_bus, req, &pc, -1) )
goto EXIT;
if( !pc )
goto EXIT;
mce_dbus_pending_call_blocks_suspend(pc);
if( !dbus_pending_call_set_notify(pc, xconnman_set_property_cb, 0, 0) )
goto EXIT;
// success
res = TRUE;
EXIT:
if( pc ) dbus_pending_call_unref(pc);
if( req ) dbus_message_unref(req);
return res;
}
开发者ID:spiiroin,项目名称:mce,代码行数:61,代码来源:radiostates.c
示例5: handle_run_hello_from_self
static DBusHandlerResult
handle_run_hello_from_self (DBusConnection *connection,
DBusMessage *message)
{
DBusError error;
DBusMessage *reply, *self_message;
DBusPendingCall *pcall;
char *s;
_dbus_verbose ("sending reply to Echo method\n");
dbus_error_init (&error);
if (!dbus_message_get_args (message,
&error,
DBUS_TYPE_STRING, &s,
DBUS_TYPE_INVALID))
{
reply = dbus_message_new_error (message,
error.name,
error.message);
if (reply == NULL)
die ("No memory\n");
if (!dbus_connection_send (connection, reply, NULL))
die ("No memory\n");
dbus_message_unref (reply);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
printf ("Sending HelloFromSelf\n");
_dbus_verbose ("*** Sending message to self\n");
self_message = dbus_message_new_method_call ("org.freedesktop.DBus.TestSuiteEchoService",
"/org/freedesktop/TestSuite",
"org.freedesktop.TestSuite",
"HelloFromSelf");
if (self_message == NULL)
die ("No memory");
if (!dbus_connection_send_with_reply (connection, self_message, &pcall, -1))
die("No memory");
dbus_message_ref (message);
if (!dbus_pending_call_set_notify (pcall, check_hello_from_self_reply, (void *)message, NULL))
die("No memory");
printf ("Sent HelloFromSelf\n");
return DBUS_HANDLER_RESULT_HANDLED;
}
开发者ID:psunkari,项目名称:spicebird,代码行数:53,代码来源:test-service.c
示例6: _eldbus_connection_send
/*
* On success @param msg is unref'd or its ref is stolen by the returned
* Eldbus_Pending.
*/
Eldbus_Pending *
_eldbus_connection_send(Eldbus_Connection *conn, Eldbus_Message *msg, Eldbus_Message_Cb cb, const void *cb_data, double timeout)
{
Eldbus_Pending *pending;
Eldbus_Message *error_msg;
DBG("conn=%p, msg=%p, cb=%p, cb_data=%p, timeout=%f",
conn, msg, cb, cb_data, timeout);
if (!cb)
{
dbus_connection_send(conn->dbus_conn, msg->dbus_msg, NULL);
eldbus_message_unref(msg);
return NULL;
}
pending = calloc(1, sizeof(Eldbus_Pending));
EINA_SAFETY_ON_NULL_RETURN_VAL(pending, NULL);
pending->cb = cb;
pending->cb_data = cb_data;
pending->conn = conn;
pending->dest = eina_stringshare_add(dbus_message_get_destination(msg->dbus_msg));
pending->interface = eina_stringshare_add(dbus_message_get_interface(msg->dbus_msg));
pending->method = eina_stringshare_add(dbus_message_get_member(msg->dbus_msg));
pending->path = eina_stringshare_add(dbus_message_get_path(msg->dbus_msg));
/* Steal the reference */
pending->msg_sent = msg;
EINA_MAGIC_SET(pending, ELDBUS_PENDING_MAGIC);
if (!dbus_connection_send_with_reply(conn->dbus_conn,
msg->dbus_msg,
&pending->dbus_pending, timeout))
{
error_msg = eldbus_message_error_new(msg, "org.enlightenment.DBus.NoConnection",
"Eldbus_Connection was closed.");
eldbus_pending_dispatch(pending, error_msg);
return NULL;
}
if (dbus_pending_call_set_notify(pending->dbus_pending, cb_pending, pending, NULL))
return pending;
dbus_pending_call_cancel(pending->dbus_pending);
error_msg = eldbus_message_error_new(pending->msg_sent,
"org.enlightenment.DBus.Error",
"Error when try set callback to message.");
eldbus_pending_dispatch(pending, error_msg);
return NULL;
}
开发者ID:FlorentRevest,项目名称:EFL,代码行数:54,代码来源:eldbus_pending.c
示例7: test_uae
static void
test_uae (Fixture *f,
gconstpointer context)
{
const Config *config = context;
DBusMessage *m;
DBusPendingCall *pc;
DBusMessageIter args_iter;
DBusMessageIter arr_iter;
if (f->skip)
return;
m = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, "UpdateActivationEnvironment");
if (m == NULL)
g_error ("OOM");
dbus_message_iter_init_append (m, &args_iter);
/* Append an empty a{ss} (string => string dictionary). */
if (!dbus_message_iter_open_container (&args_iter, DBUS_TYPE_ARRAY,
"{ss}", &arr_iter) ||
!dbus_message_iter_close_container (&args_iter, &arr_iter))
g_error ("OOM");
if (!dbus_connection_send_with_reply (f->conn, m, &pc,
DBUS_TIMEOUT_USE_DEFAULT) ||
pc == NULL)
g_error ("OOM");
dbus_message_unref (m);
m = NULL;
if (dbus_pending_call_get_completed (pc))
test_pending_call_store_reply (pc, &m);
else if (!dbus_pending_call_set_notify (pc, test_pending_call_store_reply,
&m, NULL))
g_error ("OOM");
while (m == NULL)
test_main_context_iterate (f->ctx, TRUE);
if (config->expect_success)
{
/* it succeeds */
g_assert_cmpint (dbus_message_get_type (m), ==,
DBUS_MESSAGE_TYPE_METHOD_RETURN);
}
开发者ID:MOBO-OSS,项目名称:systemd-relative,代码行数:50,代码来源:uid-permissions.c
示例8: hald_runner_run_method
/* Run a helper program using the commandline, with input as infomation on
* stdin */
void
hald_runner_run_method(HalDevice *device,
const gchar *command_line, char **extra_env,
gchar *input, gboolean error_on_stderr,
guint32 timeout,
HalRunTerminatedCB cb,
gpointer data1, gpointer data2) {
DBusMessage *msg;
DBusMessageIter iter;
DBusPendingCall *call;
HelperData *hd = NULL;
msg = dbus_message_new_method_call("org.freedesktop.HalRunner",
"/org/freedesktop/HalRunner",
"org.freedesktop.HalRunner",
"Run");
if (msg == NULL)
DIE(("No memory"));
dbus_message_iter_init_append(msg, &iter);
if (!add_first_part(&iter, device, command_line, extra_env))
goto error;
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &input);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &error_on_stderr);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32, &timeout);
if (!dbus_connection_send_with_reply(runner_connection,
msg, &call, INT_MAX))
DIE (("No memory"));
/* the connection was disconnected */
if (call == NULL)
goto error;
hd = malloc(sizeof(HelperData));
hd->d = device;
hd->cb = cb;
hd->data1 = data1;
hd->data2 = data2;
g_object_ref (device);
dbus_pending_call_set_notify(call, call_notify, hd, free);
dbus_message_unref(msg);
return;
error:
dbus_message_unref(msg);
free(hd);
cb(device, HALD_RUN_FAILED, 0, NULL, data1, data2);
}
开发者ID:AlainODea,项目名称:illumos-gate,代码行数:52,代码来源:hald_runner.c
示例9: add_interface
static int add_interface(struct supplicant_task *task)
{
const char *driver = connman_option_get_string("wifi");
DBusMessage *message;
DBusMessageIter array, dict;
DBusPendingCall *call;
_DBG_SUPPLICANT("task %p", task);
message = dbus_message_new_method_call(SUPPLICANT_NAME, SUPPLICANT_PATH,
SUPPLICANT_INTF, "addInterface");
if (message == NULL)
return -ENOMEM;
dbus_message_set_auto_start(message, FALSE);
dbus_message_iter_init_append(message, &array);
dbus_message_iter_append_basic(&array,
DBUS_TYPE_STRING, &task->ifname);
dbus_message_iter_open_container(&array, 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);
connman_dbus_dict_append_variant(&dict, "driver",
DBUS_TYPE_STRING, &driver);
dbus_message_iter_close_container(&array, &dict);
if (dbus_connection_send_with_reply(connection, message,
&call, TIMEOUT) == FALSE) {
connman_error("Failed to add interface");
dbus_message_unref(message);
return -EIO;
}
if (call == NULL) {
connman_error("D-Bus connection not available");
dbus_message_unref(message);
return -EIO;
}
dbus_pending_call_set_notify(call, add_interface_reply, task, NULL);
dbus_message_unref(message);
return -EINPROGRESS;
}
开发者ID:wenhann,项目名称:chromiumos,代码行数:50,代码来源:supplicant.c
示例10: test_echo
static void
test_echo (Fixture *f,
gconstpointer context G_GNUC_UNUSED)
{
guint count = 2000;
guint sent;
guint received = 0;
double elapsed;
if (g_test_perf ())
count = 100000;
add_echo_filter (f);
g_test_timer_start ();
for (sent = 0; sent < count; sent++)
{
DBusMessage *m = dbus_message_new_method_call (
dbus_bus_get_unique_name (f->right_conn), "/",
"com.example", "Spam");
DBusPendingCall *pc;
if (m == NULL)
g_error ("OOM");
if (!dbus_connection_send_with_reply (f->left_conn, m, &pc,
DBUS_TIMEOUT_INFINITE) ||
pc == NULL)
g_error ("OOM");
if (dbus_pending_call_get_completed (pc))
pc_count (pc, &received);
else if (!dbus_pending_call_set_notify (pc, pc_count, &received,
NULL))
g_error ("OOM");
dbus_pending_call_unref (pc);
dbus_message_unref (m);
}
while (received < count)
g_main_context_iteration (NULL, TRUE);
elapsed = g_test_timer_elapsed ();
g_test_maximized_result (count / elapsed, "%u messages / %f seconds",
count, elapsed);
}
开发者ID:OmarBizreh,项目名称:Sliding_XZ,代码行数:49,代码来源:dbus-daemon.c
示例11: handle_authorize_request
DBusHandlerResult handle_authorize_request(DBusConnection *conn,
DBusMessage *msg,
struct service *service,
const char *address,
const char *uuid)
{
struct auth_agent_req *req;
char adapter_path[PATH_MAX];
bdaddr_t bdaddr;
int adapter_id;
debug("handle_authorize_request");
if (!default_auth_agent) {
debug("no default agent");
return error_auth_agent_does_not_exist(conn, msg);
}
str2ba(address, &bdaddr);
adapter_id = hci_for_each_dev(HCI_UP, find_conn, (long) &bdaddr);
if (adapter_id < 0)
return error_not_connected(conn, msg);
debug("Found %s connected to hci%d", address, adapter_id);
snprintf(adapter_path, sizeof(adapter_path), "/org/bluez/hci%d",
adapter_id);
req = auth_agent_req_new(msg, default_auth_agent, adapter_path,
address, service->object_path, uuid);
req->call = auth_agent_call_authorize(default_auth_agent, adapter_path,
service->object_path, address,
uuid);
if (!req->call) {
auth_agent_req_free(req);
return DBUS_HANDLER_RESULT_NEED_MEMORY;
}
dbus_pending_call_set_notify(req->call, auth_agent_req_reply, req,
NULL);
default_auth_agent->pending_requests =
g_slist_append(default_auth_agent->pending_requests, req);
debug("authorize request was forwarded");
return DBUS_HANDLER_RESULT_HANDLED;
}
开发者ID:tazjel,项目名称:QtSixA,代码行数:49,代码来源:dbus-security.c
示例12: cka_clients_verify_name
/** Verify that a client exists via an asynchronous GetNameOwner method call
*
* @param name the dbus name who's owner we wish to know
*
* @return TRUE if the method call was initiated, or FALSE in case of errors
*/
static
gboolean
cka_clients_verify_name(const char *name)
{
gboolean res = FALSE;
DBusMessage *req = 0;
DBusPendingCall *pc = 0;
gchar *key = 0;
if( !(req = cka_dbusutil_create_GetNameOwner_req(name)) )
{
goto EXIT;
}
if( !dbus_connection_send_with_reply(cka_dbus_systembus, req, &pc, -1) )
{
goto EXIT;
}
if( !pc )
{
goto EXIT;
}
mce_dbus_pending_call_blocks_suspend(pc);
key = g_strdup(name);
if( !dbus_pending_call_set_notify(pc, cka_clients_verify_name_cb,
key, g_free) )
{
goto EXIT;
}
// key string is owned by pending call
key = 0;
// success
res = TRUE;
EXIT:
g_free(key);
if( pc ) dbus_pending_call_unref(pc);
if( req ) dbus_message_unref(req);
return res;
}
开发者ID:spiiroin,项目名称:mce,代码行数:55,代码来源:cpu-keepalive.c
示例13: cras_bt_transport_set_volume
int cras_bt_transport_set_volume(struct cras_bt_transport *transport,
uint16_t volume)
{
const char *key = "Volume";
const char *interface = BLUEZ_INTERFACE_MEDIA_TRANSPORT;
DBusMessage *method_call;
DBusMessageIter message_iter, variant;
DBusPendingCall *pending_call;
method_call = dbus_message_new_method_call(
BLUEZ_SERVICE,
transport->object_path,
DBUS_INTERFACE_PROPERTIES,
"Set");
if (!method_call)
return -ENOMEM;
dbus_message_iter_init_append(method_call, &message_iter);
dbus_message_iter_append_basic(&message_iter, DBUS_TYPE_STRING,
&interface);
dbus_message_iter_append_basic(&message_iter, DBUS_TYPE_STRING, &key);
dbus_message_iter_open_container(&message_iter, DBUS_TYPE_VARIANT,
DBUS_TYPE_UINT16_AS_STRING, &variant);
dbus_message_iter_append_basic(&variant, DBUS_TYPE_UINT16, &volume);
dbus_message_iter_close_container(&message_iter, &variant);
if (!dbus_connection_send_with_reply(transport->conn, method_call,
&pending_call,
DBUS_TIMEOUT_USE_DEFAULT)) {
dbus_message_unref(method_call);
return -ENOMEM;
}
dbus_message_unref(method_call);
if (!pending_call)
return -EIO;
if (!dbus_pending_call_set_notify(pending_call,
on_transport_volume_set,
NULL, NULL)) {
dbus_pending_call_cancel(pending_call);
dbus_pending_call_unref(pending_call);
return -ENOMEM;
}
return 0;
}
开发者ID:dgreid,项目名称:adhd,代码行数:49,代码来源:cras_bt_transport.c
示例14: g_dbus_proxy_refresh_property
gboolean g_dbus_proxy_refresh_property(GDBusProxy *proxy, const char *name)
{
struct refresh_property_data *data;
GDBusClient *client;
DBusMessage *msg;
DBusMessageIter iter;
DBusPendingCall *call;
if (proxy == NULL || name == NULL)
return FALSE;
client = proxy->client;
if (client == NULL)
return FALSE;
data = g_try_new0(struct refresh_property_data, 1);
if (data == NULL)
return FALSE;
data->proxy = proxy;
data->name = g_strdup(name);
msg = dbus_message_new_method_call(client->service_name,
proxy->obj_path, DBUS_INTERFACE_PROPERTIES, "Get");
if (msg == NULL) {
refresh_property_free(data);
return FALSE;
}
dbus_message_iter_init_append(msg, &iter);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING,
&proxy->interface);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &name);
if (g_dbus_send_message_with_reply(client->dbus_conn, msg,
&call, -1) == FALSE) {
dbus_message_unref(msg);
refresh_property_free(data);
return FALSE;
}
dbus_pending_call_set_notify(call, refresh_property_reply,
data, refresh_property_free);
dbus_pending_call_unref(call);
dbus_message_unref(msg);
return TRUE;
}
开发者ID:AwxiVYTHUIiMOol,项目名称:bluez,代码行数:49,代码来源:client.c
示例15: get_properties
static void get_properties(struct supplicant_task *task)
{
DBusMessage *message;
char *path;
path = g_slist_nth_data(task->scan_results, 0);
if (path == NULL)
goto noscan;
message = dbus_message_new_method_call(SUPPLICANT_NAME, path,
SUPPLICANT_INTF ".BSSID",
"properties");
task->scan_results = g_slist_remove(task->scan_results, path);
g_free(path);
if (message == NULL)
goto noscan;
dbus_message_set_auto_start(message, FALSE);
if (dbus_connection_send_with_reply(connection, message,
&task->result_call, TIMEOUT) == FALSE) {
connman_error("Failed to get network properties");
dbus_message_unref(message);
goto noscan;
}
if (task->result_call == NULL) {
connman_error("D-Bus connection not available");
dbus_message_unref(message);
goto noscan;
}
dbus_pending_call_set_notify(task->result_call,
properties_reply, task, NULL);
dbus_message_unref(message);
return;
noscan:
task->result_call = NULL;
if (task->scanning == TRUE) {
connman_device_set_scanning(task->device, FALSE);
task->scanning = FALSE;
}
}
开发者ID:wenhann,项目名称:chromiumos,代码行数:49,代码来源:supplicant.c
示例16: dbus_message_new_method_call
static struct pending_req *send_method_call(DBusConnection *connection,
const char *dest, const char *path,
const char *interface, const char *method,
DBusPendingCallNotifyFunction cb,
void *user_data, int type, ...)
{
DBusMessage *msg;
DBusPendingCall *call;
va_list args;
struct pending_req *req;
msg = dbus_message_new_method_call(dest, path, interface, method);
if (!msg) {
error("Unable to allocate new D-Bus %s message", method);
return NULL;
}
va_start(args, type);
if (!dbus_message_append_args_valist(msg, type, args)) {
dbus_message_unref(msg);
va_end(args);
return NULL;
}
va_end(args);
if (!cb) {
g_dbus_send_message(connection, msg);
return 0;
}
if (!dbus_connection_send_with_reply(connection, msg, &call, -1)) {
error("Sending %s failed", method);
dbus_message_unref(msg);
return NULL;
}
dbus_pending_call_set_notify(call, cb, user_data, NULL);
req = g_new0(struct pending_req, 1);
req->call = call;
req->user_data = user_data;
dbus_message_unref(msg);
return req;
}
开发者ID:KpuBopy4ka,项目名称:obexd-map,代码行数:48,代码来源:session.c
示例17: _libnm_glib_get_nm_state
static void
_libnm_glib_get_nm_state (libnm_glib_ctx *ctx)
{
DBusMessage * message;
DBusPendingCall * pcall = NULL;
g_return_if_fail (ctx != NULL);
if ((message = dbus_message_new_method_call (NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, "state")))
{
dbus_connection_send_with_reply (ctx->dbus_con, message, &pcall, -1);
if (pcall)
dbus_pending_call_set_notify (pcall, _libnm_glib_nm_state_cb, ctx, NULL);
dbus_message_unref (message);
}
}
开发者ID:BtbN,项目名称:NetworkManager,代码行数:16,代码来源:libnm_glib.c
示例18: provider_remove
static int provider_remove(struct connman_provider *provider)
{
DBusPendingCall *call;
DBusMessage *message;
struct connection_data *data;
data = connman_provider_get_data(provider);
DBG("provider %p data %p", provider, data);
/*
* When provider.c:provider_remove() calls this function,
* it will remove the provider itself after the call.
* This means that we cannot use the provider pointer later
* as it is no longer valid.
*/
data->provider = NULL;
message = dbus_message_new_method_call(VPN_SERVICE, "/",
VPN_MANAGER_INTERFACE,
VPN_REMOVE);
if (message == NULL)
return -ENOMEM;
dbus_message_append_args(message, DBUS_TYPE_OBJECT_PATH, &data->path,
NULL);
if (dbus_connection_send_with_reply(connection, message,
&call, DBUS_TIMEOUT) == FALSE) {
connman_error("Unable to call %s.%s()", VPN_MANAGER_INTERFACE,
VPN_REMOVE);
dbus_message_unref(message);
return -EINVAL;
}
if (call == NULL) {
dbus_message_unref(message);
return -EINVAL;
}
dbus_pending_call_set_notify(call, remove_connection_reply,
NULL, NULL);
dbus_message_unref(message);
return 0;
}
开发者ID:manjurajv,项目名称:connman,代码行数:47,代码来源:vpn.c
示例19: get_device_list
static gboolean get_device_list(gchar *adapter_path)
{
DBusMessage *request = NULL;
DBusPendingCall *pending_call = NULL;
DBusConnection *connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
if (!connection) {
goto error;
}
if ((request =
dbus_message_new_method_call ("org.bluez",
adapter_path,
"org.bluez.Adapter",
"ListDevices")) == NULL) {
goto error;
}
if (!dbus_connection_send_with_reply (connection,
request,
&pending_call,
-1)) {
goto error;
}
if (!dbus_pending_call_set_notify (pending_call,
get_device_list_cb,
NULL,
NULL)) {
dbus_pending_call_cancel (pending_call);
goto error;
}
dbus_message_unref(request);
return TRUE;
error:
if (request)
dbus_message_unref(request);
return FALSE;
}
开发者ID:foolab,项目名称:ohm-plugins-misc,代码行数:47,代码来源:bluetooth.c
示例20: get_default_adapter
/* start the D-Bus command chain to find out the already connected
* devices */
static gboolean get_default_adapter(void)
{
DBusMessage *request = NULL;
DBusPendingCall *pending_call = NULL;
DBusConnection *connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
if (!connection) {
goto error;
}
if ((request =
dbus_message_new_method_call ("org.bluez",
"/",
"org.bluez.Manager",
"DefaultAdapter")) == NULL) {
goto error;
}
if (!dbus_connection_send_with_reply (connection,
request,
&pending_call,
-1)) {
goto error;
}
if (!dbus_pending_call_set_notify (pending_call,
get_default_adapter_cb,
NULL,
NULL)) {
dbus_pending_call_cancel (pending_call);
goto error;
}
dbus_message_unref(request);
return TRUE;
error:
if (request)
dbus_message_unref(request);
return FALSE;
}
开发者ID:foolab,项目名称:ohm-plugins-misc,代码行数:49,代码来源:bluetooth.c
注:本文中的dbus_pending_call_set_notify函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论