Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/2] android/bluetooth: Add function for getting bonded device list
@ 2014-05-12 14:38 Grzegorz Kolodziejczyk
  2014-05-12 14:38 ` [PATCH 2/2] android/gatt: Refresh device cache on disconnect if not bonded Grzegorz Kolodziejczyk
  2014-05-14 13:25 ` [PATCH 1/2] android/bluetooth: Add function for getting bonded device list Szymon Janc
  0 siblings, 2 replies; 3+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-05-12 14:38 UTC (permalink / raw)
  To: linux-bluetooth

This will be used by GATT HAL.
---
 android/bluetooth.c | 8 ++++++++
 android/bluetooth.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index be7b47c..ecdbeac 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -1218,6 +1218,14 @@ const char *bt_get_adapter_name(void)
 	return adapter.name;
 }
 
+bool bt_device_is_bonded(const bdaddr_t *bdaddr)
+{
+	if (g_slist_find_custom(bonded_devices, bdaddr, device_match))
+		return true;
+
+	return false;
+}
+
 static bool rssi_above_threshold(int old, int new)
 {
 	/* only 8 dBm or more */
diff --git a/android/bluetooth.h b/android/bluetooth.h
index dddbf20..3eef7a4 100644
--- a/android/bluetooth.h
+++ b/android/bluetooth.h
@@ -49,3 +49,4 @@ bool bt_le_set_advertising(bool advertising, bt_le_set_advertising_done cb,
 
 uint8_t bt_get_device_android_type(const bdaddr_t *addr);
 const char *bt_get_adapter_name(void);
+bool bt_device_is_bonded(const bdaddr_t *bdaddr);
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] android/gatt: Refresh device cache on disconnect if not bonded
  2014-05-12 14:38 [PATCH 1/2] android/bluetooth: Add function for getting bonded device list Grzegorz Kolodziejczyk
@ 2014-05-12 14:38 ` Grzegorz Kolodziejczyk
  2014-05-14 13:25 ` [PATCH 1/2] android/bluetooth: Add function for getting bonded device list Szymon Janc
  1 sibling, 0 replies; 3+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-05-12 14:38 UTC (permalink / raw)
  To: linux-bluetooth

This adds refreshing of device cache in case if device is not bonded.

It affects on TC_GAD_CL_BV_01_C, TC_GAD_CL_BV_02_C and search services
PTS test cases. With this patch those PTS tests cases pass.
---
 android/gatt.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/android/gatt.c b/android/gatt.c
index 157ebe6..1c94713 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -570,6 +570,10 @@ static void connection_cleanup(struct gatt_device *device)
 			bt_le_discovery_stop(NULL);
 	}
 
+	/* If device is not bonded service cache should be refreshed */
+	if (!bt_device_is_bonded(&device->bdaddr))
+		queue_remove_all(device->services, NULL, NULL, destroy_service);
+
 	device_set_state(device, DEVICE_DISCONNECTED);
 }
 
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] android/bluetooth: Add function for getting bonded device list
  2014-05-12 14:38 [PATCH 1/2] android/bluetooth: Add function for getting bonded device list Grzegorz Kolodziejczyk
  2014-05-12 14:38 ` [PATCH 2/2] android/gatt: Refresh device cache on disconnect if not bonded Grzegorz Kolodziejczyk
@ 2014-05-14 13:25 ` Szymon Janc
  1 sibling, 0 replies; 3+ messages in thread
From: Szymon Janc @ 2014-05-14 13:25 UTC (permalink / raw)
  To: Grzegorz Kolodziejczyk; +Cc: linux-bluetooth

Hi Grzegorz,

On Monday 12 of May 2014 16:38:12 Grzegorz Kolodziejczyk wrote:
> This will be used by GATT HAL.
> ---
>  android/bluetooth.c | 8 ++++++++
>  android/bluetooth.h | 1 +
>  2 files changed, 9 insertions(+)
> 
> diff --git a/android/bluetooth.c b/android/bluetooth.c
> index be7b47c..ecdbeac 100644
> --- a/android/bluetooth.c
> +++ b/android/bluetooth.c
> @@ -1218,6 +1218,14 @@ const char *bt_get_adapter_name(void)
>  	return adapter.name;
>  }
>  
> +bool bt_device_is_bonded(const bdaddr_t *bdaddr)
> +{
> +	if (g_slist_find_custom(bonded_devices, bdaddr, device_match))
> +		return true;
> +
> +	return false;
> +}
> +
>  static bool rssi_above_threshold(int old, int new)
>  {
>  	/* only 8 dBm or more */
> diff --git a/android/bluetooth.h b/android/bluetooth.h
> index dddbf20..3eef7a4 100644
> --- a/android/bluetooth.h
> +++ b/android/bluetooth.h
> @@ -49,3 +49,4 @@ bool bt_le_set_advertising(bool advertising, bt_le_set_advertising_done cb,
>  
>  uint8_t bt_get_device_android_type(const bdaddr_t *addr);
>  const char *bt_get_adapter_name(void);
> +bool bt_device_is_bonded(const bdaddr_t *bdaddr);
> 

Both patches applied, thanks.

-- 
Best regards, 
Szymon Janc

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-14 13:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-12 14:38 [PATCH 1/2] android/bluetooth: Add function for getting bonded device list Grzegorz Kolodziejczyk
2014-05-12 14:38 ` [PATCH 2/2] android/gatt: Refresh device cache on disconnect if not bonded Grzegorz Kolodziejczyk
2014-05-14 13:25 ` [PATCH 1/2] android/bluetooth: Add function for getting bonded device list Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox