char *handsfree_path;
DBusMessage *slc_msg;
gboolean agent_registered;
+ DBusPendingCall *call;
};
static void hfp_debug(const char *str, void *user_data)
struct hfp_data *data = ofono_modem_get_data(modem);
const char *obj_path = ofono_modem_get_path(modem);
+ if (data->call != NULL)
+ dbus_pending_call_cancel(data->call);
+
if (g_dbus_unregister_interface(connection, obj_path,
HFP_AGENT_INTERFACE))
hfp_unregister_ofono_handsfree(modem);
done:
dbus_message_unref(reply);
+ data->call = NULL;
}
/* power up hardware */
status = bluetooth_send_with_reply(data->handsfree_path,
BLUEZ_GATEWAY_INTERFACE, "Connect",
- NULL, hfp_connect_reply, modem, NULL,
+ &data->call, hfp_connect_reply,
+ modem, NULL,
DBUS_TIMEOUT, DBUS_TYPE_INVALID);
if (status < 0)
static void hfp_power_down(DBusPendingCall *call, gpointer user_data)
{
struct ofono_modem *modem = user_data;
+ struct hfp_data *data = ofono_modem_get_data(modem);
DBusMessage *reply;
DBusError derr;
done:
dbus_message_unref(reply);
+ data->call = NULL;
}
static int hfp_disable(struct ofono_modem *modem)
if (data->agent_registered) {
status = bluetooth_send_with_reply(data->handsfree_path,
BLUEZ_GATEWAY_INTERFACE, "Disconnect",
- NULL, hfp_power_down, modem, NULL,
+ &data->call, hfp_power_down,
+ modem, NULL,
DBUS_TIMEOUT, DBUS_TYPE_INVALID);
if (status < 0)