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/01/20 23:24:56 UTC
[4/4] incubator-mynewt-larva git commit: Add function for local
attribute write.
Add function for local attribute write.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/fe475640
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/fe475640
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/fe475640
Branch: refs/heads/master
Commit: fe4756407c986127debe96f691c573c49e1c8df8
Parents: 0fa4e7f
Author: Christopher Collins <cc...@gmail.com>
Authored: Wed Jan 20 14:20:05 2016 -0800
Committer: Christopher Collins <cc...@gmail.com>
Committed: Wed Jan 20 14:24:44 2016 -0800
----------------------------------------------------------------------
net/nimble/host/include/host/ble_att.h | 3 +++
net/nimble/host/src/ble_att_svr.c | 22 ++++++++++++++++++++++
2 files changed, 25 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/fe475640/net/nimble/host/include/host/ble_att.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/include/host/ble_att.h b/net/nimble/host/include/host/ble_att.h
index 949c963..6d7300c 100644
--- a/net/nimble/host/include/host/ble_att.h
+++ b/net/nimble/host/include/host/ble_att.h
@@ -112,6 +112,9 @@ typedef int ble_att_svr_notify_fn(uint16_t conn_handle, uint16_t attr_handle,
uint8_t *attr_val, uint16_t attr_len,
void *arg);
+int ble_att_svr_write_local(uint16_t attr_handle, void *data,
+ uint16_t data_len);
+
void ble_att_set_notify_cb(ble_att_svr_notify_fn *cb, void *cb_arg);
#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/fe475640/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 236751a..e92f4b9 100644
--- a/net/nimble/host/src/ble_att_svr.c
+++ b/net/nimble/host/src/ble_att_svr.c
@@ -2072,6 +2072,28 @@ err:
return rc;
}
+int
+ble_att_svr_write_local(uint16_t attr_handle, void *data, uint16_t data_len)
+{
+ struct ble_att_svr_access_ctxt ctxt;
+ struct ble_att_svr_entry *entry;
+ int rc;
+
+ entry = NULL;
+ rc = ble_att_svr_find_by_handle(attr_handle, &entry);
+ if (rc != 0) {
+ return rc;
+ }
+
+ ctxt.attr_data = data;
+ ctxt.data_len = data_len;
+ ctxt.offset = 0;
+
+ rc = ble_att_svr_write(NULL, entry, &ctxt, NULL);
+
+ return rc;
+}
+
static void
ble_att_svr_prep_free(struct ble_att_prep_entry *entry)
{