From: Szymon Janc <szymon.janc@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Szymon Janc <szymon.janc@gmail.com>
Subject: [PATCH 3/5] android/gatt: Implement enable test command
Date: Mon, 26 May 2014 23:53:26 +0200 [thread overview]
Message-ID: <1401141208-26912-4-git-send-email-szymon.janc@gmail.com> (raw)
In-Reply-To: <1401141208-26912-1-git-send-email-szymon.janc@gmail.com>
This command is used to enable and disable test interface.
---
android/gatt.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/android/gatt.c b/android/gatt.c
index 8b0082e..1ce6ff9 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -194,6 +194,12 @@ static GIOChannel *listening_io = NULL;
static struct bt_crypto *crypto = NULL;
+static int test_client_if = 0;
+static const uint8_t TEST_UUID[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04
+};
+
static void bt_le_discovery_stop_cb(void);
static bool is_bluetooth_uuid(const uint8_t *uuid)
@@ -3450,6 +3456,20 @@ static void handle_client_test_command(const void *buf, uint16_t len)
switch (cmd->command) {
case GATT_CLIENT_TEST_CMD_ENABLE:
+ if (cmd->u1) {
+ if (!test_client_if)
+ test_client_if = register_app(TEST_UUID,
+ APP_CLIENT);
+
+ if (test_client_if)
+ status = HAL_STATUS_SUCCESS;
+ else
+ status = HAL_STATUS_FAILED;
+ } else {
+ status = unregister_client(test_client_if);
+ test_client_if = 0;
+ }
+ break;
case GATT_CLIENT_TEST_CMD_CONNECT:
case GATT_CLIENT_TEST_CMD_DISCONNECT:
case GATT_CLIENT_TEST_CMD_DISCOVER:
--
2.0.0.rc4
next prev parent reply other threads:[~2014-05-26 21:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-26 21:53 [PATCH 0/5] android: GATT client test interface Szymon Janc
2014-05-26 21:53 ` [PATCH 1/5] android/gatt: Add initial implementation of client test command Szymon Janc
2014-05-26 21:53 ` [PATCH 2/5] android/gatt: Factor out unregistering client into helper function Szymon Janc
2014-05-26 21:53 ` Szymon Janc [this message]
2014-05-26 21:53 ` [PATCH 4/5] android/gatt: Implement connect test command Szymon Janc
2014-05-26 21:53 ` [PATCH 5/5] android/gatt: Implement disconnect " Szymon Janc
2014-05-28 12:45 ` [PATCH 0/5] android: GATT client test interface 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=1401141208-26912-4-git-send-email-szymon.janc@gmail.com \
--to=szymon.janc@gmail.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;
as well as URLs for NNTP newsgroup(s).