50 return "Data Provider";
85 if (j.contains(
"FileReader"))
114 auto obs = std::make_shared<WiFiObs>();
120 line.erase(line.begin(), std::ranges::find_if(line, [](
int ch) { return std::isgraph(ch); }));
128 std::stringstream lineStream(line);
131 uint16_t gpsCycle = 0;
132 uint16_t gpsWeek = 0;
133 long double gpsToW = 0.0;
136 bool gpsCycleSet =
false;
137 bool gpsWeekSet =
false;
138 bool gpsToWSet =
false;
139 bool macAddressSet =
false;
140 bool distanceSet =
false;
141 bool distanceStdSet =
false;
146 if (std::getline(lineStream, cell,
','))
149 cell.erase(std::ranges::find_if(cell, [](
int ch) {
return std::iscntrl(ch); }), cell.end());
155 if (column ==
"GpsCycle")
157 gpsCycle =
static_cast<uint16_t
>(std::stoul(cell));
160 else if (column ==
"GpsWeek")
162 gpsWeek =
static_cast<uint16_t
>(std::stoul(cell));
165 else if (column ==
"GpsToW [s]")
167 gpsToW = std::stold(cell);
170 else if (column ==
"MacAddress")
172 obs->macAddress = cell;
173 macAddressSet =
true;
175 else if (column ==
"Distance [m]")
177 obs->distance = std::stod(cell);
180 else if (column ==
"DistanceStd [m]")
182 obs->distanceStd = std::stod(cell);
183 distanceStdSet =
true;
188 if (!gpsCycleSet || !gpsWeekSet || !gpsToWSet || !macAddressSet || !distanceSet || !distanceStdSet)
193 time =
InsTime(gpsCycle, gpsWeek, gpsToW);
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_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.
Espressif Observation Class.
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.
@ PATH_CHANGED
The path changed and exists.
std::vector< std::string > _headerColumns
Header Columns of a CSV file.
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.
auto & getline(std::string &str)
Reads a line from the filestream.
json save() const
Saves the node into a json object.
void deinitialize()
Deinitialize the file reader.
The class is responsible for all time-related tasks.
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.
static constexpr size_t OUTPUT_PORT_INDEX_WiFiObs_OBS
Flow (WiFiObs)
std::shared_ptr< const NodeData > pollData()
Polls data from the file.
json save() const override
Saves the node into a json object.
void deinitialize() override
Deinitialize the node.
WiFiObsFile()
Default constructor.
bool initialize() override
Initialize the node.
void restore(const json &j) override
Restores the node from a json object.
std::string type() const override
String representation of the Class Type.
void guiConfig() override
ImGui config window which is shown on double click.
static std::string typeStatic()
String representation of the Class Type.
bool resetNode() override
Resets the node. Moves the read cursor to the start.
static std::string category()
String representation of the Class Category.
~WiFiObsFile() override
Destructor.
static std::string type()
Returns the type of the data class.
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.