Bluetooth: Audio: Remove ISO disconnected and connected cbs
The callbacks were implemented to notify the application about the state of the ISO. However, since then, callbacks such as `started` and `stopped` have been implemented, and as such the `connected` and `disconnected` callbacks no longer server any purpose. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
04ea1ee1af
commit
628b54a959
10 changed files with 19 additions and 122 deletions
|
@ -1232,26 +1232,6 @@ struct bt_audio_stream_ops {
|
||||||
*/
|
*/
|
||||||
void (*released)(struct bt_audio_stream *stream);
|
void (*released)(struct bt_audio_stream *stream);
|
||||||
|
|
||||||
/** @brief Stream connected callback
|
|
||||||
*
|
|
||||||
* If this callback is provided it will be called when the
|
|
||||||
* isochronous stream is connected.
|
|
||||||
*
|
|
||||||
* @param stream The stream that has been connected
|
|
||||||
*/
|
|
||||||
void (*connected)(struct bt_audio_stream *stream);
|
|
||||||
|
|
||||||
/** @brief Stream disconnected callback
|
|
||||||
*
|
|
||||||
* If this callback is provided it will be called when the
|
|
||||||
* isochronous stream is disconnected, including when a connection gets
|
|
||||||
* rejected.
|
|
||||||
*
|
|
||||||
* @param stream The stream that has been Disconnected
|
|
||||||
* @param reason HCI reason for the disconnection.
|
|
||||||
*/
|
|
||||||
void (*disconnected)(struct bt_audio_stream *stream, uint8_t reason);
|
|
||||||
|
|
||||||
/** @brief Stream audio HCI receive callback.
|
/** @brief Stream audio HCI receive callback.
|
||||||
*
|
*
|
||||||
* This callback is only used if the ISO data path is HCI.
|
* This callback is only used if the ISO data path is HCI.
|
||||||
|
|
|
@ -258,6 +258,9 @@ static void stream_disabled(struct bt_audio_stream *stream)
|
||||||
static void stream_stopped(struct bt_audio_stream *stream)
|
static void stream_stopped(struct bt_audio_stream *stream)
|
||||||
{
|
{
|
||||||
printk("Audio Stream %p stopped\n", stream);
|
printk("Audio Stream %p stopped\n", stream);
|
||||||
|
|
||||||
|
/* Stop send timer */
|
||||||
|
k_work_cancel_delayable(&audio_send_work);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stream_released(struct bt_audio_stream *stream)
|
static void stream_released(struct bt_audio_stream *stream)
|
||||||
|
@ -265,18 +268,6 @@ static void stream_released(struct bt_audio_stream *stream)
|
||||||
printk("Audio Stream %p released\n", stream);
|
printk("Audio Stream %p released\n", stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stream_connected(struct bt_audio_stream *stream)
|
|
||||||
{
|
|
||||||
printk("Audio Stream %p connected, start sending\n", stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void stream_disconnected(struct bt_audio_stream *stream, uint8_t reason)
|
|
||||||
{
|
|
||||||
printk("Audio Stream %p disconnected (reason 0x%02x)\n",
|
|
||||||
stream, reason);
|
|
||||||
k_work_cancel_delayable(&audio_send_work);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct bt_audio_stream_ops stream_ops = {
|
static struct bt_audio_stream_ops stream_ops = {
|
||||||
.configured = stream_configured,
|
.configured = stream_configured,
|
||||||
.qos_set = stream_qos_set,
|
.qos_set = stream_qos_set,
|
||||||
|
@ -286,8 +277,6 @@ static struct bt_audio_stream_ops stream_ops = {
|
||||||
.disabled = stream_disabled,
|
.disabled = stream_disabled,
|
||||||
.stopped = stream_stopped,
|
.stopped = stream_stopped,
|
||||||
.released = stream_released,
|
.released = stream_released,
|
||||||
.connected = stream_connected,
|
|
||||||
.disconnected = stream_disconnected,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void add_remote_sink(struct bt_audio_ep *ep, uint8_t index)
|
static void add_remote_sink(struct bt_audio_ep *ep, uint8_t index)
|
||||||
|
|
|
@ -199,24 +199,12 @@ static struct bt_audio_capability_ops lc3_ops = {
|
||||||
.release = lc3_release,
|
.release = lc3_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void stream_connected(struct bt_audio_stream *stream)
|
|
||||||
{
|
|
||||||
printk("Audio Stream %p connected\n", stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void stream_disconnected(struct bt_audio_stream *stream, uint8_t reason)
|
|
||||||
{
|
|
||||||
printk("Audio Stream %p disconnected (reason 0x%02x)\n", stream, reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void stream_recv(struct bt_audio_stream *stream, struct net_buf *buf)
|
static void stream_recv(struct bt_audio_stream *stream, struct net_buf *buf)
|
||||||
{
|
{
|
||||||
printk("Incoming audio on stream %p len %u\n", stream, buf->len);
|
printk("Incoming audio on stream %p len %u\n", stream, buf->len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_audio_stream_ops stream_ops = {
|
static struct bt_audio_stream_ops stream_ops = {
|
||||||
.connected = stream_connected,
|
|
||||||
.disconnected = stream_disconnected,
|
|
||||||
.recv = stream_recv
|
.recv = stream_recv
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -256,16 +256,9 @@ static void ascs_iso_recv(struct bt_iso_chan *chan,
|
||||||
static void ascs_iso_connected(struct bt_iso_chan *chan)
|
static void ascs_iso_connected(struct bt_iso_chan *chan)
|
||||||
{
|
{
|
||||||
struct bt_audio_ep *ep = CONTAINER_OF(chan, struct bt_audio_ep, iso);
|
struct bt_audio_ep *ep = CONTAINER_OF(chan, struct bt_audio_ep, iso);
|
||||||
struct bt_audio_stream_ops *ops = ep->stream->ops;
|
|
||||||
|
|
||||||
BT_DBG("stream %p ep %p type %u", chan, ep, ep != NULL ? ep->type : 0);
|
BT_DBG("stream %p ep %p type %u", chan, ep, ep != NULL ? ep->type : 0);
|
||||||
|
|
||||||
if (ops != NULL && ops->connected != NULL) {
|
|
||||||
ops->connected(ep->stream);
|
|
||||||
} else {
|
|
||||||
BT_WARN("No callback for connected set");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ep->status.state != BT_AUDIO_EP_STATE_ENABLING) {
|
if (ep->status.state != BT_AUDIO_EP_STATE_ENABLING) {
|
||||||
BT_DBG("endpoint not in enabling state: %s",
|
BT_DBG("endpoint not in enabling state: %s",
|
||||||
bt_audio_ep_state_str(ep->status.state));
|
bt_audio_ep_state_str(ep->status.state));
|
||||||
|
@ -284,10 +277,10 @@ static void ascs_iso_disconnected(struct bt_iso_chan *chan, uint8_t reason)
|
||||||
|
|
||||||
BT_DBG("stream %p ep %p reason 0x%02x", chan, ep, reason);
|
BT_DBG("stream %p ep %p reason 0x%02x", chan, ep, reason);
|
||||||
|
|
||||||
if (ops != NULL && ops->disconnected != NULL) {
|
if (ops != NULL && ops->stopped != NULL) {
|
||||||
ops->disconnected(stream, reason);
|
ops->stopped(stream);
|
||||||
} else {
|
} else {
|
||||||
BT_WARN("No callback for disconnected set");
|
BT_WARN("No callback for stopped set");
|
||||||
}
|
}
|
||||||
|
|
||||||
ascs_ep_set_state(ep, BT_AUDIO_EP_STATE_QOS_CONFIGURED);
|
ascs_ep_set_state(ep, BT_AUDIO_EP_STATE_QOS_CONFIGURED);
|
||||||
|
|
|
@ -114,8 +114,8 @@ static void broadcast_sink_iso_connected(struct bt_iso_chan *chan)
|
||||||
|
|
||||||
broadcast_sink_set_ep_state(ep, BT_AUDIO_EP_STATE_STREAMING);
|
broadcast_sink_set_ep_state(ep, BT_AUDIO_EP_STATE_STREAMING);
|
||||||
|
|
||||||
if (ops != NULL && ops->connected != NULL) {
|
if (ops != NULL && ops->started != NULL) {
|
||||||
ops->connected(ep->stream);
|
ops->started(ep->stream);
|
||||||
} else {
|
} else {
|
||||||
BT_WARN("No callback for connected set");
|
BT_WARN("No callback for connected set");
|
||||||
}
|
}
|
||||||
|
@ -132,10 +132,10 @@ static void broadcast_sink_iso_disconnected(struct bt_iso_chan *chan,
|
||||||
|
|
||||||
broadcast_sink_set_ep_state(ep, BT_AUDIO_EP_STATE_IDLE);
|
broadcast_sink_set_ep_state(ep, BT_AUDIO_EP_STATE_IDLE);
|
||||||
|
|
||||||
if (ops != NULL && ops->disconnected != NULL) {
|
if (ops != NULL && ops->stopped != NULL) {
|
||||||
ops->disconnected(stream, reason);
|
ops->stopped(stream);
|
||||||
} else {
|
} else {
|
||||||
BT_WARN("No callback for disconnected set");
|
BT_WARN("No callback for stopped set");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,8 +139,8 @@ static void broadcast_source_iso_connected(struct bt_iso_chan *chan)
|
||||||
|
|
||||||
broadcast_source_set_ep_state(ep, BT_AUDIO_EP_STATE_STREAMING);
|
broadcast_source_set_ep_state(ep, BT_AUDIO_EP_STATE_STREAMING);
|
||||||
|
|
||||||
if (ops != NULL && ops->connected != NULL) {
|
if (ops != NULL && ops->started != NULL) {
|
||||||
ops->connected(ep->stream);
|
ops->started(ep->stream);
|
||||||
} else {
|
} else {
|
||||||
BT_WARN("No callback for connected set");
|
BT_WARN("No callback for connected set");
|
||||||
}
|
}
|
||||||
|
@ -156,10 +156,10 @@ static void broadcast_source_iso_disconnected(struct bt_iso_chan *chan, uint8_t
|
||||||
|
|
||||||
broadcast_source_set_ep_state(ep, BT_AUDIO_EP_STATE_IDLE);
|
broadcast_source_set_ep_state(ep, BT_AUDIO_EP_STATE_IDLE);
|
||||||
|
|
||||||
if (ops != NULL && ops->disconnected != NULL) {
|
if (ops != NULL && ops->stopped != NULL) {
|
||||||
ops->disconnected(stream, reason);
|
ops->stopped(stream);
|
||||||
} else {
|
} else {
|
||||||
BT_WARN("No callback for disconnected set");
|
BT_WARN("No callback for stopped set");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,16 +83,9 @@ static void unicast_client_ep_iso_recv(struct bt_iso_chan *chan,
|
||||||
static void unicast_client_ep_iso_connected(struct bt_iso_chan *chan)
|
static void unicast_client_ep_iso_connected(struct bt_iso_chan *chan)
|
||||||
{
|
{
|
||||||
struct bt_audio_ep *ep = EP_ISO(chan);
|
struct bt_audio_ep *ep = EP_ISO(chan);
|
||||||
struct bt_audio_stream_ops *ops = ep->stream->ops;
|
|
||||||
|
|
||||||
BT_DBG("stream %p ep %p type %u", chan, ep, ep != NULL ? ep->type : 0);
|
BT_DBG("stream %p ep %p type %u", chan, ep, ep != NULL ? ep->type : 0);
|
||||||
|
|
||||||
if (ops != NULL && ops->connected != NULL) {
|
|
||||||
ops->connected(ep->stream);
|
|
||||||
} else {
|
|
||||||
BT_WARN("No callback for connected set");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ep->status.state != BT_AUDIO_EP_STATE_ENABLING) {
|
if (ep->status.state != BT_AUDIO_EP_STATE_ENABLING) {
|
||||||
BT_DBG("endpoint not in enabling state: %s",
|
BT_DBG("endpoint not in enabling state: %s",
|
||||||
bt_audio_ep_state_str(ep->status.state));
|
bt_audio_ep_state_str(ep->status.state));
|
||||||
|
@ -112,10 +105,10 @@ static void unicast_client_ep_iso_disconnected(struct bt_iso_chan *chan,
|
||||||
|
|
||||||
BT_DBG("stream %p ep %p reason 0x%02x", chan, ep, reason);
|
BT_DBG("stream %p ep %p reason 0x%02x", chan, ep, reason);
|
||||||
|
|
||||||
if (ops != NULL && ops->disconnected != NULL) {
|
if (ops != NULL && ops->stopped != NULL) {
|
||||||
ops->disconnected(stream, reason);
|
ops->stopped(stream);
|
||||||
} else {
|
} else {
|
||||||
BT_WARN("No callback for disconnected set");
|
BT_WARN("No callback for stopped set");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ep->type != BT_AUDIO_EP_LOCAL) {
|
if (ep->type != BT_AUDIO_EP_LOCAL) {
|
||||||
|
@ -503,13 +496,6 @@ static void unicast_client_ep_releasing_state(struct bt_audio_ep *ep,
|
||||||
BT_DBG("dir 0x%02x",
|
BT_DBG("dir 0x%02x",
|
||||||
unicast_client_ep_is_snk(ep) ? BT_AUDIO_SINK : BT_AUDIO_SOURCE);
|
unicast_client_ep_is_snk(ep) ? BT_AUDIO_SINK : BT_AUDIO_SOURCE);
|
||||||
|
|
||||||
/* Notify upper layer */
|
|
||||||
if (stream->ops != NULL && stream->ops->stopped != NULL) {
|
|
||||||
stream->ops->stopped(stream);
|
|
||||||
} else {
|
|
||||||
BT_WARN("No callback for stopped set");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The Unicast Client shall terminate any CIS established for that ASE
|
/* The Unicast Client shall terminate any CIS established for that ASE
|
||||||
* by following the Connected Isochronous Stream Terminate procedure
|
* by following the Connected Isochronous Stream Terminate procedure
|
||||||
* defined in Volume 3, Part C, Section 9.3.15 in when the Unicast
|
* defined in Volume 3, Part C, Section 9.3.15 in when the Unicast
|
||||||
|
|
|
@ -1078,25 +1078,12 @@ static struct bt_audio_broadcast_sink_cb sink_cbs = {
|
||||||
};
|
};
|
||||||
#endif /* CONFIG_BT_AUDIO_BROADCAST_SINK */
|
#endif /* CONFIG_BT_AUDIO_BROADCAST_SINK */
|
||||||
|
|
||||||
static void audio_connected(struct bt_audio_stream *stream)
|
|
||||||
{
|
|
||||||
shell_print(ctx_shell, "Channel %p connected\n", stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void audio_disconnected(struct bt_audio_stream *stream, uint8_t reason)
|
|
||||||
{
|
|
||||||
shell_print(ctx_shell, "Channel %p disconnected with reason 0x%2x\n",
|
|
||||||
stream, reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void audio_recv(struct bt_audio_stream *stream, struct net_buf *buf)
|
static void audio_recv(struct bt_audio_stream *stream, struct net_buf *buf)
|
||||||
{
|
{
|
||||||
shell_print(ctx_shell, "Incoming audio on stream %p len %u\n", stream, buf->len);
|
shell_print(ctx_shell, "Incoming audio on stream %p len %u\n", stream, buf->len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_audio_stream_ops stream_ops = {
|
static struct bt_audio_stream_ops stream_ops = {
|
||||||
.connected = audio_connected,
|
|
||||||
.disconnected = audio_disconnected,
|
|
||||||
.recv = audio_recv
|
.recv = audio_recv
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -80,17 +80,6 @@ static void stream_released(struct bt_audio_stream *stream)
|
||||||
printk("Released stream %p\n", stream);
|
printk("Released stream %p\n", stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stream_connected(struct bt_audio_stream *stream)
|
|
||||||
{
|
|
||||||
printk("Audio Stream %p connected\n", stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void stream_disconnected(struct bt_audio_stream *stream, uint8_t reason)
|
|
||||||
{
|
|
||||||
printk("Audio Stream %p disconnected (reason 0x%02x)\n",
|
|
||||||
stream, reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct bt_audio_stream_ops stream_ops = {
|
static struct bt_audio_stream_ops stream_ops = {
|
||||||
.configured = stream_configured,
|
.configured = stream_configured,
|
||||||
.qos_set = stream_qos_set,
|
.qos_set = stream_qos_set,
|
||||||
|
@ -100,8 +89,6 @@ static struct bt_audio_stream_ops stream_ops = {
|
||||||
.disabled = stream_disabled,
|
.disabled = stream_disabled,
|
||||||
.stopped = stream_stopped,
|
.stopped = stream_stopped,
|
||||||
.released = stream_released,
|
.released = stream_released,
|
||||||
.connected = stream_connected,
|
|
||||||
.disconnected = stream_disconnected,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void add_remote_sink(struct bt_audio_ep *ep, uint8_t index)
|
static void add_remote_sink(struct bt_audio_ep *ep, uint8_t index)
|
||||||
|
|
|
@ -133,25 +133,12 @@ static struct bt_audio_capability_ops lc3_ops = {
|
||||||
.release = lc3_release,
|
.release = lc3_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void stream_connected(struct bt_audio_stream *stream)
|
|
||||||
{
|
|
||||||
printk("Audio Stream %p connected\n", stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void stream_disconnected(struct bt_audio_stream *stream, uint8_t reason)
|
|
||||||
{
|
|
||||||
printk("Audio Stream %p disconnected (reason 0x%02x)\n",
|
|
||||||
stream, reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void stream_recv(struct bt_audio_stream *stream, struct net_buf *buf)
|
static void stream_recv(struct bt_audio_stream *stream, struct net_buf *buf)
|
||||||
{
|
{
|
||||||
printk("Incoming audio on stream %p len %u\n", stream, buf->len);
|
printk("Incoming audio on stream %p len %u\n", stream, buf->len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_audio_stream_ops stream_ops = {
|
static struct bt_audio_stream_ops stream_ops = {
|
||||||
.connected = stream_connected,
|
|
||||||
.disconnected = stream_disconnected,
|
|
||||||
.recv = stream_recv
|
.recv = stream_recv
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue