Browse Source

ULog: add INFO_MULTIPLE & FLAG_BITS messages

This requires support in the parsers, and thus the ULog file version is
increased.
As long as no data is appended, both, existing pyulog & FlightPlot, can
still read the new logs (they will output a warning).
The replay module will print an error, but still continue.
sbg
Beat Küng 8 years ago committed by Lorenz Meier
parent
commit
b515873bee
  1. 12
      src/modules/logger/logger.cpp
  2. 24
      src/modules/logger/messages.h

12
src/modules/logger/logger.cpp

@ -1639,10 +1639,20 @@ void Logger::write_header() @@ -1639,10 +1639,20 @@ void Logger::write_header()
header.magic[4] = 0x01;
header.magic[5] = 0x12;
header.magic[6] = 0x35;
header.magic[7] = 0x00; //file version 0
header.magic[7] = 0x01; //file version 1
header.timestamp = hrt_absolute_time();
_writer.lock();
write_message(&header, sizeof(header));
// write the Flags message: this MUST be written right after the ulog header
ulog_message_flag_bits_s flag_bits;
memset(&flag_bits, 0, sizeof(flag_bits));
flag_bits.msg_size = sizeof(flag_bits) - ULOG_MSG_HEADER_LEN;
flag_bits.msg_type = static_cast<uint8_t>(ULogMessageType::FLAG_BITS);
write_message(&flag_bits, sizeof(flag_bits));
_writer.unlock();
}

24
src/modules/logger/messages.h

@ -37,12 +37,14 @@ enum class ULogMessageType : uint8_t { @@ -37,12 +37,14 @@ enum class ULogMessageType : uint8_t {
FORMAT = 'F',
DATA = 'D',
INFO = 'I',
INFO_MULTIPLE = 'M',
PARAMETER = 'P',
ADD_LOGGED_MSG = 'A',
REMOVE_LOGGED_MSG = 'R',
SYNC = 'S',
DROPOUT = 'O',
LOGGING = 'L',
FLAG_BITS = 'B',
};
@ -113,6 +115,15 @@ struct ulog_message_info_header_s { @@ -113,6 +115,15 @@ struct ulog_message_info_header_s {
char key[255];
};
struct ulog_message_info_multiple_header_s {
uint16_t msg_size; //size of message - ULOG_MSG_HEADER_LEN
uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::INFO_MULTIPLE);
uint8_t is_continued; ///< can be used for arrays: set to 1, if this message is part of the previous with the same key
uint8_t key_len;
char key[255];
};
struct ulog_message_logging_s {
uint16_t msg_size; //size of message - ULOG_MSG_HEADER_LEN
uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::LOGGING);
@ -129,4 +140,17 @@ struct ulog_message_parameter_header_s { @@ -129,4 +140,17 @@ struct ulog_message_parameter_header_s {
uint8_t key_len;
char key[255];
};
#define ULOG_INCOMPAT_FLAG0_DATA_APPENDED_MASK (1<<0)
struct ulog_message_flag_bits_s {
uint16_t msg_size;
uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::FLAG_BITS);
uint8_t compat_flags[8];
uint8_t incompat_flags[8]; ///< @see ULOG_INCOMPAT_FLAG_*
uint64_t appended_offsets[3]; ///< file offset(s) for appended data if ULOG_INCOMPAT_FLAG0_DATA_APPENDED_MASK is set
};
#pragma pack(pop)

Loading…
Cancel
Save