From b1fed7fb9c711fc9e82a0ab0dcc4d92439392c7e Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Mon, 9 Nov 2015 18:39:07 +0200 Subject: [PATCH] shared/att: Use smaller defines Not every term of the command needs to be part of the define as it make them awful long. --- src/shared/att-types.h | 4 ++-- src/shared/att.c | 6 +++--- src/shared/gatt-helpers.c | 10 +++++----- src/shared/gatt-server.c | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/shared/att-types.h b/src/shared/att-types.h index d474495db..c3062c006 100644 --- a/src/shared/att-types.h +++ b/src/shared/att-types.h @@ -42,8 +42,8 @@ #define BT_ATT_OP_MTU_RSP 0x03 #define BT_ATT_OP_FIND_INFO_REQ 0x04 #define BT_ATT_OP_FIND_INFO_RSP 0x05 -#define BT_ATT_OP_FIND_BY_TYPE_VAL_REQ 0x06 -#define BT_ATT_OP_FIND_BY_TYPE_VAL_RSP 0x07 +#define BT_ATT_OP_FIND_BY_TYPE_REQ 0x06 +#define BT_ATT_OP_FIND_BY_TYPE_RSP 0x07 #define BT_ATT_OP_READ_BY_TYPE_REQ 0x08 #define BT_ATT_OP_READ_BY_TYPE_RSP 0x09 #define BT_ATT_OP_READ_REQ 0x0a diff --git a/src/shared/att.c b/src/shared/att.c index faff18f7b..3a84783b6 100644 --- a/src/shared/att.c +++ b/src/shared/att.c @@ -112,8 +112,8 @@ static const struct { { BT_ATT_OP_MTU_RSP, ATT_OP_TYPE_RSP }, { BT_ATT_OP_FIND_INFO_REQ, ATT_OP_TYPE_REQ }, { BT_ATT_OP_FIND_INFO_RSP, ATT_OP_TYPE_RSP }, - { BT_ATT_OP_FIND_BY_TYPE_VAL_REQ, ATT_OP_TYPE_REQ }, - { BT_ATT_OP_FIND_BY_TYPE_VAL_RSP, ATT_OP_TYPE_RSP }, + { BT_ATT_OP_FIND_BY_TYPE_REQ, ATT_OP_TYPE_REQ }, + { BT_ATT_OP_FIND_BY_TYPE_RSP, ATT_OP_TYPE_RSP }, { BT_ATT_OP_READ_BY_TYPE_REQ, ATT_OP_TYPE_REQ }, { BT_ATT_OP_READ_BY_TYPE_RSP, ATT_OP_TYPE_RSP }, { BT_ATT_OP_READ_REQ, ATT_OP_TYPE_REQ }, @@ -156,7 +156,7 @@ static const struct { } att_req_rsp_mapping_table[] = { { BT_ATT_OP_MTU_REQ, BT_ATT_OP_MTU_RSP }, { BT_ATT_OP_FIND_INFO_REQ, BT_ATT_OP_FIND_INFO_RSP}, - { BT_ATT_OP_FIND_BY_TYPE_VAL_REQ, BT_ATT_OP_FIND_BY_TYPE_VAL_RSP }, + { BT_ATT_OP_FIND_BY_TYPE_REQ, BT_ATT_OP_FIND_BY_TYPE_RSP }, { BT_ATT_OP_READ_BY_TYPE_REQ, BT_ATT_OP_READ_BY_TYPE_RSP }, { BT_ATT_OP_READ_REQ, BT_ATT_OP_READ_RSP }, { BT_ATT_OP_READ_BLOB_REQ, BT_ATT_OP_READ_BLOB_RSP }, diff --git a/src/shared/gatt-helpers.c b/src/shared/gatt-helpers.c index b1dd38b5d..a0a5b2676 100644 --- a/src/shared/gatt-helpers.c +++ b/src/shared/gatt-helpers.c @@ -107,7 +107,7 @@ unsigned int bt_gatt_result_service_count(struct bt_gatt_result *result) return 0; if (result->opcode != BT_ATT_OP_READ_BY_GRP_TYPE_RSP && - result->opcode != BT_ATT_OP_FIND_BY_TYPE_VAL_RSP) + result->opcode != BT_ATT_OP_FIND_BY_TYPE_RSP) return 0; return result_element_count(result); @@ -342,7 +342,7 @@ bool bt_gatt_iter_next_service(struct bt_gatt_iter *iter, *end_handle = get_le16(pdu_ptr + 2); convert_uuid_le(pdu_ptr + 4, iter->result->data_len - 4, uuid); break; - case BT_ATT_OP_FIND_BY_TYPE_VAL_RSP: + case BT_ATT_OP_FIND_BY_TYPE_RSP: *start_handle = get_le16(pdu_ptr); *end_handle = get_le16(pdu_ptr + 2); @@ -747,7 +747,7 @@ static void find_by_type_val_cb(uint8_t opcode, const void *pdu, /* PDU must contain 4 bytes and it must be a multiple of 4, where each * 4 bytes contain the 16-bit attribute and group end handles. */ - if (opcode != BT_ATT_OP_FIND_BY_TYPE_VAL_RSP || !pdu || !length || + if (opcode != BT_ATT_OP_FIND_BY_TYPE_RSP || !pdu || !length || length % 4) { success = false; goto done; @@ -785,7 +785,7 @@ static void find_by_type_val_cb(uint8_t opcode, const void *pdu, put_le16(op->service_type, pdu + 4); bt_uuid_to_le(&op->uuid, pdu + 6); - op->id = bt_att_send(op->att, BT_ATT_OP_FIND_BY_TYPE_VAL_REQ, + op->id = bt_att_send(op->att, BT_ATT_OP_FIND_BY_TYPE_REQ, pdu, sizeof(pdu), find_by_type_val_cb, bt_gatt_request_ref(op), @@ -855,7 +855,7 @@ static struct bt_gatt_request *discover_services(struct bt_att *att, put_le16(op->service_type, pdu + 4); bt_uuid_to_le(&op->uuid, pdu + 6); - op->id = bt_att_send(att, BT_ATT_OP_FIND_BY_TYPE_VAL_REQ, + op->id = bt_att_send(att, BT_ATT_OP_FIND_BY_TYPE_REQ, pdu, sizeof(pdu), find_by_type_val_cb, bt_gatt_request_ref(op), diff --git a/src/shared/gatt-server.c b/src/shared/gatt-server.c index 4025cd1af..ba668e38d 100644 --- a/src/shared/gatt-server.c +++ b/src/shared/gatt-server.c @@ -711,7 +711,7 @@ static void find_by_type_val_cb(uint8_t opcode, const void *pdu, if (data.ecode) goto error; - bt_att_send(server->att, BT_ATT_OP_FIND_BY_TYPE_VAL_RSP, data.pdu, + bt_att_send(server->att, BT_ATT_OP_FIND_BY_TYPE_RSP, data.pdu, data.len, NULL, NULL, NULL); return; @@ -1316,7 +1316,7 @@ static bool gatt_server_register_att_handlers(struct bt_gatt_server *server) /* Find By Type Value */ server->find_by_type_value_id = bt_att_register(server->att, - BT_ATT_OP_FIND_BY_TYPE_VAL_REQ, + BT_ATT_OP_FIND_BY_TYPE_REQ, find_by_type_val_cb, server, NULL); -- 2.47.3