All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/9] android/bluetooth: Add support for reporting adapter type property
@ 2013-12-11 10:31 Szymon Janc
  2013-12-11 10:31 ` [PATCH 2/9] android/bluetooth: Add support for adapter bonded devices property Szymon Janc
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Szymon Janc @ 2013-12-11 10:31 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This allows to get property with adapter type.
---
 android/bluetooth.c | 32 +++++++++++++++++++++++++++++---
 android/hal-msg.h   |  4 ++++
 2 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index e456f3c..82003fd 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -1674,13 +1674,39 @@ static uint8_t get_adapter_class(void)
 	return HAL_STATUS_SUCCESS;
 }
 
+static uint8_t settings2type(void)
+{
+	bool bredr, le;
+
+	bredr = adapter.current_settings & MGMT_SETTING_BREDR;
+	le = adapter.current_settings & MGMT_SETTING_LE;
+
+	if (bredr && le)
+		return HAL_TYPE_DUAL;
+
+	if (bredr && !le)
+		return HAL_TYPE_BREDR;
+
+	if (!bredr && le)
+		return HAL_TYPE_LE;
+
+	return 0;
+}
+
 static uint8_t get_adapter_type(void)
 {
-	DBG("Not implemented");
+	uint8_t type;
 
-	/* TODO: Add implementation */
+	DBG("");
 
-	return HAL_STATUS_FAILED;
+	type = settings2type();
+
+	if (!type)
+		return HAL_STATUS_FAILED;
+
+	send_adapter_property(HAL_PROP_ADAPTER_TYPE, sizeof(type), &type);
+
+	return HAL_STATUS_SUCCESS;
 }
 
 static uint8_t get_adapter_service_rec(void)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 80c4a25..3be91aa 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -116,6 +116,10 @@ struct hal_cmd_get_adapter_prop {
 #define HAL_ADAPTER_SCAN_MODE_CONN		0x01
 #define HAL_ADAPTER_SCAN_MODE_CONN_DISC	0x02
 
+#define HAL_TYPE_BREDR				0x01
+#define HAL_TYPE_LE				0x02
+#define HAL_TYPE_DUAL				0x03
+
 #define HAL_OP_SET_ADAPTER_PROP		0x05
 struct hal_cmd_set_adapter_prop {
 	uint8_t  type;
-- 
1.8.3.2


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

end of thread, other threads:[~2013-12-12 11:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-11 10:31 [PATCH 1/9] android/bluetooth: Add support for reporting adapter type property Szymon Janc
2013-12-11 10:31 ` [PATCH 2/9] android/bluetooth: Add support for adapter bonded devices property Szymon Janc
2013-12-11 10:31 ` [PATCH 3/9] android/bluetooth: Add support for remote device friendly name Szymon Janc
2013-12-11 10:31 ` [PATCH 4/9] android/bluetooth: Free devices on service unregister Szymon Janc
2013-12-11 10:31 ` [PATCH 5/9] android/bluetooth: Add support for remote device class Szymon Janc
2013-12-11 10:31 ` [PATCH 6/9] android/bluetooth: Add support for remote device RSSI Szymon Janc
2013-12-12  0:04   ` Anderson Lizardo
2013-12-12  8:58     ` Szymon Janc
2013-12-12 11:03       ` Anderson Lizardo
2013-12-11 10:31 ` [PATCH 7/9] android/bluetooth: Add support for get remote device properties command Szymon Janc
2013-12-11 10:31 ` [PATCH 8/9] android/bluetooth: Add support for remote device type property Szymon Janc
2013-12-11 10:31 ` [PATCH 9/9] android/bluetooth: Code style and whitespace cleanup Szymon Janc
2013-12-11 13:50 ` [PATCH 1/9] android/bluetooth: Add support for reporting adapter type property Johan Hedberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.