Bluetooth: GATT: Expose ATT error codes to application callbacks
Introduce BT_GATT_ERR macro to make it possible for application callbacks to return exact ATT error codes. Change-Id: I971536508e75036fbddc40b3f33e5201e11940bc Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
15ac9992a9
commit
a72d967d33
8 changed files with 55 additions and 51 deletions
|
@ -301,7 +301,7 @@ int bt_gatt_attr_read_ccc(struct bt_conn *conn,
|
|||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
return -ENOSYS;
|
||||
return BT_GATT_ERR(BT_ATT_ERR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
int bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
||||
|
@ -312,11 +312,11 @@ int bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
|||
const uint16_t *data = buf;
|
||||
|
||||
if (offset > sizeof(*data)) {
|
||||
return -EINVAL;
|
||||
return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET);
|
||||
}
|
||||
|
||||
if (offset + len > sizeof(*data)) {
|
||||
return -EFBIG;
|
||||
return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN);
|
||||
}
|
||||
|
||||
/* We expect to receive this only when the has really changed */
|
||||
|
@ -346,14 +346,14 @@ int bt_gatt_attr_read_cud(struct bt_conn *conn,
|
|||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
return -ENOSYS;
|
||||
return BT_GATT_ERR(BT_ATT_ERR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
int bt_gatt_attr_read_cpf(struct bt_conn *conn,
|
||||
const struct bt_gatt_attr *attr, void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
return -ENOSYS;
|
||||
return BT_GATT_ERR(BT_ATT_ERR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
int bt_gatt_notify(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue