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:
Emil Gydesen 2022-02-22 15:30:30 +01:00 committed by Carles Cufí
commit 9e862411b3
6 changed files with 33 additions and 33 deletions

View file

@ -93,13 +93,13 @@ extern "C" {
*/
enum {
/** Channel disconnected */
BT_ISO_DISCONNECTED,
BT_ISO_STATE_DISCONNECTED,
/** Channel in connecting state */
BT_ISO_CONNECTING,
BT_ISO_STATE_CONNECTING,
/** Channel ready for upper layer traffic on it */
BT_ISO_CONNECTED,
BT_ISO_STATE_CONNECTED,
/** Channel in disconnecting state */
BT_ISO_DISCONNECTING,
BT_ISO_STATE_DISCONNECTING,
};

View file

@ -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);
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);
*chan = &iso_chans[i].chan;
cig_create_param.num_cis++;

View file

@ -1003,11 +1003,11 @@ int bt_audio_stream_connect(struct bt_audio_stream *stream)
param.iso_chan = stream->iso;
switch (stream->iso->state) {
case BT_ISO_DISCONNECTED:
case BT_ISO_STATE_DISCONNECTED:
return bt_iso_chan_connect(&param, 1);
case BT_ISO_CONNECTING:
case BT_ISO_STATE_CONNECTING:
return 0;
case BT_ISO_CONNECTED:
case BT_ISO_STATE_CONNECTED:
return -EALREADY;
default:
return bt_iso_chan_connect(&param, 1);

View file

@ -363,7 +363,7 @@ static void unicast_client_ep_qos_state(struct bt_audio_ep *ep,
stream->qos->pd);
/* Disconnect ISO if connected */
if (stream->iso->state == BT_ISO_CONNECTED) {
if (stream->iso->state == BT_ISO_STATE_CONNECTED) {
bt_audio_stream_disconnect(stream);
}

View file

@ -1554,7 +1554,7 @@ static void deferred_work(struct k_work *work)
if (chan != NULL) {
bt_iso_chan_set_state(chan,
BT_ISO_DISCONNECTING);
BT_ISO_STATE_DISCONNECTING);
}
bt_iso_cleanup_acl(iso);

View file

@ -379,7 +379,7 @@ void bt_iso_connected(struct bt_conn *iso)
return;
}
bt_iso_chan_set_state(chan, BT_ISO_CONNECTED);
bt_iso_chan_set_state(chan, BT_ISO_STATE_CONNECTED);
if (chan->ops->connected) {
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);
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
* 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;
SYS_SLIST_FOR_EACH_CONTAINER(&cig->cis_channels, cis_chan, node) {
if (cis_chan->state == BT_ISO_CONNECTED ||
cis_chan->state == BT_ISO_CONNECTING) {
if (cis_chan->state == BT_ISO_STATE_CONNECTED ||
cis_chan->state == BT_ISO_STATE_CONNECTING) {
is_chan_connected = true;
break;
}
@ -509,13 +509,13 @@ void bt_iso_disconnected(struct bt_conn *iso)
const char *bt_iso_chan_state_str(uint8_t state)
{
switch (state) {
case BT_ISO_DISCONNECTED:
case BT_ISO_STATE_DISCONNECTED:
return "disconnected";
case BT_ISO_CONNECTING:
case BT_ISO_STATE_CONNECTING:
return "connecting";
case BT_ISO_CONNECTED:
case BT_ISO_STATE_CONNECTED:
return "connected";
case BT_ISO_DISCONNECTING:
case BT_ISO_STATE_DISCONNECTING:
return "disconnecting";
default:
return "unknown";
@ -531,21 +531,21 @@ void bt_iso_chan_set_state_debug(struct bt_iso_chan *chan, uint8_t state,
/* check transitions validness */
switch (state) {
case BT_ISO_DISCONNECTED:
case BT_ISO_STATE_DISCONNECTED:
/* regardless of old state always allows this states */
break;
case BT_ISO_CONNECTING:
if (chan->state != BT_ISO_DISCONNECTED) {
case BT_ISO_STATE_CONNECTING:
if (chan->state != BT_ISO_STATE_DISCONNECTED) {
BT_WARN("%s()%d: invalid transition", func, line);
}
break;
case BT_ISO_CONNECTED:
if (chan->state != BT_ISO_CONNECTING) {
case BT_ISO_STATE_CONNECTED:
if (chan->state != BT_ISO_STATE_CONNECTING) {
BT_WARN("%s()%d: invalid transition", func, line);
}
break;
case BT_ISO_DISCONNECTING:
if (chan->state != BT_ISO_CONNECTED) {
case BT_ISO_STATE_DISCONNECTING:
if (chan->state != BT_ISO_STATE_CONNECTED) {
BT_WARN("%s()%d: invalid transition", func, line);
}
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));
if (chan->state != BT_ISO_CONNECTED) {
if (chan->state != BT_ISO_STATE_CONNECTED) {
BT_DBG("Not connected");
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_set_state(chan, BT_ISO_CONNECTING);
bt_iso_chan_set_state(chan, BT_ISO_STATE_CONNECTING);
return 0;
}
@ -1574,8 +1574,8 @@ int bt_iso_chan_connect(const struct bt_iso_connect_param *param, size_t count)
return -EINVAL;
}
if (param[i].iso_chan->state != BT_ISO_DISCONNECTED) {
BT_DBG("[%zu]: ISO is not in the BT_ISO_DISCONNECTED state: %u",
if (param[i].iso_chan->state != BT_ISO_STATE_DISCONNECTED) {
BT_DBG("[%zu]: ISO is not in the BT_ISO_STATE_DISCONNECTED state: %u",
i, param[i].iso_chan->state);
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);
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);
__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) {
bt_iso_chan_set_state(bis, BT_ISO_CONNECTING);
bt_iso_chan_set_state(bis, BT_ISO_STATE_CONNECTING);
}
return err;
@ -2048,7 +2048,7 @@ int bt_iso_big_terminate(struct bt_iso_big *big)
*/
if (!err) {
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)) {
@ -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) {
bt_iso_chan_set_state(bis, BT_ISO_CONNECTING);
bt_iso_chan_set_state(bis, BT_ISO_STATE_CONNECTING);
}
*out_big = big;