Debian Codegraph @

Hardware/CS2Udp.h

raw symbols SCIP
1 /*
2 RailControl - Model Railway Control Software
3
4 Copyright (c) 2017-2025 by Teddy / Dominik Mahrer - www.railcontrol.org
5
6 RailControl is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 3, or (at your option) any
9 later version.
10
11 RailControl is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 See the GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with RailControl; see the file LICENCE. If not see
18 <http://www.gnu.org/licenses/>.
19 */
20
21 #pragma once
22
23 #include "Hardware/HardwareParams.h"
24 #include "Hardware/Protocols/MaerklinCAN.h"
25 #include "Logger/Logger.h"
26 #include "Network/UdpConnection.h"
27
28 namespace Hardware
29 {
30 class CS2Udp : protected Protocols::MaerklinCAN
31 {
32 public:
33 CS2Udp() = delete;
34 CS2Udp(const CS2Udp&) = delete;
35 CS2Udp& operator=(const CS2Udp&) = delete;
36
37 CS2Udp(const HardwareParams* params);
38
39 ~CS2Udp();
40
41 static void GetArgumentTypesAndHint(std::map<unsigned char,ArgumentType>& argumentTypes, std::string& hint)
42 {
43 argumentTypes[1] = ArgumentTypeIpAddress;
44 argumentTypes[2] = ArgumentTypeMainSecundary;
45 hint = Languages::GetText(Languages::TextHintCs2Udp);
46 }
47
48 private:
49 Network::UdpConnection senderConnection;
50 Network::UdpConnection receiverConnection;
51
52 void Send(const unsigned char* buffer) override;
53 void Receiver() override;
54
55 static const unsigned short CS2SenderPort = 15731;
56 static const unsigned short CS2ReceiverPort = 15730;
57 };
58
59 } // namespace
60