diff mbox series

[BlueZ,1/1] adapter: Be able to use ConnectDevice for discovered devices

Message ID 20230728052506.582394-2-simon.mikuda@streamunlimited.com
State New
Headers show
Series Adapter1.ConnectDevice | expand

Commit Message

Simon Mikuda July 28, 2023, 5:25 a.m. UTC
This can be useful when you want to specify trasport type for already
paired device (e.g. use LE transport for dual mode device).
---
 doc/adapter-api.txt | 2 +-
 src/adapter.c       | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)

Comments

Luiz Augusto von Dentz July 28, 2023, 5:48 p.m. UTC | #1
Hi Simon,

On Thu, Jul 27, 2023 at 10:46 PM Simon Mikuda
<simon.mikuda@streamunlimited.com> wrote:
>
> This can be useful when you want to specify trasport type for already
> paired device (e.g. use LE transport for dual mode device).
> ---
>  doc/adapter-api.txt | 2 +-
>  src/adapter.c       | 3 ---
>  2 files changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/doc/adapter-api.txt b/doc/adapter-api.txt
> index 9b2721c1b..239d9463d 100644
> --- a/doc/adapter-api.txt
> +++ b/doc/adapter-api.txt
> @@ -182,7 +182,7 @@ Methods             void StartDiscovery()
>                         profile will be connected. There is no need for calling
>                         Connect on Device1 after this call. If connection was
>                         successful this method returns object path to created
> -                       device object.
> +                       device object or device that already exist.

Perhaps we should mention the intent here is to allow applications to
specify what bearer to connect as opposed to Device.Connect that
connects on the last seen bearer first.

>
>                         Parameters that may be set in the filter dictionary
>                         include the following:
> diff --git a/src/adapter.c b/src/adapter.c
> index 2679d4302..17f4a637d 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -3763,9 +3763,6 @@ static DBusMessage *connect_device(DBusConnection *conn,
>         if (!bacmp(&addr, BDADDR_ANY))
>                 return btd_error_invalid_args(msg);
>
> -       if (btd_adapter_find_device(adapter, &addr, addr_type))
> -               return btd_error_already_exists(msg);
> -
>         device_connect(adapter, &addr, addr_type, msg);
>         return NULL;
>  }
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/doc/adapter-api.txt b/doc/adapter-api.txt
index 9b2721c1b..239d9463d 100644
--- a/doc/adapter-api.txt
+++ b/doc/adapter-api.txt
@@ -182,7 +182,7 @@  Methods		void StartDiscovery()
 			profile will be connected. There is no need for calling
 			Connect on Device1 after this call. If connection was
 			successful this method returns object path to created
-			device object.
+			device object or device that already exist.
 
 			Parameters that may be set in the filter dictionary
 			include the following:
diff --git a/src/adapter.c b/src/adapter.c
index 2679d4302..17f4a637d 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3763,9 +3763,6 @@  static DBusMessage *connect_device(DBusConnection *conn,
 	if (!bacmp(&addr, BDADDR_ANY))
 		return btd_error_invalid_args(msg);
 
-	if (btd_adapter_find_device(adapter, &addr, addr_type))
-		return btd_error_already_exists(msg);
-
 	device_connect(adapter, &addr, addr_type, msg);
 	return NULL;
 }