summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/hfp_hf_bluez5.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index cd3f9a65..0d6bdd95 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -340,11 +340,40 @@ static DBusMessage *profile_cancel(DBusConnection *conn,
static DBusMessage *profile_disconnection(DBusConnection *conn,
DBusMessage *msg, void *user_data)
{
+ struct ofono_modem *modem;
+ struct hfp *hfp;
+ const char *device;
+ struct hfp_slc_info *info;
+ DBusMessageIter entry;
+
DBG("Profile handler RequestDisconnection");
- return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE
- ".NotImplemented",
- "Implementation not provided");
+ if (dbus_message_iter_init(msg, &entry) == FALSE)
+ goto error;
+
+ if (dbus_message_iter_get_arg_type(&entry) != DBUS_TYPE_OBJECT_PATH)
+ goto error;
+
+ dbus_message_iter_get_basic(&entry, &device);
+
+ modem = g_hash_table_lookup(modem_hash, device);
+ if (modem == NULL)
+ goto error;
+
+ ofono_modem_set_powered(modem, FALSE);
+
+ hfp = ofono_modem_get_data(modem);
+ info = &hfp->info;
+
+ g_at_chat_unref(info->chat);
+ info->chat = NULL;
+
+ return dbus_message_new_method_return(msg);
+
+error:
+ return g_dbus_create_error(msg,
+ BLUEZ_ERROR_INTERFACE ".Rejected",
+ "Invalid arguments in method call");
}
static const GDBusMethodTable profile_methods[] = {