本文整理汇总了C++中dbus_pending_call_steal_reply函数的典型用法代码示例。如果您正苦于以下问题:C++ dbus_pending_call_steal_reply函数的具体用法?C++ dbus_pending_call_steal_reply怎么用?C++ dbus_pending_call_steal_reply使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbus_pending_call_steal_reply函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_config_reply
static void create_config_reply(DBusPendingCall *call, void *user_data)
{
DBusMessage *reply = dbus_pending_call_steal_reply(call);
const char *path;
DBG("");
if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) {
connman_error("Failed to create proxy configuration");
goto done;
}
if (dbus_message_get_args(reply, NULL, DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID) == FALSE)
goto done;
g_free(current_config);
current_config = g_strdup(path);
done:
dbus_message_unref(reply);
}
示例2: dbus_func_args_async_callback
void dbus_func_args_async_callback(DBusPendingCall *call, void *data) {
dbus_async_call_t *req = (dbus_async_call_t *)data;
DBusMessage *msg;
/* This is guaranteed to be non-NULL, because this function is called only
when once the remote method invokation returns. */
msg = dbus_pending_call_steal_reply(call);
if (msg) {
if (req->user_cb) {
// The user may not deref the message object.
req->user_cb(msg, req->user);
}
dbus_message_unref(msg);
}
//dbus_message_unref(req->method);
dbus_pending_call_cancel(call);
dbus_pending_call_unref(call);
free(req);
}
示例3: get_active_cb
static void
get_active_cb(DBusPendingCall *pending, void *data)
{
struct launcher_logind *wl = data;
DBusMessageIter iter;
DBusMessage *m;
int type;
dbus_pending_call_unref(wl->pending_active);
wl->pending_active = NULL;
m = dbus_pending_call_steal_reply(pending);
if (!m)
return;
type = dbus_message_get_type(m);
if (type == DBUS_MESSAGE_TYPE_METHOD_RETURN &&
dbus_message_iter_init(m, &iter))
parse_active(wl, m, &iter);
dbus_message_unref(m);
}
示例4: systemui_ack_cb
static void
systemui_ack_cb(DBusPendingCall *pending, void *user_data)
{
DBusMessage *rsp = dbus_pending_call_steal_reply(pending);
if( rsp != 0 )
{
DBusError err = DBUS_ERROR_INIT;
dbus_int32_t *vec = 0;
int cnt = 0;
switch( dbus_message_get_type(rsp) )
{
case DBUS_MESSAGE_TYPE_METHOD_RETURN:
if( dbus_message_get_args(rsp, &err,
DBUS_TYPE_ARRAY,
DBUS_TYPE_INT32, &vec, &cnt,
DBUS_TYPE_INVALID) )
{
if( systemui_ack_callback != 0 )
{
systemui_ack_callback(vec, cnt);
}
}
if( dbus_error_is_set(&err) )
{
log_error_F("%s: %s\n", err.name, err.message);
}
break;
case DBUS_MESSAGE_TYPE_ERROR:
// TODO: handle system ui not up
break;
}
dbus_error_free(&err);
dbus_message_unref(rsp);
}
}
示例5: new_conn_reply
static void new_conn_reply(DBusPendingCall *call, void *user_data)
{
struct ext_io *conn = user_data;
struct ext_profile *ext = conn->ext;
DBusMessage *reply = dbus_pending_call_steal_reply(call);
DBusError err;
dbus_error_init(&err);
dbus_set_error_from_message(&err, reply);
dbus_message_unref(reply);
dbus_pending_call_unref(conn->new_conn);
conn->new_conn = NULL;
if (!dbus_error_is_set(&err)) {
if (conn->cb) {
conn->cb(&ext->p, conn->device, 0);
conn->cb = NULL;
}
return;
}
error("%s replied with an error: %s, %s", ext->name,
err.name, err.message);
if (conn->cb) {
conn->cb(&ext->p, conn->device, -ECONNREFUSED);
conn->cb = NULL;
}
if (dbus_error_has_name(&err, DBUS_ERROR_NO_REPLY))
ext_cancel(ext);
dbus_error_free(&err);
ext->conns = g_slist_remove(ext->conns, conn);
ext_io_destroy(conn);
}
示例6: mode_request_reply
static void mode_request_reply(DBusPendingCall *call, void *user_data)
{
struct obex_server *server = user_data;
DBusMessage *reply = dbus_pending_call_steal_reply(call);
DBusError derr;
dbus_error_init(&derr);
if (dbus_set_error_from_message(&derr, reply)) {
error("usb: Replied with an error: %s, %s",
derr.name, derr.message);
dbus_error_free(&derr);
} else {
const char *mode;
dbus_message_get_args(reply, NULL,
DBUS_TYPE_STRING, &mode,
DBUS_TYPE_INVALID);
usb_set_mode(server, mode);
}
dbus_message_unref(reply);
}
示例7: session_request_reply
static void session_request_reply(DBusPendingCall *call, gpointer user_data)
{
struct pending_data *pending = user_data;
struct obc_session *session = pending->session;
DBusMessage *reply = dbus_pending_call_steal_reply(call);
const char *name;
DBusError derr;
dbus_error_init(&derr);
if (dbus_set_error_from_message(&derr, reply)) {
GError *gerr = NULL;
error("Replied with an error: %s, %s",
derr.name, derr.message);
dbus_error_free(&derr);
dbus_message_unref(reply);
g_set_error(&gerr, OBEX_IO_ERROR, -ECANCELED, "%s",
derr.message);
session_terminate_transfer(session, pending->transfer, gerr);
g_clear_error(&gerr);
return;
}
dbus_message_get_args(reply, NULL,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_INVALID);
DBG("Agent.Request() reply: %s", name);
if (strlen(name))
obc_transfer_set_name(pending->transfer, name);
pending->cb(session, NULL, pending->transfer);
dbus_message_unref(reply);
return;
}
示例8: connect_cb
static void connect_cb(DBusPendingCall *call, void *user_data)
{
struct synce_context *context = user_data;
DBusConnection *conn;
DBusMessage *reply;
DBusError err;
char *path;
conn = context->dbus_conn;
reply = dbus_pending_call_steal_reply(call);
dbus_error_init(&err);
if (dbus_message_get_args(reply, &err, DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID) == FALSE) {
error("%s", err.message);
dbus_error_free(&err);
goto failed;
}
DBG("Got conn object %s from syncevolution", path);
context->conn_obj = g_strdup(path);
context->reply_watch = g_dbus_add_signal_watch(conn, NULL, path,
SYNCE_CONN_INTERFACE, "Reply",
reply_signal, context, NULL);
context->abort_watch = g_dbus_add_signal_watch(conn, NULL, path,
SYNCE_CONN_INTERFACE, "Abort",
abort_signal, context, NULL);
dbus_message_unref(reply);
return;
failed:
obex_object_set_io_flags(context, G_IO_ERR, -EPERM);
context->lasterr = -EPERM;
}
示例9: dbus_call_method
int dbus_call_method(DBusConnection* dbus_connection, const char* bus_name,
const char* path, const char* iface, const char* method,
char** params, char** ret)
{
DBusMessage *message;
DBusMessageIter args;
DBusPendingCall* pending;
int param_index, param_count = sizeof(params) / sizeof(char*);
message = dbus_message_new_method_call(
bus_name,
path,
iface,
method);
dbus_message_iter_init_append(message, &args);
for (param_index = 0; param_index < param_count; param_index++) {
dbus_message_iter_append_basic(
&args, DBUS_TYPE_STRING,
¶ms[param_index]);
}
dbus_connection_send_with_reply(dbus_connection, message, &pending, -1);
dbus_connection_flush(dbus_connection);
dbus_message_unref(message);
dbus_pending_call_block(pending);
if (ret) message = dbus_pending_call_steal_reply(pending);
dbus_pending_call_unref(pending);
if (ret) {
dbus_message_iter_init(message, &args);
dbus_message_iter_get_basic(&args, ret);
dbus_message_unref(message);
}
return RET_OK;
}
示例10: cb_pending
static void
cb_pending(DBusPendingCall *dbus_pending, void *user_data)
{
Eldbus_Message *msg;
Eldbus_Pending *pending = user_data;
if (!dbus_pending_call_get_completed(dbus_pending))
{
INF("timeout to pending %p", pending);
dbus_pending_call_cancel(dbus_pending);
msg = eldbus_message_error_new(pending->msg_sent,
ELDBUS_ERROR_PENDING_TIMEOUT,
"This call was not completed in time.");
eldbus_pending_dispatch(pending, msg);
return;
}
msg = eldbus_message_new(EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN(msg);
msg->dbus_msg = dbus_pending_call_steal_reply(dbus_pending);
if (!msg->dbus_msg)
{
EINA_SAFETY_ON_NULL_GOTO(pending->cb, cleanup);
msg->dbus_msg = dbus_message_new_error(NULL,
"org.enlightenment.DBus.NoReply",
"There was no reply to this method call.");
EINA_SAFETY_ON_NULL_GOTO(msg->dbus_msg, cleanup);
}
dbus_message_iter_init(msg->dbus_msg, &msg->iterator->dbus_iterator);
eldbus_pending_dispatch(pending, msg);
return;
cleanup:
eldbus_message_unref(msg);
}
示例11: systemui_ack_close
static void
systemui_ack_close(DBusPendingCall *pending, void *user_data)
{
cookie_t cookie = (cookie_t)user_data;
int result = 0;
DBusMessage *rsp = dbus_pending_call_steal_reply(pending);
if( rsp != 0 )
{
DBusError err = DBUS_ERROR_INIT;
dbus_int32_t ack = 0;
switch( dbus_message_get_type(rsp) )
{
case DBUS_MESSAGE_TYPE_METHOD_RETURN:
if( dbus_message_get_args(rsp, &err,
DBUS_TYPE_INT32, &ack,
DBUS_TYPE_INVALID) )
{
result = ack;
}
if( dbus_error_is_set(&err) )
{
log_error_F("%s: %s\n", err.name, err.message);
}
break;
case DBUS_MESSAGE_TYPE_ERROR:
// TODO: handle system ui not up
break;
}
dbus_error_free(&err);
dbus_message_unref(rsp);
}
log_debug_F("%ld -> %s\n", (long)cookie, (result>0) ? "ACK" : "NAK");
}
示例12: loader_needed_cb
static void loader_needed_cb(DBusPendingCall *pending, void *user_data)
{
(void)user_data;
DBusMessage *rsp = 0;
DBusError err = DBUS_ERROR_INIT;
if (!(rsp = dbus_pending_call_steal_reply(pending)))
goto cleanup;
if (dbus_set_error_from_message(&err, rsp)) {
dsme_log(LOG_DEBUG, "wlanloader: disabled, GetUnit: %s: %s",
err.name, err.message);
} else {
/* We got the reply without error, so the service exists */
dsme_dbus_bind_signals(&bound, signals);
dsme_log(LOG_DEBUG, "wlanloader: activated");
}
cleanup:
if (rsp) dbus_message_unref(rsp);
dbus_error_free(&err);
}
示例13: object_destroyed
/* Don't be bothered by the fact that this function is almost exactly
* the same as object_created(). The little difference is that it
* gives the callback the objectid on error too. */
static void object_destroyed(DBusPendingCall *pendelum, RequestReplyInfo *info)
{
GError *error;
DBusMessage *reply;
reply = dbus_pending_call_steal_reply(pendelum);
if (!(error = mafw_dbus_is_error(reply, MAFW_SOURCE_ERROR))) {
g_assert(dbus_message_get_type(reply) ==
DBUS_MESSAGE_TYPE_METHOD_RETURN);
if (info->object_destroyed_cb)
info->object_destroyed_cb(info->src,
info->objectid,
info->cbdata, NULL);
} else {
if (info->object_destroyed_cb)
info->object_destroyed_cb(info->src,
info->objectid,
info->cbdata, error);
g_error_free(error);
}
dbus_message_unref(reply);
dbus_pending_call_unref(pendelum);
}
示例14: register_agent_cb
static void register_agent_cb(DBusPendingCall *pending, void *user_data)
{
DBusMessage *reply;
if (dbus_pending_call_get_completed(pending) == FALSE)
return;
register_call = NULL;
reply = dbus_pending_call_steal_reply(pending);
if (reply == NULL)
goto out;
if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) {
g_dbus_unregister_interface(connection,
AGENT_PATH, NEARD_AGENT_INTERFACE);
} else
agent_registered = TRUE;
dbus_message_unref(reply);
out:
dbus_pending_call_unref(pending);
}
示例15: method_call_reply
static void method_call_reply(DBusPendingCall *call, void *user_data)
{
struct method_call_data *data = user_data;
DBusMessage *reply;
DBusMessageIter iter;
const char *error;
reply = dbus_pending_call_steal_reply(call);
if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR)
error = dbus_message_get_error_name(reply);
else
error = NULL;
dbus_message_iter_init(reply, &iter);
if (data->function != NULL)
data->function(error, &iter, data->user_data);
dbus_message_unref(reply);
dbus_pending_call_unref(call);
}