Bluetooth: GATT: Remove unnecessary usage of full UUID structs

To access the 16-bit value of GATT UUIDs it's quite overkill to first
create anonymous UUID structs and then access the value member from
them. We can simplify this a lot with the help of the recently added
UUID value definitions.

Change-Id: Ib58012c20d07b3e60e5911cea6feb73301d1323c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2016-01-27 21:52:58 -05:00 committed by Anas Nashif
commit 44541091dc
2 changed files with 5 additions and 5 deletions

View file

@ -499,7 +499,7 @@ static uint8_t att_find_type_req(struct bt_att *att, struct net_buf *buf)
* and the Attribute Value set to the 16-bit Bluetooth UUID or 128-bit
* UUID for the specific primary service.
*/
if (type != BT_UUID_GATT_PRIMARY->u16) {
if (type != BT_UUID_GATT_PRIMARY_VAL) {
send_err_rsp(conn, BT_ATT_OP_FIND_TYPE_REQ, start_handle,
BT_ATT_ERR_ATTRIBUTE_NOT_FOUND);
return 0;

View file

@ -758,9 +758,9 @@ static int att_find_type(struct bt_conn *conn,
req->end_handle = sys_cpu_to_le16(params->end_handle);
if (params->type == BT_GATT_DISCOVER_PRIMARY) {
req->type = sys_cpu_to_le16(BT_UUID_GATT_PRIMARY->u16);
req->type = sys_cpu_to_le16(BT_UUID_GATT_PRIMARY_VAL);
} else {
req->type = sys_cpu_to_le16(BT_UUID_GATT_SECONDARY->u16);
req->type = sys_cpu_to_le16(BT_UUID_GATT_SECONDARY_VAL);
}
BT_DBG("uuid %s start_handle 0x%04x end_handle 0x%04x",
@ -1002,9 +1002,9 @@ static int att_read_type(struct bt_conn *conn,
value = net_buf_add(buf, sizeof(*value));
if (params->type == BT_GATT_DISCOVER_INCLUDE)
*value = sys_cpu_to_le16(BT_UUID_GATT_INCLUDE->u16);
*value = sys_cpu_to_le16(BT_UUID_GATT_INCLUDE_VAL);
else
*value = sys_cpu_to_le16(BT_UUID_GATT_CHRC->u16);
*value = sys_cpu_to_le16(BT_UUID_GATT_CHRC_VAL);
BT_DBG("start_handle 0x%04x end_handle 0x%04x", params->start_handle,
params->end_handle);