Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v3 1/3] android: Add wrapper function for get remote dev properties
@ 2014-01-07 14:13 Lukasz Rymanowski
  2014-01-07 14:13 ` [PATCH v3 2/3] android: Move get_remote_device_props up in the file Lukasz Rymanowski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lukasz Rymanowski @ 2014-01-07 14:13 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: johan.hedberg, szymon.janc, Lukasz Rymanowski

---
 android/bluetooth.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 3cbf68d..f281fcf 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -2673,6 +2673,19 @@ static uint8_t get_device_timestamp(struct device *dev)
 	return HAL_STATUS_SUCCESS;
 }
 
+static void get_remote_device_props(struct device *dev)
+{
+	get_device_name(dev);
+	get_device_uuids(dev);
+	get_device_class(dev);
+	get_device_type(dev);
+	get_device_service_rec(dev);
+	get_device_friendly_name(dev);
+	get_device_rssi(dev);
+	get_device_version_info(dev);
+	get_device_timestamp(dev);
+}
+
 static void handle_get_remote_device_props_cmd(const void *buf, uint16_t len)
 {
 	const struct hal_cmd_get_remote_device_props *cmd = buf;
@@ -2688,15 +2701,7 @@ static void handle_get_remote_device_props_cmd(const void *buf, uint16_t len)
 		goto failed;
 	}
 
-	get_device_name(l->data);
-	get_device_uuids(l->data);
-	get_device_class(l->data);
-	get_device_type(l->data);
-	get_device_service_rec(l->data);
-	get_device_friendly_name(l->data);
-	get_device_rssi(l->data);
-	get_device_version_info(l->data);
-	get_device_timestamp(l->data);
+	get_remote_device_props(l->data);
 
 	status = HAL_STATUS_SUCCESS;
 
-- 
1.8.4


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

* [PATCH v3 2/3] android: Move get_remote_device_props up in the file
  2014-01-07 14:13 [PATCH v3 1/3] android: Add wrapper function for get remote dev properties Lukasz Rymanowski
@ 2014-01-07 14:13 ` Lukasz Rymanowski
  2014-01-07 14:13 ` [PATCH v3 3/3] android: Send remote devices properties on enable Lukasz Rymanowski
  2014-01-08 12:19 ` [PATCH v3 1/3] android: Add wrapper function for get remote dev properties Szymon Janc
  2 siblings, 0 replies; 4+ messages in thread
From: Lukasz Rymanowski @ 2014-01-07 14:13 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: johan.hedberg, szymon.janc, Lukasz Rymanowski

This patch moves up function get_remote_device_props() and all
functions required by this function.

---
 android/bluetooth.c | 100 ++++++++++++++++++++++++++--------------------------
 1 file changed, 50 insertions(+), 50 deletions(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index f281fcf..e0673bb 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -2550,56 +2550,6 @@ static void handle_get_remote_services_cmd(const void *buf, uint16_t len)
 									status);
 }
 
-static void handle_enable_cmd(const void *buf, uint16_t len)
-{
-	uint8_t status;
-
-	/* Framework expects all properties to be emitted while
-	 * enabling adapter */
-	get_adapter_properties();
-
-	if (adapter.current_settings & MGMT_SETTING_POWERED) {
-		status = HAL_STATUS_DONE;
-		goto failed;
-	}
-
-	if (!set_mode(MGMT_OP_SET_POWERED, 0x01)) {
-		status = HAL_STATUS_FAILED;
-		goto failed;
-	}
-
-	status = HAL_STATUS_SUCCESS;
-failed:
-	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_ENABLE, status);
-}
-
-static void handle_disable_cmd(const void *buf, uint16_t len)
-{
-	uint8_t status;
-
-	if (!(adapter.current_settings & MGMT_SETTING_POWERED)) {
-		status = HAL_STATUS_DONE;
-		goto failed;
-	}
-
-	if (!set_mode(MGMT_OP_SET_POWERED, 0x00)) {
-		status = HAL_STATUS_FAILED;
-		goto failed;
-	}
-
-	status = HAL_STATUS_SUCCESS;
-failed:
-	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_DISABLE, status);
-}
-
-static void handle_get_adapter_props_cmd(const void *buf, uint16_t len)
-{
-	get_adapter_properties();
-
-	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_GET_ADAPTER_PROPS,
-							HAL_STATUS_SUCCESS);
-}
-
 static uint8_t get_device_uuids(struct device *dev)
 {
 	send_device_uuids_notif(dev);
@@ -2686,6 +2636,56 @@ static void get_remote_device_props(struct device *dev)
 	get_device_timestamp(dev);
 }
 
+static void handle_enable_cmd(const void *buf, uint16_t len)
+{
+	uint8_t status;
+
+	/* Framework expects all properties to be emitted while
+	 * enabling adapter */
+	get_adapter_properties();
+
+	if (adapter.current_settings & MGMT_SETTING_POWERED) {
+		status = HAL_STATUS_DONE;
+		goto failed;
+	}
+
+	if (!set_mode(MGMT_OP_SET_POWERED, 0x01)) {
+		status = HAL_STATUS_FAILED;
+		goto failed;
+	}
+
+	status = HAL_STATUS_SUCCESS;
+failed:
+	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_ENABLE, status);
+}
+
+static void handle_disable_cmd(const void *buf, uint16_t len)
+{
+	uint8_t status;
+
+	if (!(adapter.current_settings & MGMT_SETTING_POWERED)) {
+		status = HAL_STATUS_DONE;
+		goto failed;
+	}
+
+	if (!set_mode(MGMT_OP_SET_POWERED, 0x00)) {
+		status = HAL_STATUS_FAILED;
+		goto failed;
+	}
+
+	status = HAL_STATUS_SUCCESS;
+failed:
+	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_DISABLE, status);
+}
+
+static void handle_get_adapter_props_cmd(const void *buf, uint16_t len)
+{
+	get_adapter_properties();
+
+	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_GET_ADAPTER_PROPS,
+							HAL_STATUS_SUCCESS);
+}
+
 static void handle_get_remote_device_props_cmd(const void *buf, uint16_t len)
 {
 	const struct hal_cmd_get_remote_device_props *cmd = buf;
-- 
1.8.4


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

* [PATCH v3 3/3] android: Send remote devices properties on enable
  2014-01-07 14:13 [PATCH v3 1/3] android: Add wrapper function for get remote dev properties Lukasz Rymanowski
  2014-01-07 14:13 ` [PATCH v3 2/3] android: Move get_remote_device_props up in the file Lukasz Rymanowski
@ 2014-01-07 14:13 ` Lukasz Rymanowski
  2014-01-08 12:19 ` [PATCH v3 1/3] android: Add wrapper function for get remote dev properties Szymon Janc
  2 siblings, 0 replies; 4+ messages in thread
From: Lukasz Rymanowski @ 2014-01-07 14:13 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: johan.hedberg, szymon.janc, Lukasz Rymanowski

If there is any bonded device stored then on bluetooth enable we
should send notification with its properties.

---
 android/bluetooth.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index e0673bb..9da988b 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -2636,6 +2636,18 @@ static void get_remote_device_props(struct device *dev)
 	get_device_timestamp(dev);
 }
 
+static void send_bonded_devices_props(void)
+{
+	GSList *l;
+
+	for (l = devices; l; l = g_slist_next(l)) {
+		struct device *dev = l->data;
+
+		if (dev->bond_state == HAL_BOND_STATE_BONDED)
+			get_remote_device_props(dev);
+	}
+}
+
 static void handle_enable_cmd(const void *buf, uint16_t len)
 {
 	uint8_t status;
@@ -2644,6 +2656,9 @@ static void handle_enable_cmd(const void *buf, uint16_t len)
 	 * enabling adapter */
 	get_adapter_properties();
 
+	/* Sent also properties of bonded devices */
+	send_bonded_devices_props();
+
 	if (adapter.current_settings & MGMT_SETTING_POWERED) {
 		status = HAL_STATUS_DONE;
 		goto failed;
-- 
1.8.4


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

* Re: [PATCH v3 1/3] android: Add wrapper function for get remote dev properties
  2014-01-07 14:13 [PATCH v3 1/3] android: Add wrapper function for get remote dev properties Lukasz Rymanowski
  2014-01-07 14:13 ` [PATCH v3 2/3] android: Move get_remote_device_props up in the file Lukasz Rymanowski
  2014-01-07 14:13 ` [PATCH v3 3/3] android: Send remote devices properties on enable Lukasz Rymanowski
@ 2014-01-08 12:19 ` Szymon Janc
  2 siblings, 0 replies; 4+ messages in thread
From: Szymon Janc @ 2014-01-08 12:19 UTC (permalink / raw)
  To: Lukasz Rymanowski; +Cc: linux-bluetooth, johan.hedberg

Hi Łukasz,

> ---
>  android/bluetooth.c | 23 ++++++++++++++---------
>  1 file changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/android/bluetooth.c b/android/bluetooth.c
> index 3cbf68d..f281fcf 100644
> --- a/android/bluetooth.c
> +++ b/android/bluetooth.c
> @@ -2673,6 +2673,19 @@ static uint8_t get_device_timestamp(struct device *dev)
>  	return HAL_STATUS_SUCCESS;
>  }
>  
> +static void get_remote_device_props(struct device *dev)
> +{
> +	get_device_name(dev);
> +	get_device_uuids(dev);
> +	get_device_class(dev);
> +	get_device_type(dev);
> +	get_device_service_rec(dev);
> +	get_device_friendly_name(dev);
> +	get_device_rssi(dev);
> +	get_device_version_info(dev);
> +	get_device_timestamp(dev);
> +}
> +
>  static void handle_get_remote_device_props_cmd(const void *buf, uint16_t len)
>  {
>  	const struct hal_cmd_get_remote_device_props *cmd = buf;
> @@ -2688,15 +2701,7 @@ static void handle_get_remote_device_props_cmd(const void *buf, uint16_t len)
>  		goto failed;
>  	}
>  
> -	get_device_name(l->data);
> -	get_device_uuids(l->data);
> -	get_device_class(l->data);
> -	get_device_type(l->data);
> -	get_device_service_rec(l->data);
> -	get_device_friendly_name(l->data);
> -	get_device_rssi(l->data);
> -	get_device_version_info(l->data);
> -	get_device_timestamp(l->data);
> +	get_remote_device_props(l->data);
>  
>  	status = HAL_STATUS_SUCCESS;
>  
> 

Patches applied, thanks.

-- 
BR
Szymon Janc

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

end of thread, other threads:[~2014-01-08 12:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-07 14:13 [PATCH v3 1/3] android: Add wrapper function for get remote dev properties Lukasz Rymanowski
2014-01-07 14:13 ` [PATCH v3 2/3] android: Move get_remote_device_props up in the file Lukasz Rymanowski
2014-01-07 14:13 ` [PATCH v3 3/3] android: Send remote devices properties on enable Lukasz Rymanowski
2014-01-08 12:19 ` [PATCH v3 1/3] android: Add wrapper function for get remote dev properties Szymon Janc

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