Linux bluetooth development
 help / color / mirror / Atom feed
From: Jakub Tyszkowski <jakub.tyszkowski@tieto.com>
To: linux-bluetooth@vger.kernel.org
Cc: Jakub Tyszkowski <jakub.tyszkowski@tieto.com>
Subject: [PATCH 1/6] android/gatt: Initial support for write test command
Date: Thu, 29 May 2014 15:04:59 +0200	[thread overview]
Message-ID: <1401368704-4265-1-git-send-email-jakub.tyszkowski@tieto.com> (raw)

This is handled mostly the same way as read so we can use the same
function for sending att requests.

As test command parameters are of type uint16_t, we cannot write longer
values. We can figure out the ways to overcome this limitation if it
turns out that it's really needed (i.e. some PTS test cases cannot be
passed).
---
 android/gatt.c    | 19 +++++++++++++------
 android/hal-msg.h |  1 +
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 9b51ab1..5919377 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -3442,9 +3442,10 @@ failed:
 				HAL_OP_GATT_CLIENT_SET_ADV_DATA, status);
 }
 
-static uint8_t handle_test_command_read(bdaddr_t *bdaddr, bt_uuid_t *uuid,
-					uint16_t read_type, uint16_t u2,
-					uint16_t u3, uint16_t u4, uint16_t u5)
+static uint8_t handle_test_command_read_write(bdaddr_t *bdaddr, bt_uuid_t *uuid,
+						uint16_t op, uint16_t u2,
+						uint16_t u3, uint16_t u4,
+						uint16_t u5)
 {
 	guint16 length = 0;
 	struct gatt_device *dev;
@@ -3459,7 +3460,7 @@ static uint8_t handle_test_command_read(bdaddr_t *bdaddr, bt_uuid_t *uuid,
 	if (!pdu)
 		return HAL_STATUS_FAILED;
 
-	switch (read_type) {
+	switch (op) {
 	case ATT_OP_READ_REQ:
 		length = enc_read_req(u2, pdu, mtu);
 		break;
@@ -3473,8 +3474,13 @@ static uint8_t handle_test_command_read(bdaddr_t *bdaddr, bt_uuid_t *uuid,
 		length = enc_read_by_grp_req(u2, u3, uuid, pdu, mtu);
 		break;
 	case ATT_OP_READ_MULTI_REQ:
+		return HAL_STATUS_UNSUPPORTED;
+	case ATT_OP_WRITE_REQ:
+	case ATT_OP_WRITE_CMD:
+	case ATT_OP_PREP_WRITE_REQ:
+	case ATT_OP_EXEC_WRITE_REQ:
 	default:
-		error("gatt: Unknown read type");
+		error("gatt: Unknown operation type");
 
 		return HAL_STATUS_UNSUPPORTED;
 	}
@@ -3532,7 +3538,8 @@ static void handle_client_test_command(const void *buf, uint16_t len)
 		status = HAL_STATUS_FAILED;
 		break;
 	case GATT_CLIENT_TEST_CMD_READ:
-		status = handle_test_command_read(&bdaddr, &uuid, cmd->u1,
+	case GATT_CLIENT_TEST_CMD_WRITE:
+		status = handle_test_command_read_write(&bdaddr, &uuid, cmd->u1,
 							cmd->u2, cmd->u3,
 							cmd->u4, cmd->u5);
 		break;
diff --git a/android/hal-msg.h b/android/hal-msg.h
index ae15499..5da62f3 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -752,6 +752,7 @@ struct hal_cmd_gatt_client_set_adv_data {
 #define GATT_CLIENT_TEST_CMD_DISCONNECT		0x03
 #define GATT_CLIENT_TEST_CMD_DISCOVER		0x04
 #define GATT_CLIENT_TEST_CMD_READ		0xe0
+#define GATT_CLIENT_TEST_CMD_WRITE		0xe1
 #define GATT_CLIENT_TEST_CMD_PAIRING_CONFIG	0xf0
 
 #define HAL_OP_GATT_CLIENT_TEST_COMMAND		0x16
-- 
1.9.3


             reply	other threads:[~2014-05-29 13:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-29 13:04 Jakub Tyszkowski [this message]
2014-05-29 13:05 ` [PATCH 2/6] android/gatt: Support write request test command Jakub Tyszkowski
2014-05-29 13:05 ` [PATCH 3/6] android/gatt: Support write command " Jakub Tyszkowski
2014-05-29 13:05 ` [PATCH 4/6] android/gatt: Support prepare write request " Jakub Tyszkowski
2014-05-29 13:05 ` [PATCH 5/6] android/gatt: Support exec " Jakub Tyszkowski
2014-05-29 13:05 ` [PATCH 6/6] android/pts: Update GATT results Jakub Tyszkowski
2014-05-29 14:22 ` [PATCH 1/6] android/gatt: Initial support for write test command 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=1401368704-4265-1-git-send-email-jakub.tyszkowski@tieto.com \
    --to=jakub.tyszkowski@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