diff options
author | 2019-05-22 14:56:59 +0300 | |
---|---|---|
committer | 2019-05-22 14:56:59 +0300 | |
commit | 27992079c057ea068a355e01365800d77b7ace13 (patch) | |
tree | a78f18dd6e5faa298c26c93f490d02b51e4c7c39 | |
parent | 3fa7dd642af57b8b138e9a0d674c2d9960ebedf4 (diff) | |
download | usurpation-27992079c057ea068a355e01365800d77b7ace13.tar.gz usurpation-27992079c057ea068a355e01365800d77b7ace13.tar.bz2 usurpation-27992079c057ea068a355e01365800d77b7ace13.zip |
Protocol: attempted to fix stupids.
Signed-off-by: Ramūnas Mažeikis <ramunasnezinomas@gmail.com>
-rw-r--r--[-rwxr-xr-x] | include/udp.h | 30 | ||||
-rw-r--r-- | src/common/protocol.c (renamed from src/common/protocol.cpp) | 8 | ||||
-rw-r--r-- | src/device/protocol_device.c (renamed from src/device/protocol_device.ino) | 0 | ||||
-rw-r--r-- | src/device/udp.c (renamed from src/device/udp.ino) | 0 |
4 files changed, 19 insertions, 19 deletions
diff --git a/include/udp.h b/include/udp.h index 358e585..0bf43ff 100755..100644 --- a/include/udp.h +++ b/include/udp.h @@ -1,16 +1,16 @@ -#ifndef DEVICE_UDP_H
-#define DEVICE_UDP_H
-
-#include <ESP8266WiFi.h>
-#include <WiFiUdp.h>
-
-static const int com_port = 6996;
-IPAddress ip; /* Daemon IP */
-WiFiUDP Udp;
-
-extern void discover_client(const int port);
-extern void udp_init_packet(IPAddress ip, const int port);
-extern void udp_push(const void * const data, const size_t size);
-extern int udp_flush(void);
-
+#ifndef DEVICE_UDP_H +#define DEVICE_UDP_H + +#include <ESP8266WiFi.h> +#include <WiFiUdp.h> + +static const int com_port = 6996; +IPAddress ip; /* Daemon IP */ +WiFiUDP Udp; + +extern void discover_client(const int port); +extern void udp_init_packet(IPAddress ip, const int port); +extern void udp_push(const void * const data, const size_t size); +extern int udp_flush(void); + #endif /* DEVICE_UDP_H */
\ No newline at end of file diff --git a/src/common/protocol.cpp b/src/common/protocol.c index 135be37..43ff6a5 100644 --- a/src/common/protocol.cpp +++ b/src/common/protocol.c @@ -83,8 +83,8 @@ static int push_timestamp(cd_t connection, const char *data) static int push_request(cd_t connection, const char *data) { - return push_tlv_header(connection, REQUEST, sizeof(msg_idx_t)) - | push_bytes(connection, data, sizeof(msg_idx_t)); + return push_tlv_header(connection, REQUEST, sizeof(msg_idx_t)) + | push_bytes(connection, data, sizeof(msg_idx_t)); } static int push_reply(cd_t connection, const char *data) @@ -120,7 +120,7 @@ size_t tlv_count(const struct packet_data * const packet) return ret; } -size_t get_tlvs( const struct packet_data * const data, +size_t get_tlvs( const struct packet_data * const data, struct tlv *buf, size_t buf_size) { @@ -147,7 +147,7 @@ size_t parse_tlv(const char *data, size_t cursor, struct tlv *t) cursor += sizeof(enum tlv_type); t->length += READ_AS(enum tlv_type ,data + cursor); data += sizeof(size_t); - t->data = (void*)data + cursor; + t->data = data + cursor; return data + cursor - begin + 1UL; } diff --git a/src/device/protocol_device.ino b/src/device/protocol_device.c index 22e1be1..22e1be1 100644 --- a/src/device/protocol_device.ino +++ b/src/device/protocol_device.c diff --git a/src/device/udp.ino b/src/device/udp.c index b88f314..b88f314 100644 --- a/src/device/udp.ino +++ b/src/device/udp.c |