bletiny: add read permission to write_no_rsp characteristic for PTS With this patch it is possible to pass GATT/SR/GAW/BV-01-C.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/e4231b64 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/e4231b64 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/e4231b64 Branch: refs/heads/develop Commit: e4231b64ea5a744c4c238ccc5a85abdbc447a0e8 Parents: ae4d777 Author: MichaÅ Narajowski <[email protected]> Authored: Tue Jan 10 13:57:15 2017 +0100 Committer: MichaÅ Narajowski <[email protected]> Committed: Wed Jan 18 11:12:08 2017 +0100 ---------------------------------------------------------------------- apps/bletiny/src/gatt_svr.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e4231b64/apps/bletiny/src/gatt_svr.c ---------------------------------------------------------------------- diff --git a/apps/bletiny/src/gatt_svr.c b/apps/bletiny/src/gatt_svr.c index 67b13b2..cce15e4 100644 --- a/apps/bletiny/src/gatt_svr.c +++ b/apps/bletiny/src/gatt_svr.c @@ -134,7 +134,7 @@ static const struct ble_gatt_svc_def gatt_svr_svcs[] = { }, { .uuid128 = PTS_UUID(PTS_CHR_WRITE_NO_RSP), .access_cb = gatt_svr_access_test, - .flags = BLE_GATT_CHR_F_WRITE_NO_RSP, + .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_WRITE_NO_RSP, }, { .uuid128 = PTS_UUID(PTS_CHR_READ_WRITE), .access_cb = gatt_svr_access_test, @@ -387,11 +387,16 @@ gatt_svr_access_test(uint16_t conn_handle, uint16_t attr_handle, case PTS_CHR_WRITE: case PTS_CHR_RELIABLE_WRITE: case PTS_CHR_WRITE_NO_RSP: - assert(ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR); - rc = gatt_svr_chr_write(ctxt->om,0, - sizeof gatt_svr_pts_static_val, - &gatt_svr_pts_static_val, NULL); - return rc; + if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { + rc = gatt_svr_chr_write(ctxt->om,0, + sizeof gatt_svr_pts_static_val, + &gatt_svr_pts_static_val, NULL); + return rc; + } else if (ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR) { + rc = os_mbuf_append(ctxt->om, &gatt_svr_pts_static_val, + sizeof gatt_svr_pts_static_val); + return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; + } case PTS_CHR_READ_WRITE: case PTS_CHR_READ_WRITE_ENC:
