aboutsummaryrefslogtreecommitdiff
path: root/client/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/commands.c')
-rw-r--r--client/commands.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/client/commands.c b/client/commands.c
index 18373f6..778e9c1 100644
--- a/client/commands.c
+++ b/client/commands.c
@@ -15,42 +15,41 @@ void w2_send_bin(w2_s_bin *data) {
}
}
-w2_s_bin *w2_send_mode(w2_e_mode mode) {
- W2_CREATE_MSG_BIN(w2_s_cmd_mode_rx, msg, msg_bin);
-
- msg->opcode = W2_CMD_MODE | W2_CMDDIR_RX;
- msg->mode = mode;
+void w2_send_info() {
+ W2_CREATE_MSG_BIN(w2_s_cmd_info_rx, msg, msg_bin);
+ msg->opcode = W2_CMD_INFO | W2_CMDDIR_RX;
w2_send_bin(msg_bin);
free(msg_bin);
- return NULL;
}
-w2_s_bin *w2_send_dirc(uint16_t left, uint16_t right) {
+void w2_send_dirc(uint16_t left, uint16_t right) {
W2_CREATE_MSG_BIN(w2_s_cmd_dirc_rx, msg, msg_bin);
msg->opcode = W2_CMD_DIRC | W2_CMDDIR_RX;
msg->left = w2_bin_hton16(left);
msg->right = w2_bin_hton16(right);
- w2_send_bin(msg_bin);
- free(msg_bin);
- return NULL;
-}
-w2_s_bin *w2_send_info() {
- W2_CREATE_MSG_BIN(w2_s_cmd_info_rx, msg, msg_bin);
- msg->opcode = W2_CMD_INFO | W2_CMDDIR_RX;
w2_send_bin(msg_bin);
free(msg_bin);
- return NULL;
}
-w2_s_bin *w2_send_ping() {
+void w2_send_ping() {
+ g_w2_state.ping_id = (uint8_t)rand();
W2_CREATE_MSG_BIN(w2_s_cmd_ping_rx, msg, msg_bin);
msg->opcode = W2_CMD_PING | W2_CMDDIR_RX;
msg->id = g_w2_state.ping_id;
+
w2_send_bin(msg_bin);
free(msg_bin);
w2_timer_start(W2_TIMER_PING);
- return NULL;
+}
+
+void w2_send_mode(w2_e_mode mode) {
+ W2_CREATE_MSG_BIN(w2_s_cmd_mode_rx, msg, msg_bin);
+ msg->opcode = W2_CMD_MODE | W2_CMDDIR_RX;
+ msg->mode = mode;
+
+ w2_send_bin(msg_bin);
+ free(msg_bin);
}