Fix connection to incorrect peripheral

This commit is contained in:
Xudong Zheng 2020-11-10 23:02:31 -05:00 committed by Pete Johanson
parent 91e3a7d75a
commit 51ca4fbc18

View file

@ -187,19 +187,19 @@ static bool split_central_eir_found(struct bt_data *data, void *user_data) {
for (i = 0; i < data->data_len; i += 16) { for (i = 0; i < data->data_len; i += 16) {
struct bt_le_conn_param *param; struct bt_le_conn_param *param;
struct bt_uuid uuid; struct bt_uuid_128 uuid;
int err; int err;
if (!bt_uuid_create(&uuid, &data->data[i], 16)) { if (!bt_uuid_create(&uuid.uuid, &data->data[i], 16)) {
LOG_ERR("Unable to load UUID"); LOG_ERR("Unable to load UUID");
continue; continue;
} }
if (!bt_uuid_cmp(&uuid, BT_UUID_DECLARE_128(ZMK_SPLIT_BT_SERVICE_UUID))) { if (bt_uuid_cmp(&uuid.uuid, BT_UUID_DECLARE_128(ZMK_SPLIT_BT_SERVICE_UUID))) {
char uuid_str[BT_UUID_STR_LEN]; char uuid_str[BT_UUID_STR_LEN];
char service_uuid_str[BT_UUID_STR_LEN]; char service_uuid_str[BT_UUID_STR_LEN];
bt_uuid_to_str(&uuid, uuid_str, sizeof(uuid_str)); bt_uuid_to_str(&uuid.uuid, uuid_str, sizeof(uuid_str));
bt_uuid_to_str(BT_UUID_DECLARE_128(ZMK_SPLIT_BT_SERVICE_UUID), service_uuid_str, bt_uuid_to_str(BT_UUID_DECLARE_128(ZMK_SPLIT_BT_SERVICE_UUID), service_uuid_str,
sizeof(service_uuid_str)); sizeof(service_uuid_str));
LOG_DBG("UUID %s does not match split UUID: %s", log_strdup(uuid_str), LOG_DBG("UUID %s does not match split UUID: %s", log_strdup(uuid_str),