* [PATCH BlueZ 1/4] android/hal-msg: Add defines for each audio state
@ 2014-01-17 13:33 Luiz Augusto von Dentz
2014-01-17 13:33 ` [PATCH BlueZ 2/4] android/A2DP: Notify when audio state change to started Luiz Augusto von Dentz
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2014-01-17 13:33 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/hal-msg.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index ceaa3b2..cfb5460 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -564,6 +564,10 @@ struct hal_ev_a2dp_conn_state {
uint8_t bdaddr[6];
} __attribute__((packed));
+#define HAL_AUDIO_SUSPEND 0x00
+#define HAL_AUDIO_STOPPED 0x01
+#define HAL_AUDIO_STARTED 0x02
+
#define HAL_EV_A2DP_AUDIO_STATE 0x82
struct hal_ev_a2dp_audio_state {
uint8_t state;
--
1.8.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH BlueZ 2/4] android/A2DP: Notify when audio state change to started 2014-01-17 13:33 [PATCH BlueZ 1/4] android/hal-msg: Add defines for each audio state Luiz Augusto von Dentz @ 2014-01-17 13:33 ` Luiz Augusto von Dentz 2014-01-17 13:33 ` [PATCH BlueZ 3/4] android/A2DP: Notify when audio state change to stopped Luiz Augusto von Dentz ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: Luiz Augusto von Dentz @ 2014-01-17 13:33 UTC (permalink / raw) To: linux-bluetooth From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> --- android/a2dp.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/android/a2dp.c b/android/a2dp.c index 2288912..515cf17 100644 --- a/android/a2dp.c +++ b/android/a2dp.c @@ -85,6 +85,7 @@ struct a2dp_setup { struct a2dp_endpoint *endpoint; struct a2dp_preset *preset; struct avdtp_stream *stream; + uint8_t state; }; static int device_cmp(gconstpointer s, gconstpointer user_data) @@ -190,6 +191,26 @@ static void bt_a2dp_notify_state(struct a2dp_device *dev, uint8_t state) a2dp_device_free(dev); } +static void bt_audio_notify_state(struct a2dp_setup *setup, uint8_t state) +{ + struct hal_ev_a2dp_audio_state ev; + char address[18]; + + if (setup->state == state) + return; + + setup->state = state; + + ba2str(&setup->dev->dst, address); + DBG("device %s state %u", address, state); + + bdaddr2android(&setup->dev->dst, ev.bdaddr); + ev.state = state; + + ipc_send_notif(HAL_SERVICE_ID_A2DP, HAL_EV_A2DP_AUDIO_STATE, sizeof(ev), + &ev); +} + static void disconnect_cb(void *user_data) { struct a2dp_device *dev = user_data; @@ -962,6 +983,8 @@ static gboolean sep_start_ind(struct avdtp *session, return FALSE; } + bt_audio_notify_state(setup, HAL_AUDIO_STARTED); + return TRUE; } @@ -1059,13 +1082,23 @@ static void sep_start_cfm(struct avdtp *session, struct avdtp_local_sep *sep, void *user_data) { struct a2dp_endpoint *endpoint = user_data; + struct a2dp_setup *setup; DBG(""); - if (!err) + if (err) { + setup_remove_by_id(endpoint->id); return; + } - setup_remove_by_id(endpoint->id); + setup = find_setup(endpoint->id); + if (!setup) { + error("Unable to find stream setup for %u endpoint", + endpoint->id); + return; + } + + bt_audio_notify_state(setup, HAL_AUDIO_STARTED); } static void sep_suspend_cfm(struct avdtp *session, struct avdtp_local_sep *sep, -- 1.8.4.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH BlueZ 3/4] android/A2DP: Notify when audio state change to stopped 2014-01-17 13:33 [PATCH BlueZ 1/4] android/hal-msg: Add defines for each audio state Luiz Augusto von Dentz 2014-01-17 13:33 ` [PATCH BlueZ 2/4] android/A2DP: Notify when audio state change to started Luiz Augusto von Dentz @ 2014-01-17 13:33 ` Luiz Augusto von Dentz 2014-01-17 13:33 ` [PATCH BlueZ 4/4] android/A2DP: Notify when audio state change to suspend Luiz Augusto von Dentz 2014-01-18 22:28 ` [PATCH BlueZ 1/4] android/hal-msg: Add defines for each audio state Luiz Augusto von Dentz 3 siblings, 0 replies; 5+ messages in thread From: Luiz Augusto von Dentz @ 2014-01-17 13:33 UTC (permalink / raw) To: linux-bluetooth From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> --- android/a2dp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/android/a2dp.c b/android/a2dp.c index 515cf17..12a8a69 100644 --- a/android/a2dp.c +++ b/android/a2dp.c @@ -1106,13 +1106,23 @@ static void sep_suspend_cfm(struct avdtp *session, struct avdtp_local_sep *sep, void *user_data) { struct a2dp_endpoint *endpoint = user_data; + struct a2dp_setup *setup; DBG(""); - if (!err) + if (err) { + setup_remove_by_id(endpoint->id); return; + } - setup_remove_by_id(endpoint->id); + setup = find_setup(endpoint->id); + if (!setup) { + error("Unable to find stream setup for %u endpoint", + endpoint->id); + return; + } + + bt_audio_notify_state(setup, HAL_AUDIO_STOPPED); } static void sep_close_cfm(struct avdtp *session, struct avdtp_local_sep *sep, -- 1.8.4.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH BlueZ 4/4] android/A2DP: Notify when audio state change to suspend 2014-01-17 13:33 [PATCH BlueZ 1/4] android/hal-msg: Add defines for each audio state Luiz Augusto von Dentz 2014-01-17 13:33 ` [PATCH BlueZ 2/4] android/A2DP: Notify when audio state change to started Luiz Augusto von Dentz 2014-01-17 13:33 ` [PATCH BlueZ 3/4] android/A2DP: Notify when audio state change to stopped Luiz Augusto von Dentz @ 2014-01-17 13:33 ` Luiz Augusto von Dentz 2014-01-18 22:28 ` [PATCH BlueZ 1/4] android/hal-msg: Add defines for each audio state Luiz Augusto von Dentz 3 siblings, 0 replies; 5+ messages in thread From: Luiz Augusto von Dentz @ 2014-01-17 13:33 UTC (permalink / raw) To: linux-bluetooth From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> --- android/a2dp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/android/a2dp.c b/android/a2dp.c index 12a8a69..8ec03c8 100644 --- a/android/a2dp.c +++ b/android/a2dp.c @@ -1007,6 +1007,8 @@ static gboolean sep_suspend_ind(struct avdtp *session, return FALSE; } + bt_audio_notify_state(setup, HAL_AUDIO_SUSPEND); + return TRUE; } -- 1.8.4.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH BlueZ 1/4] android/hal-msg: Add defines for each audio state 2014-01-17 13:33 [PATCH BlueZ 1/4] android/hal-msg: Add defines for each audio state Luiz Augusto von Dentz ` (2 preceding siblings ...) 2014-01-17 13:33 ` [PATCH BlueZ 4/4] android/A2DP: Notify when audio state change to suspend Luiz Augusto von Dentz @ 2014-01-18 22:28 ` Luiz Augusto von Dentz 3 siblings, 0 replies; 5+ messages in thread From: Luiz Augusto von Dentz @ 2014-01-18 22:28 UTC (permalink / raw) To: linux-bluetooth@vger.kernel.org Hi, On Fri, Jan 17, 2014 at 3:33 PM, Luiz Augusto von Dentz <luiz.dentz@gmail.com> wrote: > From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> > > --- > android/hal-msg.h | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/android/hal-msg.h b/android/hal-msg.h > index ceaa3b2..cfb5460 100644 > --- a/android/hal-msg.h > +++ b/android/hal-msg.h > @@ -564,6 +564,10 @@ struct hal_ev_a2dp_conn_state { > uint8_t bdaddr[6]; > } __attribute__((packed)); > > +#define HAL_AUDIO_SUSPEND 0x00 > +#define HAL_AUDIO_STOPPED 0x01 > +#define HAL_AUDIO_STARTED 0x02 > + > #define HAL_EV_A2DP_AUDIO_STATE 0x82 > struct hal_ev_a2dp_audio_state { > uint8_t state; > -- > 1.8.4.2 Pushed. -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-01-18 22:28 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-01-17 13:33 [PATCH BlueZ 1/4] android/hal-msg: Add defines for each audio state Luiz Augusto von Dentz 2014-01-17 13:33 ` [PATCH BlueZ 2/4] android/A2DP: Notify when audio state change to started Luiz Augusto von Dentz 2014-01-17 13:33 ` [PATCH BlueZ 3/4] android/A2DP: Notify when audio state change to stopped Luiz Augusto von Dentz 2014-01-17 13:33 ` [PATCH BlueZ 4/4] android/A2DP: Notify when audio state change to suspend Luiz Augusto von Dentz 2014-01-18 22:28 ` [PATCH BlueZ 1/4] android/hal-msg: Add defines for each audio state Luiz Augusto von Dentz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox