0.2.0
Loading...
Searching...
No Matches
udpSend.hpp
Go to the documentation of this file.
1// This file is part of INSTINCT, the INS Toolkit for Integrated
2// Navigation Concepts and Training by the Institute of Navigation of
3// the University of Stuttgart, Germany.
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
13
14#pragma once
15
17
19#include <boost/asio.hpp>
20#include <string>
21
22namespace NAV
23{
25class UdpSend : public Node
26{
27 public:
31 ~UdpSend() override;
33 UdpSend(const UdpSend&) = delete;
35 UdpSend(UdpSend&&) = delete;
37 UdpSend& operator=(const UdpSend&) = delete;
40
42 [[nodiscard]] static std::string typeStatic();
43
45 [[nodiscard]] std::string type() const override;
46
48 [[nodiscard]] static std::string category();
49
52 void guiConfig() override;
53
55 [[nodiscard]] json save() const override;
56
59 void restore(const json& j) override;
60
62 bool resetNode() override;
63
64 private:
65 constexpr static size_t INPUT_PORT_INDEX_NODE_DATA = 0;
66
68 bool initialize() override;
69
71 void deinitialize() override;
72
76 void receivePosVelAtt(InputPin::NodeDataQueue& queue, size_t pinIdx);
77
79 std::array<int, 4> _ip{};
80
82 int _port = 4567;
83
85 static constexpr std::array<int, 2> IP_LIMITS = { 0, 255 };
87 static constexpr std::array<int, 2> PORT_LIMITS = { 0, 65535 };
88
90 boost::asio::io_context _io_context;
92 boost::asio::ip::udp::socket _socket;
94 boost::asio::ip::udp::resolver _resolver;
96 boost::asio::ip::udp::resolver::results_type _endpoints;
97};
98} // namespace NAV
nlohmann::json json
json namespace
Definition FlowManager.hpp:21
Node Class.
Position, Velocity and Attitude Storage Class.
Abstract parent class for all nodes.
Definition Node.hpp:86
UDP Client.
Definition udpSend.hpp:26
UdpSend & operator=(UdpSend &&)=delete
Move assignment operator.
UdpSend()
Default constructor.
bool resetNode() override
Resets the node. Moves the read cursor to the start.
std::string type() const override
String representation of the Class Type.
void restore(const json &j) override
Restores the node from a json object.
void guiConfig() override
ImGui config window which is shown on double click.
UdpSend(UdpSend &&)=delete
Move constructor.
UdpSend(const UdpSend &)=delete
Copy constructor.
static std::string category()
String representation of the Class Category.
UdpSend & operator=(const UdpSend &)=delete
Copy assignment operator.
json save() const override
Saves the node into a json object.
~UdpSend() override
Destructor.
static std::string typeStatic()
String representation of the Class Type.