2016-02-17 21:25:53 -04:00
|
|
|
#pragma once
|
2015-08-06 09:18:28 -03:00
|
|
|
|
2019-01-18 00:23:42 -04:00
|
|
|
#include "AP_Logger_Backend.h"
|
2015-08-06 09:18:28 -03:00
|
|
|
|
2015-11-09 18:14:22 -04:00
|
|
|
#include <AP_Mission/AP_Mission.h>
|
2018-12-29 00:01:46 -04:00
|
|
|
#include <AP_Rally/AP_Rally.h>
|
2015-08-06 09:18:28 -03:00
|
|
|
|
2019-01-18 00:23:42 -04:00
|
|
|
class LoggerMessageWriter {
|
2015-08-06 09:18:28 -03:00
|
|
|
public:
|
|
|
|
|
|
|
|
virtual void reset() = 0;
|
|
|
|
virtual void process() = 0;
|
2016-07-01 02:35:45 -03:00
|
|
|
virtual bool finished() { return _finished; }
|
2015-08-06 09:18:28 -03:00
|
|
|
|
2019-02-11 04:38:01 -04:00
|
|
|
virtual void set_logger_backend(class AP_Logger_Backend *backend) {
|
|
|
|
_logger_backend = backend;
|
2015-11-09 18:14:22 -04:00
|
|
|
}
|
|
|
|
|
2015-08-06 09:18:28 -03:00
|
|
|
protected:
|
2015-09-17 07:28:50 -03:00
|
|
|
bool _finished = false;
|
2019-02-11 04:38:01 -04:00
|
|
|
AP_Logger_Backend *_logger_backend = nullptr;
|
2015-08-06 09:18:28 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-01-18 00:23:42 -04:00
|
|
|
class LoggerMessageWriter_WriteSysInfo : public LoggerMessageWriter {
|
2015-08-06 09:18:28 -03:00
|
|
|
public:
|
|
|
|
|
2018-11-07 07:26:49 -04:00
|
|
|
void reset() override;
|
|
|
|
void process() override;
|
2015-08-06 09:18:28 -03:00
|
|
|
|
|
|
|
private:
|
2019-02-22 18:46:59 -04:00
|
|
|
enum write_sysinfo_blockwriter_stage : uint8_t {
|
|
|
|
ws_blockwriter_stage_formats = 0,
|
2015-08-06 09:18:28 -03:00
|
|
|
ws_blockwriter_stage_firmware_string,
|
|
|
|
ws_blockwriter_stage_git_versions,
|
|
|
|
ws_blockwriter_stage_system_id
|
|
|
|
};
|
2019-02-22 18:46:59 -04:00
|
|
|
write_sysinfo_blockwriter_stage stage;
|
2015-08-06 09:18:28 -03:00
|
|
|
};
|
|
|
|
|
2019-01-18 00:23:42 -04:00
|
|
|
class LoggerMessageWriter_WriteEntireMission : public LoggerMessageWriter {
|
2015-08-06 09:18:28 -03:00
|
|
|
public:
|
2015-11-09 18:14:22 -04:00
|
|
|
|
2018-11-07 07:26:49 -04:00
|
|
|
void reset() override;
|
|
|
|
void process() override;
|
2015-08-06 09:18:28 -03:00
|
|
|
|
|
|
|
private:
|
|
|
|
enum entire_mission_blockwriter_stage {
|
2019-02-22 18:46:59 -04:00
|
|
|
em_blockwriter_stage_write_new_mission_message = 0,
|
2015-08-06 09:18:28 -03:00
|
|
|
em_blockwriter_stage_write_mission_items,
|
|
|
|
em_blockwriter_stage_done
|
|
|
|
};
|
|
|
|
|
2019-02-22 18:46:59 -04:00
|
|
|
uint16_t _mission_number_to_send;
|
|
|
|
entire_mission_blockwriter_stage stage;
|
2015-08-06 09:18:28 -03:00
|
|
|
};
|
|
|
|
|
2018-12-29 00:01:46 -04:00
|
|
|
class LoggerMessageWriter_WriteAllRallyPoints : public LoggerMessageWriter {
|
|
|
|
public:
|
|
|
|
|
|
|
|
void reset() override;
|
|
|
|
void process() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
enum all_rally_points_blockwriter_stage {
|
2019-02-22 18:46:59 -04:00
|
|
|
ar_blockwriter_stage_write_new_rally_message = 0,
|
2018-12-29 00:01:46 -04:00
|
|
|
ar_blockwriter_stage_write_all_rally_points,
|
|
|
|
ar_blockwriter_stage_done
|
|
|
|
};
|
|
|
|
|
2019-02-22 18:46:59 -04:00
|
|
|
uint16_t _rally_number_to_send;
|
|
|
|
all_rally_points_blockwriter_stage stage;
|
2018-12-29 00:01:46 -04:00
|
|
|
};
|
|
|
|
|
2019-01-18 00:23:42 -04:00
|
|
|
class LoggerMessageWriter_DFLogStart : public LoggerMessageWriter {
|
2015-08-06 09:18:28 -03:00
|
|
|
public:
|
2019-01-18 00:23:42 -04:00
|
|
|
LoggerMessageWriter_DFLogStart() :
|
2018-06-12 00:34:00 -03:00
|
|
|
_writesysinfo(),
|
2018-12-29 00:02:29 -04:00
|
|
|
_writeentiremission(),
|
|
|
|
_writeallrallypoints()
|
2015-08-06 09:18:28 -03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-02-11 04:38:01 -04:00
|
|
|
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);
|
2015-11-09 18:14:22 -04:00
|
|
|
}
|
|
|
|
|
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; }
|
2015-08-06 09:18:28 -03:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
enum log_start_blockwriter_stage {
|
2019-02-22 18:46:59 -04:00
|
|
|
ls_blockwriter_stage_formats = 0,
|
2015-12-07 20:51:46 -04:00
|
|
|
ls_blockwriter_stage_units,
|
|
|
|
ls_blockwriter_stage_multipliers,
|
|
|
|
ls_blockwriter_stage_format_units,
|
2015-08-06 09:18:28 -03:00
|
|
|
ls_blockwriter_stage_parms,
|
|
|
|
ls_blockwriter_stage_sysinfo,
|
|
|
|
ls_blockwriter_stage_write_entire_mission,
|
2018-12-29 00:01:46 -04:00
|
|
|
ls_blockwriter_stage_write_all_rally_points,
|
2015-08-06 09:18:28 -03:00
|
|
|
ls_blockwriter_stage_vehicle_messages,
|
|
|
|
ls_blockwriter_stage_done,
|
|
|
|
};
|
|
|
|
|
2019-02-22 18:46:59 -04:00
|
|
|
bool _fmt_done;
|
2015-09-17 07:28:50 -03:00
|
|
|
|
2019-02-22 18:46:59 -04:00
|
|
|
log_start_blockwriter_stage stage;
|
2015-08-06 09:18:28 -03:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2015-08-06 09:18:28 -03:00
|
|
|
AP_Param::ParamToken token;
|
|
|
|
AP_Param *ap;
|
|
|
|
enum ap_var_type type;
|
|
|
|
|
|
|
|
|
2019-01-18 00:23:42 -04:00
|
|
|
LoggerMessageWriter_WriteSysInfo _writesysinfo;
|
|
|
|
LoggerMessageWriter_WriteEntireMission _writeentiremission;
|
2018-12-29 00:01:46 -04:00
|
|
|
LoggerMessageWriter_WriteAllRallyPoints _writeallrallypoints;
|
2015-08-06 09:18:28 -03:00
|
|
|
};
|