]> git.vomp.tv Git - vompclient.git/blob - src/telem.h
Tweaks to telemetry. Load IP/port from config
[vompclient.git] / src / telem.h
1 /*
2     Copyright 2024 Chris Tallon
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
18 */
19
20 #ifndef TELEM_H
21 #define TELEM_H
22
23 // Master telemetry enable. If 0 the code isn't included and all
24 // calls to TELEM() will be deleted by the preprocessor
25 #define TELEM_ENABLED 0
26
27 #if TELEM_ENABLED == 0
28   #define TELEM(x, y)
29 #else
30
31 #include <string>
32 #include "defines.h"
33 #include "udp4.h"
34
35 class Telemetry
36 {
37   public:
38     static void init();
39     static void message(u4 messageNumber, i4 data);
40     static void message(u4 messageNumber, i8 data);
41     static void message(u4 messageNumber, u8 data);
42
43   private:
44     static UDP4 udp;
45     static std::string telemReceiverIP;
46     static const char* ip;
47     static i4 telemPort;
48 };
49
50   #define TELEM(x, y) Telemetry::message(x, y)
51 #endif
52
53 #endif