Bluetooth: Tweak connection state debug log
Enables more readable debug log during changing connection state. Available when CONFIG_BLUETOOTH_DEBUG_CONN is on. Change-Id: I51938f003be1382bdd234d9fc67a628a754a30ca Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
parent
83dab3854d
commit
0e8952f4fc
1 changed files with 19 additions and 1 deletions
|
@ -54,6 +54,24 @@
|
|||
|
||||
static struct bt_conn conns[CONFIG_BLUETOOTH_MAX_CONN];
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_DEBUG_CONN)
|
||||
static const char *state2str(bt_conn_state_t state)
|
||||
{
|
||||
switch (state) {
|
||||
case BT_CONN_DISCONNECTED:
|
||||
return "disconnected";
|
||||
case BT_CONN_CONNECT:
|
||||
return "connect";
|
||||
case BT_CONN_CONNECTED:
|
||||
return "connected";
|
||||
case BT_CONN_DISCONNECT:
|
||||
return "disconnect";
|
||||
default:
|
||||
return "(unknown)";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void bt_conn_reset_rx_state(struct bt_conn *conn)
|
||||
{
|
||||
if (!conn->rx_len) {
|
||||
|
@ -277,7 +295,7 @@ struct bt_conn *bt_conn_add(struct bt_dev *dev, uint16_t handle, uint8_t role)
|
|||
|
||||
void bt_conn_set_state(struct bt_conn *conn, bt_conn_state_t state)
|
||||
{
|
||||
BT_DBG("%u -> %u\n", conn->state, state);
|
||||
BT_DBG("%s -> %s\n", state2str(conn->state), state2str(state));
|
||||
|
||||
if (conn->state == state) {
|
||||
BT_WARN("no transition\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue