binding: bluetooth: allow connection to select uuid profiles 99/9599/2
authorMatt Ranostay <matt.ranostay@konsulko.com>
Thu, 1 Jun 2017 22:37:25 +0000 (15:37 -0700)
committerMatt Ranostay <matt.ranostay@konsulko.com>
Thu, 1 Jun 2017 23:24:33 +0000 (16:24 -0700)
Currenly the bluetooth binding connects to all available bluetooth
profiles. This change allows you select an singular profile.

Change-Id: Iccb016f132e0690699eefddee637ad91ea69e69c
Bug-AGL: SPEC-638
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
binding-bluetooth/bluetooth-api.c
binding-bluetooth/bluetooth-manager.c
binding-bluetooth/bluetooth-manager.h

index 4a7092a..78fd87b 100644 (file)
@@ -476,7 +476,7 @@ static void bt_connect (struct afb_req request)
         return;
     }
 
-    ret = device_connect(value);
+    ret = device_connect(value, NULL);
 
     if (0 == ret)
     {
@@ -503,7 +503,7 @@ static void bt_disconnect (struct afb_req request)
         return;
     }
 
-    ret = device_disconnect(value);
+    ret = device_disconnect(value, NULL);
     if (0 == ret)
     {
         afb_req_success (request, NULL, NULL);
index 7417624..525d034 100644 (file)
@@ -1443,7 +1443,7 @@ int device_cancelPairing(const gchar * bdaddr)
  * send connect command
  * If success return 0, else return -1;
  */
-int device_connect(const gchar * bdaddr)
+int device_connect(const gchar * bdaddr, const gchar * uuid)
 {
     LOGD("\n%s\n",bdaddr);
 
@@ -1470,8 +1470,9 @@ int device_connect(const gchar * bdaddr)
     devices_list_unlock();
 
     value = g_dbus_connection_call_sync(cli.system_conn, BLUEZ_SERVICE,
-                path, DEVICE_INTERFACE, "Connect",
-                NULL, NULL, G_DBUS_CALL_FLAGS_NONE,
+                path, DEVICE_INTERFACE, uuid ? "ConnectProfile" : "Connect",
+                uuid ? g_variant_new("(s)", uuid) : NULL,
+                NULL, G_DBUS_CALL_FLAGS_NONE,
                 DBUS_REPLY_TIMEOUT, NULL, &error);
 
     g_free(path);
@@ -1491,7 +1492,7 @@ int device_connect(const gchar * bdaddr)
  * send disconnect command
  * If success return 0, else return -1;
  */
-int device_disconnect(const gchar* bdaddr)
+int device_disconnect(const gchar* bdaddr, const gchar *uuid)
 {
     LOGD("\n%s\n",bdaddr);
 
@@ -1518,8 +1519,9 @@ int device_disconnect(const gchar* bdaddr)
     devices_list_unlock();
 
     value = g_dbus_connection_call_sync(cli.system_conn, BLUEZ_SERVICE,
-                path, DEVICE_INTERFACE, "Disconnect",
-                NULL, NULL, G_DBUS_CALL_FLAGS_NONE,
+                path, DEVICE_INTERFACE, uuid ? "DisconnectProfile" : "Disconnect",
+                uuid ? g_variant_new("(s)", uuid) : NULL,
+                NULL, G_DBUS_CALL_FLAGS_NONE,
                 DBUS_REPLY_TIMEOUT, NULL, &error);
 
     g_free(path);
index 287a0a2..e05fcb1 100644 (file)
@@ -183,10 +183,8 @@ int adapter_stop_discovery();
 int adapter_remove_device(const gchar *addr);
 int device_pair(const gchar * addr);
 int device_cancelPairing(const gchar * bdaddr);
-int device_connect(const gchar *addr);
-//int device_connectProfile();
-int device_disconnect(const gchar *addr);
-//int device_disconnectProfile();
+int device_connect(const gchar *addr, const gchar *uuid);
+int device_disconnect(const gchar *addr, const gchar *uuid);
 int device_set_property(const gchar * bdaddr, const gchar *property, const gchar *value);
 int device_call_avrcp_method(const gchar* device, const gchar* method);