Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: linux-bluetooth@vger.kernel.org
Cc: Szymon Janc <szymon.janc@tieto.com>
Subject: [PATCH 2/2] android/gatt: Implement get device type command
Date: Sat, 26 Apr 2014 17:26:14 +0200	[thread overview]
Message-ID: <1398525974-3672-2-git-send-email-szymon.janc@tieto.com> (raw)
In-Reply-To: <1398525974-3672-1-git-send-email-szymon.janc@tieto.com>

---
 android/gatt.c    | 13 +++++++++++--
 android/hal-msg.h |  4 ++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 8c7909a..0355af1 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -2972,10 +2972,19 @@ failed:
 
 static void handle_client_get_device_type(const void *buf, uint16_t len)
 {
+	const struct hal_cmd_gatt_client_get_device_type *cmd = buf;
+	struct hal_rsp_gatt_client_get_device_type rsp;
+	bdaddr_t bdaddr;
+
 	DBG("");
 
-	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
-			HAL_OP_GATT_CLIENT_GET_DEVICE_TYPE, HAL_STATUS_FAILED);
+	android2bdaddr(cmd->bdaddr, &bdaddr);
+
+	rsp.type = bt_get_device_android_type(&bdaddr);
+
+	ipc_send_rsp_full(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_GET_DEVICE_TYPE,
+					sizeof(rsp), &rsp, -1);
 }
 
 static void handle_client_set_adv_data(const void *buf, uint16_t len)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 52ecafb..9d28866 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -730,6 +730,10 @@ struct hal_cmd_gatt_client_get_device_type {
 	uint8_t bdaddr[6];
 } __attribute__((packed));
 
+struct hal_rsp_gatt_client_get_device_type {
+	uint8_t type;
+} __attribute__((packed));
+
 #define HAL_OP_GATT_CLIENT_SET_ADV_DATA		0x015
 struct hal_cmd_gatt_client_set_adv_data {
 	int32_t  server_if;
-- 
1.9.0


  reply	other threads:[~2014-04-26 15:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-26 15:26 [PATCH 1/2] android/bluetooth: Add function for getting device Android type Szymon Janc
2014-04-26 15:26 ` Szymon Janc [this message]
2014-04-28 12:12 ` Szymon Janc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1398525974-3672-2-git-send-email-szymon.janc@tieto.com \
    --to=szymon.janc@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox