Bluetooth: GATT: Refactor use of 16-bit UUID core types
Refactor use of 16-bit common GATT UUID types where a complete UUID object is declared on the stack only to use the 16-bit value. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
41967f999f
commit
374cbdd124
1 changed files with 10 additions and 10 deletions
|
@ -2774,9 +2774,9 @@ static void gatt_find_type_rsp(struct bt_conn *conn, uint8_t err,
|
|||
|
||||
uuid_svc.uuid.type = BT_UUID_TYPE_16;
|
||||
if (params->type == BT_GATT_DISCOVER_PRIMARY) {
|
||||
uuid_svc.val = BT_UUID_16(BT_UUID_GATT_PRIMARY)->val;
|
||||
uuid_svc.val = BT_UUID_GATT_PRIMARY_VAL;
|
||||
} else {
|
||||
uuid_svc.val = BT_UUID_16(BT_UUID_GATT_SECONDARY)->val;
|
||||
uuid_svc.val = BT_UUID_GATT_SECONDARY_VAL;
|
||||
}
|
||||
|
||||
value.end_handle = end_handle;
|
||||
|
@ -2815,9 +2815,9 @@ static int gatt_find_type(struct bt_conn *conn,
|
|||
req->end_handle = sys_cpu_to_le16(params->end_handle);
|
||||
|
||||
if (params->type == BT_GATT_DISCOVER_PRIMARY) {
|
||||
uuid_val = BT_UUID_16(BT_UUID_GATT_PRIMARY)->val;
|
||||
uuid_val = BT_UUID_GATT_PRIMARY_VAL;
|
||||
} else {
|
||||
uuid_val = BT_UUID_16(BT_UUID_GATT_SECONDARY)->val;
|
||||
uuid_val = BT_UUID_GATT_SECONDARY_VAL;
|
||||
}
|
||||
|
||||
req->type = sys_cpu_to_le16(uuid_val);
|
||||
|
@ -3125,9 +3125,9 @@ static int gatt_read_type(struct bt_conn *conn,
|
|||
req->end_handle = sys_cpu_to_le16(params->end_handle);
|
||||
|
||||
if (params->type == BT_GATT_DISCOVER_INCLUDE) {
|
||||
net_buf_add_le16(buf, BT_UUID_16(BT_UUID_GATT_INCLUDE)->val);
|
||||
net_buf_add_le16(buf, BT_UUID_GATT_INCLUDE_VAL);
|
||||
} else {
|
||||
net_buf_add_le16(buf, BT_UUID_16(BT_UUID_GATT_CHRC)->val);
|
||||
net_buf_add_le16(buf, BT_UUID_GATT_CHRC_VAL);
|
||||
}
|
||||
|
||||
BT_DBG("start_handle 0x%04x end_handle 0x%04x", params->start_handle,
|
||||
|
@ -3194,9 +3194,9 @@ static uint16_t parse_service(struct bt_conn *conn, const void *pdu,
|
|||
|
||||
uuid_svc.uuid.type = BT_UUID_TYPE_16;
|
||||
if (params->type == BT_GATT_DISCOVER_PRIMARY) {
|
||||
uuid_svc.val = BT_UUID_16(BT_UUID_GATT_PRIMARY)->val;
|
||||
uuid_svc.val = BT_UUID_GATT_PRIMARY_VAL;
|
||||
} else {
|
||||
uuid_svc.val = BT_UUID_16(BT_UUID_GATT_SECONDARY)->val;
|
||||
uuid_svc.val = BT_UUID_GATT_SECONDARY_VAL;
|
||||
}
|
||||
|
||||
value.end_handle = end_handle;
|
||||
|
@ -3259,9 +3259,9 @@ static int gatt_read_group(struct bt_conn *conn,
|
|||
req->end_handle = sys_cpu_to_le16(params->end_handle);
|
||||
|
||||
if (params->type == BT_GATT_DISCOVER_PRIMARY) {
|
||||
net_buf_add_le16(buf, BT_UUID_16(BT_UUID_GATT_PRIMARY)->val);
|
||||
net_buf_add_le16(buf, BT_UUID_GATT_PRIMARY_VAL);
|
||||
} else {
|
||||
net_buf_add_le16(buf, BT_UUID_16(BT_UUID_GATT_SECONDARY)->val);
|
||||
net_buf_add_le16(buf, BT_UUID_GATT_SECONDARY_VAL);
|
||||
}
|
||||
|
||||
BT_DBG("start_handle 0x%04x end_handle 0x%04x", params->start_handle,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue