Disconnect all profiles if a device is restricted by DPM 18/97518/1
authorSangki Park <sangki79.park@samsung.com>
Tue, 20 Sep 2016 08:32:53 +0000 (17:32 +0900)
committerSudha Bheemanna <b.sudha@samsung.com>
Mon, 14 Nov 2016 10:37:43 +0000 (16:07 +0530)
[Model] R765
[BinType] AP
[Customer] N/A

[Issue#] P160919-02331
[Request] PLM
[Occurrence Version] N/A

[Problem] A device is not disconnected even if it is set to blacklist device
[Cause & Measure] Not implemented
[Checking Method] connect -> set the device to blacklist using dpm-toolkit

[Team] Basic connection
[Developer] Sangki Park
[Solution company] Samsung
[Change Type] Specific change

Signed-off-by: Sudha Bheemanna <b.sudha@samsung.com>
Change-Id: I64e8cac1dd64482ffa0f09593a2fe475c0690486

bt-service/bt-service-device.c
bt-service/include/bt-service-device.h

index 630e23c..206af08 100644 (file)
@@ -2236,6 +2236,47 @@ int _bt_connect_profile(char *address, char *uuid,
        return BLUETOOTH_ERROR_NONE;
 }
 
+int _bt_disconnect_all(char *address)
+{
+       int ret = BLUETOOTH_ERROR_NONE;
+       char *object_path;
+       GDBusProxy *proxy;
+       GDBusConnection *conn;
+       GVariant *result = NULL;
+       GError *err = NULL;
+
+       BT_DBG("");
+       conn = _bt_gdbus_get_system_gconn();
+       retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       object_path = _bt_get_device_object_path(address);
+       retv_if(object_path == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE,
+                                       NULL, BT_BLUEZ_NAME,
+                                       object_path, BT_DEVICE_INTERFACE,  NULL, NULL);
+       g_free(object_path);
+       retv_if(proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+       result = g_dbus_proxy_call_sync(proxy, "Disconnect",
+               NULL,
+               G_DBUS_CALL_FLAGS_NONE,
+               -1, NULL,
+               &err);
+
+       if (err != NULL) {
+               BT_ERR("Dbus Call Error:[%s]", err->message);
+               g_error_free(err);
+               ret = BLUETOOTH_ERROR_INTERNAL;
+       }
+
+       g_object_unref(proxy);
+       if (result)
+               g_variant_unref(result);
+
+       return ret;
+}
+
 int _bt_disconnect_profile(char *address, char *uuid,
                                                void *cb, gpointer func_data)
 {
index 5391e22..ab78174 100644 (file)
@@ -98,6 +98,8 @@ int _bt_get_le_connection_parameter(bluetooth_le_connection_mode_t mode,
 int _bt_connect_profile(char *address, char *uuid,
                                                void *cb, gpointer func_data);
 
+int _bt_disconnect_all(char *address);
+
 int _bt_disconnect_profile(char *address, char *uuid,
                                                void *cb, gpointer func_data);