ardupilot/libraries/AP_Logger/LoggerMessageWriter.h

128 lines
2.7 KiB
C
Raw Normal View History

#pragma once
#include "AP_Logger_Backend.h"
class LoggerMessageWriter {
public:
virtual void reset() = 0;
virtual void process() = 0;
2016-07-01 02:35:45 -03:00
virtual bool finished() { return _finished; }
virtual void set_logger_backend(class AP_Logger_Backend *backend) {
_logger_backend = backend;
}
protected:
bool _finished = false;
AP_Logger_Backend *_logger_backend = nullptr;
};
class LoggerMessageWriter_WriteSysInfo : public LoggerMessageWriter {
public:
2018-11-07 07:26:49 -04:00
void reset() override;
void process() override;
private:
enum class Stage : uint8_t {
FORMATS = 0,
FIRMWARE_STRING,
GIT_VERSIONS,
SYSTEM_ID,
PARAM_SPACE_USED,
RC_PROTOCOL
};
Stage stage;
};
class LoggerMessageWriter_WriteEntireMission : public LoggerMessageWriter {
public:
2018-11-07 07:26:49 -04:00
void reset() override;
void process() override;
private:
enum Stage {
WRITE_NEW_MISSION_MESSAGE = 0,
WRITE_MISSION_ITEMS,
DONE
};
uint16_t _mission_number_to_send;
Stage stage;
};
class LoggerMessageWriter_WriteAllRallyPoints : public LoggerMessageWriter {
public:
void reset() override;
void process() override;
private:
enum Stage {
WRITE_NEW_RALLY_MESSAGE = 0,
WRITE_ALL_RALLY_POINTS,
DONE
};
uint16_t _rally_number_to_send;
Stage stage = Stage::WRITE_NEW_RALLY_MESSAGE;
};
class LoggerMessageWriter_DFLogStart : public LoggerMessageWriter {
public:
LoggerMessageWriter_DFLogStart() :
_writesysinfo(),
_writeentiremission(),
_writeallrallypoints()
{
}
virtual void set_logger_backend(class AP_Logger_Backend *backend) override {
LoggerMessageWriter::set_logger_backend(backend);
_writesysinfo.set_logger_backend(backend);
_writeentiremission.set_logger_backend(backend);
_writeallrallypoints.set_logger_backend(backend);
}
2018-11-07 07:26:49 -04:00
void reset() override;
void process() override;
2016-07-01 02:35:45 -03:00
bool fmt_done() { return _fmt_done; }
private:
enum Stage {
FORMATS = 0,
UNITS,
MULTIPLIERS,
FORMAT_UNITS,
PARMS,
SYSINFO,
WRITE_ENTIRE_MISSION,
WRITE_ALL_RALLY_POINTS,
VEHICLE_MESSAGES,
DONE,
};
bool _fmt_done;
Stage stage;
uint16_t next_format_to_send;
2015-12-07 20:51:46 -04:00
uint8_t _next_unit_to_send;
uint8_t _next_format_unit_to_send;
uint8_t _next_multiplier_to_send;
AP_Param::ParamToken token;
AP_Param *ap;
enum ap_var_type type;
LoggerMessageWriter_WriteSysInfo _writesysinfo;
LoggerMessageWriter_WriteEntireMission _writeentiremission;
LoggerMessageWriter_WriteAllRallyPoints _writeallrallypoints;
};