本文整理汇总了C++中dbus_set_error_from_message函数的典型用法代码示例。如果您正苦于以下问题:C++ dbus_set_error_from_message函数的具体用法?C++ dbus_set_error_from_message怎么用?C++ dbus_set_error_from_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbus_set_error_from_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newconnection_reply
static void newconnection_reply(DBusPendingCall *call, void *data)
{
struct audio_device *dev = data;
struct gateway *gw = dev->gateway;
struct hf_agent *agent = gw->agent;
DBusMessage *reply = dbus_pending_call_steal_reply(call);
DBusError derr;
dbus_pending_call_unref(agent->call);
agent->call = NULL;
dbus_error_init(&derr);
if (!dbus_set_error_from_message(&derr, reply)) {
DBG("Agent reply: file descriptor passed successfully");
gw->rfcomm_id = g_io_add_watch(gw->rfcomm,
G_IO_ERR | G_IO_HUP | G_IO_NVAL,
(GIOFunc) rfcomm_disconnect_cb,
dev);
change_state(dev, GATEWAY_STATE_CONNECTED);
goto done;
}
DBG("Agent reply: %s", derr.message);
dbus_error_free(&derr);
gateway_close(dev);
done:
dbus_message_unref(reply);
}
示例2: remove_connection_reply
static void remove_connection_reply(DBusPendingCall *call, void *user_data)
{
DBusMessage *reply;
DBusError error;
if (dbus_pending_call_get_completed(call) == FALSE)
return;
DBG("");
reply = dbus_pending_call_steal_reply(call);
dbus_error_init(&error);
if (dbus_set_error_from_message(&error, reply) == TRUE) {
/*
* If the returned error is NotFound, it means that we
* have actually removed the provider in vpnd already.
*/
if (dbus_error_has_name(&error, CONNMAN_ERROR_INTERFACE
".NotFound") == FALSE)
connman_error("%s", error.message);
dbus_error_free(&error);
}
dbus_message_unref(reply);
dbus_pending_call_unref(call);
}
示例3: newconnection_reply
static void newconnection_reply(DBusPendingCall *call, void *data)
{
struct audio_device *dev = data;
DBusMessage *reply = dbus_pending_call_steal_reply(call);
DBusError derr;
if (!dev->gateway->rfcomm) {
DBG("RFCOMM disconnected from server before agent reply");
goto done;
}
dbus_error_init(&derr);
if (!dbus_set_error_from_message(&derr, reply)) {
DBG("Agent reply: file descriptor passed successfully");
change_state(dev, GATEWAY_STATE_CONNECTED);
goto done;
}
DBG("Agent reply: %s", derr.message);
dbus_error_free(&derr);
gateway_close(dev);
done:
dbus_message_unref(reply);
}
示例4: server_unregister_reply
static void server_unregister_reply(DBusPendingCall *call, void *user_data)
{
struct connman_technology *technology = user_data;
DBusError error;
DBusMessage *reply;
DBG("");
reply = dbus_pending_call_steal_reply(call);
dbus_error_init(&error);
if (dbus_set_error_from_message(&error, reply) == TRUE) {
connman_error("%s", error.message);
dbus_error_free(&error);
dbus_message_unref(reply);
dbus_pending_call_unref(call);
return;
}
dbus_message_unref(reply);
dbus_pending_call_unref(call);
connman_technology_tethering_notify(technology, FALSE);
}
示例5: connect_reply
static void connect_reply(DBusPendingCall *call, void *user_data)
{
char *path = user_data;
struct connman_network *network;
DBusMessage *reply;
DBusError error;
const char *interface = NULL;
int index;
network = g_hash_table_lookup(bluetooth_networks, path);
if (!network)
return;
DBG("network %p", network);
reply = dbus_pending_call_steal_reply(call);
dbus_error_init(&error);
if (dbus_set_error_from_message(&error, reply)) {
connman_error("%s", error.message);
dbus_error_free(&error);
goto err;
}
if (!dbus_message_get_args(reply, &error, DBUS_TYPE_STRING,
&interface, DBUS_TYPE_INVALID)) {
if (dbus_error_is_set(&error)) {
connman_error("%s", error.message);
dbus_error_free(&error);
} else
connman_error("Wrong arguments for connect");
goto err;
}
if (!interface)
goto err;
DBG("interface %s", interface);
index = connman_inet_ifindex(interface);
connman_network_set_index(network, index);
connman_network_set_connected(network, true);
dbus_message_unref(reply);
dbus_pending_call_unref(call);
return;
err:
connman_network_set_connected(network, false);
dbus_message_unref(reply);
dbus_pending_call_unref(call);
}
示例6: dbus_method_reply
static void dbus_method_reply(DBusPendingCall *call, void *user_data)
{
struct dbus_callback *callback = user_data;
DBusMessage *reply;
DBusMessageIter iter;
reply = dbus_pending_call_steal_reply(call);
dbus_pending_call_unref(call);
if (dbus_message_get_type(reply) == DBUS_MESSAGE_TYPE_ERROR) {
DBusError err;
dbus_error_init(&err);
dbus_set_error_from_message(&err, reply);
callback->cb(NULL, err.message, callback->user_data);
dbus_error_free(&err);
goto end;
}
dbus_message_iter_init(reply, &iter);
callback->cb(&iter, NULL, callback->user_data);
end:
callback_ended();
free(callback);
dbus_message_unref(reply);
}
示例7: rtkit_make_high_priority
int rtkit_make_high_priority(DBusConnection *connection, pid_t thread, int nice_level) {
DBusMessage *m = NULL, *r = NULL;
dbus_uint64_t u64;
dbus_int32_t s32;
DBusError error;
int ret;
dbus_error_init(&error);
if (thread == 0)
thread = _gettid();
if (!(m = dbus_message_new_method_call(
RTKIT_SERVICE_NAME,
RTKIT_OBJECT_PATH,
"org.freedesktop.RealtimeKit1",
"MakeThreadHighPriority"))) {
ret = -ENOMEM;
goto finish;
}
u64 = (dbus_uint64_t) thread;
s32 = (dbus_int32_t) nice_level;
if (!dbus_message_append_args(
m,
DBUS_TYPE_UINT64, &u64,
DBUS_TYPE_INT32, &s32,
DBUS_TYPE_INVALID)) {
ret = -ENOMEM;
goto finish;
}
if (!(r = dbus_connection_send_with_reply_and_block(connection, m, -1, &error))) {
ret = translate_error(error.name);
goto finish;
}
if (dbus_set_error_from_message(&error, r)) {
ret = translate_error(error.name);
goto finish;
}
ret = 0;
finish:
if (m)
dbus_message_unref(m);
if (r)
dbus_message_unref(r);
dbus_error_free(&error);
return ret;
}
示例8: adapter_reply
static void adapter_reply(DBusPendingCall *call, void *user_data)
{
DBusError err;
DBusMessage *reply;
struct callback_data *callback = user_data;
struct obc_session *session = callback->session;
struct pending_req *req = find_session_request(session, call);
reply = dbus_pending_call_steal_reply(call);
session->pending_calls = g_slist_remove(session->pending_calls, req);
pending_req_finalize(req);
dbus_error_init(&err);
if (dbus_set_error_from_message(&err, reply)) {
error("manager replied with an error: %s, %s",
err.name, err.message);
dbus_error_free(&err);
goto failed;
}
if (session_connect(session, callback) < 0)
goto failed;
goto proceed;
failed:
obc_session_unref(session);
g_free(callback);
proceed:
dbus_message_unref(reply);
}
示例9: add_record_reply
static void add_record_reply(DBusPendingCall *call, void *user_data)
{
struct bluetooth_service *service = user_data;
DBusMessage *reply = dbus_pending_call_steal_reply(call);
DBusError derr;
uint32_t handle;
dbus_error_init(&derr);
if (dbus_set_error_from_message(&derr, reply)) {
error("bluetooth: Replied with an error: %s, %s",
derr.name, derr.message);
dbus_error_free(&derr);
handle = 0;
} else {
dbus_message_get_args(reply, NULL,
DBUS_TYPE_UINT32, &handle,
DBUS_TYPE_INVALID);
service->handle = handle;
DBG("Registered: %s, handle: 0x%x",
service->driver->name, service->handle);
}
dbus_message_unref(reply);
}
示例10: gkr_operation_handle_errors
gboolean
gkr_operation_handle_errors (GkrOperation *op, DBusMessage *reply)
{
DBusError derr = DBUS_ERROR_INIT;
MateKeyringResult res;
gboolean was_keyring;
g_assert (op);
g_assert (reply);
was_keyring = op->was_keyring;
op->was_keyring = FALSE;
if (dbus_set_error_from_message (&derr, reply)) {
if (dbus_error_has_name (&derr, ERROR_NO_SUCH_OBJECT)) {
if (was_keyring)
res = MATE_KEYRING_RESULT_NO_SUCH_KEYRING;
else
res = MATE_KEYRING_RESULT_BAD_ARGUMENTS;
} else {
g_message ("secret service operation failed: %s", derr.message);
res = MATE_KEYRING_RESULT_IO_ERROR;
}
dbus_error_free (&derr);
gkr_operation_complete (op, res);
return TRUE;
}
return FALSE;
}
示例11: onConnectSinkResult
static void onConnectSinkResult(DBusMessage *msg, void *user, void *natData) {
LOGV(__FUNCTION__);
char *c_path = (char *)user;
DBusError err;
JNIEnv *env;
if (nat->vm->GetEnv((void**)&env, nat->envVer) < 0) {
LOGE("%s: error finding Env for our VM\n", __FUNCTION__);
return;
}
dbus_error_init(&err);
LOGV("... path = %s", c_path);
if (dbus_set_error_from_message(&err, msg)) {
/* if (!strcmp(err.name, BLUEZ_DBUS_BASE_IFC ".Error.AuthenticationFailed")) */
LOGE("%s: D-Bus error: %s (%s)\n", __FUNCTION__, err.name, err.message);
dbus_error_free(&err);
env->CallVoidMethod(nat->me,
method_onSinkDisconnected,
env->NewStringUTF(c_path));
if (env->ExceptionCheck()) {
LOGE("VM Exception occurred in native function %s (%s:%d)",
__FUNCTION__, __FILE__, __LINE__);
}
} // else Java callback is triggered by signal in a2dp_event_filter
free(c_path);
}
示例12: get_managed_objects_reply
static void get_managed_objects_reply(DBusPendingCall *call, void *user_data)
{
GDBusClient *client = user_data;
DBusMessage *reply = dbus_pending_call_steal_reply(call);
DBusError error;
g_dbus_client_ref(client);
dbus_error_init(&error);
if (dbus_set_error_from_message(&error, reply) == TRUE) {
dbus_error_free(&error);
goto done;
}
parse_managed_objects(client, reply);
done:
if (client->ready)
client->ready(client, client->ready_data);
dbus_message_unref(reply);
dbus_pending_call_unref(client->get_objects_call);
client->get_objects_call = NULL;
g_dbus_client_unref(client);
}
示例13: get_all_properties_reply
static void get_all_properties_reply(DBusPendingCall *call, void *user_data)
{
GDBusProxy *proxy = user_data;
GDBusClient *client = proxy->client;
DBusMessage *reply = dbus_pending_call_steal_reply(call);
DBusMessageIter iter;
DBusError error;
dbus_error_init(&error);
if (dbus_set_error_from_message(&error, reply) == TRUE) {
dbus_error_free(&error);
goto done;
}
dbus_message_iter_init(reply, &iter);
update_properties(proxy, &iter, FALSE);
done:
if (g_list_find(client->proxy_list, proxy) == NULL) {
if (client->proxy_added)
client->proxy_added(proxy, client->user_data);
client->proxy_list = g_list_append(client->proxy_list, proxy);
}
dbus_message_unref(reply);
g_dbus_client_unref(client);
}
示例14: read_radio_states_cb
static void read_radio_states_cb(DBusPendingCall *call, void *user_data)
{
DBusError err;
DBusMessage *reply;
dbus_uint32_t radio_states;
struct btd_adapter *adapter = user_data;
reply = dbus_pending_call_steal_reply(call);
dbus_error_init(&err);
if (dbus_set_error_from_message(&err, reply)) {
error("mce replied with an error: %s, %s",
err.name, err.message);
dbus_error_free(&err);
goto done;
}
dbus_error_init(&err);
if (dbus_message_get_args(reply, &err,
DBUS_TYPE_UINT32, &radio_states,
DBUS_TYPE_INVALID) == FALSE) {
error("unable to parse get_radio_states reply: %s, %s",
err.name, err.message);
dbus_error_free(&err);
goto done;
}
if (radio_states & MCE_RADIO_STATE_BLUETOOTH)
btd_adapter_switch_online(adapter);
done:
dbus_message_unref(reply);
}
示例15: xconnman_check_service_cb
/** Handle reply to asynchronous connman service name ownership query
*
* @param pc State data for asynchronous D-Bus method call
* @param user_data (not used)
*/
static void xconnman_check_service_cb(DBusPendingCall *pc, void *user_data)
{
(void)user_data;
DBusMessage *rsp = 0;
const char *owner = 0;
DBusError err = DBUS_ERROR_INIT;
if( !(rsp = dbus_pending_call_steal_reply(pc)) )
goto EXIT;
if( dbus_set_error_from_message(&err, rsp) ||
!dbus_message_get_args(rsp, &err,
DBUS_TYPE_STRING, &owner,
DBUS_TYPE_INVALID) )
{
if( strcmp(err.name, DBUS_ERROR_NAME_HAS_NO_OWNER) ) {
mce_log(LL_WARN, "%s: %s", err.name, err.message);
}
goto EXIT;
}
xconnman_set_runstate(owner && *owner);
EXIT:
if( rsp ) dbus_message_unref(rsp);
dbus_error_free(&err);
}