Bluetooth: Add connection role to bt_conn_info

This can be useful for both LE and BR/EDR connections so it sits
outside of those specific structs. The values are intentionally
matching the HCI values so for the HCI case we can just do a direct
assignment.

Change-Id: Id78d304bb61e5fd941f2c35351758c1eecc6ab6a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2016-02-11 13:15:55 +02:00
commit 500513b5f0
2 changed files with 11 additions and 0 deletions

View file

@ -127,10 +127,20 @@ struct bt_conn_br_info {
}; };
#endif #endif
/** Connection role (master or slave) */
enum {
BT_CONN_ROLE_MASTER,
BT_CONN_ROLE_SLAVE,
};
/** Connection Info Structure */ /** Connection Info Structure */
struct bt_conn_info { struct bt_conn_info {
/** Connection Type */ /** Connection Type */
uint8_t type; uint8_t type;
/** Connection Role */
uint8_t role;
union { union {
/** LE Connection specific Info */ /** LE Connection specific Info */
struct bt_conn_le_info le; struct bt_conn_le_info le;

View file

@ -802,6 +802,7 @@ const bt_addr_le_t *bt_conn_get_dst(const struct bt_conn *conn)
int bt_conn_get_info(const struct bt_conn *conn, struct bt_conn_info *info) int bt_conn_get_info(const struct bt_conn *conn, struct bt_conn_info *info)
{ {
info->type = conn->type; info->type = conn->type;
info->role = conn->role;
switch (conn->type) { switch (conn->type) {
case BT_CONN_TYPE_LE: case BT_CONN_TYPE_LE: