aboutsummaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/pclient.c9
-rw-r--r--shared/protocol.h8
2 files changed, 9 insertions, 8 deletions
diff --git a/shared/pclient.c b/shared/pclient.c
index 728bfa0..ff2315c 100644
--- a/shared/pclient.c
+++ b/shared/pclient.c
@@ -45,8 +45,8 @@ cd_s_bin* cd_cmd_gen_post_link_add(cd_uuid_t button, cd_uuid_t light, cd_e_cmd_l
msg->opcode = CD_CMD_POST_LINK;
msg->id = cd_bin_hton16(cd_protocol_fresh_message_id());
msg->add = true;
- memcpy(&msg->button, &button, sizeof(cd_uuid_t));
- memcpy(&msg->led, &light, sizeof(cd_uuid_t));
+ memcpy(msg->button, button, sizeof(cd_uuid_t));
+ memcpy(msg->led, light, sizeof(cd_uuid_t));
msg->type = type;
return bin;
@@ -58,8 +58,9 @@ cd_s_bin* cd_cmd_gen_post_link_rm(cd_uuid_t button, cd_uuid_t light) {
msg->opcode = CD_CMD_POST_LINK;
msg->id = cd_bin_hton16(cd_protocol_fresh_message_id());
msg->add = false;
- memcpy(&msg->button, &button, sizeof(cd_uuid_t));
- memcpy(&msg->led, &light, sizeof(cd_uuid_t));
+ memcpy(msg->button, button, sizeof(cd_uuid_t));
+ memcpy(msg->led, light, sizeof(cd_uuid_t));
+ msg->type = 0;
return bin;
}
diff --git a/shared/protocol.h b/shared/protocol.h
index cad9a1c..b9a2c93 100644
--- a/shared/protocol.h
+++ b/shared/protocol.h
@@ -60,9 +60,9 @@ typedef struct {
} cd_s_cmd_post_led;
typedef enum {
- CD_CMD_LINK_TYPE_TOGGLE = 0x00,
- CD_CMD_LINK_TYPE_TURN_ON = 0x01,
- CD_CMD_LINK_TYPE_TURN_OFF = 0x02,
+ CD_CMD_LINK_TYPE_TOGGLE = 0x00, /** @brief button toggles light */
+ CD_CMD_LINK_TYPE_TURN_ON = 0x01, /** @brief button always turns on light (regardless of previous state) */
+ CD_CMD_LINK_TYPE_TURN_OFF = 0x02, /** @brief button always turns off light (regardless of previous state) */
} cd_e_cmd_link_type;
typedef struct {
@@ -71,7 +71,7 @@ typedef struct {
cd_uuid_t button; /** @brief uuid of button node */
cd_uuid_t led; /** @brief uuid of led node */
cd_cmd_bool_t add; /** @brief `true` to create/overwrite link, `false` to remove link */
- cd_e_cmd_link_type type; /** @brief link type */
+ uint8_t type; /** @brief link type cd_e_cmd_link_type */
} cd_s_cmd_post_link;
typedef struct {