0.2.0
Loading...
Searching...
No Matches
UartSensor.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
16#include <string>
17
18#include <fmt/ostream.h>
19#include <nlohmann/json.hpp>
20using json = nlohmann::json;
21
22namespace NAV
23{
26{
27 public:
42
44 ~UartSensor() = default;
46 UartSensor(const UartSensor&) = delete;
50 UartSensor& operator=(const UartSensor&) = delete;
53
54 protected:
56 UartSensor() = default;
57
59 [[nodiscard]] json save() const;
60
63 void restore(const json& j);
64
66 [[nodiscard]] Baudrate sensorBaudrate() const;
67
70 static int baudrate2Selection(Baudrate baud);
71
79 std::string _sensorPort;
80
83};
84
85} // namespace NAV
86
87#ifndef DOXYGEN_IGNORE
88
89template<>
90struct fmt::formatter<NAV::UartSensor::Baudrate> : ostream_formatter
91{};
92
93#endif
nlohmann::json json
json namespace
Definition FlowManager.hpp:21
Abstract Uart Sensor Class.
Definition UartSensor.hpp:26
Baudrate sensorBaudrate() const
Returns the Baudrate for the element Selected by the GUI.
int _selectedBaudrate
Baudrate for the sensor.
Definition UartSensor.hpp:82
UartSensor(const UartSensor &)=delete
Copy constructor.
std::string _sensorPort
Definition UartSensor.hpp:79
Baudrate
Available Baudrates.
Definition UartSensor.hpp:30
@ BAUDRATE_115200
Baudrate with 115200 symbols per second [Baud].
Definition UartSensor.hpp:36
@ BAUDRATE_57600
Baudrate with 57600 symbols per second [Baud].
Definition UartSensor.hpp:35
@ BAUDRATE_230400
Baudrate with 230400 symbols per second [Baud].
Definition UartSensor.hpp:38
@ BAUDRATE_FASTEST
Fastest possible Baudrate will be automatically chosen.
Definition UartSensor.hpp:31
@ BAUDRATE_128000
Baudrate with 128000 symbols per second [Baud].
Definition UartSensor.hpp:37
@ BAUDRATE_38400
Baudrate with 38400 symbols per second [Baud].
Definition UartSensor.hpp:34
@ BAUDRATE_9600
Baudrate with 9600 symbols per second [Baud].
Definition UartSensor.hpp:32
@ BAUDRATE_19200
Baudrate with 19200 symbols per second [Baud].
Definition UartSensor.hpp:33
@ BAUDRATE_921600
Baudrate with 921600 symbols per second [Baud].
Definition UartSensor.hpp:40
@ BAUDRATE_460800
Baudrate with 460800 symbols per second [Baud].
Definition UartSensor.hpp:39
UartSensor()=default
Default constructor.
UartSensor & operator=(UartSensor &&)=delete
Move assignment operator.
void restore(const json &j)
Restores the node from a json object.
static int baudrate2Selection(Baudrate baud)
Returns the guiSelection for the given baudrate.
UartSensor & operator=(const UartSensor &)=delete
Copy assignment operator.
UartSensor(UartSensor &&)=delete
Move constructor.
~UartSensor()=default
Destructor.
json save() const
Saves the node into a json object.