From: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Subject: [PATCH 1/5] android/health: Implement mcl_disconnected cb
Date: Mon, 30 Jun 2014 18:31:50 +0300 [thread overview]
Message-ID: <1404142314-20795-2-git-send-email-ravikumar.veeramally@linux.intel.com> (raw)
In-Reply-To: <1404142314-20795-1-git-send-email-ravikumar.veeramally@linux.intel.com>
Provide a utility to find device by mcl and update the
mcl status.
---
android/health.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 45 insertions(+), 1 deletion(-)
diff --git a/android/health.c b/android/health.c
index 3225617..1905862 100644
--- a/android/health.c
+++ b/android/health.c
@@ -243,6 +243,14 @@ static bool match_channel_by_id(const void *data, const void *user_data)
return channel->id == channel_id;
}
+static bool match_dev_by_mcl(const void *data, const void *user_data)
+{
+ const struct health_device *dev = data;
+ const struct mcap_mcl *mcl = user_data;
+
+ return dev->mcl == mcl;
+}
+
static bool match_dev_by_addr(const void *data, const void *user_data)
{
const struct health_device *dev = data;
@@ -329,6 +337,36 @@ static struct health_channel *search_channel_by_id(uint16_t id)
return search.channel;
}
+struct mcl_search {
+ struct mcap_mcl *mcl;
+ struct health_device *dev;
+};
+
+static void app_search_dev(void *data, void *user_data)
+{
+ struct health_app *app = data;
+ struct mcl_search *search = user_data;
+
+ if (search->dev)
+ return;
+
+ search->dev = queue_find(app->devices, match_dev_by_mcl, search->mcl);
+}
+
+static struct health_device *search_dev_by_mcl(struct mcap_mcl *mcl)
+{
+ struct mcl_search search;
+
+ DBG("");
+
+ search.mcl = mcl;
+ search.dev = NULL;
+
+ queue_foreach(apps, app_search_dev, &search);
+
+ return search.dev;
+}
+
struct app_search {
uint8_t mdepid;
struct health_app *app;
@@ -1977,7 +2015,13 @@ static void mcl_reconnected(struct mcap_mcl *mcl, gpointer data)
static void mcl_disconnected(struct mcap_mcl *mcl, gpointer data)
{
- DBG("Not implemented");
+ struct health_device *dev;
+
+ DBG("");
+
+ dev = search_dev_by_mcl(mcl);
+ if (dev)
+ dev->mcl_conn = false;
}
static void mcl_uncached(struct mcap_mcl *mcl, gpointer data)
--
1.9.1
next prev parent reply other threads:[~2014-06-30 15:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-30 15:31 [PATCH 0/5] Implement disconenct and reconnect Ravi kumar Veeramally
2014-06-30 15:31 ` Ravi kumar Veeramally [this message]
2014-06-30 15:31 ` [PATCH 2/5] android/health: Implement mcl_uncached callback Ravi kumar Veeramally
2014-06-30 15:31 ` [PATCH 3/5] android/health: Fix do not set mdl callbacks on mcl_reconneced call back Ravi kumar Veeramally
2014-06-30 15:31 ` [PATCH 4/5] android/health: Implement MDL reconnection from remote device Ravi kumar Veeramally
2014-06-30 16:36 ` Szymon Janc
2014-06-30 15:31 ` [PATCH 5/5] android/health: Update PTS result Ravi kumar Veeramally
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=1404142314-20795-2-git-send-email-ravikumar.veeramally@linux.intel.com \
--to=ravikumar.veeramally@linux.intel.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