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/05/18 23:59:18 UTC
[6/9] incubator-mynewt-core git commit: MYNEWT-754 BLE Host - Support
deleting of CCCDs.
MYNEWT-754 BLE Host - Support deleting of CCCDs.
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/c24413e1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/c24413e1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/c24413e1
Branch: refs/heads/master
Commit: c24413e1106042015a693713305f046845169a2e
Parents: fd6da96
Author: Christopher Collins <cc...@apache.org>
Authored: Thu May 11 17:02:28 2017 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Thu May 11 18:04:41 2017 -0700
----------------------------------------------------------------------
net/nimble/host/store/ram/src/ble_store_ram.c | 26 ++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/c24413e1/net/nimble/host/store/ram/src/ble_store_ram.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/store/ram/src/ble_store_ram.c b/net/nimble/host/store/ram/src/ble_store_ram.c
index 058f08a..e6b2950 100644
--- a/net/nimble/host/store/ram/src/ble_store_ram.c
+++ b/net/nimble/host/store/ram/src/ble_store_ram.c
@@ -322,6 +322,28 @@ ble_store_ram_find_cccd(const struct ble_store_key_cccd *key)
}
static int
+ble_store_ram_delete_cccd(const struct ble_store_key_cccd *key_cccd)
+{
+ int idx;
+ int rc;
+
+ idx = ble_store_ram_find_cccd(key_cccd);
+ if (idx == -1) {
+ return BLE_HS_ENOENT;
+ }
+
+ rc = ble_store_ram_delete_obj(ble_store_ram_cccds,
+ sizeof *ble_store_ram_cccds,
+ idx,
+ &ble_store_ram_num_cccds);
+ if (rc != 0) {
+ return rc;
+ }
+
+ return 0;
+}
+
+static int
ble_store_ram_read_cccd(const struct ble_store_key_cccd *key_cccd,
struct ble_store_value_cccd *value_cccd)
{
@@ -450,8 +472,8 @@ ble_store_ram_delete(int obj_type, const union ble_store_key *key)
return rc;
case BLE_STORE_OBJ_TYPE_CCCD:
- /* XXX: There is no good reason not to support this. */
- return BLE_HS_ENOTSUP;
+ rc = ble_store_ram_delete_cccd(&key->cccd);
+ return rc;
default:
return BLE_HS_ENOTSUP;