You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2017/01/03 22:35:21 UTC

[1/6] incubator-mynewt-core git commit: nimble: fix execute write flags

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop 56e711b8f -> ac1496259


nimble: fix execute write flags

Changed the definition and interpretation of exec write flags
to similar to Bluez.


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/48bce399
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/48bce399
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/48bce399

Branch: refs/heads/develop
Commit: 48bce399c8eda704abe2d81d3c0f038ca8d61241
Parents: aa27be5
Author: Micha\u0142 Narajowski <mi...@codecoup.pl>
Authored: Tue Dec 20 15:24:35 2016 +0100
Committer: Micha\u0142 Narajowski <mi...@codecoup.pl>
Committed: Fri Dec 30 11:21:42 2016 +0100

----------------------------------------------------------------------
 net/nimble/host/src/ble_att_clt.c              |  4 ----
 net/nimble/host/src/ble_att_cmd_priv.h         |  4 ++--
 net/nimble/host/src/ble_att_svr.c              |  2 +-
 net/nimble/host/src/ble_gattc.c                |  8 ++++----
 net/nimble/host/test/src/ble_att_clt_test.c    |  8 ++++----
 net/nimble/host/test/src/ble_att_svr_test.c    | 20 ++++++++++----------
 net/nimble/host/test/src/ble_gatt_write_test.c | 10 +++++-----
 7 files changed, 26 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/48bce399/net/nimble/host/src/ble_att_clt.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_clt.c b/net/nimble/host/src/ble_att_clt.c
index d703cb4..e7cd69c 100644
--- a/net/nimble/host/src/ble_att_clt.c
+++ b/net/nimble/host/src/ble_att_clt.c
@@ -1048,10 +1048,6 @@ ble_att_clt_tx_exec_write(uint16_t conn_handle,
     struct os_mbuf *txom;
     int rc;
 
-    if ((req->baeq_flags & BLE_ATT_EXEC_WRITE_F_RESERVED) != 0) {
-        return BLE_HS_EINVAL;
-    }
-
     rc = ble_att_clt_init_req(BLE_ATT_EXEC_WRITE_REQ_SZ, &txom);
     if (rc != 0) {
         return rc;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/48bce399/net/nimble/host/src/ble_att_cmd_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_cmd_priv.h b/net/nimble/host/src/ble_att_cmd_priv.h
index f954340..356b566 100644
--- a/net/nimble/host/src/ble_att_cmd_priv.h
+++ b/net/nimble/host/src/ble_att_cmd_priv.h
@@ -269,8 +269,8 @@ struct ble_att_exec_write_req {
     uint8_t baeq_flags;
 } __attribute__((packed));
 
-#define BLE_ATT_EXEC_WRITE_F_CONFIRM    0x01
-#define BLE_ATT_EXEC_WRITE_F_RESERVED   0xfe
+#define BLE_ATT_EXEC_WRITE_F_CANCEL     0x00
+#define BLE_ATT_EXEC_WRITE_F_EXECUTE    0x01
 
 /**
  * | Parameter                          | Size (octets)     |

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/48bce399/net/nimble/host/src/ble_att_svr.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_svr.c b/net/nimble/host/src/ble_att_svr.c
index 656d432..3d85bd1 100644
--- a/net/nimble/host/src/ble_att_svr.c
+++ b/net/nimble/host/src/ble_att_svr.c
@@ -2577,7 +2577,7 @@ done:
         SLIST_INIT(&conn->bhc_att_svr.basc_prep_list);
         ble_hs_unlock();
 
-        if (req.baeq_flags & BLE_ATT_EXEC_WRITE_F_CONFIRM) {
+        if (req.baeq_flags) {
             /* Perform attribute writes. */
             att_err = ble_att_svr_prep_write(conn_handle, &prep_list,
                                              &err_handle);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/48bce399/net/nimble/host/src/ble_gattc.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gattc.c b/net/nimble/host/src/ble_gattc.c
index 6eb0606..c99facc 100644
--- a/net/nimble/host/src/ble_gattc.c
+++ b/net/nimble/host/src/ble_gattc.c
@@ -3919,7 +3919,7 @@ ble_gattc_write_long_tx(struct ble_gattc_proc *proc)
                         proc->write_long.attr.offset);
 
     if (write_len <= 0) {
-        exec_req.baeq_flags = BLE_ATT_EXEC_WRITE_F_CONFIRM;
+        exec_req.baeq_flags = BLE_ATT_EXEC_WRITE_F_EXECUTE;
         rc = ble_att_clt_tx_exec_write(proc->conn_handle, &exec_req);
         goto done;
     }
@@ -3988,7 +3988,7 @@ ble_gattc_write_long_err(struct ble_gattc_proc *proc, int status,
         proc->write_long.attr.offset <
             OS_MBUF_PKTLEN(proc->write_long.attr.om)) {
 
-        exec_req.baeq_flags = 0;
+        exec_req.baeq_flags = BLE_ATT_EXEC_WRITE_F_CANCEL;
         ble_att_clt_tx_exec_write(proc->conn_handle, &exec_req);
     }
 
@@ -4224,7 +4224,7 @@ ble_gattc_write_reliable_tx(struct ble_gattc_proc *proc)
     attr_idx = proc->write_reliable.cur_attr;
 
     if (attr_idx >= proc->write_reliable.num_attrs) {
-        exec_req.baeq_flags = BLE_ATT_EXEC_WRITE_F_CONFIRM;
+        exec_req.baeq_flags = BLE_ATT_EXEC_WRITE_F_EXECUTE;
         rc = ble_att_clt_tx_exec_write(proc->conn_handle, &exec_req);
         goto done;
     }
@@ -4303,7 +4303,7 @@ ble_gattc_write_reliable_err(struct ble_gattc_proc *proc, int status,
     if (proc->write_reliable.cur_attr > 0 &&
         proc->write_reliable.cur_attr < proc->write_reliable.num_attrs) {
 
-        exec_req.baeq_flags = 0;
+        exec_req.baeq_flags = BLE_ATT_EXEC_WRITE_F_CANCEL;
         ble_att_clt_tx_exec_write(proc->conn_handle, &exec_req);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/48bce399/net/nimble/host/test/src/ble_att_clt_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_att_clt_test.c b/net/nimble/host/test/src/ble_att_clt_test.c
index a260a75..c34df53 100644
--- a/net/nimble/host/test/src/ble_att_clt_test.c
+++ b/net/nimble/host/test/src/ble_att_clt_test.c
@@ -516,13 +516,13 @@ TEST_CASE(ble_att_clt_test_tx_exec_write)
     conn_handle = ble_att_clt_test_misc_init();
 
     /*** Success. */
-    ble_att_clt_test_misc_exec_good(0);
-    ble_att_clt_test_misc_exec_good(BLE_ATT_EXEC_WRITE_F_CONFIRM);
+    ble_att_clt_test_misc_exec_good(BLE_ATT_EXEC_WRITE_F_CANCEL);
+    ble_att_clt_test_misc_exec_good(BLE_ATT_EXEC_WRITE_F_EXECUTE);
 
-    /*** Error: invalid flags value. */
+    /*** Success: nonzero == execute. */
     req.baeq_flags = 0x02;
     rc = ble_att_clt_tx_exec_write(conn_handle, &req);
-    TEST_ASSERT(rc == BLE_HS_EINVAL);
+    TEST_ASSERT(rc == 0);
 }
 
 TEST_CASE(ble_att_clt_test_tx_mtu)

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/48bce399/net/nimble/host/test/src/ble_att_svr_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_att_svr_test.c b/net/nimble/host/test/src/ble_att_svr_test.c
index d2fbe63..25b6a1d 100644
--- a/net/nimble/host/test/src/ble_att_svr_test.c
+++ b/net/nimble/host/test/src/ble_att_svr_test.c
@@ -1623,7 +1623,7 @@ TEST_CASE(ble_att_svr_test_prep_write)
         0xabae, BLE_ATT_F_WRITE, 6, ble_att_svr_test_misc_attr_fn_w_fail);
 
     /*** Empty write succeeds. */
-    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_CONFIRM,
+    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_EXECUTE,
                                      0, 0);
 
     /*** Empty cancel succeeds. */
@@ -1657,7 +1657,7 @@ TEST_CASE(ble_att_svr_test_prep_write)
 
     /*** Failure for write starting at nonzero offset. */
     ble_att_svr_test_misc_prep_write(conn_handle, 1, 1, data, 10, 0);
-    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_CONFIRM,
+    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_EXECUTE,
                                      BLE_ATT_ERR_INVALID_OFFSET, 1);
     ble_att_svr_test_misc_verify_w_1(NULL, 0);
 
@@ -1669,7 +1669,7 @@ TEST_CASE(ble_att_svr_test_prep_write)
     /*** Failure for write with gap. */
     ble_att_svr_test_misc_prep_write(conn_handle, 1, 0, data, 10, 0);
     ble_att_svr_test_misc_prep_write(conn_handle, 1, 11, data, 10, 0);
-    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_CONFIRM,
+    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_EXECUTE,
                                      BLE_ATT_ERR_INVALID_OFFSET, 1);
     ble_att_svr_test_misc_verify_w_1(NULL, 0);
 
@@ -1683,14 +1683,14 @@ TEST_CASE(ble_att_svr_test_prep_write)
     ble_att_svr_test_misc_prep_write(conn_handle, 1, 0, data, 200, 0);
     ble_att_svr_test_misc_prep_write(conn_handle, 1, 200, data + 200, 200, 0);
     ble_att_svr_test_misc_prep_write(conn_handle, 1, 400, data + 400, 200, 0);
-    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_CONFIRM,
+    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_EXECUTE,
                                      BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN, 1);
     ble_att_svr_test_misc_verify_w_1(NULL, 0);
 
     /*** Successful two part write. */
     ble_att_svr_test_misc_prep_write(conn_handle, 1, 0, data, 20, 0);
     ble_att_svr_test_misc_prep_write(conn_handle, 1, 20, data + 20, 20, 0);
-    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_CONFIRM,
+    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_EXECUTE,
                                      0, 0);
     ble_att_svr_test_misc_verify_w_1(data, 40);
 
@@ -1698,7 +1698,7 @@ TEST_CASE(ble_att_svr_test_prep_write)
     ble_att_svr_test_misc_prep_write(conn_handle, 1, 0, data, 35, 0);
     ble_att_svr_test_misc_prep_write(conn_handle, 1, 35, data + 35, 43, 0);
     ble_att_svr_test_misc_prep_write(conn_handle, 1, 78, data + 78, 1, 0);
-    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_CONFIRM,
+    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_EXECUTE,
                                      0, 0);
     ble_att_svr_test_misc_verify_w_1(data, 79);
 
@@ -1707,7 +1707,7 @@ TEST_CASE(ble_att_svr_test_prep_write)
     ble_att_svr_test_misc_prep_write(conn_handle, 1, 7, data + 7, 10, 0);
     ble_att_svr_test_misc_prep_write(conn_handle, 2, 0, data, 20, 0);
     ble_att_svr_test_misc_prep_write(conn_handle, 2, 20, data + 20, 10, 0);
-    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_CONFIRM,
+    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_EXECUTE,
                                      0, 0);
     ble_att_svr_test_misc_verify_w_1(data, 17);
     ble_att_svr_test_misc_verify_w_2(data, 30);
@@ -1717,7 +1717,7 @@ TEST_CASE(ble_att_svr_test_prep_write)
     ble_att_svr_test_misc_prep_write(conn_handle, 1, 5, data + 5, 2, 0);
     ble_att_svr_test_misc_prep_write(conn_handle, 2, 0, data, 11, 0);
     ble_att_svr_test_misc_prep_write(conn_handle, 2, 12, data + 11, 19, 0);
-    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_CONFIRM,
+    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_EXECUTE,
                                      BLE_ATT_ERR_INVALID_OFFSET, 2);
     ble_att_svr_test_misc_verify_w_1(data, 17);
     ble_att_svr_test_misc_verify_w_2(data, 30);
@@ -1727,7 +1727,7 @@ TEST_CASE(ble_att_svr_test_prep_write)
     ble_att_svr_test_misc_prep_write(conn_handle, 2, 0, data, 18, 0);
     ble_att_svr_test_misc_prep_write(conn_handle, 1, 9, data + 9, 3, 0);
     ble_att_svr_test_misc_prep_write(conn_handle, 2, 18, data + 18, 43, 0);
-    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_CONFIRM,
+    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_EXECUTE,
                                      0, 0);
     ble_att_svr_test_misc_verify_w_1(data, 12);
     ble_att_svr_test_misc_verify_w_2(data, 61);
@@ -1736,7 +1736,7 @@ TEST_CASE(ble_att_svr_test_prep_write)
     ble_att_svr_test_misc_prep_write(conn_handle, 6, 0, data, 35, 0);
     ble_att_svr_test_misc_prep_write(conn_handle, 6, 35, data + 35, 43, 0);
     ble_att_svr_test_misc_prep_write(conn_handle, 6, 78, data + 78, 1, 0);
-    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_CONFIRM,
+    ble_att_svr_test_misc_exec_write(conn_handle, BLE_ATT_EXEC_WRITE_F_EXECUTE,
                                      BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN, 6);
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/48bce399/net/nimble/host/test/src/ble_gatt_write_test.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/test/src/ble_gatt_write_test.c b/net/nimble/host/test/src/ble_gatt_write_test.c
index 33456c8..d3b77d2 100644
--- a/net/nimble/host/test/src/ble_gatt_write_test.c
+++ b/net/nimble/host/test/src/ble_gatt_write_test.c
@@ -161,7 +161,7 @@ ble_gatt_write_test_misc_long_good(int attr_len)
     }
 
     /* Verify execute write request sent. */
-    ble_hs_test_util_verify_tx_exec_write(BLE_ATT_EXEC_WRITE_F_CONFIRM);
+    ble_hs_test_util_verify_tx_exec_write(BLE_ATT_EXEC_WRITE_F_EXECUTE);
 
     /* Receive Exec Write response. */
     ble_hs_test_util_tx_all();
@@ -351,7 +351,7 @@ ble_gatt_write_test_misc_reliable_good(
     }
 
     /* Verify execute write request sent. */
-    ble_hs_test_util_verify_tx_exec_write(BLE_ATT_EXEC_WRITE_F_CONFIRM);
+    ble_hs_test_util_verify_tx_exec_write(BLE_ATT_EXEC_WRITE_F_EXECUTE);
 
     /* Receive Exec Write response. */
     ble_hs_test_util_tx_all();
@@ -611,7 +611,7 @@ TEST_CASE(ble_gatt_write_test_long_queue_full)
     TEST_ASSERT(ble_gatt_write_test_error.att_handle == 100);
 
     /* Verify clear queue command got sent. */
-    ble_hs_test_util_verify_tx_exec_write(0);
+    ble_hs_test_util_verify_tx_exec_write(BLE_ATT_EXEC_WRITE_F_CANCEL);
 }
 
 TEST_CASE(ble_gatt_write_test_long_oom)
@@ -699,7 +699,7 @@ TEST_CASE(ble_gatt_write_test_long_oom)
     ble_hs_test_util_tx_all();
 
     /* Verify execute write request sent. */
-    ble_hs_test_util_verify_tx_exec_write(BLE_ATT_EXEC_WRITE_F_CONFIRM);
+    ble_hs_test_util_verify_tx_exec_write(BLE_ATT_EXEC_WRITE_F_EXECUTE);
 
     /* Receive Exec Write response. */
     ble_hs_test_util_tx_all();
@@ -799,7 +799,7 @@ TEST_CASE(ble_gatt_write_test_reliable_oom)
     ble_hs_test_util_tx_all();
 
     /* Verify execute write request sent. */
-    ble_hs_test_util_verify_tx_exec_write(BLE_ATT_EXEC_WRITE_F_CONFIRM);
+    ble_hs_test_util_verify_tx_exec_write(BLE_ATT_EXEC_WRITE_F_EXECUTE);
 
     /* Receive Exec Write response. */
     ble_hs_test_util_tx_all();


[3/6] incubator-mynewt-core git commit: nimble: passed some PTS tests

Posted by cc...@apache.org.
nimble: passed some PTS tests


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/e0421ecc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/e0421ecc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/e0421ecc

Branch: refs/heads/develop
Commit: e0421ecc9c86461c67507eddf800b195c3a0a265
Parents: 4a9c7e6
Author: Micha\u0142 Narajowski <mi...@codecoup.pl>
Authored: Fri Dec 30 16:28:26 2016 +0100
Committer: Micha\u0142 Narajowski <mi...@codecoup.pl>
Committed: Fri Dec 30 16:42:18 2016 +0100

----------------------------------------------------------------------
 net/nimble/host/pts/pts-gatt.txt | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e0421ecc/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 cee3522..a9c86d4 100644
--- a/net/nimble/host/pts/pts-gatt.txt
+++ b/net/nimble/host/pts/pts-gatt.txt
@@ -265,7 +265,9 @@ TC_GAW_CL_BI_04_C	PASS	b conn peer_addr=<addr>
 TC_GAW_CL_BI_05_C	PASS	b conn peer_addr=<addr>
 				b write conn=<handle> attr=<val_handle> value=aa
 				b term conn=<handle>
-TC_GAW_CL_BI_06_C	INC	
+TC_GAW_CL_BI_06_C	PASS	b conn peer_addr=<addr>
+				b write conn=<handle> attr=<val_handle> value=00
+				b term conn=<handle>
 TC_GAW_CL_BV_05_C	PASS	b conn peer_addr=<addr>
 				b write long=1 conn=<handle> attr=<val_handle> value=aa
 				b term conn=<handle>
@@ -284,7 +286,9 @@ TC_GAW_CL_BI_11_C	PASS	b conn peer_addr=<addr>
 TC_GAW_CL_BI_12_C	PASS	b conn peer_addr=<addr>
 				b write long=1 conn=<handle> attr=<val_handle> value=aa
 				b term conn=<handle>
-TC_GAW_CL_BI_13_C	INC
+TC_GAW_CL_BI_13_C	PASS	b conn peer_addr=<addr>
+				b write long=1 conn=<handle> attr=<val_handle> value=aa
+				b term conn=<handle>
 TC_GAW_CL_BV_06_C	PASS	b conn peer_addr=<addr>
 				b write long=1 conn=<handle> attr=<val_handle> value=aa
 				b term conn=<handle>
@@ -300,7 +304,9 @@ TC_GAW_CL_BI_17_C	PASS	b conn peer_addr=<addr>
 TC_GAW_CL_BI_18_C	PASS	b conn peer_addr=<addr>
 				b write long=1 conn=<handle> attr=<val_handle> value=aa
 				b term conn=<handle>
-TC_GAW_CL_BI_19_C	INC
+TC_GAW_CL_BI_19_C	PASS	b conn peer_addr=<addr>
+				b write conn=<handle> attr=<val_handle> value=aa attr=<val_handle> value=aa
+				b term conn=<handle>
 TC_GAW_CL_BV_08_C	PASS	b conn peer_addr=<addr>
 				b write conn=<handle> attr=<val_handle> value=aa
 				b term conn=<handle>
@@ -316,7 +322,9 @@ TC_GAW_CL_BI_22_C	PASS	b conn peer_addr=<addr>
 TC_GAW_CL_BI_23_C	PASS	b conn peer_addr=<addr>
 				b write conn=<handle> attr=<val_handle> value=aa
 				b term conn=<handle>
-TC_GAW_CL_BI_24_C	INC	
+TC_GAW_CL_BI_24_C	PASS	b conn peer_addr=<addr>
+				b write conn=<handle> attr=<val_handle> value=aa
+				b term conn=<handle>
 TC_GAW_CL_BV_09_C	PASS	b conn peer_addr=<addr>
 				b write long=1 conn=<handle> attr=<val_handle> value=aa
 				b term conn=<handle>
@@ -335,7 +343,9 @@ TC_GAW_CL_BI_29_C	PASS	b conn peer_addr=<addr>
 TC_GAW_CL_BI_30_C	PASS	b conn peer_addr=<addr>
 				b write long=1 conn=<handle> attr=<val_handle> value=aa
 				b term conn=<handle>
-TC_GAW_CL_BI_31_C	INC
+TC_GAW_CL_BI_31_C	PASS	b conn peer_addr=<addr>
+				b write long=1 conn=<handle> attr=<val_handle> value=aa
+				b term conn=<handle>
 TC_GAW_CL_BI_32_C	PASS	b conn peer_addr=<addr>
 				b write conn=<handle> attr=<val_handle1> value=<val> attr=<val_handle2> value=<val>
 TC_GAW_CL_BI_33_C	PASS	b conn peer_addr=<addr>


[6/6] incubator-mynewt-core git commit: This closes #154.

Posted by cc...@apache.org.
This closes #154.

Merge remote-tracking branch 'michal-narajowski/write-cancel' into develop

* michal-narajowski/write-cancel:
  nimble: fixed nested long writes
  nimble: added missing descriptors
  nimble: passed some PTS tests
  nimble: fix send cancel pending writes on error
  nimble: fix execute write flags


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/ac149625
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/ac149625
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/ac149625

Branch: refs/heads/develop
Commit: ac14962592d94543065f461d9963f7cadf6bc190
Parents: 56e711b 20539f6
Author: Christopher Collins <cc...@apache.org>
Authored: Tue Jan 3 14:17:19 2017 -0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Jan 3 14:17:19 2017 -0800

----------------------------------------------------------------------
 apps/bletiny/src/gatt_svr.c                    | 57 ++++++++++++++++++---
 net/nimble/host/pts/pts-gatt.txt               | 33 ++++++++----
 net/nimble/host/src/ble_att_clt.c              |  4 --
 net/nimble/host/src/ble_att_cmd_priv.h         |  4 +-
 net/nimble/host/src/ble_att_svr.c              |  2 +-
 net/nimble/host/src/ble_gattc.c                | 13 +++--
 net/nimble/host/test/src/ble_att_clt_test.c    |  8 +--
 net/nimble/host/test/src/ble_att_svr_test.c    | 20 ++++----
 net/nimble/host/test/src/ble_gatt_write_test.c | 10 ++--
 9 files changed, 99 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ac149625/net/nimble/host/src/ble_gattc.c
----------------------------------------------------------------------


[2/6] incubator-mynewt-core git commit: nimble: fix send cancel pending writes on error

Posted by cc...@apache.org.
nimble: fix send cancel pending writes on error

Changed the cur_attr range check, because cur_attr is still 0 when first
response is received.

With this patch it is possible to pass TC_GAW_CL_BI_32_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/4a9c7e6f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/4a9c7e6f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/4a9c7e6f

Branch: refs/heads/develop
Commit: 4a9c7e6fbc40243fa74af34784b0ed53fae2533c
Parents: 48bce39
Author: Micha\u0142 Narajowski <mi...@codecoup.pl>
Authored: Fri Dec 30 11:11:16 2016 +0100
Committer: Micha\u0142 Narajowski <mi...@codecoup.pl>
Committed: Fri Dec 30 11:26:25 2016 +0100

----------------------------------------------------------------------
 net/nimble/host/pts/pts-gatt.txt | 3 ++-
 net/nimble/host/src/ble_gattc.c  | 5 ++---
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4a9c7e6f/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 8d08356..cee3522 100644
--- a/net/nimble/host/pts/pts-gatt.txt
+++ b/net/nimble/host/pts/pts-gatt.txt
@@ -336,7 +336,8 @@ TC_GAW_CL_BI_30_C	PASS	b conn peer_addr=<addr>
 				b write long=1 conn=<handle> attr=<val_handle> value=aa
 				b term conn=<handle>
 TC_GAW_CL_BI_31_C	INC
-TC_GAW_CL_BI_32_C	INC
+TC_GAW_CL_BI_32_C	PASS	b conn peer_addr=<addr>
+				b write conn=<handle> attr=<val_handle1> value=<val> attr=<val_handle2> value=<val>
 TC_GAW_CL_BI_33_C	PASS	b conn peer_addr=<addr>
 				b write conn=<handle> attr=<val_handle> value=aa:bb
 				b term conn=<handle>

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4a9c7e6f/net/nimble/host/src/ble_gattc.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gattc.c b/net/nimble/host/src/ble_gattc.c
index c99facc..96c1d7c 100644
--- a/net/nimble/host/src/ble_gattc.c
+++ b/net/nimble/host/src/ble_gattc.c
@@ -4300,7 +4300,7 @@ ble_gattc_write_reliable_err(struct ble_gattc_proc *proc, int status,
     /* If we have successfully queued any data, and the failure occurred before
      * we could send the execute write command, then erase all queued data.
      */
-    if (proc->write_reliable.cur_attr > 0 &&
+    if (proc->write_reliable.cur_attr >= 0 &&
         proc->write_reliable.cur_attr < proc->write_reliable.num_attrs) {
 
         exec_req.baeq_flags = BLE_ATT_EXEC_WRITE_F_CANCEL;
@@ -4371,8 +4371,7 @@ ble_gattc_write_reliable_rx_prep(struct ble_gattc_proc *proc,
     return 0;
 
 err:
-    /* XXX: Might need to cancel pending writes. */
-    ble_gattc_write_reliable_cb(proc, rc, 0);
+    ble_gattc_write_reliable_err(proc, rc, 0);
     return BLE_HS_EDONE;
 }
 


[4/6] incubator-mynewt-core git commit: nimble: added missing descriptors

Posted by cc...@apache.org.
nimble: added missing descriptors

With this patch it is possible to pass TC_GAW_SR_BV_08_C,
TC_GAW_SR_BV_09_C, TC_GAW_SR_BV_27_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/fae2eb35
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/fae2eb35
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/fae2eb35

Branch: refs/heads/develop
Commit: fae2eb35c088aaa0f4ea3b9280932821fb80d3f7
Parents: e0421ec
Author: Micha\u0142 Narajowski <mi...@codecoup.pl>
Authored: Fri Dec 30 16:42:27 2016 +0100
Committer: Micha\u0142 Narajowski <mi...@codecoup.pl>
Committed: Fri Dec 30 16:42:27 2016 +0100

----------------------------------------------------------------------
 apps/bletiny/src/gatt_svr.c      | 20 ++++++++++++++++----
 net/nimble/host/pts/pts-gatt.txt |  8 ++++----
 2 files changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fae2eb35/apps/bletiny/src/gatt_svr.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/gatt_svr.c b/apps/bletiny/src/gatt_svr.c
index 5c69d8b..96f7aa8 100644
--- a/apps/bletiny/src/gatt_svr.c
+++ b/apps/bletiny/src/gatt_svr.c
@@ -42,8 +42,9 @@
 #define  PTS_CHR_READ_WRITE_AUTHEN       0x0008
 #define  PTS_DSC_READ                    0x0009
 #define  PTS_DSC_WRITE                   0x000a
-#define  PTS_DSC_READ_WRITE_ENC          0x000b
-#define  PTS_DSC_READ_WRITE_AUTHEN       0x000c
+#define  PTS_DSC_READ_WRITE              0x000b
+#define  PTS_DSC_READ_WRITE_ENC          0x000c
+#define  PTS_DSC_READ_WRITE_AUTHEN       0x000d
 
 #define  PTS_LONG_SVC                    0x0011
 #define  PTS_LONG_CHR_READ               0x0012
@@ -54,8 +55,9 @@
 #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_ENC     0x001a
-#define  PTS_LONG_DSC_READ_WRITE_AUTHEN  0x001b
+#define  PTS_LONG_DSC_READ_WRITE         0x001a
+#define  PTS_LONG_DSC_READ_WRITE_ENC     0x001b
+#define  PTS_LONG_DSC_READ_WRITE_AUTHEN  0x001c
 
 /**
  * The vendor specific security test service consists of two characteristics:
@@ -155,6 +157,10 @@ static const struct ble_gatt_svc_def gatt_svr_svcs[] = {
                         .access_cb = gatt_svr_access_test,
                         .att_flags = BLE_ATT_F_WRITE,
                     }, {
+                        .uuid128 = PTS_UUID(PTS_DSC_READ_WRITE),
+                        .access_cb = gatt_svr_access_test,
+                        .att_flags = BLE_ATT_F_READ | BLE_ATT_F_WRITE,
+                    }, {
                         .uuid128 = PTS_UUID(PTS_DSC_READ_WRITE_ENC),
                         .access_cb = gatt_svr_access_test,
                         .att_flags = BLE_ATT_F_READ | BLE_ATT_F_READ_ENC |
@@ -212,6 +218,10 @@ static const struct ble_gatt_svc_def gatt_svr_svcs[] = {
                         .access_cb = gatt_svr_long_access_test,
                         .att_flags = BLE_ATT_F_WRITE,
                     }, {
+                        .uuid128 = PTS_UUID(PTS_LONG_DSC_READ_WRITE),
+                        .access_cb = gatt_svr_long_access_test,
+                        .att_flags = BLE_ATT_F_READ | BLE_ATT_F_WRITE,
+                    }, {
                         .uuid128 = PTS_UUID(PTS_LONG_DSC_READ_WRITE_ENC),
                         .access_cb = gatt_svr_long_access_test,
                         .att_flags = BLE_ATT_F_READ | BLE_ATT_F_READ_ENC |
@@ -400,6 +410,7 @@ gatt_svr_access_test(uint16_t conn_handle, uint16_t attr_handle,
                                 &gatt_svr_pts_static_val, NULL);
         return rc;
 
+    case PTS_DSC_READ_WRITE:
     case PTS_DSC_READ_WRITE_ENC:
     case PTS_DSC_READ_WRITE_AUTHEN:
         if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_DSC) {
@@ -472,6 +483,7 @@ gatt_svr_long_access_test(uint16_t conn_handle, uint16_t attr_handle,
                                 &gatt_svr_pts_static_long_val, NULL);
         return rc;
 
+    case PTS_LONG_DSC_READ_WRITE:
     case PTS_LONG_DSC_READ_WRITE_ENC:
     case PTS_LONG_DSC_READ_WRITE_AUTHEN:
         if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_DSC) {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fae2eb35/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 a9c86d4..ee22812 100644
--- a/net/nimble/host/pts/pts-gatt.txt
+++ b/net/nimble/host/pts/pts-gatt.txt
@@ -391,7 +391,7 @@ TC_GAW_SR_BI_17_C	N/A
 TC_GAW_SR_BI_18_C	PASS	b adv
 TC_GAW_SR_BI_19_C	INC	
 TC_GAW_SR_BV_07_C	PASS	b adv
-TC_GAW_CL_BV_08_C	INC	- ATT Write returned an error.
+TC_GAW_SR_BV_08_C	PASS	b adv
 TC_GAW_SR_BI_20_C	PASS	b adv
 				<enter ffff>
 TC_GAW_SR_BI_21_C	PASS	b adv
@@ -399,19 +399,19 @@ TC_GAW_SR_BI_21_C	PASS	b adv
 TC_GAW_SR_BI_22_C	N/A
 TC_GAW_SR_BI_23_C	PASS	b adv
 TC_GAW_SR_BI_24_C	INC
-TC_GAW_SR_BV_09_C	INC	- cltReadCfm value convert to struct failed.
+TC_GAW_SR_BV_09_C	PASS	b adv
 TC_GAW_SR_BI_25_C	PASS	b adv
 				<enter ffff>
 TC_GAW_SR_BI_26_C	PASS	b adv
 				<enter dsc value handle without WRITE flag>
-TC_GAW_SR_BI_27_C	INC	- cltReadCfm value convert to struct failed.
+TC_GAW_SR_BI_27_C	PASS	b adv
 TC_GAW_SR_BI_29_C	N/A
 TC_GAW_SR_BI_30_C	PASS
 TC_GAW_SR_BI_31_C	INC	
 TC_GAW_SR_BI_32_C	PASS	b adv
 TC_GAW_SR_BI_33_C	PASS	b adv
 TC_GAW_SR_BI_34_C	PASS	b adv
-TC_GAW_SR_BI_35_C	INC	- cltReadCfm value convert to struct failed.
+TC_GAW_SR_BI_35_C	PASS	b adv
 -------------------------------------------------------------------------------
 
 TC_GAN_CL_BV_01_C	PASS	b conn peer_addr=<addr>


[5/6] incubator-mynewt-core git commit: nimble: fixed nested long writes

Posted by cc...@apache.org.
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\u0142 Narajowski <mi...@codecoup.pl>
Authored: Fri Dec 30 17:07:27 2016 +0100
Committer: Micha\u0142 Narajowski <mi...@codecoup.pl>
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