aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-01-13 15:32:58 +0100
committerlonkaars <loek@pipeframe.xyz>2023-01-13 15:32:58 +0100
commitdba17944c70cf4e51a40e617a1ba6abc0fd1e65d (patch)
tree667ce85f3d11d29a56ffd740c207044987d2b268
parent81e1d54c33fedd3e297bbf812c36d628e8261056 (diff)
fix infinite loop
-rw-r--r--confui/mainwindow.cpp7
-rw-r--r--confui/mainwindow.h2
-rw-r--r--confui/ui_node.cpp2
-rw-r--r--confui/ui_node.h2
-rw-r--r--shared/protocol-tests/get-node-response-broken.src80
-rw-r--r--shared/protocol-tests/post-net-rm-d61c4e47-78ba-48cc-8000-000000000000.src21
6 files changed, 113 insertions, 1 deletions
diff --git a/confui/mainwindow.cpp b/confui/mainwindow.cpp
index 4fac1e9..20f61f1 100644
--- a/confui/mainwindow.cpp
+++ b/confui/mainwindow.cpp
@@ -73,13 +73,18 @@ void CDMainWindow::update() {
QAction *menu_port = menu_options_serialport->addAction(QString::fromStdString(port));
connect(menu_port, &QAction::triggered, this, [this, port]() { menu_set_serial_port(port); });
}
+}
+void CDMainWindow::update_net() {
cd_s_bin *msg = cd_cmd_gen_get_node(true, NULL);
cd_pclient_send(msg);
free(msg);
}
-void CDMainWindow::menu_refresh() { update(); }
+void CDMainWindow::menu_refresh() {
+ update_net();
+ update();
+}
void CDMainWindow::menu_add_automation() {
g_cd_mesh_connector->create_link();
diff --git a/confui/mainwindow.h b/confui/mainwindow.h
index 53a30c2..af52617 100644
--- a/confui/mainwindow.h
+++ b/confui/mainwindow.h
@@ -42,4 +42,6 @@ public:
virtual void menu_add_automation();
/** @brief menu bar set serial port action handler */
void menu_set_serial_port(string new_port);
+ /** @brief send get_node command to sync network state */
+ virtual void update_net();
};
diff --git a/confui/ui_node.cpp b/confui/ui_node.cpp
index f1175f6..2898c42 100644
--- a/confui/ui_node.cpp
+++ b/confui/ui_node.cpp
@@ -44,7 +44,9 @@ void CDNodeWidget::update() {
switch_on_off->setChecked(_node->light_on);
button_add_remove->setText(_node->provisioned ? "Remove from network" : "Join network");
+}
+void CDNodeWidget::update_net() {
cd_s_bin *msg = cd_cmd_gen_get_node(false, this->_node->uuid);
cd_pclient_send(msg);
free(msg);
diff --git a/confui/ui_node.h b/confui/ui_node.h
index eb07f6d..4c049b3 100644
--- a/confui/ui_node.h
+++ b/confui/ui_node.h
@@ -34,4 +34,6 @@ public:
virtual void toggle_provision();
/** @brief turn led on/off */
virtual void update_led(bool on);
+ /** @brief send get_node command to update self */
+ virtual void update_net();
};
diff --git a/shared/protocol-tests/get-node-response-broken.src b/shared/protocol-tests/get-node-response-broken.src
new file mode 100644
index 0000000..c3f5333
--- /dev/null
+++ b/shared/protocol-tests/get-node-response-broken.src
@@ -0,0 +1,80 @@
+00: ff ; FIXME: this is a 'real' network file that causes the qt client to crash
+01: 05
+02: 00
+03: 03
+04: 00
+05: 01
+06: 8f
+07: f8
+08: 00
+09: 46
+0a: 00
+0b: 02
+0c: 00
+0d: 42
+0e: d6
+0f: 1c
+10: 4e
+11: 47
+12: 78
+13: ba
+14: 48
+15: cc
+16: 80
+17: 00
+18: 00
+19: 00
+1a: 00
+1b: 00
+1c: 00
+1d: 00
+1e: 00
+1f: 00
+20: 00
+21: 00
+22: 00
+23: 00
+24: 00
+25: 00
+26: 00
+27: de
+28: ad
+29: be
+2a: ef
+2b: 00
+2c: 00
+2d: 00
+2e: 00
+2f: 51
+30: 6e
+31: d0
+32: e2
+33: c7
+34: fe
+35: 42
+36: bc
+37: 80
+38: 00
+39: 00
+3a: 00
+3b: 00
+3c: 00
+3d: 00
+3e: 00
+3f: 00
+40: 00
+41: 00
+42: 00
+43: 00
+44: 00
+45: 00
+46: 00
+47: 00
+48: de
+49: ad
+4a: be
+4b: ef
+4c: 00
+4d: 00
+4e: 00
+4f: 00
diff --git a/shared/protocol-tests/post-net-rm-d61c4e47-78ba-48cc-8000-000000000000.src b/shared/protocol-tests/post-net-rm-d61c4e47-78ba-48cc-8000-000000000000.src
new file mode 100644
index 0000000..d3b1260
--- /dev/null
+++ b/shared/protocol-tests/post-net-rm-d61c4e47-78ba-48cc-8000-000000000000.src
@@ -0,0 +1,21 @@
+00: ff ; start byte
+01: 04 ; post net opcode
+02: 00 ; message id
+03: 00 ; ^
+04: d6 ; uuid (d61c4e47-78ba-48cc-8000-000000000000)
+05: 1c ; ^
+06: 4e ; ^
+07: 47 ; ^
+08: 78 ; ^
+09: ba ; ^
+0a: 48 ; ^
+0b: cc ; ^
+0c: 80 ; ^
+0d: 00 ; ^
+0e: 00 ; ^
+0f: 00 ; ^
+10: 00 ; ^
+11: 00 ; ^
+12: 00 ; ^
+13: 00 ; ^
+14: 00 ; join network (false, leave)