Bluetooth: Do not compile GATT response handlers if Client is disabled
This will exclude GATT Client response handlers from compilation if GATT Client support is disabled. Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This commit is contained in:
parent
ae4d7612f0
commit
50768a6bba
1 changed files with 64 additions and 58 deletions
|
@ -338,6 +338,7 @@ process:
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_GATT_CLIENT)
|
||||
static u8_t att_mtu_rsp(struct bt_att *att, struct net_buf *buf)
|
||||
{
|
||||
struct bt_att_exchange_mtu_rsp *rsp;
|
||||
|
@ -371,6 +372,7 @@ static u8_t att_mtu_rsp(struct bt_att *att, struct net_buf *buf)
|
|||
|
||||
return att_handle_rsp(att, rsp, buf->len, 0);
|
||||
}
|
||||
#endif /* CONFIG_BT_GATT_CLIENT */
|
||||
|
||||
static bool range_is_valid(u16_t start, u16_t end, u16_t *err)
|
||||
{
|
||||
|
@ -1505,6 +1507,7 @@ static u8_t att_signed_write_cmd(struct bt_att *att, struct net_buf *buf)
|
|||
}
|
||||
#endif /* CONFIG_BT_SIGNING */
|
||||
|
||||
#if defined(CONFIG_BT_GATT_CLIENT)
|
||||
#if defined(CONFIG_BT_SMP)
|
||||
static int att_change_security(struct bt_conn *conn, u8_t err)
|
||||
{
|
||||
|
@ -1712,6 +1715,7 @@ static u8_t att_indicate(struct bt_att *att, struct net_buf *buf)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_BT_GATT_CLIENT */
|
||||
|
||||
static u8_t att_confirm(struct bt_att *att, struct net_buf *buf)
|
||||
{
|
||||
|
@ -1726,110 +1730,52 @@ static const struct att_handler {
|
|||
att_type_t type;
|
||||
u8_t (*func)(struct bt_att *att, struct net_buf *buf);
|
||||
} handlers[] = {
|
||||
{ BT_ATT_OP_ERROR_RSP,
|
||||
sizeof(struct bt_att_error_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_error_rsp },
|
||||
{ BT_ATT_OP_MTU_REQ,
|
||||
sizeof(struct bt_att_exchange_mtu_req),
|
||||
ATT_REQUEST,
|
||||
att_mtu_req },
|
||||
{ BT_ATT_OP_MTU_RSP,
|
||||
sizeof(struct bt_att_exchange_mtu_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_mtu_rsp },
|
||||
{ BT_ATT_OP_FIND_INFO_REQ,
|
||||
sizeof(struct bt_att_find_info_req),
|
||||
ATT_REQUEST,
|
||||
att_find_info_req },
|
||||
{ BT_ATT_OP_FIND_INFO_RSP,
|
||||
sizeof(struct bt_att_find_info_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_find_info_rsp },
|
||||
{ BT_ATT_OP_FIND_TYPE_REQ,
|
||||
sizeof(struct bt_att_find_type_req),
|
||||
ATT_REQUEST,
|
||||
att_find_type_req },
|
||||
{ BT_ATT_OP_FIND_TYPE_RSP,
|
||||
sizeof(struct bt_att_find_type_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_find_type_rsp },
|
||||
{ BT_ATT_OP_READ_TYPE_REQ,
|
||||
sizeof(struct bt_att_read_type_req),
|
||||
ATT_REQUEST,
|
||||
att_read_type_req },
|
||||
{ BT_ATT_OP_READ_TYPE_RSP,
|
||||
sizeof(struct bt_att_read_type_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_read_type_rsp },
|
||||
{ BT_ATT_OP_READ_REQ,
|
||||
sizeof(struct bt_att_read_req),
|
||||
ATT_REQUEST,
|
||||
att_read_req },
|
||||
{ BT_ATT_OP_READ_RSP,
|
||||
sizeof(struct bt_att_read_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_read_rsp },
|
||||
{ BT_ATT_OP_READ_BLOB_REQ,
|
||||
sizeof(struct bt_att_read_blob_req),
|
||||
ATT_REQUEST,
|
||||
att_read_blob_req },
|
||||
{ BT_ATT_OP_READ_BLOB_RSP,
|
||||
sizeof(struct bt_att_read_blob_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_read_blob_rsp },
|
||||
#if defined(CONFIG_BT_GATT_READ_MULTIPLE)
|
||||
{ BT_ATT_OP_READ_MULT_REQ,
|
||||
BT_ATT_READ_MULT_MIN_LEN_REQ,
|
||||
ATT_REQUEST,
|
||||
att_read_mult_req },
|
||||
#endif /* CONFIG_BT_GATT_READ_MULTIPLE */
|
||||
#if defined(CONFIG_BT_GATT_READ_MULTIPLE)
|
||||
{ BT_ATT_OP_READ_MULT_RSP,
|
||||
sizeof(struct bt_att_read_mult_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_read_mult_rsp },
|
||||
#endif /* CONFIG_BT_GATT_READ_MULTIPLE */
|
||||
{ BT_ATT_OP_READ_GROUP_REQ,
|
||||
sizeof(struct bt_att_read_group_req),
|
||||
ATT_REQUEST,
|
||||
att_read_group_req },
|
||||
{ BT_ATT_OP_READ_GROUP_RSP,
|
||||
sizeof(struct bt_att_read_group_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_read_group_rsp },
|
||||
{ BT_ATT_OP_WRITE_REQ,
|
||||
sizeof(struct bt_att_write_req),
|
||||
ATT_REQUEST,
|
||||
att_write_req },
|
||||
{ BT_ATT_OP_WRITE_RSP,
|
||||
0,
|
||||
ATT_RESPONSE,
|
||||
att_handle_write_rsp },
|
||||
{ BT_ATT_OP_PREPARE_WRITE_REQ,
|
||||
sizeof(struct bt_att_prepare_write_req),
|
||||
ATT_REQUEST,
|
||||
att_prepare_write_req },
|
||||
{ BT_ATT_OP_PREPARE_WRITE_RSP,
|
||||
sizeof(struct bt_att_prepare_write_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_prepare_write_rsp },
|
||||
{ BT_ATT_OP_EXEC_WRITE_REQ,
|
||||
sizeof(struct bt_att_exec_write_req),
|
||||
ATT_REQUEST,
|
||||
att_exec_write_req },
|
||||
{ BT_ATT_OP_EXEC_WRITE_RSP,
|
||||
0,
|
||||
ATT_RESPONSE,
|
||||
att_handle_exec_write_rsp },
|
||||
{ BT_ATT_OP_NOTIFY,
|
||||
sizeof(struct bt_att_notify),
|
||||
ATT_NOTIFICATION,
|
||||
att_notify },
|
||||
{ BT_ATT_OP_INDICATE,
|
||||
sizeof(struct bt_att_indicate),
|
||||
ATT_INDICATION,
|
||||
att_indicate },
|
||||
{ BT_ATT_OP_CONFIRM,
|
||||
0,
|
||||
ATT_CONFIRMATION,
|
||||
|
@ -1845,6 +1791,66 @@ static const struct att_handler {
|
|||
ATT_COMMAND,
|
||||
att_signed_write_cmd },
|
||||
#endif /* CONFIG_BT_SIGNING */
|
||||
#if defined(CONFIG_BT_GATT_CLIENT)
|
||||
{ BT_ATT_OP_ERROR_RSP,
|
||||
sizeof(struct bt_att_error_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_error_rsp },
|
||||
{ BT_ATT_OP_MTU_RSP,
|
||||
sizeof(struct bt_att_exchange_mtu_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_mtu_rsp },
|
||||
{ BT_ATT_OP_FIND_INFO_RSP,
|
||||
sizeof(struct bt_att_find_info_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_find_info_rsp },
|
||||
{ BT_ATT_OP_FIND_TYPE_RSP,
|
||||
sizeof(struct bt_att_find_type_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_find_type_rsp },
|
||||
{ BT_ATT_OP_READ_TYPE_RSP,
|
||||
sizeof(struct bt_att_read_type_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_read_type_rsp },
|
||||
{ BT_ATT_OP_READ_RSP,
|
||||
sizeof(struct bt_att_read_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_read_rsp },
|
||||
{ BT_ATT_OP_READ_BLOB_RSP,
|
||||
sizeof(struct bt_att_read_blob_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_read_blob_rsp },
|
||||
#if defined(CONFIG_BT_GATT_READ_MULTIPLE)
|
||||
{ BT_ATT_OP_READ_MULT_RSP,
|
||||
sizeof(struct bt_att_read_mult_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_read_mult_rsp },
|
||||
#endif /* CONFIG_BT_GATT_READ_MULTIPLE */
|
||||
{ BT_ATT_OP_READ_GROUP_RSP,
|
||||
sizeof(struct bt_att_read_group_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_read_group_rsp },
|
||||
{ BT_ATT_OP_WRITE_RSP,
|
||||
0,
|
||||
ATT_RESPONSE,
|
||||
att_handle_write_rsp },
|
||||
{ BT_ATT_OP_PREPARE_WRITE_RSP,
|
||||
sizeof(struct bt_att_prepare_write_rsp),
|
||||
ATT_RESPONSE,
|
||||
att_handle_prepare_write_rsp },
|
||||
{ BT_ATT_OP_EXEC_WRITE_RSP,
|
||||
0,
|
||||
ATT_RESPONSE,
|
||||
att_handle_exec_write_rsp },
|
||||
{ BT_ATT_OP_NOTIFY,
|
||||
sizeof(struct bt_att_notify),
|
||||
ATT_NOTIFICATION,
|
||||
att_notify },
|
||||
{ BT_ATT_OP_INDICATE,
|
||||
sizeof(struct bt_att_indicate),
|
||||
ATT_INDICATION,
|
||||
att_indicate },
|
||||
#endif /* CONFIG_BT_GATT_CLIENT */
|
||||
};
|
||||
|
||||
static att_type_t att_op_get_type(u8_t op)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue