0.4.1
Loading...
Searching...
No Matches
UartPacketConverter.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
9/// @file UartPacketConverter.hpp
10/// @brief Decrypts Uart packets
11/// @author T. Topp (topp@ins.uni-stuttgart.de)
12/// @author R. Lintz (r-lintz@gmx.de) (master thesis)
13/// @date 2022-06-13
14
15#pragma once
16
17#include <cstdint>
19
20namespace NAV
21{
22/// Decrypts Uart packets
24{
25 public:
26 /// @brief Default constructor
28 /// @brief Destructor
29 ~UartPacketConverter() override;
30 /// @brief Copy constructor
32 /// @brief Move constructor
34 /// @brief Copy assignment operator
36 /// @brief Move assignment operator
38
39 /// @brief String representation of the Class Type
40 [[nodiscard]] static std::string typeStatic();
41
42 /// @brief String representation of the Class Type
43 [[nodiscard]] std::string type() const override;
44
45 /// @brief String representation of the Class Category
46 [[nodiscard]] static std::string category();
47
48 /// @brief ImGui config window which is shown on double click
49 /// @attention Don't forget to set _hasConfig to true in the constructor of the node
50 void guiConfig() override;
51
52 /// @brief Saves the node into a json object
53 [[nodiscard]] json save() const override;
54
55 /// @brief Restores the node from a json object
56 /// @param[in] j Json object with the node state
57 void restore(const json& j) override;
58
59 private:
60 constexpr static size_t OUTPUT_PORT_INDEX_CONVERTED = 0; ///< @brief Flow
61 constexpr static size_t INPUT_PORT_INDEX_UART_PACKET = 0; ///< @brief Flow (UartPacket)
62 constexpr static size_t INPUT_PORT_INDEX_SYNC_IN = 1; ///< @brief Flow (SyncIn)
63
64 /// Enum specifying the type of the output message
65 enum OutputType : uint8_t
66 {
67 OutputType_UbloxObs, ///< Extract UbloxObs data
68 OutputType_EmlidObs, ///< Extract EmlidObs data
69 OutputType_WiFiObs, ///< Extract WiFiObs data
70 };
71
72 /// The selected output type in the GUI
74
75 /// Show the SyncIn Pin
76 bool _syncInPin = false;
77
78 /// Last received syncInCnt
79 int64_t _lastSyncInCnt = 0;
80
81 /// Last received syncOutCnt
82 int64_t _lastSyncOutCnt = 0;
83
84 /// Corrected SyncOut counter in case of a reset (initiator)
85 int64_t _syncOutCntCorr = 0;
86
87 /// Corrected SyncIn counter in case of a reset (target)
88 int64_t _syncInCntCorr = 0;
89
90 /// @brief Initialize the node
91 bool initialize() override;
92
93 /// @brief Converts the UartPacket to the selected message type
94 /// @param[in] queue Queue with all the received data messages
95 /// @param[in] pinIdx Index of the pin the data is received on
96 void receiveObs(InputPin::NodeDataQueue& queue, size_t pinIdx);
97};
98
99} // namespace NAV
nlohmann::json json
json namespace
Node Class.
TsDeque< std::shared_ptr< const NAV::NodeData > > NodeDataQueue
Node data queue type.
Definition Pin.hpp:707
Node(std::string name)
Constructor.
Definition Node.cpp:30
static std::string category()
String representation of the Class Category.
json save() const override
Saves the node into a json object.
UartPacketConverter & operator=(UartPacketConverter &&)=delete
Move assignment operator.
bool _syncInPin
Show the SyncIn Pin.
void restore(const json &j) override
Restores the node from a json object.
UartPacketConverter()
Default constructor.
OutputType _outputType
The selected output type in the GUI.
int64_t _syncOutCntCorr
Corrected SyncOut counter in case of a reset (initiator)
static constexpr size_t INPUT_PORT_INDEX_UART_PACKET
Flow (UartPacket)
UartPacketConverter(const UartPacketConverter &)=delete
Copy constructor.
UartPacketConverter(UartPacketConverter &&)=delete
Move constructor.
bool initialize() override
Initialize the node.
static constexpr size_t OUTPUT_PORT_INDEX_CONVERTED
Flow.
int64_t _lastSyncOutCnt
Last received syncOutCnt.
UartPacketConverter & operator=(const UartPacketConverter &)=delete
Copy assignment operator.
void guiConfig() override
ImGui config window which is shown on double click.
static std::string typeStatic()
String representation of the Class Type.
~UartPacketConverter() override
Destructor.
OutputType
Enum specifying the type of the output message.
@ OutputType_UbloxObs
Extract UbloxObs data.
@ OutputType_EmlidObs
Extract EmlidObs data.
@ OutputType_WiFiObs
Extract WiFiObs data.
static constexpr size_t INPUT_PORT_INDEX_SYNC_IN
Flow (SyncIn)
std::string type() const override
String representation of the Class Type.
void receiveObs(InputPin::NodeDataQueue &queue, size_t pinIdx)
Converts the UartPacket to the selected message type.
int64_t _lastSyncInCnt
Last received syncInCnt.
int64_t _syncInCntCorr
Corrected SyncIn counter in case of a reset (target)