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 2016/05/25 19:16:56 UTC

[3/9] incubator-mynewt-core git commit: BLE Host - Much needed comment re: CCCD persist.

BLE Host - Much needed comment re: CCCD persist.


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

Branch: refs/heads/develop
Commit: ce14aee034e46d88e2df9214c9a00c6d74406ab3
Parents: 355103a
Author: Christopher Collins <cc...@apache.org>
Authored: Tue May 24 18:47:52 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Wed May 25 12:16:46 2016 -0700

----------------------------------------------------------------------
 net/nimble/host/src/ble_gatts.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ce14aee0/net/nimble/host/src/ble_gatts.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gatts.c b/net/nimble/host/src/ble_gatts.c
index 149b1bc..2d53519 100644
--- a/net/nimble/host/src/ble_gatts.c
+++ b/net/nimble/host/src/ble_gatts.c
@@ -527,9 +527,29 @@ ble_gatts_clt_cfg_find(struct ble_gatts_clt_cfg *cfgs,
     }
 }
 
+/**
+ * Performs a read or write access on a client characteritic configuration
+ * descriptor (CCCD).
+ *
+ * @param conn                  The connection of the peer doing the accessing.
+ * @apram attr_handle           The handle of the CCCD.
+ * @param att_op                The ATT operation being performed (read or
+ *                                  write).
+ * @param ctxt                  Communication channel between this function and
+ *                                  the caller within the nimble stack.
+ *                                  Semantics depends on the operation being
+ *                                  performed.
+ * @param out_cccd              If the CCCD should be persisted as a result of
+ *                                  the access, the data-to-be-persisted gets
+ *                                  written here.  If no persistence is
+ *                                  necessary, out_cccd->chr_val_handle is set
+ *                                  to 0.
+ *
+ * @return                      0 on success; nonzero on failure.
+ */
 static int
 ble_gatts_clt_cfg_access_locked(struct ble_hs_conn *conn, uint16_t attr_handle,
-                                uint8_t *uuid128, uint8_t att_op,
+                                uint8_t att_op,
                                 struct ble_att_svr_access_ctxt *ctxt,
                                 struct ble_store_value_cccd *out_cccd)
 {
@@ -617,12 +637,13 @@ ble_gatts_clt_cfg_access(uint16_t conn_handle, uint16_t attr_handle,
     if (conn == NULL) {
         rc = BLE_ATT_ERR_UNLIKELY;
     } else {
-        rc = ble_gatts_clt_cfg_access_locked(conn, attr_handle, uuid128, op,
-                                             ctxt, &cccd_value);
+        rc = ble_gatts_clt_cfg_access_locked(conn, attr_handle, op, ctxt,
+                                             &cccd_value);
     }
 
     ble_hs_unlock();
 
+    /* Persist the CCCD if required. */
     if (rc == 0 && cccd_value.chr_val_handle != 0) {
         if (cccd_value.flags == 0) {
             ble_store_key_from_value_cccd(&cccd_key, &cccd_value);