Skip to contentSkip to conversation

mesh: Store node state variables prior to response

PATCH New Brian Gix 1 participant 1 message Mar 21, 2019 1 message not in the archive Bluetooth drivers

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Brian Gix

author
#1 lore raw

PATCH 1/1 mesh: Store node state variables prior to response

Remotely set node state variables need to be saved to the file system or other NVM prior to returning success status.

---
 mesh/node.c    |  4 +--
 mesh/storage.c | 99 ++++++++++++++++++++++++++++++++++++++++++++--------------
 mesh/storage.h |  9 +++---
 3 files changed, 83 insertions(+), 29 deletions(-)
mesh/node.c +2 -2
index 761a67af4..af8eb6bb8 100644
@@ -497,7 +497,7 @@ bool node_default_ttl_set(struct mesh_node *node, uint8_t ttl)
 	if (!node)
 		return false;
 
-	res = storage_set_ttl(node->jconfig, ttl);
+	res = storage_set_ttl(node, ttl);
 
 	if (res) {
 		node->ttl = ttl;
@@ -621,7 +621,7 @@ bool node_relay_mode_set(struct mesh_node *node, bool enable, uint8_t cnt,
 	if (!node || node->relay.mode == MESH_MODE_UNSUPPORTED)
 		return false;
 
-	res = storage_set_relay(node->jconfig, enable, cnt, interval);
+	res = storage_set_relay(node, enable, cnt, interval);
 
 	if (res) {
 		node->relay.mode = enable ? MESH_MODE_ENABLED :
mesh/storage.c +76 -23

190 lines not on this page · raw message

mesh/storage.h +5 -4
index 8b14c8e8e..d71d11b8e 100644
@@ -28,12 +28,13 @@ void storage_save_config(struct mesh_node *node, bool no_wait,
 bool storage_model_bind(struct mesh_node *node, uint16_t addr, uint32_t id,
 						uint16_t app_idx, bool unbind);
 
-bool storage_set_ttl(json_object *jnode, uint8_t ttl);
-bool storage_set_relay(json_object *jnode, bool enable, uint8_t count,
+bool storage_set_ttl(struct mesh_node *node, uint8_t ttl);
+bool storage_set_relay(struct mesh_node *node, bool enable, uint8_t count,
 							uint8_t interval);
-bool storage_set_transmit_params(json_object *jnode, uint8_t count,
+bool storage_set_transmit_params(struct mesh_node *node, uint8_t count,
 							uint8_t interval);
-bool storage_set_mode(json_object *jnode, uint8_t mode, const char *mode_name);
+bool storage_set_mode(struct mesh_node *node, uint8_t mode,
+						const char *mode_name);
 bool storage_net_key_add(struct mesh_net *net, uint16_t net_idx,
 					const uint8_t key[16], bool update);
 bool storage_net_key_del(struct mesh_net *net, uint16_t net_idx);
Signature · 1 line
2.14.5