Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth: has: Ensure that notifications are sent #61980

Merged
merged 14 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,203 changes: 765 additions & 438 deletions subsys/bluetooth/audio/has.c

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions subsys/bluetooth/audio/has_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ struct bt_has_cp_read_preset_rsp {
struct bt_has_cp_preset_changed {
uint8_t change_id;
uint8_t is_last;
uint8_t additional_params[0];
} __packed;

struct bt_has_cp_generic_update {
Expand Down
1 change: 1 addition & 0 deletions tests/bsim/bluetooth/audio/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ CONFIG_BT_BAP_BROADCAST_ASSISTANT=y

# Hearing Access
CONFIG_BT_HAS=y
CONFIG_BT_HAS_PRESET_COUNT=3
CONFIG_BT_HAS_CLIENT=y
CONFIG_BT_HAS_FEATURES_NOTIFIABLE=y

Expand Down
12 changes: 12 additions & 0 deletions tests/bsim/bluetooth/audio/src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ extern enum bst_result_t bst_result;
struct bt_conn *default_conn;
atomic_t flag_connected;
atomic_t flag_conn_updated;
volatile bt_security_t security_level;

const struct bt_data ad[AD_SIZE] = {
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR))
Expand Down Expand Up @@ -94,6 +95,7 @@ void disconnected(struct bt_conn *conn, uint8_t reason)
default_conn = NULL;
UNSET_FLAG(flag_connected);
UNSET_FLAG(flag_conn_updated);
security_level = BT_SECURITY_L1;
}

static void conn_param_updated_cb(struct bt_conn *conn, uint16_t interval, uint16_t latency,
Expand All @@ -105,10 +107,20 @@ static void conn_param_updated_cb(struct bt_conn *conn, uint16_t interval, uint1
SET_FLAG(flag_conn_updated);
}

static void security_changed_cb(struct bt_conn *conn, bt_security_t level, enum bt_security_err err)
{
printk("Security changed: %p level %d err %d\n", conn, level, err);

if (err == BT_SECURITY_ERR_SUCCESS) {
security_level = level;
}
}

BT_CONN_CB_DEFINE(conn_callbacks) = {
.connected = connected,
.disconnected = disconnected,
.le_param_updated = conn_param_updated_cb,
.security_changed = security_changed_cb,
};

void test_tick(bs_time_t HW_device_time)
Expand Down
1 change: 1 addition & 0 deletions tests/bsim/bluetooth/audio/src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ extern const struct bt_data ad[AD_SIZE];
extern struct bt_conn *default_conn;
extern atomic_t flag_connected;
extern atomic_t flag_conn_updated;
extern volatile bt_security_t security_level;

void disconnected(struct bt_conn *conn, uint8_t reason);
void test_tick(bs_time_t HW_device_time);
Expand Down
Loading
Loading