diff options
Diffstat (limited to 'confui/mesh_connector.h')
-rw-r--r-- | confui/mesh_connector.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/confui/mesh_connector.h b/confui/mesh_connector.h new file mode 100644 index 0000000..070a83c --- /dev/null +++ b/confui/mesh_connector.h @@ -0,0 +1,51 @@ +#pragma once + +#include <stdint.h> +#include <vector> +#include <map> + +typedef uint32_t cd_link_t; +typedef uint8_t cd_mac_addr_t[6]; + +using std::size_t; +using std::vector; +using std::map; + +enum cd_e_automation_type { + CD_AUTOMATION_TYPE_TOGGLE, + CD_AUTOMATION_TYPE_TURN_ON, + CD_AUTOMATION_TYPE_TURN_OFF, +}; + +typedef struct { + cd_mac_addr_t address; + size_t name_len; + char* name; + bool light_on; + bool provisioned; +} cd_s_node; + +typedef struct { + cd_e_automation_type type; + cd_s_node button; + cd_s_node light; +} cd_s_automation; + +class CDMeshConnector { +private: + vector<cd_s_node> _nodes; + map<cd_link_t, cd_s_automation> _links; +public: + CDMeshConnector(); + virtual ~CDMeshConnector(); + virtual void refresh_nodes_sync(); + virtual void refresh_config_sync(); + virtual vector<cd_s_node> get_nodes(); + virtual vector<cd_s_automation> get_config(); + virtual cd_link_t set_link(cd_mac_addr_t button, cd_mac_addr_t light); + virtual void remove_link(cd_link_t link_handle); + virtual cd_s_node* get_node_by_id(cd_mac_addr_t address); + virtual void set_node(cd_s_node* node_ptr, bool light_status); + virtual void node_join_network(cd_s_node* node_ptr); + virtual void node_remove_network(cd_s_node* node_ptr); +}; |