diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-01-05 15:03:58 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-01-05 15:03:58 +0100 |
commit | 759d73e4ef0167c654535637488bdfcd423015a0 (patch) | |
tree | 6bf6dc0a1e332e2e346634ed15cde831a814b9a4 /confui | |
parent | 8294ed270bce6b563efc1859a8049e018818e1be (diff) |
improve parseability of get-nodes response
Diffstat (limited to 'confui')
-rw-r--r-- | confui/serial.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/confui/serial.cpp b/confui/serial.cpp index c0e686b..dd2a702 100644 --- a/confui/serial.cpp +++ b/confui/serial.cpp @@ -97,21 +97,26 @@ void cd_cmd_ping(cd_s_bin* data) { // free(response); // response = nullptr; - cd_uuid_t light_addrs[] = { + cd_uuid_t test_node_light_addrs[] = { { 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xde, 0xad, 0xbe, 0xef, 0x00, 0x00, 0x00, 0x00 }, }; - cd_s_cmd_node* test = cd_cmd_node_alloc("gert", { + cd_s_cmd_node* test_node = cd_cmd_node_alloc("gert", { .uuid = { 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xde, 0xad, 0xbe, 0xef, 0x00, 0x00, 0x00, 0x00 }, .address = { 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, }, .light_on = false, .provisioned = false, .button_pub = 0xdeadbeef, - }, 1, light_addrs); - cd_s_bin* testres = cd_cmd_res(CD_CMD_GET_NODE, 0xf88f, cd_cmd_node_sizeof(test), (uint8_t*) test); - free(test); + }, 1, test_node_light_addrs); - cd_pclient_send(testres); - free(testres); + cd_s_cmd_node* nodes[] = { test_node }; + cd_s_cmd_response_get_node* response_get_nodes = cd_cmd_get_node_res_from_node_arr(1, nodes); + free(test_node); + + cd_s_bin* response = cd_cmd_res(CD_CMD_GET_NODE, 0xf88f, cd_cmd_response_get_node_sizeof(response_get_nodes), (uint8_t*) response_get_nodes); + free(response_get_nodes); + + cd_pclient_send(response); + free(response); } void cd_cmd_response(cd_s_bin* data) { |