From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 7/8] android/AVCTP: Add avctp_set_destroy_cb
Date: Thu, 23 Jan 2014 18:39:57 +0200 [thread overview]
Message-ID: <1390495198-28400-7-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1390495198-28400-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds avctp_set_destroy_cb that can be use to set a callback when
the AVCTP has been disconnected.
---
android/avctp.c | 13 +++++++++++++
android/avctp.h | 3 +++
2 files changed, 16 insertions(+)
diff --git a/android/avctp.c b/android/avctp.c
index a31dcc6..87e26be 100644
--- a/android/avctp.c
+++ b/android/avctp.c
@@ -175,6 +175,9 @@ struct avctp {
uint8_t key_quirks[256];
struct key_pressed key;
uint16_t version;
+
+ avctp_destroy_cb_t destroy;
+ void *data;
};
struct avctp_passthrough_handler {
@@ -1446,6 +1449,13 @@ int avctp_connect_browsing(struct avctp *session, int fd, size_t imtu,
return 0;
}
+void avctp_set_destroy_cb(struct avctp *session, avctp_destroy_cb_t cb,
+ void *user_data)
+{
+ session->destroy = cb;
+ session->data = user_data;
+}
+
void avctp_shutdown(struct avctp *session)
{
if (!session)
@@ -1457,6 +1467,9 @@ void avctp_shutdown(struct avctp *session)
if (session->control)
avctp_channel_destroy(session->control);
+ if (session->destroy)
+ session->destroy(session->data);
+
if (session->key.timer > 0)
g_source_remove(session->key.timer);
diff --git a/android/avctp.h b/android/avctp.h
index 99aaf95..a22bf13 100644
--- a/android/avctp.h
+++ b/android/avctp.h
@@ -103,6 +103,9 @@ typedef size_t (*avctp_browsing_pdu_cb) (struct avctp *session,
typedef void (*avctp_destroy_cb_t) (void *user_data);
struct avctp *avctp_new(int fd, size_t imtu, size_t omtu, uint16_t version);
+void avctp_set_destroy_cb(struct avctp *session, avctp_destroy_cb_t cb,
+ void *user_data);
+
int avctp_init_uinput(struct avctp *session, const char *name,
const char *address);
int avctp_connect_browsing(struct avctp *session, int fd, size_t imtu,
--
1.8.4.2
next prev parent reply other threads:[~2014-01-23 16:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-23 16:39 [PATCH BlueZ 1/8] android: Add copy of current AVCTP implemention Luiz Augusto von Dentz
2014-01-23 16:39 ` [PATCH BlueZ 2/8] android/AVCTP: Strip dependencies Luiz Augusto von Dentz
2014-01-23 16:39 ` [PATCH BlueZ 3/8] android: Add initial skeleton for AVRCP in the daemon Luiz Augusto von Dentz
2014-01-23 16:39 ` [PATCH BlueZ 4/8] android: Add initial skeleton for AVRCP in the HAL Luiz Augusto von Dentz
2014-01-23 16:39 ` [PATCH BlueZ 5/8] android/haltest: Add init and cleanup calls to rc methods Luiz Augusto von Dentz
2014-01-23 16:39 ` [PATCH BlueZ 6/8] android/AVRCP: Add implementation of SDP record Luiz Augusto von Dentz
2014-01-24 11:22 ` Andrei Emeltchenko
2014-01-24 11:27 ` Andrei Emeltchenko
2014-01-23 16:39 ` Luiz Augusto von Dentz [this message]
2014-01-23 16:39 ` [PATCH BlueZ 8/8] android/AVRCP: Add initial socket handling Luiz Augusto von Dentz
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=1390495198-28400-7-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@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