From: Szymon Janc <szymon.janc@tieto.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: Szymon Janc <szymon.janc@tieto.com>
Subject: [PATCH 4/6] android: Send notification on adapter power state change
Date: Wed, 23 Oct 2013 15:46:24 +0200 [thread overview]
Message-ID: <1382535986-30684-4-git-send-email-szymon.janc@tieto.com> (raw)
In-Reply-To: <1382535986-30684-1-git-send-email-szymon.janc@tieto.com>
---
android/adapter.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/android/adapter.c b/android/adapter.c
index f9843d1..7a219df 100644
--- a/android/adapter.c
+++ b/android/adapter.c
@@ -74,6 +74,20 @@ static void mgmt_local_name_changed_event(uint16_t index, uint16_t length,
/* TODO Update services if needed */
}
+static void settings_changed_powered(struct bt_adapter *adapter)
+{
+ struct hal_msg_ev_bt_adapter_state_changed ev;
+
+ ev.state = (adapter->current_settings & MGMT_SETTING_POWERED) ?
+ HAL_BT_ADAPTER_STATE_ON : HAL_BT_ADAPTER_STATE_OFF;
+
+ DBG("%u", ev.state);
+
+ ipc_send(notification_io, HAL_SERVICE_ID_BLUETOOTH,
+ HAL_MSG_EV_BT_ADAPTER_STATE_CHANGED,
+ sizeof(ev), &ev, -1);
+}
+
static void settings_changed_connectable(struct bt_adapter *adapter)
{
/* TODO */
@@ -94,16 +108,8 @@ static void settings_changed(struct bt_adapter *adapter, uint32_t settings)
DBG("0x%08x", changed_mask);
- if (changed_mask & MGMT_SETTING_POWERED) {
- info("Powered");
-
- /*
- if (adapter->current_settings & MGMT_SETTING_POWERED)
- start_adapter()
- else
- stop_adapter()
- */
- }
+ if (changed_mask & MGMT_SETTING_POWERED)
+ settings_changed_powered(adapter);
if (changed_mask & MGMT_SETTING_CONNECTABLE) {
DBG("Connectable");
--
1.8.4
next prev parent reply other threads:[~2013-10-23 13:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-23 13:46 [PATCH 1/6] android: Add missing adapter state values to IPC documentation Szymon Janc
2013-10-23 13:46 ` [PATCH 2/6] android: Add missing adapter state values to IPC header Szymon Janc
2013-10-23 13:46 ` [PATCH 3/6] android/hal: Fix crash while receiving notification Szymon Janc
2013-10-23 13:46 ` Szymon Janc [this message]
2013-10-23 13:46 ` [PATCH 5/6] android/hal: Verify if command response service ID match Szymon Janc
2013-10-23 13:46 ` [PATCH 6/6] android: Fix use of invalid service ID in response Szymon Janc
2013-10-23 16:34 ` [PATCH 1/6] android: Add missing adapter state values to IPC documentation Johan Hedberg
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=1382535986-30684-4-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