static void agent_receive_message(DBusPendingCall *call, void *user_data) { struct connman_agent *queue_data = user_data; DBusMessage *reply; int err; DBG("waiting for %p received %p", agent_request, queue_data); if (agent_request != queue_data) { connman_error("Agent callback expected %p got %p", agent_request, queue_data); return; } reply = dbus_pending_call_steal_reply(call); dbus_pending_call_unref(call); queue_data->call = NULL; if (dbus_message_is_error(reply, "org.freedesktop.DBus.Error.Timeout") == TRUE || dbus_message_is_error(reply, "org.freedesktop.DBus.Error.TimedOut") == TRUE) { agent_send_cancel(queue_data->user_context); } queue_data->callback(reply, queue_data->user_data); dbus_message_unref(reply); agent_data_free(queue_data); agent_request = NULL; err = agent_send_next_request(); if (err < 0) DBG("send next request failed (%s/%d)", strerror(-err), -err); }
static void agent_receive_message(DBusPendingCall *call, void *user_data) { struct connman_agent *agent = user_data; DBusMessage *reply; int err; DBG("agent %p req %p", agent, agent->pending); reply = dbus_pending_call_steal_reply(call); dbus_pending_call_unref(call); agent->pending->call = NULL; if (dbus_message_is_error(reply, "org.freedesktop.DBus.Error.Timeout") || dbus_message_is_error(reply, "org.freedesktop.DBus.Error.TimedOut")) { send_cancel_request(agent, agent->pending); } agent_finalize_pending(agent, reply); dbus_message_unref(reply); err = agent_send_next_request(agent); if (err < 0 && err != -EBUSY) DBG("send next request failed (%s/%d)", strerror(-err), -err); }
static void register_profile_reply(DBusPendingCall *pending, void *userdata) { DBusMessage *r; pa_dbus_pending *p; pa_bluetooth_backend *b; char *profile; pa_assert(pending); pa_assert_se(p = userdata); pa_assert_se(b = p->context_data); pa_assert_se(profile = p->call_data); pa_assert_se(r = dbus_pending_call_steal_reply(pending)); if (dbus_message_is_error(r, BLUEZ_ERROR_NOT_SUPPORTED)) { pa_log_info("Couldn't register profile %s because it is disabled in BlueZ", profile); goto finish; } if (dbus_message_get_type(r) == DBUS_MESSAGE_TYPE_ERROR) { pa_log_error(BLUEZ_PROFILE_MANAGER_INTERFACE ".RegisterProfile() failed: %s: %s", dbus_message_get_error_name(r), pa_dbus_get_error_message(r)); goto finish; } finish: dbus_message_unref(r); PA_LLIST_REMOVE(pa_dbus_pending, b->pending, p); pa_dbus_pending_free(p); pa_xfree(profile); }
static void reply_handler_function(DBusPendingCall *call, void *user_data) { struct pin_request *req = (struct pin_request *) user_data; pin_code_reply_cp pr; DBusMessage *message; DBusMessageIter iter; int type; size_t len; char *pin; message = dbus_pending_call_get_reply(call); if (dbus_message_is_error(message, WRONG_ARGS_ERROR)) goto error; dbus_message_iter_init(message, &iter); type = dbus_message_iter_get_arg_type(&iter); if (type != DBUS_TYPE_STRING) goto error; pin = dbus_message_iter_get_string(&iter); len = strlen(pin); memset(&pr, 0, sizeof(pr)); bacpy(&pr.bdaddr, &req->bda); memcpy(pr.pin_code, pin, len); pr.pin_len = len; hci_send_cmd(req->dev, OGF_LINK_CTL, OCF_PIN_CODE_REPLY, PIN_CODE_REPLY_CP_SIZE, &pr); return; error: hci_send_cmd(req->dev, OGF_LINK_CTL, OCF_PIN_CODE_NEG_REPLY, 6, &req->bda); }
gboolean ibus_message_is_error (IBusMessage *message, const gchar *error_name) { return dbus_message_is_error (message, error_name); }
bool EdbusMessage::is_error_reply(const char* errmsg) { if(!dm) return false; return dbus_message_is_error(dm->msg, errmsg); }