From 714d4d2a25efa0e56b87bbc3a84ff78de5fb300e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Rymanowski?= Date: Tue, 16 Jan 2018 19:43:30 +0100 Subject: [PATCH] nimble/att: Fix error code when accessing characteristics With this patch BLE_HS_ENOSUP is used only when given ATT operations is not supported. Otherwise it is BLE_HS_EREJECT. It affects only test code. X-Original-Commit: b854f39fbe03fe1ec16b6c7c2403890f17e678d4 --- nimble/host/src/ble_att_svr.c | 6 +++--- nimble/host/test/src/ble_att_svr_test.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nimble/host/src/ble_att_svr.c b/nimble/host/src/ble_att_svr.c index 4c2680ff8..f0911663e 100644 --- a/nimble/host/src/ble_att_svr.c +++ b/nimble/host/src/ble_att_svr.c @@ -258,7 +258,7 @@ ble_att_svr_check_perms(uint16_t conn_handle, int is_read, if (is_read) { if (!(entry->ha_flags & BLE_ATT_F_READ)) { *out_att_err = BLE_ATT_ERR_READ_NOT_PERMITTED; - return BLE_HS_ENOTSUP; + return BLE_HS_EREJECT; } enc = entry->ha_flags & BLE_ATT_F_READ_ENC; @@ -267,7 +267,7 @@ ble_att_svr_check_perms(uint16_t conn_handle, int is_read, } else { if (!(entry->ha_flags & BLE_ATT_F_WRITE)) { *out_att_err = BLE_ATT_ERR_WRITE_NOT_PERMITTED; - return BLE_HS_ENOTSUP; + return BLE_HS_EREJECT; } enc = entry->ha_flags & BLE_ATT_F_WRITE_ENC; @@ -1957,7 +1957,7 @@ ble_att_svr_rx_read_group_type(uint16_t conn_handle, struct os_mbuf **rxom) if (!ble_att_svr_is_valid_read_group_type(&uuid.u)) { att_err = BLE_ATT_ERR_UNSUPPORTED_GROUP; err_handle = start_handle; - rc = BLE_HS_ENOTSUP; + rc = BLE_HS_EREJECT; goto done; } diff --git a/nimble/host/test/src/ble_att_svr_test.c b/nimble/host/test/src/ble_att_svr_test.c index 0469bfd79..3e71b603c 100644 --- a/nimble/host/test/src/ble_att_svr_test.c +++ b/nimble/host/test/src/ble_att_svr_test.c @@ -1043,7 +1043,7 @@ TEST_CASE(ble_att_svr_test_write) rc = ble_hs_test_util_rx_att_write_req(conn_handle, attr_handle, attr_val, sizeof attr_val); - TEST_ASSERT(rc == BLE_HS_ENOTSUP); + TEST_ASSERT(rc == BLE_HS_EREJECT); ble_hs_test_util_verify_tx_err_rsp(BLE_ATT_OP_WRITE_REQ, attr_handle, BLE_ATT_ERR_WRITE_NOT_PERMITTED);