Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/Tools/Replay/DataFlashFileReader.h
9314 views
1
#pragma once
2
3
#include <AP_Logger/AP_Logger.h>
4
5
#define LOGREADER_MAX_FORMATS 255 // must be >= highest MESSAGE
6
7
class AP_LoggerFileReader
8
{
9
public:
10
11
AP_LoggerFileReader();
12
~AP_LoggerFileReader();
13
14
bool open_log(const char *logfile);
15
bool update();
16
17
virtual bool handle_log_format_msg(const struct log_Format &f) = 0;
18
virtual bool handle_msg(const struct log_Format &f, uint8_t *msg) = 0;
19
20
void format_type(uint16_t type, char dest[5]);
21
void get_packet_counts(uint64_t dest[]);
22
float get_percent_read(); // Get percentage of log file read
23
24
protected:
25
int fd = -1;
26
27
struct log_Format formats[LOGREADER_MAX_FORMATS] {};
28
29
private:
30
ssize_t read_input(void *buf, size_t count);
31
32
uint64_t bytes_read = 0;
33
uint64_t file_size = 0; // Total size of the log file
34
uint32_t message_count = 0;
35
uint64_t start_micros;
36
37
uint64_t packet_counts[LOGREADER_MAX_FORMATS] = {};
38
};
39
40