summaryrefslogtreecommitdiff
path: root/mesh/mesh-config-json.c
diff options
context:
space:
mode:
authorInga Stotland <inga.stotland@intel.com>2020-05-08 17:00:23 -0700
committerBrian Gix <brian.gix@intel.com>2020-05-14 09:12:56 -0700
commit8a382262125787caf38a1f800ec8956a1bf71d85 (patch)
treefce31876da2494dd5beef32c22381ebecec641a3 /mesh/mesh-config-json.c
parentb91f6f0be34386d4e5e0deebf32ec5a4301e5303 (diff)
downloadbluez-8a382262125787caf38a1f800ec8956a1bf71d85.tar.gz
mesh: Allow updating CID, PID, VID & CRPL on node attach
This allows to update settings of the following composition fields when an existing node (application) attaches to the daemon: Company ID (CID), Product ID (PID), Versioin ID (VID), CRPL (replay protection depth)
Diffstat (limited to 'mesh/mesh-config-json.c')
-rw-r--r--mesh/mesh-config-json.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/mesh/mesh-config-json.c b/mesh/mesh-config-json.c
index ce7058b5a..9ac3979f8 100644
--- a/mesh/mesh-config-json.c
+++ b/mesh/mesh-config-json.c
@@ -2057,6 +2057,38 @@ bool mesh_config_write_ttl(struct mesh_config *cfg, uint8_t ttl)
return save_config(cfg->jnode, cfg->node_dir_path);
}
+bool mesh_config_update_company_id(struct mesh_config *cfg, uint16_t cid)
+{
+ if (!cfg || !write_uint16_hex(cfg->jnode, "cid", cid))
+ return false;
+
+ return save_config(cfg->jnode, cfg->node_dir_path);
+}
+
+bool mesh_config_update_product_id(struct mesh_config *cfg, uint16_t pid)
+{
+ if (!cfg || !write_uint16_hex(cfg->jnode, "pid", pid))
+ return false;
+
+ return save_config(cfg->jnode, cfg->node_dir_path);
+}
+
+bool mesh_config_update_version_id(struct mesh_config *cfg, uint16_t vid)
+{
+ if (!cfg || !write_uint16_hex(cfg->jnode, "vid", vid))
+ return false;
+
+ return save_config(cfg->jnode, cfg->node_dir_path);
+}
+
+bool mesh_config_update_crpl(struct mesh_config *cfg, uint16_t crpl)
+{
+ if (!cfg || !write_uint16_hex(cfg->jnode, "crpl", crpl))
+ return false;
+
+ return save_config(cfg->jnode, cfg->node_dir_path);
+}
+
static bool load_node(const char *fname, const uint8_t uuid[16],
mesh_config_node_func_t cb, void *user_data)
{