From: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCHv1 3/8] android/daemon: Implement mgmt device connected event
Date: Fri, 1 Nov 2013 15:41:40 +0200 [thread overview]
Message-ID: <1383313305-9442-3-git-send-email-Andrei.Emeltchenko.news@gmail.com> (raw)
In-Reply-To: <1383313305-9442-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Send HAL_EV_ACL_STATE_CHANGED event to HAL through IPC.
---
android/adapter.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/android/adapter.c b/android/adapter.c
index 5ce0797..5a5fa2e 100644
--- a/android/adapter.c
+++ b/android/adapter.c
@@ -628,6 +628,29 @@ static void mgmt_device_found_event(uint16_t index, uint16_t length,
confirm_name, eir, eir_len);
}
+static void mgmt_device_connected_event(uint16_t index, uint16_t length,
+ const void *param, void *user_data)
+{
+ const struct mgmt_ev_device_connected *ev = param;
+ struct hal_ev_acl_state_changed hal_ev;
+
+ if (length < sizeof(*ev)) {
+ error("Too short device connected event (%u bytes)", length);
+ return;
+ }
+
+ /* TODO: Update device */
+
+ /* TODO: Check Set bonding state */
+
+ hal_ev.status = HAL_STATUS_SUCCESS;
+ hal_ev.state = HAL_ACL_STATE_CONNECTED;
+ bdaddr2android(&ev->addr.bdaddr, hal_ev.bdaddr);
+
+ ipc_send(notification_io, HAL_SERVICE_ID_BLUETOOTH,
+ HAL_EV_ACL_STATE_CHANGED, sizeof(hal_ev), &hal_ev, -1);
+}
+
static void register_mgmt_handlers(void)
{
mgmt_register(adapter->mgmt, MGMT_EV_NEW_SETTINGS, adapter->index,
@@ -665,6 +688,9 @@ static void register_mgmt_handlers(void)
mgmt_register(adapter->mgmt, MGMT_EV_DEVICE_FOUND,
adapter->index, mgmt_device_found_event,
NULL, NULL);
+
+ mgmt_register(adapter->mgmt, MGMT_EV_DEVICE_CONNECTED, adapter->index,
+ mgmt_device_connected_event, NULL, NULL);
}
static void load_link_keys_complete(uint8_t status, uint16_t length,
--
1.7.10.4
next prev parent reply other threads:[~2013-11-01 13:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-01 13:41 [PATCHv1 1/8] android/haltest: Fix print device name Andrei Emeltchenko
2013-11-01 13:41 ` [PATCHv1 2/8] android/ipc: Update HAL IPC header Andrei Emeltchenko
2013-11-01 13:41 ` Andrei Emeltchenko [this message]
2013-11-01 13:41 ` [PATCHv1 4/8] android/hal: Handle acl_state_changed event Andrei Emeltchenko
2013-11-01 13:41 ` [PATCHv1 5/8] android/daemon: Add debug handlers for unhandled mgmt event Andrei Emeltchenko
2013-11-01 13:41 ` [PATCHv1 6/8] android/hal: Add debug prints for every HAL callback Andrei Emeltchenko
2013-11-01 13:41 ` [PATCHv1 7/8] android/daemon: Add handler for device disconnected Andrei Emeltchenko
2013-11-01 13:41 ` [PATCHv1 8/8] android/daemon: Refactor sending acl state Andrei Emeltchenko
2013-11-01 14:40 ` 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=1383313305-9442-3-git-send-email-Andrei.Emeltchenko.news@gmail.com \
--to=andrei.emeltchenko.news@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