41 return "UartDataLogger";
78 if (j.contains(
"FileWriter"))
105 auto obs = std::static_pointer_cast<const UartPacket>(queue.
extract_front());
107 if (obs->raw.getRawDataLength() > 0)
109 _filestream.write(
reinterpret_cast<const char*
>(obs->raw.getRawData().data()),
static_cast<std::streamsize
>(obs->raw.getRawDataLength()));
113 LOG_ERROR(
"{}: Tried to write binary, but observation had no binary data.",
nameId());
nlohmann::json json
json namespace
Utility class for logging to console and file.
#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...
Data Logger for Uart packets.
UART Packet storage class.
FileType _fileType
File Type.
void deinitialize()
Deinitialize the file reader.
bool guiConfig(const char *vFilters, const std::vector< std::string > &extensions, size_t id, const std::string &nameId)
ImGui config.
void restore(const json &j)
Restores the node from a json object.
json save() const
Saves the node into a json object.
bool initialize()
Initialize the file reader.
std::ofstream _filestream
File stream to write the file.
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 _hasConfig
Flag if the config window should be shown.
auto extract_front()
Returns a copy of the first element in the container and removes it from the container.
UartDataLogger()
Default constructor.
static std::string category()
String representation of the Class Category.
void guiConfig() override
ImGui config window which is shown on double click.
static std::string typeStatic()
String representation of the Class Type.
json save() const override
Saves the node into a json object.
void flush() override
Function called by the flow executer after finishing to flush out remaining data.
void restore(const json &j) override
Restores the node from a json object.
std::string type() const override
String representation of the Class Type.
bool initialize() override
Initialize the node.
void deinitialize() override
Deinitialize the node.
void writeObservation(InputPin::NodeDataQueue &queue, size_t pinIdx)
Write Observation to the file.
~UartDataLogger() override
Destructor.
static std::string type()
Returns the type of the data class.
InputPin * CreateInputPin(Node *node, const char *name, Pin::Type pinType, const std::vector< std::string > &dataIdentifier={}, InputPin::Callback callback=static_cast< InputPin::FlowFirableCallbackFunc >(nullptr), InputPin::FlowFirableCheckFunc firable=nullptr, int priority=0, int idx=-1)
Create an Input Pin object.
void ApplyChanges()
Signals that there have been changes to the flow.