All of lore.kernel.org
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>,
	Szymon Janc <szymon.janc@tieto.com>
Subject: [PATCH 08/14] neard: Add support for setting power state in RequestOOB reply
Date: Thu, 7 Feb 2013 09:13:58 +0100	[thread overview]
Message-ID: <1360224844-12280-9-git-send-email-szymon.janc@tieto.com> (raw)
In-Reply-To: <1360224844-12280-1-git-send-email-szymon.janc@tieto.com>

This allows neard to properly set Bluetooth carrier power state in
handover message.
---
 plugins/neard.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/plugins/neard.c b/plugins/neard.c
index 0418430..0bd376b 100644
--- a/plugins/neard.c
+++ b/plugins/neard.c
@@ -173,6 +173,19 @@ unregister:
 							AGENT_INTERFACE);
 }
 
+static void add_power_state(DBusMessageIter *dict, struct btd_adapter *adapter)
+{
+	const char *state;
+
+	if (btd_adapter_get_powered(adapter) &&
+			btd_adapter_get_connectable(adapter))
+		state = "active";
+	else
+		state = "inactive";
+
+	dict_append_entry(dict, "State", DBUS_TYPE_STRING, &state);
+}
+
 static DBusMessage *create_request_oob_reply(struct btd_adapter *adapter,
 						const uint8_t *hash,
 						const uint8_t *randomizer,
@@ -208,6 +221,8 @@ static DBusMessage *create_request_oob_reply(struct btd_adapter *adapter,
 
 	dict_append_array(&dict, "EIR", DBUS_TYPE_BYTE, &peir, len);
 
+	add_power_state(&dict, adapter);
+
 	dbus_message_iter_close_container(&iter, &dict);
 
 	return reply;
-- 
1.8.1.1


  parent reply	other threads:[~2013-02-07  8:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-07  8:13 [PATCH 00/14] neard plugin update Szymon Janc
2013-02-07  8:13 ` [PATCH 01/14] neard: Adjust errors to latest API changes Szymon Janc
2013-02-07  8:13 ` [PATCH 02/14] neard: Refactor message processing Szymon Janc
2013-02-07  8:13 ` [PATCH 03/14] neard: Add ability to parse 'State' field Szymon Janc
2013-02-07  8:13 ` [PATCH 04/14] neard: Move pairable check from check_adapter Szymon Janc
2013-02-07  8:13 ` [PATCH 05/14] adapter: Add btd_adapter_get_powered function Szymon Janc
2013-02-07  8:13 ` [PATCH 06/14] neard: Check if adapter is powered in PushOOB Szymon Janc
2013-02-07  8:13 ` [PATCH 07/14] adapter: Add btd_adapter_get_connectable function Szymon Janc
2013-02-07  8:13 ` Szymon Janc [this message]
2013-02-07  8:13 ` [PATCH 09/14] neard: Use path instead of boolean to track if registered to neard Szymon Janc
2013-02-15  8:46   ` Johan Hedberg
2013-02-07  8:14 ` [PATCH 10/14] neard: Restrict method calls only to neard process Szymon Janc
2013-02-07  8:14 ` [PATCH 11/14] neard: Use bool instead of gboolean for agent_register_postpone Szymon Janc
2013-02-07  8:14 ` [PATCH 12/14] neard: Update copyright information Szymon Janc
2013-02-07  8:14 ` [PATCH 13/14] neard: Updated neard handover registration agent api calls Szymon Janc
2013-02-07  8:14 ` [PATCH 14/14] neard: Add fallback to legacy register if register failed Szymon Janc
2013-02-11  9:52 ` [PATCH 00/14] neard plugin update 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=1360224844-12280-9-git-send-email-szymon.janc@tieto.com \
    --to=szymon.janc@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=ravikumar.veeramally@linux.intel.com \
    /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 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.