fwt_software/include/fgc/TelemetryParser.h

20 lines
573 B
C++

#pragma once
#include "fgc/IMotorController.h"
#include <optional>
#include <string>
namespace fgc {
// Parse a motor-controller telemetry line of the form:
//
// $;Xenc;Xerr;sgt_val;sgt_stat;is_moving;control_status;hdg;deviation_warn;humid;temp;fan_pwm;
//
// i.e. a leading '$' marker followed by 11 ';'-separated numeric fields
// (a trailing ';' is tolerated). Returns nullopt if the line does not start
// with '$', has too few fields, or a field fails to convert.
std::optional<MotorTelemetry> parseTelemetryLine(const std::string& line);
} // namespace fgc