Linux bluetooth development
 help / color / mirror / Atom feed
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_v3 5/6] android/health: Implement mcap_mdl_deleted_cb
Date: Sun, 22 Jun 2014 14:59:00 +0300	[thread overview]
Message-ID: <1403438341-14321-6-git-send-email-ravikumar.veeramally@linux.intel.com> (raw)
In-Reply-To: <1403438341-14321-1-git-send-email-ravikumar.veeramally@linux.intel.com>

mcap_mdl_deleted_cb will be called if remote device sends MDL_DELETE_REQ.
Free channel data and notify channel is destroyed.
---
 android/health.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/android/health.c b/android/health.c
index 6003aaa..effa5e2 100644
--- a/android/health.c
+++ b/android/health.c
@@ -1006,9 +1006,30 @@ static void mcap_mdl_closed_cb(struct mcap_mdl *mdl, void *data)
 	DBG("Not Implemeneted");
 }
 
+static void notify_channel(void *data, void *user_data)
+{
+	struct health_channel *channel = data;
+
+	send_channel_state_notify(channel, HAL_HEALTH_CHANNEL_DESTROYED, -1);
+}
+
 static void mcap_mdl_deleted_cb(struct mcap_mdl *mdl, void *data)
 {
-	DBG("Not Implemeneted");
+	struct health_channel *channel = data;
+	struct health_device *dev;
+
+	DBG("");
+
+	dev = channel->dev;
+	/* mdl == NULL means, delete all mdls */
+	if (!mdl) {
+		queue_foreach(dev->channels, notify_channel, NULL);
+		queue_destroy(dev->channels, free_health_channel);
+		dev->channels = NULL;
+		return;
+	}
+
+	destroy_channel(channel);
 }
 
 static void mcap_mdl_aborted_cb(struct mcap_mdl *mdl, void *data)
-- 
1.9.1


  parent reply	other threads:[~2014-06-22 11:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-22 11:58 [PATCH_v3 0/6] Initial implementation for MCAP data channel Ravi kumar Veeramally
2014-06-22 11:58 ` [PATCH_v3 1/6] android/health: Check if device and channel already exists or not Ravi kumar Veeramally
2014-06-22 11:58 ` [PATCH_v3 2/6] android/health: Cache remote mdep id on channel connect request Ravi kumar Veeramally
2014-06-22 11:58 ` [PATCH_v3 3/6] android/health: Notify channel status on channel destroy call Ravi kumar Veeramally
2014-06-22 11:58 ` [PATCH_v3 4/6] android/health: Create and connect MDL Ravi kumar Veeramally
2014-06-22 11:59 ` Ravi kumar Veeramally [this message]
2014-06-22 11:59 ` [PATCH_v3 6/6] anrdroid/client/health: Cache fd and close on channel disconnection Ravi kumar Veeramally
2014-06-23  9:15 ` [PATCH_v3 0/6] Initial implementation for MCAP data channel 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=1403438341-14321-6-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