nimble: fixed nested long writes The test was looking for second long descriptor.
With this patch it is possible to pass TC_GAW_SR_BV_10_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/20539f6d Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/20539f6d Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/20539f6d Branch: refs/heads/develop Commit: 20539f6da0db392ba8571f510aed985014479b46 Parents: fae2eb3 Author: MichaÅ Narajowski <[email protected]> Authored: Fri Dec 30 17:07:27 2016 +0100 Committer: MichaÅ Narajowski <[email protected]> Committed: Fri Dec 30 17:30:32 2016 +0100 ---------------------------------------------------------------------- apps/bletiny/src/gatt_svr.c | 43 +++++++++++++++++++++++++++++------ net/nimble/host/pts/pts-gatt.txt | 2 +- 2 files changed, 37 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/20539f6d/apps/bletiny/src/gatt_svr.c ---------------------------------------------------------------------- diff --git a/apps/bletiny/src/gatt_svr.c b/apps/bletiny/src/gatt_svr.c index 96f7aa8..1c31438 100644 --- a/apps/bletiny/src/gatt_svr.c +++ b/apps/bletiny/src/gatt_svr.c @@ -51,13 +51,14 @@ #define PTS_LONG_CHR_WRITE 0x0013 #define PTS_LONG_CHR_RELIABLE_WRITE 0x0014 #define PTS_LONG_CHR_READ_WRITE 0x0015 -#define PTS_LONG_CHR_READ_WRITE_ENC 0x0016 -#define PTS_LONG_CHR_READ_WRITE_AUTHEN 0x0017 -#define PTS_LONG_DSC_READ 0x0018 -#define PTS_LONG_DSC_WRITE 0x0019 -#define PTS_LONG_DSC_READ_WRITE 0x001a -#define PTS_LONG_DSC_READ_WRITE_ENC 0x001b -#define PTS_LONG_DSC_READ_WRITE_AUTHEN 0x001c +#define PTS_LONG_CHR_READ_WRITE_ALT 0x0016 +#define PTS_LONG_CHR_READ_WRITE_ENC 0x0017 +#define PTS_LONG_CHR_READ_WRITE_AUTHEN 0x0018 +#define PTS_LONG_DSC_READ 0x0019 +#define PTS_LONG_DSC_WRITE 0x001a +#define PTS_LONG_DSC_READ_WRITE 0x001b +#define PTS_LONG_DSC_READ_WRITE_ENC 0x001c +#define PTS_LONG_DSC_READ_WRITE_AUTHEN 0x001d /** * The vendor specific security test service consists of two characteristics: @@ -96,6 +97,7 @@ static uint8_t gatt_svr_sec_test_static_val; static uint8_t gatt_svr_pts_static_val; static uint8_t gatt_svr_pts_static_long_val[30]; +static uint8_t gatt_svr_pts_static_long_val_alt[30]; static int gatt_svr_chr_access_sec_test(uint16_t conn_handle, uint16_t attr_handle, @@ -199,6 +201,10 @@ static const struct ble_gatt_svc_def gatt_svr_svcs[] = { .access_cb = gatt_svr_long_access_test, .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_WRITE, }, { + .uuid128 = PTS_UUID(PTS_LONG_CHR_READ_WRITE_ALT), + .access_cb = gatt_svr_long_access_test, + .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_WRITE, + }, { .uuid128 = PTS_UUID(PTS_LONG_CHR_READ_WRITE_ENC), .access_cb = gatt_svr_long_access_test, .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_READ_ENC | @@ -457,6 +463,29 @@ gatt_svr_long_access_test(uint16_t conn_handle, uint16_t attr_handle, return rc; case PTS_LONG_CHR_READ_WRITE: + if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { + rc = gatt_svr_chr_write(ctxt->om,0, + sizeof gatt_svr_pts_static_long_val, + &gatt_svr_pts_static_long_val, NULL); + return rc; + } else if (ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR) { + rc = os_mbuf_append(ctxt->om, &gatt_svr_pts_static_long_val, + sizeof gatt_svr_pts_static_long_val); + return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; + } + + case PTS_LONG_CHR_READ_WRITE_ALT: + if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { + rc = gatt_svr_chr_write(ctxt->om,0, + sizeof gatt_svr_pts_static_long_val_alt, + &gatt_svr_pts_static_long_val_alt, NULL); + return rc; + } else if (ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR) { + rc = os_mbuf_append(ctxt->om, &gatt_svr_pts_static_long_val_alt, + sizeof gatt_svr_pts_static_long_val_alt); + return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; + } + case PTS_LONG_CHR_READ_WRITE_ENC: case PTS_LONG_CHR_READ_WRITE_AUTHEN: if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/20539f6d/net/nimble/host/pts/pts-gatt.txt ---------------------------------------------------------------------- diff --git a/net/nimble/host/pts/pts-gatt.txt b/net/nimble/host/pts/pts-gatt.txt index ee22812..eed92f5 100644 --- a/net/nimble/host/pts/pts-gatt.txt +++ b/net/nimble/host/pts/pts-gatt.txt @@ -382,7 +382,7 @@ TC_GAW_SR_BI_11_C N/A TC_GAW_SR_BI_12_C PASS b adv TC_GAW_SR_BI_13_C INC TC_GAW_SR_BV_06_C PASS b adv -TC_GAW_SR_BV_10_C FAIL +TC_GAW_SR_BV_10_C PASS b adv TC_GAW_SR_BI_14_C PASS b adv <enter ffff> TC_GAW_SR_BI_15_C PASS b adv
