Bluetooth: ISO: Add STATE
infix for ISO state enum
Change from BT_ISO_<state> to BT_ISO_STATE_<state> to make the value more descriptive. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
5d25e34d89
commit
9e862411b3
6 changed files with 33 additions and 33 deletions
|
@ -93,13 +93,13 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/** Channel disconnected */
|
/** Channel disconnected */
|
||||||
BT_ISO_DISCONNECTED,
|
BT_ISO_STATE_DISCONNECTED,
|
||||||
/** Channel in connecting state */
|
/** Channel in connecting state */
|
||||||
BT_ISO_CONNECTING,
|
BT_ISO_STATE_CONNECTING,
|
||||||
/** Channel ready for upper layer traffic on it */
|
/** Channel ready for upper layer traffic on it */
|
||||||
BT_ISO_CONNECTED,
|
BT_ISO_STATE_CONNECTED,
|
||||||
/** Channel in disconnecting state */
|
/** Channel in disconnecting state */
|
||||||
BT_ISO_DISCONNECTING,
|
BT_ISO_STATE_DISCONNECTING,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -310,7 +310,7 @@ static int iso_accept(const struct bt_iso_accept_info *info,
|
||||||
LOG_INF("Incoming ISO request from %p", (void *)info->acl);
|
LOG_INF("Incoming ISO request from %p", (void *)info->acl);
|
||||||
|
|
||||||
for (int i = 0; i < ARRAY_SIZE(iso_chans); i++) {
|
for (int i = 0; i < ARRAY_SIZE(iso_chans); i++) {
|
||||||
if (iso_chans[i].chan.state == BT_ISO_DISCONNECTED) {
|
if (iso_chans[i].chan.state == BT_ISO_STATE_DISCONNECTED) {
|
||||||
LOG_INF("Returning instance %d", i);
|
LOG_INF("Returning instance %d", i);
|
||||||
*chan = &iso_chans[i].chan;
|
*chan = &iso_chans[i].chan;
|
||||||
cig_create_param.num_cis++;
|
cig_create_param.num_cis++;
|
||||||
|
|
|
@ -1003,11 +1003,11 @@ int bt_audio_stream_connect(struct bt_audio_stream *stream)
|
||||||
param.iso_chan = stream->iso;
|
param.iso_chan = stream->iso;
|
||||||
|
|
||||||
switch (stream->iso->state) {
|
switch (stream->iso->state) {
|
||||||
case BT_ISO_DISCONNECTED:
|
case BT_ISO_STATE_DISCONNECTED:
|
||||||
return bt_iso_chan_connect(¶m, 1);
|
return bt_iso_chan_connect(¶m, 1);
|
||||||
case BT_ISO_CONNECTING:
|
case BT_ISO_STATE_CONNECTING:
|
||||||
return 0;
|
return 0;
|
||||||
case BT_ISO_CONNECTED:
|
case BT_ISO_STATE_CONNECTED:
|
||||||
return -EALREADY;
|
return -EALREADY;
|
||||||
default:
|
default:
|
||||||
return bt_iso_chan_connect(¶m, 1);
|
return bt_iso_chan_connect(¶m, 1);
|
||||||
|
|
|
@ -363,7 +363,7 @@ static void unicast_client_ep_qos_state(struct bt_audio_ep *ep,
|
||||||
stream->qos->pd);
|
stream->qos->pd);
|
||||||
|
|
||||||
/* Disconnect ISO if connected */
|
/* Disconnect ISO if connected */
|
||||||
if (stream->iso->state == BT_ISO_CONNECTED) {
|
if (stream->iso->state == BT_ISO_STATE_CONNECTED) {
|
||||||
bt_audio_stream_disconnect(stream);
|
bt_audio_stream_disconnect(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1554,7 +1554,7 @@ static void deferred_work(struct k_work *work)
|
||||||
|
|
||||||
if (chan != NULL) {
|
if (chan != NULL) {
|
||||||
bt_iso_chan_set_state(chan,
|
bt_iso_chan_set_state(chan,
|
||||||
BT_ISO_DISCONNECTING);
|
BT_ISO_STATE_DISCONNECTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
bt_iso_cleanup_acl(iso);
|
bt_iso_cleanup_acl(iso);
|
||||||
|
|
|
@ -379,7 +379,7 @@ void bt_iso_connected(struct bt_conn *iso)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bt_iso_chan_set_state(chan, BT_ISO_CONNECTED);
|
bt_iso_chan_set_state(chan, BT_ISO_STATE_CONNECTED);
|
||||||
|
|
||||||
if (chan->ops->connected) {
|
if (chan->ops->connected) {
|
||||||
chan->ops->connected(chan);
|
chan->ops->connected(chan);
|
||||||
|
@ -435,7 +435,7 @@ static void bt_iso_chan_disconnected(struct bt_iso_chan *chan, uint8_t reason)
|
||||||
|
|
||||||
__ASSERT(chan->iso != NULL, "NULL conn for iso chan %p", chan);
|
__ASSERT(chan->iso != NULL, "NULL conn for iso chan %p", chan);
|
||||||
|
|
||||||
bt_iso_chan_set_state(chan, BT_ISO_DISCONNECTED);
|
bt_iso_chan_set_state(chan, BT_ISO_STATE_DISCONNECTED);
|
||||||
|
|
||||||
/* The peripheral does not have the concept of a CIG, so once a CIS
|
/* The peripheral does not have the concept of a CIG, so once a CIS
|
||||||
* disconnects it is completely freed by unref'ing it
|
* disconnects it is completely freed by unref'ing it
|
||||||
|
@ -465,8 +465,8 @@ static void bt_iso_chan_disconnected(struct bt_iso_chan *chan, uint8_t reason)
|
||||||
|
|
||||||
is_chan_connected = false;
|
is_chan_connected = false;
|
||||||
SYS_SLIST_FOR_EACH_CONTAINER(&cig->cis_channels, cis_chan, node) {
|
SYS_SLIST_FOR_EACH_CONTAINER(&cig->cis_channels, cis_chan, node) {
|
||||||
if (cis_chan->state == BT_ISO_CONNECTED ||
|
if (cis_chan->state == BT_ISO_STATE_CONNECTED ||
|
||||||
cis_chan->state == BT_ISO_CONNECTING) {
|
cis_chan->state == BT_ISO_STATE_CONNECTING) {
|
||||||
is_chan_connected = true;
|
is_chan_connected = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -509,13 +509,13 @@ void bt_iso_disconnected(struct bt_conn *iso)
|
||||||
const char *bt_iso_chan_state_str(uint8_t state)
|
const char *bt_iso_chan_state_str(uint8_t state)
|
||||||
{
|
{
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case BT_ISO_DISCONNECTED:
|
case BT_ISO_STATE_DISCONNECTED:
|
||||||
return "disconnected";
|
return "disconnected";
|
||||||
case BT_ISO_CONNECTING:
|
case BT_ISO_STATE_CONNECTING:
|
||||||
return "connecting";
|
return "connecting";
|
||||||
case BT_ISO_CONNECTED:
|
case BT_ISO_STATE_CONNECTED:
|
||||||
return "connected";
|
return "connected";
|
||||||
case BT_ISO_DISCONNECTING:
|
case BT_ISO_STATE_DISCONNECTING:
|
||||||
return "disconnecting";
|
return "disconnecting";
|
||||||
default:
|
default:
|
||||||
return "unknown";
|
return "unknown";
|
||||||
|
@ -531,21 +531,21 @@ void bt_iso_chan_set_state_debug(struct bt_iso_chan *chan, uint8_t state,
|
||||||
|
|
||||||
/* check transitions validness */
|
/* check transitions validness */
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case BT_ISO_DISCONNECTED:
|
case BT_ISO_STATE_DISCONNECTED:
|
||||||
/* regardless of old state always allows this states */
|
/* regardless of old state always allows this states */
|
||||||
break;
|
break;
|
||||||
case BT_ISO_CONNECTING:
|
case BT_ISO_STATE_CONNECTING:
|
||||||
if (chan->state != BT_ISO_DISCONNECTED) {
|
if (chan->state != BT_ISO_STATE_DISCONNECTED) {
|
||||||
BT_WARN("%s()%d: invalid transition", func, line);
|
BT_WARN("%s()%d: invalid transition", func, line);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BT_ISO_CONNECTED:
|
case BT_ISO_STATE_CONNECTED:
|
||||||
if (chan->state != BT_ISO_CONNECTING) {
|
if (chan->state != BT_ISO_STATE_CONNECTING) {
|
||||||
BT_WARN("%s()%d: invalid transition", func, line);
|
BT_WARN("%s()%d: invalid transition", func, line);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BT_ISO_DISCONNECTING:
|
case BT_ISO_STATE_DISCONNECTING:
|
||||||
if (chan->state != BT_ISO_CONNECTED) {
|
if (chan->state != BT_ISO_STATE_CONNECTED) {
|
||||||
BT_WARN("%s()%d: invalid transition", func, line);
|
BT_WARN("%s()%d: invalid transition", func, line);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -755,7 +755,7 @@ int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf)
|
||||||
|
|
||||||
BT_DBG("chan %p len %zu", chan, net_buf_frags_len(buf));
|
BT_DBG("chan %p len %zu", chan, net_buf_frags_len(buf));
|
||||||
|
|
||||||
if (chan->state != BT_ISO_CONNECTED) {
|
if (chan->state != BT_ISO_STATE_CONNECTED) {
|
||||||
BT_DBG("Not connected");
|
BT_DBG("Not connected");
|
||||||
return -ENOTCONN;
|
return -ENOTCONN;
|
||||||
}
|
}
|
||||||
|
@ -824,7 +824,7 @@ static int iso_accept(struct bt_conn *acl, struct bt_conn *iso)
|
||||||
}
|
}
|
||||||
|
|
||||||
bt_iso_chan_add(iso, chan);
|
bt_iso_chan_add(iso, chan);
|
||||||
bt_iso_chan_set_state(chan, BT_ISO_CONNECTING);
|
bt_iso_chan_set_state(chan, BT_ISO_STATE_CONNECTING);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1574,8 +1574,8 @@ int bt_iso_chan_connect(const struct bt_iso_connect_param *param, size_t count)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (param[i].iso_chan->state != BT_ISO_DISCONNECTED) {
|
if (param[i].iso_chan->state != BT_ISO_STATE_DISCONNECTED) {
|
||||||
BT_DBG("[%zu]: ISO is not in the BT_ISO_DISCONNECTED state: %u",
|
BT_DBG("[%zu]: ISO is not in the BT_ISO_STATE_DISCONNECTED state: %u",
|
||||||
i, param[i].iso_chan->state);
|
i, param[i].iso_chan->state);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -1594,7 +1594,7 @@ int bt_iso_chan_connect(const struct bt_iso_connect_param *param, size_t count)
|
||||||
|
|
||||||
iso_chan->iso->iso.acl = bt_conn_ref(param[i].acl);
|
iso_chan->iso->iso.acl = bt_conn_ref(param[i].acl);
|
||||||
bt_conn_set_state(iso_chan->iso, BT_CONN_CONNECTING);
|
bt_conn_set_state(iso_chan->iso, BT_CONN_CONNECTING);
|
||||||
bt_iso_chan_set_state(iso_chan, BT_ISO_CONNECTING);
|
bt_iso_chan_set_state(iso_chan, BT_ISO_STATE_CONNECTING);
|
||||||
|
|
||||||
cig = get_cig(iso_chan);
|
cig = get_cig(iso_chan);
|
||||||
__ASSERT(cig != NULL, "CIG was NULL");
|
__ASSERT(cig != NULL, "CIG was NULL");
|
||||||
|
@ -1803,7 +1803,7 @@ static int hci_le_create_big(struct bt_le_ext_adv *padv, struct bt_iso_big *big,
|
||||||
}
|
}
|
||||||
|
|
||||||
SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) {
|
SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) {
|
||||||
bt_iso_chan_set_state(bis, BT_ISO_CONNECTING);
|
bt_iso_chan_set_state(bis, BT_ISO_STATE_CONNECTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
@ -2048,7 +2048,7 @@ int bt_iso_big_terminate(struct bt_iso_big *big)
|
||||||
*/
|
*/
|
||||||
if (!err) {
|
if (!err) {
|
||||||
SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) {
|
SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) {
|
||||||
bt_iso_chan_set_state(bis, BT_ISO_DISCONNECTING);
|
bt_iso_chan_set_state(bis, BT_ISO_STATE_DISCONNECTING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (IS_ENABLED(CONFIG_BT_ISO_SYNC_RECEIVER)) {
|
} else if (IS_ENABLED(CONFIG_BT_ISO_SYNC_RECEIVER)) {
|
||||||
|
@ -2268,7 +2268,7 @@ int bt_iso_big_sync(struct bt_le_per_adv_sync *sync, struct bt_iso_big_sync_para
|
||||||
|
|
||||||
|
|
||||||
SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) {
|
SYS_SLIST_FOR_EACH_CONTAINER(&big->bis_channels, bis, node) {
|
||||||
bt_iso_chan_set_state(bis, BT_ISO_CONNECTING);
|
bt_iso_chan_set_state(bis, BT_ISO_STATE_CONNECTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
*out_big = big;
|
*out_big = big;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue