samples: bluetooth: rename shadow variables
Rename shadow variables found by -Wshadow. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
e3ecca5784
commit
eedc0bf0fa
14 changed files with 79 additions and 79 deletions
|
@ -23,7 +23,7 @@ static void start_scan(void);
|
||||||
|
|
||||||
static struct bt_conn *default_conn;
|
static struct bt_conn *default_conn;
|
||||||
|
|
||||||
static struct bt_uuid_16 uuid = BT_UUID_INIT_16(0);
|
static struct bt_uuid_16 discover_uuid = BT_UUID_INIT_16(0);
|
||||||
static struct bt_gatt_discover_params discover_params;
|
static struct bt_gatt_discover_params discover_params;
|
||||||
static struct bt_gatt_subscribe_params subscribe_params;
|
static struct bt_gatt_subscribe_params subscribe_params;
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ static uint8_t discover_func(struct bt_conn *conn,
|
||||||
printk("[ATTRIBUTE] handle %u\n", attr->handle);
|
printk("[ATTRIBUTE] handle %u\n", attr->handle);
|
||||||
|
|
||||||
if (!bt_uuid_cmp(discover_params.uuid, BT_UUID_HRS)) {
|
if (!bt_uuid_cmp(discover_params.uuid, BT_UUID_HRS)) {
|
||||||
memcpy(&uuid, BT_UUID_HRS_MEASUREMENT, sizeof(uuid));
|
memcpy(&discover_uuid, BT_UUID_HRS_MEASUREMENT, sizeof(discover_uuid));
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.uuid = &discover_uuid.uuid;
|
||||||
discover_params.start_handle = attr->handle + 1;
|
discover_params.start_handle = attr->handle + 1;
|
||||||
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
||||||
|
|
||||||
|
@ -68,8 +68,8 @@ static uint8_t discover_func(struct bt_conn *conn,
|
||||||
}
|
}
|
||||||
} else if (!bt_uuid_cmp(discover_params.uuid,
|
} else if (!bt_uuid_cmp(discover_params.uuid,
|
||||||
BT_UUID_HRS_MEASUREMENT)) {
|
BT_UUID_HRS_MEASUREMENT)) {
|
||||||
memcpy(&uuid, BT_UUID_GATT_CCC, sizeof(uuid));
|
memcpy(&discover_uuid, BT_UUID_GATT_CCC, sizeof(discover_uuid));
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.uuid = &discover_uuid.uuid;
|
||||||
discover_params.start_handle = attr->handle + 2;
|
discover_params.start_handle = attr->handle + 2;
|
||||||
discover_params.type = BT_GATT_DISCOVER_DESCRIPTOR;
|
discover_params.type = BT_GATT_DISCOVER_DESCRIPTOR;
|
||||||
subscribe_params.value_handle = bt_gatt_attr_value_handle(attr);
|
subscribe_params.value_handle = bt_gatt_attr_value_handle(attr);
|
||||||
|
@ -202,8 +202,8 @@ static void connected(struct bt_conn *conn, uint8_t conn_err)
|
||||||
printk("Connected: %s\n", addr);
|
printk("Connected: %s\n", addr);
|
||||||
|
|
||||||
if (conn == default_conn) {
|
if (conn == default_conn) {
|
||||||
memcpy(&uuid, BT_UUID_HRS, sizeof(uuid));
|
memcpy(&discover_uuid, BT_UUID_HRS, sizeof(discover_uuid));
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.uuid = &discover_uuid.uuid;
|
||||||
discover_params.func = discover_func;
|
discover_params.func = discover_func;
|
||||||
discover_params.start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE;
|
discover_params.start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE;
|
||||||
discover_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE;
|
discover_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
static int scan_start(void);
|
static int scan_start(void);
|
||||||
|
|
||||||
static struct bt_conn *default_conn;
|
static struct bt_conn *default_conn;
|
||||||
static struct bt_uuid_16 uuid = BT_UUID_INIT_16(0);
|
static struct bt_uuid_16 discover_uuid = BT_UUID_INIT_16(0);
|
||||||
static struct bt_gatt_discover_params discover_params;
|
static struct bt_gatt_discover_params discover_params;
|
||||||
static struct bt_gatt_subscribe_params subscribe_params;
|
static struct bt_gatt_subscribe_params subscribe_params;
|
||||||
|
|
||||||
|
@ -84,8 +84,8 @@ static uint8_t discover_func(struct bt_conn *conn,
|
||||||
printk("[ATTRIBUTE] handle %u\n", attr->handle);
|
printk("[ATTRIBUTE] handle %u\n", attr->handle);
|
||||||
|
|
||||||
if (!bt_uuid_cmp(discover_params.uuid, BT_UUID_HTS)) {
|
if (!bt_uuid_cmp(discover_params.uuid, BT_UUID_HTS)) {
|
||||||
memcpy(&uuid, BT_UUID_HTS_MEASUREMENT, sizeof(uuid));
|
memcpy(&discover_uuid, BT_UUID_HTS_MEASUREMENT, sizeof(discover_uuid));
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.uuid = &discover_uuid.uuid;
|
||||||
discover_params.start_handle = attr->handle + 1;
|
discover_params.start_handle = attr->handle + 1;
|
||||||
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
||||||
|
|
||||||
|
@ -95,8 +95,8 @@ static uint8_t discover_func(struct bt_conn *conn,
|
||||||
}
|
}
|
||||||
} else if (!bt_uuid_cmp(discover_params.uuid,
|
} else if (!bt_uuid_cmp(discover_params.uuid,
|
||||||
BT_UUID_HTS_MEASUREMENT)) {
|
BT_UUID_HTS_MEASUREMENT)) {
|
||||||
memcpy(&uuid, BT_UUID_GATT_CCC, sizeof(uuid));
|
memcpy(&discover_uuid, BT_UUID_GATT_CCC, sizeof(discover_uuid));
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.uuid = &discover_uuid.uuid;
|
||||||
discover_params.start_handle = attr->handle + 2;
|
discover_params.start_handle = attr->handle + 2;
|
||||||
discover_params.type = BT_GATT_DISCOVER_DESCRIPTOR;
|
discover_params.type = BT_GATT_DISCOVER_DESCRIPTOR;
|
||||||
subscribe_params.value_handle = bt_gatt_attr_value_handle(attr);
|
subscribe_params.value_handle = bt_gatt_attr_value_handle(attr);
|
||||||
|
@ -143,8 +143,8 @@ static void connected(struct bt_conn *conn, uint8_t conn_err)
|
||||||
printk("Connected: %s\n", addr);
|
printk("Connected: %s\n", addr);
|
||||||
|
|
||||||
if (conn == default_conn) {
|
if (conn == default_conn) {
|
||||||
memcpy(&uuid, BT_UUID_HTS, sizeof(uuid));
|
memcpy(&discover_uuid, BT_UUID_HTS, sizeof(discover_uuid));
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.uuid = &discover_uuid.uuid;
|
||||||
discover_params.func = discover_func;
|
discover_params.func = discover_func;
|
||||||
discover_params.start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE;
|
discover_params.start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE;
|
||||||
discover_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE;
|
discover_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE;
|
||||||
|
|
|
@ -45,7 +45,7 @@ static int on_obj_data_read(struct bt_ots_client *ots_inst, struct bt_conn *conn
|
||||||
uint32_t len, uint8_t *data_p, bool is_complete);
|
uint32_t len, uint8_t *data_p, bool is_complete);
|
||||||
|
|
||||||
static void start_scan(void);
|
static void start_scan(void);
|
||||||
static struct bt_uuid_16 uuid = BT_UUID_INIT_16(0);
|
static struct bt_uuid_16 discover_uuid = BT_UUID_INIT_16(0);
|
||||||
static struct bt_conn *default_conn;
|
static struct bt_conn *default_conn;
|
||||||
static atomic_t discovery_state;
|
static atomic_t discovery_state;
|
||||||
|
|
||||||
|
@ -371,8 +371,8 @@ static uint8_t discover_func(struct bt_conn *conn, const struct bt_gatt_attr *at
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bt_uuid_cmp(discover_params.uuid, BT_UUID_OTS) == 0) {
|
if (bt_uuid_cmp(discover_params.uuid, BT_UUID_OTS) == 0) {
|
||||||
(void)memcpy(&uuid, BT_UUID_OTS_FEATURE, sizeof(uuid));
|
(void)memcpy(&discover_uuid, BT_UUID_OTS_FEATURE, sizeof(discover_uuid));
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.uuid = &discover_uuid.uuid;
|
||||||
discover_params.start_handle = attr->handle + 1;
|
discover_params.start_handle = attr->handle + 1;
|
||||||
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
||||||
err = bt_gatt_discover(conn, &discover_params);
|
err = bt_gatt_discover(conn, &discover_params);
|
||||||
|
@ -384,8 +384,8 @@ static uint8_t discover_func(struct bt_conn *conn, const struct bt_gatt_attr *at
|
||||||
} else if (bt_uuid_cmp(discover_params.uuid, BT_UUID_OTS_FEATURE) == 0) {
|
} else if (bt_uuid_cmp(discover_params.uuid, BT_UUID_OTS_FEATURE) == 0) {
|
||||||
atomic_set_bit(&discovery_state, DISC_OTS_FEATURE);
|
atomic_set_bit(&discovery_state, DISC_OTS_FEATURE);
|
||||||
otc.feature_handle = bt_gatt_attr_value_handle(attr);
|
otc.feature_handle = bt_gatt_attr_value_handle(attr);
|
||||||
(void)memcpy(&uuid, BT_UUID_OTS_NAME, sizeof(uuid));
|
(void)memcpy(&discover_uuid, BT_UUID_OTS_NAME, sizeof(discover_uuid));
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.uuid = &discover_uuid.uuid;
|
||||||
discover_params.start_handle = attr->handle + 1;
|
discover_params.start_handle = attr->handle + 1;
|
||||||
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
||||||
|
|
||||||
|
@ -397,8 +397,8 @@ static uint8_t discover_func(struct bt_conn *conn, const struct bt_gatt_attr *at
|
||||||
} else if (bt_uuid_cmp(discover_params.uuid, BT_UUID_OTS_NAME) == 0) {
|
} else if (bt_uuid_cmp(discover_params.uuid, BT_UUID_OTS_NAME) == 0) {
|
||||||
atomic_set_bit(&discovery_state, DISC_OTS_NAME);
|
atomic_set_bit(&discovery_state, DISC_OTS_NAME);
|
||||||
otc.obj_name_handle = bt_gatt_attr_value_handle(attr);
|
otc.obj_name_handle = bt_gatt_attr_value_handle(attr);
|
||||||
(void)memcpy(&uuid, BT_UUID_OTS_TYPE, sizeof(uuid));
|
(void)memcpy(&discover_uuid, BT_UUID_OTS_TYPE, sizeof(discover_uuid));
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.uuid = &discover_uuid.uuid;
|
||||||
discover_params.start_handle = attr->handle + 1;
|
discover_params.start_handle = attr->handle + 1;
|
||||||
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
||||||
|
|
||||||
|
@ -410,8 +410,8 @@ static uint8_t discover_func(struct bt_conn *conn, const struct bt_gatt_attr *at
|
||||||
} else if (bt_uuid_cmp(discover_params.uuid, BT_UUID_OTS_TYPE) == 0) {
|
} else if (bt_uuid_cmp(discover_params.uuid, BT_UUID_OTS_TYPE) == 0) {
|
||||||
atomic_set_bit(&discovery_state, DISC_OTS_TYPE);
|
atomic_set_bit(&discovery_state, DISC_OTS_TYPE);
|
||||||
otc.obj_type_handle = bt_gatt_attr_value_handle(attr);
|
otc.obj_type_handle = bt_gatt_attr_value_handle(attr);
|
||||||
(void)memcpy(&uuid, BT_UUID_OTS_SIZE, sizeof(uuid));
|
(void)memcpy(&discover_uuid, BT_UUID_OTS_SIZE, sizeof(discover_uuid));
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.uuid = &discover_uuid.uuid;
|
||||||
discover_params.start_handle = attr->handle + 1;
|
discover_params.start_handle = attr->handle + 1;
|
||||||
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
||||||
|
|
||||||
|
@ -423,8 +423,8 @@ static uint8_t discover_func(struct bt_conn *conn, const struct bt_gatt_attr *at
|
||||||
} else if (bt_uuid_cmp(discover_params.uuid, BT_UUID_OTS_SIZE) == 0) {
|
} else if (bt_uuid_cmp(discover_params.uuid, BT_UUID_OTS_SIZE) == 0) {
|
||||||
atomic_set_bit(&discovery_state, DISC_OTS_SIZE);
|
atomic_set_bit(&discovery_state, DISC_OTS_SIZE);
|
||||||
otc.obj_size_handle = bt_gatt_attr_value_handle(attr);
|
otc.obj_size_handle = bt_gatt_attr_value_handle(attr);
|
||||||
(void)memcpy(&uuid, BT_UUID_OTS_ID, sizeof(uuid));
|
(void)memcpy(&discover_uuid, BT_UUID_OTS_ID, sizeof(discover_uuid));
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.uuid = &discover_uuid.uuid;
|
||||||
discover_params.start_handle = attr->handle + 1;
|
discover_params.start_handle = attr->handle + 1;
|
||||||
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
||||||
|
|
||||||
|
@ -436,8 +436,8 @@ static uint8_t discover_func(struct bt_conn *conn, const struct bt_gatt_attr *at
|
||||||
} else if (bt_uuid_cmp(discover_params.uuid, BT_UUID_OTS_ID) == 0) {
|
} else if (bt_uuid_cmp(discover_params.uuid, BT_UUID_OTS_ID) == 0) {
|
||||||
atomic_set_bit(&discovery_state, DISC_OTS_ID);
|
atomic_set_bit(&discovery_state, DISC_OTS_ID);
|
||||||
otc.obj_id_handle = bt_gatt_attr_value_handle(attr);
|
otc.obj_id_handle = bt_gatt_attr_value_handle(attr);
|
||||||
(void)memcpy(&uuid, BT_UUID_OTS_PROPERTIES, sizeof(uuid));
|
(void)memcpy(&discover_uuid, BT_UUID_OTS_PROPERTIES, sizeof(discover_uuid));
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.uuid = &discover_uuid.uuid;
|
||||||
discover_params.start_handle = attr->handle + 1;
|
discover_params.start_handle = attr->handle + 1;
|
||||||
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
||||||
|
|
||||||
|
@ -449,8 +449,8 @@ static uint8_t discover_func(struct bt_conn *conn, const struct bt_gatt_attr *at
|
||||||
} else if (bt_uuid_cmp(discover_params.uuid, BT_UUID_OTS_PROPERTIES) == 0) {
|
} else if (bt_uuid_cmp(discover_params.uuid, BT_UUID_OTS_PROPERTIES) == 0) {
|
||||||
atomic_set_bit(&discovery_state, DISC_OTS_PROPERTIES);
|
atomic_set_bit(&discovery_state, DISC_OTS_PROPERTIES);
|
||||||
otc.obj_properties_handle = bt_gatt_attr_value_handle(attr);
|
otc.obj_properties_handle = bt_gatt_attr_value_handle(attr);
|
||||||
(void)memcpy(&uuid, BT_UUID_OTS_ACTION_CP, sizeof(uuid));
|
(void)memcpy(&discover_uuid, BT_UUID_OTS_ACTION_CP, sizeof(discover_uuid));
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.uuid = &discover_uuid.uuid;
|
||||||
discover_params.start_handle = attr->handle + 1;
|
discover_params.start_handle = attr->handle + 1;
|
||||||
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
||||||
|
|
||||||
|
@ -461,8 +461,8 @@ static uint8_t discover_func(struct bt_conn *conn, const struct bt_gatt_attr *at
|
||||||
} else if (bt_uuid_cmp(discover_params.uuid, BT_UUID_OTS_ACTION_CP) == 0) {
|
} else if (bt_uuid_cmp(discover_params.uuid, BT_UUID_OTS_ACTION_CP) == 0) {
|
||||||
atomic_set_bit(&discovery_state, DISC_OTS_ACTION_CP);
|
atomic_set_bit(&discovery_state, DISC_OTS_ACTION_CP);
|
||||||
otc.oacp_handle = bt_gatt_attr_value_handle(attr);
|
otc.oacp_handle = bt_gatt_attr_value_handle(attr);
|
||||||
(void)memcpy(&uuid, BT_UUID_OTS_LIST_CP, sizeof(uuid));
|
(void)memcpy(&discover_uuid, BT_UUID_OTS_LIST_CP, sizeof(discover_uuid));
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.uuid = &discover_uuid.uuid;
|
||||||
discover_params.start_handle = attr->handle + 1;
|
discover_params.start_handle = attr->handle + 1;
|
||||||
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
discover_params.type = BT_GATT_DISCOVER_CHARACTERISTIC;
|
||||||
|
|
||||||
|
@ -517,8 +517,8 @@ static void connected(struct bt_conn *conn, uint8_t err)
|
||||||
printk("Connected: %s\n", addr);
|
printk("Connected: %s\n", addr);
|
||||||
|
|
||||||
if (conn == default_conn) {
|
if (conn == default_conn) {
|
||||||
(void)memcpy(&uuid, BT_UUID_OTS, sizeof(uuid));
|
(void)memcpy(&discover_uuid, BT_UUID_OTS, sizeof(discover_uuid));
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.uuid = &discover_uuid.uuid;
|
||||||
discover_params.func = discover_func;
|
discover_params.func = discover_func;
|
||||||
discover_params.start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE;
|
discover_params.start_handle = BT_ATT_FIRST_ATTRIBUTE_HANDLE;
|
||||||
discover_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE;
|
discover_params.end_handle = BT_ATT_LAST_ATTRIBUTE_HANDLE;
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#define ADV_DATA_HEX_STR_LEN_MAX (BT_GAP_ADV_MAX_EXT_ADV_DATA_LEN * 2 + 1)
|
#define ADV_DATA_HEX_STR_LEN_MAX (BT_GAP_ADV_MAX_EXT_ADV_DATA_LEN * 2 + 1)
|
||||||
|
|
||||||
static struct bt_le_per_adv_sync_param sync_create_param;
|
static struct bt_le_per_adv_sync_param sync_create_param;
|
||||||
static struct bt_le_per_adv_sync *sync;
|
static struct bt_le_per_adv_sync *adv_sync;
|
||||||
static bt_addr_le_t per_addr;
|
static bt_addr_le_t per_addr;
|
||||||
static bool per_adv_found;
|
static bool per_adv_found;
|
||||||
static bool scan_enabled;
|
static bool scan_enabled;
|
||||||
|
@ -264,7 +264,7 @@ static void create_sync(void)
|
||||||
sync_create_param.sid = per_sid;
|
sync_create_param.sid = per_sid;
|
||||||
sync_create_param.skip = 0;
|
sync_create_param.skip = 0;
|
||||||
sync_create_param.timeout = 0xaa;
|
sync_create_param.timeout = 0xaa;
|
||||||
err = bt_le_per_adv_sync_create(&sync_create_param, &sync);
|
err = bt_le_per_adv_sync_create(&sync_create_param, &adv_sync);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
printk("failed (err %d)\n", err);
|
printk("failed (err %d)\n", err);
|
||||||
return;
|
return;
|
||||||
|
@ -277,7 +277,7 @@ static int delete_sync(void)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
printk("Deleting Periodic Advertising Sync...");
|
printk("Deleting Periodic Advertising Sync...");
|
||||||
err = bt_le_per_adv_sync_delete(sync);
|
err = bt_le_per_adv_sync_delete(adv_sync);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
printk("failed (err %d)\n", err);
|
printk("failed (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
@ -304,7 +304,7 @@ static void enable_cte_rx(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
printk("Enable receiving of CTE...\n");
|
printk("Enable receiving of CTE...\n");
|
||||||
err = bt_df_per_adv_sync_cte_rx_enable(sync, &cte_rx_params);
|
err = bt_df_per_adv_sync_cte_rx_enable(adv_sync, &cte_rx_params);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
printk("failed (err %d)\n", err);
|
printk("failed (err %d)\n", err);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -18,14 +18,14 @@
|
||||||
static struct bt_csip_set_member_svc_inst *svc_inst;
|
static struct bt_csip_set_member_svc_inst *svc_inst;
|
||||||
|
|
||||||
static void csip_lock_changed_cb(struct bt_conn *conn,
|
static void csip_lock_changed_cb(struct bt_conn *conn,
|
||||||
struct bt_csip_set_member_svc_inst *svc_inst,
|
struct bt_csip_set_member_svc_inst *inst,
|
||||||
bool locked)
|
bool locked)
|
||||||
{
|
{
|
||||||
printk("Client %p %s the lock\n", conn, locked ? "locked" : "released");
|
printk("Client %p %s the lock\n", conn, locked ? "locked" : "released");
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t sirk_read_req_cb(struct bt_conn *conn,
|
static uint8_t sirk_read_req_cb(struct bt_conn *conn,
|
||||||
struct bt_csip_set_member_svc_inst *svc_inst)
|
struct bt_csip_set_member_svc_inst *inst)
|
||||||
{
|
{
|
||||||
return BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT;
|
return BT_CSIP_READ_SIRK_REQ_RSP_ACCEPT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ static const struct bt_data ad[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct k_work_delayable adv_work;
|
static struct k_work_delayable adv_work;
|
||||||
static struct bt_le_ext_adv *adv;
|
static struct bt_le_ext_adv *ext_adv;
|
||||||
|
|
||||||
static void disconnected(struct bt_conn *conn, uint8_t reason)
|
static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||||
{
|
{
|
||||||
|
@ -101,14 +101,14 @@ static void adv_work_handler(struct k_work *work)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (adv == NULL) {
|
if (ext_adv == NULL) {
|
||||||
/* Create a non-connectable non-scannable advertising set */
|
/* Create a non-connectable non-scannable advertising set */
|
||||||
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_CONN_NAME, &adv_cb, &adv);
|
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_CONN_NAME, &adv_cb, &ext_adv);
|
||||||
if (err) {
|
if (err) {
|
||||||
printk("Failed to create advertising set (err %d)\n", err);
|
printk("Failed to create advertising set (err %d)\n", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
err = bt_le_ext_adv_set_data(adv, ad, ARRAY_SIZE(ad), NULL, 0);
|
err = bt_le_ext_adv_set_data(ext_adv, ad, ARRAY_SIZE(ad), NULL, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
printk("Failed to set advertising data (err %d)\n", err);
|
printk("Failed to set advertising data (err %d)\n", err);
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ static void adv_work_handler(struct k_work *work)
|
||||||
__ASSERT_NO_MSG(err == 0);
|
__ASSERT_NO_MSG(err == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
err = bt_le_ext_adv_start(adv, BT_LE_EXT_ADV_START_DEFAULT);
|
err = bt_le_ext_adv_start(ext_adv, BT_LE_EXT_ADV_START_DEFAULT);
|
||||||
if (err) {
|
if (err) {
|
||||||
printk("Failed to start advertising set (err %d)\n", err);
|
printk("Failed to start advertising set (err %d)\n", err);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -36,8 +36,8 @@ static const struct bt_data ad[] = {
|
||||||
static struct k_thread pwr_thread_data;
|
static struct k_thread pwr_thread_data;
|
||||||
static K_THREAD_STACK_DEFINE(pwr_thread_stack, 512);
|
static K_THREAD_STACK_DEFINE(pwr_thread_stack, 512);
|
||||||
|
|
||||||
static const int8_t txp[DEVICE_BEACON_TXPOWER_NUM] = {4, 0, -3, -8,
|
static const int8_t txpower[DEVICE_BEACON_TXPOWER_NUM] = {4, 0, -3, -8,
|
||||||
-15, -18, -23, -30};
|
-15, -18, -23, -30};
|
||||||
static const struct bt_le_adv_param *param =
|
static const struct bt_le_adv_param *param =
|
||||||
BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_USE_NAME,
|
BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_USE_NAME,
|
||||||
0x0020, 0x0020, NULL);
|
0x0020, 0x0020, NULL);
|
||||||
|
@ -235,9 +235,9 @@ void modulate_tx_power(void *p1, void *p2, void *p3)
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (!default_conn) {
|
if (!default_conn) {
|
||||||
printk("Set Tx power level to %d\n", txp[idx]);
|
printk("Set Tx power level to %d\n", txpower[idx]);
|
||||||
set_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_ADV,
|
set_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_ADV,
|
||||||
0, txp[idx]);
|
0, txpower[idx]);
|
||||||
|
|
||||||
k_sleep(K_SECONDS(5));
|
k_sleep(K_SECONDS(5));
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ static struct bt_mesh_elem elements[] = {
|
||||||
BT_MESH_ELEM(0, root_models, BT_MESH_MODEL_NONE),
|
BT_MESH_ELEM(0, root_models, BT_MESH_MODEL_NONE),
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct bt_mesh_comp comp = {
|
static const struct bt_mesh_comp mesh_comp = {
|
||||||
.cid = BT_COMP_ID_LF,
|
.cid = BT_COMP_ID_LF,
|
||||||
.elem = elements,
|
.elem = elements,
|
||||||
.elem_count = ARRAY_SIZE(elements),
|
.elem_count = ARRAY_SIZE(elements),
|
||||||
|
@ -243,7 +243,7 @@ static void unprovisioned_beacon(uint8_t uuid[16],
|
||||||
k_sem_give(&sem_unprov_beacon);
|
k_sem_give(&sem_unprov_beacon);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void node_added(uint16_t net_idx, uint8_t uuid[16], uint16_t addr, uint8_t num_elem)
|
static void node_added(uint16_t idx, uint8_t uuid[16], uint16_t addr, uint8_t num_elem)
|
||||||
{
|
{
|
||||||
node_addr = addr;
|
node_addr = addr;
|
||||||
k_sem_give(&sem_node_added);
|
k_sem_give(&sem_node_added);
|
||||||
|
@ -260,7 +260,7 @@ static int bt_ready(void)
|
||||||
uint8_t net_key[16], dev_key[16];
|
uint8_t net_key[16], dev_key[16];
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = bt_mesh_init(&prov, &comp);
|
err = bt_mesh_init(&prov, &mesh_comp);
|
||||||
if (err) {
|
if (err) {
|
||||||
printk("Initializing mesh failed (err %d)\n", err);
|
printk("Initializing mesh failed (err %d)\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
|
|
||||||
/* Cycling Speed and Cadence Service declaration */
|
/* Cycling Speed and Cadence Service declaration */
|
||||||
|
|
||||||
static uint32_t cwr; /* Cumulative Wheel Revolutions */
|
static uint32_t c_wheel_revs; /* Cumulative Wheel Revolutions */
|
||||||
static uint8_t supported_locations[] = CSC_SUPPORTED_LOCATIONS;
|
static uint8_t supported_locations[] = CSC_SUPPORTED_LOCATIONS;
|
||||||
static uint8_t sensor_location; /* Current Sensor Location */
|
static uint8_t sensor_location; /* Current Sensor Location */
|
||||||
static bool csc_simulate;
|
static bool csc_simulate;
|
||||||
|
@ -150,7 +150,7 @@ static ssize_t write_ctrl_point(struct bt_conn *conn,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cwr = sys_le32_to_cpu(req->cwr);
|
c_wheel_revs = sys_le32_to_cpu(req->cwr);
|
||||||
status = SC_CP_RSP_SUCCESS;
|
status = SC_CP_RSP_SUCCESS;
|
||||||
break;
|
break;
|
||||||
case SC_CP_OP_UPDATE_LOC:
|
case SC_CP_OP_UPDATE_LOC:
|
||||||
|
@ -310,7 +310,7 @@ static void csc_simulation(void)
|
||||||
/* Measurements don't have to be updated every second */
|
/* Measurements don't have to be updated every second */
|
||||||
if (!(i % 2)) {
|
if (!(i % 2)) {
|
||||||
lwet += 1050 + rand % 50;
|
lwet += 1050 + rand % 50;
|
||||||
cwr += 2U;
|
c_wheel_revs += 2U;
|
||||||
nfy_wheel = true;
|
nfy_wheel = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ static void csc_simulation(void)
|
||||||
* and is determined by the Server and not required to be configurable
|
* and is determined by the Server and not required to be configurable
|
||||||
* by the Client.
|
* by the Client.
|
||||||
*/
|
*/
|
||||||
measurement_nfy(NULL, nfy_wheel ? cwr : 0, nfy_wheel ? lwet : 0,
|
measurement_nfy(NULL, nfy_wheel ? c_wheel_revs : 0, nfy_wheel ? lwet : 0,
|
||||||
nfy_crank ? ccr : 0, nfy_crank ? lcet : 0);
|
nfy_crank ? ccr : 0, nfy_crank ? lcet : 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -74,7 +74,7 @@ static const struct bt_data ad[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* BLE connection */
|
/* BLE connection */
|
||||||
struct bt_conn *conn;
|
struct bt_conn *ble_conn;
|
||||||
/* Notification state */
|
/* Notification state */
|
||||||
volatile bool notify_enable;
|
volatile bool notify_enable;
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ static void button_callback(const struct device *gpiob, struct gpio_callback *cb
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
LOG_INF("Button pressed");
|
LOG_INF("Button pressed");
|
||||||
if (conn) {
|
if (ble_conn) {
|
||||||
if (notify_enable) {
|
if (notify_enable) {
|
||||||
err = bt_gatt_notify(NULL, &stsensor_svc.attrs[4],
|
err = bt_gatt_notify(NULL, &stsensor_svc.attrs[4],
|
||||||
&but_val, sizeof(but_val));
|
&but_val, sizeof(but_val));
|
||||||
|
@ -157,17 +157,17 @@ static void connected(struct bt_conn *connected, uint8_t err)
|
||||||
LOG_ERR("Connection failed (err %u)", err);
|
LOG_ERR("Connection failed (err %u)", err);
|
||||||
} else {
|
} else {
|
||||||
LOG_INF("Connected");
|
LOG_INF("Connected");
|
||||||
if (!conn) {
|
if (!ble_conn) {
|
||||||
conn = bt_conn_ref(connected);
|
ble_conn = bt_conn_ref(connected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disconnected(struct bt_conn *disconn, uint8_t reason)
|
static void disconnected(struct bt_conn *disconn, uint8_t reason)
|
||||||
{
|
{
|
||||||
if (conn) {
|
if (ble_conn) {
|
||||||
bt_conn_unref(conn);
|
bt_conn_unref(ble_conn);
|
||||||
conn = NULL;
|
ble_conn = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INF("Disconnected (reason %u)", reason);
|
LOG_INF("Disconnected (reason %u)", reason);
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct bt_cap_initiator_broadcast_stream_param stream_params;
|
||||||
struct bt_cap_initiator_broadcast_subgroup_param subgroup_param;
|
struct bt_cap_initiator_broadcast_subgroup_param subgroup_param;
|
||||||
struct bt_cap_initiator_broadcast_create_param create_param;
|
struct bt_cap_initiator_broadcast_create_param create_param;
|
||||||
struct bt_cap_broadcast_source *broadcast_source;
|
struct bt_cap_broadcast_source *broadcast_source;
|
||||||
struct bt_le_ext_adv *adv;
|
struct bt_le_ext_adv *ext_adv;
|
||||||
|
|
||||||
static uint8_t tmap_addata[] = {
|
static uint8_t tmap_addata[] = {
|
||||||
BT_UUID_16_ENCODE(BT_UUID_TMAS_VAL), /* TMAS UUID */
|
BT_UUID_16_ENCODE(BT_UUID_TMAS_VAL), /* TMAS UUID */
|
||||||
|
@ -273,7 +273,7 @@ void cap_initiator_setup(void)
|
||||||
}
|
}
|
||||||
printk("Creating broadcast source\n");
|
printk("Creating broadcast source\n");
|
||||||
|
|
||||||
err = setup_extended_adv(&adv);
|
err = setup_extended_adv(&ext_adv);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
printk("Unable to setup extended advertiser: %d\n", err);
|
printk("Unable to setup extended advertiser: %d\n", err);
|
||||||
return;
|
return;
|
||||||
|
@ -285,19 +285,19 @@ void cap_initiator_setup(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = bt_cap_initiator_broadcast_audio_start(broadcast_source, adv);
|
err = bt_cap_initiator_broadcast_audio_start(broadcast_source, ext_adv);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
printk("Unable to start broadcast source: %d\n", err);
|
printk("Unable to start broadcast source: %d\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = setup_extended_adv_data(broadcast_source, adv);
|
err = setup_extended_adv_data(broadcast_source, ext_adv);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
printk("Unable to setup extended advertising data: %d\n", err);
|
printk("Unable to setup extended advertising data: %d\n", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = start_extended_adv(adv);
|
err = start_extended_adv(ext_adv);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
printk("Unable to start extended advertiser: %d\n", err);
|
printk("Unable to start extended advertiser: %d\n", err);
|
||||||
return;
|
return;
|
||||||
|
@ -337,7 +337,7 @@ void cap_initiator_setup(void)
|
||||||
}
|
}
|
||||||
broadcast_source = NULL;
|
broadcast_source = NULL;
|
||||||
|
|
||||||
err = stop_and_delete_extended_adv(adv);
|
err = stop_and_delete_extended_adv(ext_adv);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
printk("Failed to stop and delete extended advertising: %d\n", err);
|
printk("Failed to stop and delete extended advertising: %d\n", err);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include <zephyr/bluetooth/audio/audio.h>
|
#include <zephyr/bluetooth/audio/audio.h>
|
||||||
#include <zephyr/bluetooth/audio/vcp.h>
|
#include <zephyr/bluetooth/audio/vcp.h>
|
||||||
|
|
||||||
static struct bt_vcp_vol_ctlr *vol_ctlr;
|
static struct bt_vcp_vol_ctlr *vcp_vol_ctlr;
|
||||||
|
|
||||||
static void vcs_discover_cb(struct bt_vcp_vol_ctlr *vol_ctlr, int err,
|
static void vcs_discover_cb(struct bt_vcp_vol_ctlr *vol_ctlr, int err,
|
||||||
uint8_t vocs_count, uint8_t aics_count)
|
uint8_t vocs_count, uint8_t aics_count)
|
||||||
|
@ -66,7 +66,7 @@ static int process_profile_connection(struct bt_conn *conn)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
err = bt_vcp_vol_ctlr_discover(conn, &vol_ctlr);
|
err = bt_vcp_vol_ctlr_discover(conn, &vcp_vol_ctlr);
|
||||||
|
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
printk("bt_vcp_vol_ctlr_discover (err %d)\n", err);
|
printk("bt_vcp_vol_ctlr_discover (err %d)\n", err);
|
||||||
|
@ -107,8 +107,8 @@ int vcp_vol_ctlr_mute(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (vol_ctlr != NULL) {
|
if (vcp_vol_ctlr != NULL) {
|
||||||
err = bt_vcp_vol_ctlr_mute(vol_ctlr);
|
err = bt_vcp_vol_ctlr_mute(vcp_vol_ctlr);
|
||||||
} else {
|
} else {
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -120,8 +120,8 @@ int vcp_vol_ctlr_unmute(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (vol_ctlr != NULL) {
|
if (vcp_vol_ctlr != NULL) {
|
||||||
err = bt_vcp_vol_ctlr_unmute(vol_ctlr);
|
err = bt_vcp_vol_ctlr_unmute(vcp_vol_ctlr);
|
||||||
} else {
|
} else {
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -133,8 +133,8 @@ int vcp_vol_ctlr_set_vol(uint8_t volume)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (vol_ctlr != NULL) {
|
if (vcp_vol_ctlr != NULL) {
|
||||||
err = bt_vcp_vol_ctlr_set_vol(vol_ctlr, volume);
|
err = bt_vcp_vol_ctlr_set_vol(vcp_vol_ctlr, volume);
|
||||||
} else {
|
} else {
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,8 +235,8 @@ static int lc3_metadata(struct bt_bap_stream *stream, const struct bt_audio_code
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->data.type == BT_AUDIO_METADATA_TYPE_CCID_LIST) {
|
if (data->data.type == BT_AUDIO_METADATA_TYPE_CCID_LIST) {
|
||||||
for (uint8_t i = 0; i < data->data.data_len; i++) {
|
for (uint8_t j = 0; j < data->data.data_len; j++) {
|
||||||
const uint8_t ccid = data->data.data[i];
|
const uint8_t ccid = data->data.data[j];
|
||||||
|
|
||||||
if (!(IS_ENABLED(CONFIG_BT_TBS_CLIENT_CCID) &&
|
if (!(IS_ENABLED(CONFIG_BT_TBS_CLIENT_CCID) &&
|
||||||
bt_tbs_client_get_by_ccid(default_conn, ccid) != NULL)) {
|
bt_tbs_client_get_by_ccid(default_conn, ccid) != NULL)) {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
static struct bt_csip_set_member_svc_inst *svc_inst;
|
static struct bt_csip_set_member_svc_inst *svc_inst;
|
||||||
|
|
||||||
static void csip_lock_changed_cb(struct bt_conn *conn,
|
static void csip_lock_changed_cb(struct bt_conn *conn,
|
||||||
struct bt_csip_set_member_svc_inst *svc_inst,
|
struct bt_csip_set_member_svc_inst *inst,
|
||||||
bool locked)
|
bool locked)
|
||||||
{
|
{
|
||||||
printk("Client %p %s the lock\n", conn, locked ? "locked" : "released");
|
printk("Client %p %s the lock\n", conn, locked ? "locked" : "released");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue