50 return "Data Provider";
85 if (j.contains(
"FileReader"))
117 std::unique_ptr<uart::protocol::Packet> packet =
nullptr;
118 std::shared_ptr<UbloxObs> obs;
121 while (!
eof() &&
read(
reinterpret_cast<char*
>(&i), 1))
123 packet =
_sensor.findPacket(i);
125 if (packet !=
nullptr)
131 if (!packet ||
eof())
137 if (packet->getRawDataLength() == 0)
143 obs = std::make_shared<UbloxObs>();
145 if (packet->type() != uart::protocol::Packet::Type::TYPE_BINARY) {
continue; };
147 if (!obs->insTime.empty())
159 LOG_DATA(
"{}: Could not set valid time. Skipping package.",
nameId());
179 constexpr uint16_t BUFFER_SIZE = 10;
181 std::array<char, BUFFER_SIZE> buffer{};
182 if (filestream.good())
184 filestream.read(buffer.data(), BUFFER_SIZE);
nlohmann::json json
json namespace
Utility class for logging to console and file.
#define LOG_DEBUG
Debug information. Should not be called on functions which receive observations (spamming)
#define LOG_DATA
All output which occurs repeatedly every time observations are received.
#define LOG_ERROR
Error occurred, which stops part of the program to work, but not everything.
#define LOG_TRACE
Detailled info to trace the execution of the program. Should not be called on functions which receive...
Keeps track of the current real/simulation time.
File Reader for ubx files.
Helper Functions to work with Ublox Sensors.
bool initialize()
Initialize the file reader.
void restore(const json &j)
Restores the node from a json object.
std::string _path
Path to the file.
FileType
File Type Enumeration.
auto eof() const
Check whether the end of file is reached.
auto & read(char *__s, std::streamsize __n)
Extraction without delimiters.
std::filesystem::path getFilepath()
Returns the path of the file.
@ PATH_CHANGED
The path changed and exists.
GuiResult guiConfig(const char *vFilters, const std::vector< std::string > &extensions, size_t id, const std::string &nameId)
ImGui config.
void resetReader()
Moves the read cursor to the start.
json save() const
Saves the node into a json object.
void deinitialize()
Deinitialize the file reader.
bool doDeinitialize(bool wait=false)
Asks the node worker to deinitialize the node.
ImVec2 _guiConfigDefaultWindowSize
Node(std::string name)
Constructor.
std::string nameId() const
Node name and id.
std::string name
Name of the Node.
bool doReinitialize(bool wait=false)
Asks the node worker to reinitialize the node.
void invokeCallbacks(size_t portIndex, const std::shared_ptr< const NodeData > &data)
Calls all registered callbacks on the specified output port.
bool _hasConfig
Flag if the config window should be shown.
~UbloxFile() override
Destructor.
static std::string typeStatic()
String representation of the Class Type.
void deinitialize() override
Deinitialize the node.
void guiConfig() override
ImGui config window which is shown on double click.
InsTime _lastObsTime
Last obs time.
vendor::ublox::UbloxUartSensor _sensor
Sensor Object.
std::string type() const override
String representation of the Class Type.
UbloxFile()
Default constructor.
static constexpr size_t OUTPUT_PORT_INDEX_UBLOX_OBS
Flow (UbloxObs)
std::shared_ptr< const NodeData > pollData()
Polls data from the file.
json save() const override
Saves the node into a json object.
static std::string category()
String representation of the Class Category.
FileType determineFileType() override
Determines the type of the file.
void restore(const json &j) override
Restores the node from a json object.
bool resetNode() override
Resets the node. Moves the read cursor to the start.
bool initialize() override
Initialize the node.
static std::string type()
Returns the type of the data class.
static constexpr uint8_t BINARY_SYNC_CHAR_2
b - Second sync character which begins a new binary message
static constexpr uint8_t ASCII_START_CHAR
Ascii character which begins a new ascii message.
static constexpr uint8_t BINARY_SYNC_CHAR_1
ยต - First sync character which begins a new binary message
OutputPin * CreateOutputPin(Node *node, const char *name, Pin::Type pinType, const std::vector< std::string > &dataIdentifier, OutputPin::PinData data=static_cast< void * >(nullptr), int idx=-1)
Create an Output Pin object.
void ApplyChanges()
Signals that there have been changes to the flow.
std::string getStringFromMsgId(UbxClass msgClass, uint8_t msgId)
Get the a string from a UBX Msg Id.
bool decryptUbloxObs(const std::shared_ptr< NAV::UbloxObs > &obs, uart::protocol::Packet &packet, const std::string &nameId)
Decrypts the provided Ublox observation.