--- /dev/null
+/*
+ Copyright 2024 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "log.h"
+
+#include "telem.h"
+
+UDP4 Telemetry::udp;
+
+void Telemetry::init()
+{
+#if TELEM_ENABLED
+ LogNT::getInstance()->debug("Telem", "Init");
+ udp.init(0);
+
+ // TODO load target IP / port from config
+
+#endif
+}
+
+void Telemetry::message(u4 messageNumber, i4 data)
+{
+ char* buffer;
+ asprintf(&buffer, "%c%c%c%c%i", 1, 1, 1, 1, data);
+ memcpy(buffer, (const void*)&messageNumber, 4);
+ udp.send("", 7777, buffer, strlen(&buffer[4])+4);
+ free(buffer);
+}
+
+void Telemetry::message(u4 messageNumber, i8 data)
+{
+ char* buffer;
+ asprintf(&buffer, "%c%c%c%c%lli", 1, 1, 1, 1, data);
+ memcpy(buffer, (const void*)&messageNumber, 4);
+ udp.send("", 7777, buffer, strlen(&buffer[4])+4);
+ free(buffer);
+}
+
+void Telemetry::message(u4 messageNumber, u8 data)
+{
+ char* buffer;
+ asprintf(&buffer, "%c%c%c%c%llu", 1, 1, 1, 1, data);
+ memcpy(buffer, (const void*)&messageNumber, 4);
+ udp.send("", 7777, buffer, strlen(&buffer[4])+4);
+ free(buffer);
+}
+
--- /dev/null
+/*
+ Copyright 2024 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+#ifndef TELEM_H
+#define TELEM_H
+
+#define TELEM_ENABLED 1
+
+#include "defines.h"
+
+#include "udp4.h"
+
+
+class Telemetry
+{
+ public:
+ static void init();
+ static void message(u4 messageNumber, i4 data);
+ static void message(u4 messageNumber, i8 data);
+ static void message(u4 messageNumber, u8 data);
+
+ private:
+ static UDP4 udp;
+};
+
+#if TELEM_ENABLED
+ #define TELEM(x, y) Telemetry::message(x, y)
+#else
+ #define TELEM(x, y)
+#endif
+
+
+
+#endif