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 1/8] android/handsfree: Add support for AT+BRSF command
Date: Tue,  4 Mar 2014 16:32:03 +0100	[thread overview]
Message-ID: <1393947130-11999-2-git-send-email-szymon.janc@tieto.com> (raw)
In-Reply-To: <1393947130-11999-1-git-send-email-szymon.janc@tieto.com>

---
 android/handsfree.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/android/handsfree.c b/android/handsfree.c
index 4f69e68..ce690d7 100644
--- a/android/handsfree.c
+++ b/android/handsfree.c
@@ -54,6 +54,7 @@
 static struct {
 	bdaddr_t bdaddr;
 	uint8_t state;
+	uint32_t features;
 	struct hfp_gw *gw;
 } device;
 
@@ -119,6 +120,31 @@ static void disconnect_watch(void *user_data)
 	device_cleanup();
 }
 
+static void at_cmd_brsf(struct hfp_gw_result *result, enum hfp_gw_cmd_type type,
+							void *user_data)
+{
+	unsigned int feat;
+
+	switch (type) {
+	case HFP_GW_CMD_TYPE_SET:
+		if (!hfp_gw_result_get_number(result, &feat))
+			break;
+
+		/* TODO verify features */
+		device.features = feat;
+
+		hfp_gw_send_info(device.gw, "+BRSF=%u", HFP_AG_FEATURES);
+		hfp_gw_send_result(device.gw, HFP_RESULT_OK);
+		return;
+	case HFP_GW_CMD_TYPE_READ:
+	case HFP_GW_CMD_TYPE_TEST:
+	case HFP_GW_CMD_TYPE_COMMAND:
+		break;
+	}
+
+	hfp_gw_send_result(device.gw, HFP_RESULT_ERROR);
+}
+
 static void connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
 {
 	DBG("");
@@ -138,6 +164,8 @@ static void connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
 	hfp_gw_set_command_handler(device.gw, at_command_handler, NULL, NULL);
 	hfp_gw_set_disconnect_handler(device.gw, disconnect_watch, NULL, NULL);
 
+
+	hfp_gw_register(device.gw, at_cmd_brsf, "+BRSF", NULL, NULL);
 	device_set_state(HAL_EV_HANDSFREE_CONNECTION_STATE_CONNECTED);
 
 	return;
-- 
1.8.3.2


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

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04 15:32 [PATCH 0/8] Initial AT handling for handsfree Szymon Janc
2014-03-04 15:32 ` Szymon Janc [this message]
2014-03-04 15:32 ` [PATCH 2/8] android/handsfree: Add support for AT+CIND command Szymon Janc
2014-03-04 15:32 ` [PATCH 3/8] android/handsfree: Add support for AT+CMER command Szymon Janc
2014-03-04 15:32 ` [PATCH 4/8] android/handsfree: Distinguish between HSP and HFP connection Szymon Janc
2014-03-04 15:32 ` [PATCH 5/8] shared/hfp: Add function to check if reach end of command Szymon Janc
2014-03-04 15:32 ` [PATCH 6/8] shared/hfp: Add hfp_gw_result_get_number_default function Szymon Janc
2014-03-04 15:32 ` [PATCH 7/8] android/handsfree: Add support for AT+BIA command Szymon Janc
2014-03-04 15:32 ` [PATCH 8/8] android/handsfree: Make connection state constants name shorter Szymon Janc
2014-03-05 16:14 ` [PATCH 0/8] Initial AT handling for handsfree 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=1393947130-11999-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