Merge b3fcab17c4
into e3eb77dfc6
This commit is contained in:
commit
bcba27eea3
2 changed files with 7 additions and 7 deletions
|
@ -110,7 +110,7 @@ bool zmk_ble_active_profile_is_open() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_profile_address(uint8_t index, const bt_addr_le_t *addr) {
|
void set_profile_address(uint8_t index, const bt_addr_le_t *addr) {
|
||||||
char setting_name[15];
|
char setting_name[17];
|
||||||
char addr_str[BT_ADDR_LE_STR_LEN];
|
char addr_str[BT_ADDR_LE_STR_LEN];
|
||||||
|
|
||||||
bt_addr_le_to_str(addr, addr_str, sizeof(addr_str));
|
bt_addr_le_to_str(addr, addr_str, sizeof(addr_str));
|
||||||
|
|
|
@ -29,7 +29,7 @@ static int start_scan(void);
|
||||||
|
|
||||||
static struct bt_conn *default_conn;
|
static struct bt_conn *default_conn;
|
||||||
|
|
||||||
static struct bt_uuid_128 uuid = BT_UUID_INIT_128(ZMK_SPLIT_BT_SERVICE_UUID);
|
static struct bt_uuid uuid = {.type = BT_UUID_TYPE_128};
|
||||||
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;
|
||||||
|
|
||||||
|
@ -116,8 +116,8 @@ static uint8_t split_central_discovery_func(struct bt_conn *conn, const struct b
|
||||||
LOG_DBG("[ATTRIBUTE] handle %u", attr->handle);
|
LOG_DBG("[ATTRIBUTE] handle %u", attr->handle);
|
||||||
|
|
||||||
if (!bt_uuid_cmp(discover_params.uuid, BT_UUID_DECLARE_128(ZMK_SPLIT_BT_SERVICE_UUID))) {
|
if (!bt_uuid_cmp(discover_params.uuid, BT_UUID_DECLARE_128(ZMK_SPLIT_BT_SERVICE_UUID))) {
|
||||||
memcpy(&uuid, BT_UUID_DECLARE_128(ZMK_SPLIT_BT_CHAR_POSITION_STATE_UUID), sizeof(uuid));
|
uuid.type = BT_UUID_TYPE_128;
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.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;
|
||||||
|
|
||||||
|
@ -127,8 +127,8 @@ static uint8_t split_central_discovery_func(struct bt_conn *conn, const struct b
|
||||||
}
|
}
|
||||||
} else if (!bt_uuid_cmp(discover_params.uuid,
|
} else if (!bt_uuid_cmp(discover_params.uuid,
|
||||||
BT_UUID_DECLARE_128(ZMK_SPLIT_BT_CHAR_POSITION_STATE_UUID))) {
|
BT_UUID_DECLARE_128(ZMK_SPLIT_BT_CHAR_POSITION_STATE_UUID))) {
|
||||||
memcpy(&uuid, BT_UUID_GATT_CCC, sizeof(uuid));
|
uuid.type = BT_UUID_TYPE_16;
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.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);
|
||||||
|
@ -162,7 +162,7 @@ static void split_central_process_connection(struct bt_conn *conn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conn == default_conn && !subscribe_params.value) {
|
if (conn == default_conn && !subscribe_params.value) {
|
||||||
discover_params.uuid = &uuid.uuid;
|
discover_params.uuid = &uuid;
|
||||||
discover_params.func = split_central_discovery_func;
|
discover_params.func = split_central_discovery_func;
|
||||||
discover_params.start_handle = 0x0001;
|
discover_params.start_handle = 0x0001;
|
||||||
discover_params.end_handle = 0xffff;
|
discover_params.end_handle = 0xffff;
|
||||||
|
|
Loading…
Add table
Reference in a new issue