Skip to contentSkip to conversation

tools/mesh-cfgclient: Save node's composition in config

PATCH New Inga Stotland 1 participant 1 message May 8, 2020 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tools/mesh-cfgclient: Save node's composition in config

Store remote node's composition after successful completion of "composition-get" command (config menu).
Show model IDs when printing node info for "list-nodes" command (main menu).

---
 tools/mesh/cfgcli.c  |   2 +
 tools/mesh/mesh-db.c | 287 ++++++++++++++++++++++++++++++++++++++++---
 tools/mesh/mesh-db.h |  10 +-
 tools/mesh/remote.c  |  93 +++++++++++++-
 tools/mesh/remote.h  |   2 +
 5 files changed, 367 insertions(+), 27 deletions(-)
tools/mesh/cfgcli.c +2 -0
index b96c6c9e6..218e82c50 100644
@@ -434,6 +434,8 @@ static bool msg_recvd(uint16_t src, uint16_t idx, uint8_t *data,
 
 		print_composition(data, len);
 
+		if (!mesh_db_node_set_composition(src, data, len))
+			bt_shell_printf("Failed to save node composition!\n");
 		break;
 
 	case OP_APPKEY_STATUS:
tools/mesh/mesh-db.c +270 -17

334 lines not on this page · raw message

tools/mesh/mesh-db.h +5 -5
index 1f9e4e3d3..89c644400 100644
@@ -38,11 +38,11 @@ bool mesh_db_get_addr_range(uint16_t *low, uint16_t *high);
 bool mesh_db_add_node(uint8_t uuid[16], uint8_t num_els, uint16_t unicast,
 							uint16_t net_idx);
 bool mesh_db_del_node(uint16_t unicast);
-bool mesh_db_node_set_composition(uint16_t unicast, uint16_t cid, uint16_t pid,
-						uint16_t vid, uint16_t crpl,
-						struct mesh_config_modes modes,
-						struct l_queue *elements);
-
+bool mesh_db_node_set_composition(uint16_t unicast, uint8_t *data,
+								uint16_t len);
+bool mesh_db_add_provisioner(const char *name, uint8_t uuid[16],
+				uint16_t unicast_low, uint16_t unicast_high,
+				uint16_t group_low, uint16_t group_high);
 bool mesh_db_node_set_net_transmit(uint16_t unicast, uint8_t cnt,
 							uint16_t interval);
 bool mesh_db_node_net_key_add(uint16_t unicast, uint16_t idx);
tools/mesh/remote.c +88 -5

156 lines not on this page · raw message

tools/mesh/remote.h +2 -0
index 63382ed90..33398c8bd 100644
@@ -20,6 +20,8 @@
 bool remote_add_node(const uint8_t uuid[16], uint16_t unicast,
 					uint8_t ele_cnt, uint16_t net_idx);
 uint8_t remote_del_node(uint16_t unicast);
+bool remote_set_model(uint16_t unicast, uint8_t ele_idx, uint32_t mod_id,
+								bool vendor);
 uint16_t remote_get_next_unicast(uint16_t low, uint16_t high, uint8_t ele_cnt);
 bool remote_add_net_key(uint16_t addr, uint16_t net_idx);
 bool remote_del_net_key(uint16_t addr, uint16_t net_idx);
Signature · 1 line
2.21.3