APM:Libraries
Classes | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
DataFlash_MAVLink Class Reference

#include <DataFlash_MAVLink.h>

Inheritance diagram for DataFlash_MAVLink:
[legend]
Collaboration diagram for DataFlash_MAVLink:
[legend]

Classes

struct  _stats
 
struct  dm_block
 
struct  dm_block_queue
 

Public Member Functions

 DataFlash_MAVLink (DataFlash_Class &front, DFMessageWriter_DFLogStart *writer)
 
void Init () override
 
bool logging_started () const override
 
void stop_logging () override
 
bool _WritePrioritisedBlock (const void *pBuffer, uint16_t size, bool is_critical) override
 
bool CardInserted (void) const override
 
void EraseAll () override
 
bool NeedPrep () override
 
void Prep () override
 
uint16_t find_last_log (void) override
 
void get_log_boundaries (uint16_t log_num, uint16_t &start_page, uint16_t &end_page) override
 
void get_log_info (uint16_t log_num, uint32_t &size, uint32_t &time_utc) override
 
int16_t get_log_data (uint16_t log_num, uint16_t page, uint32_t offset, uint16_t len, uint8_t *data) override
 
uint16_t get_num_logs (void) override
 
void push_log_blocks () override
 
void remote_log_block_status_msg (mavlink_channel_t chan, mavlink_message_t *msg) override
 
- Public Member Functions inherited from DataFlash_Backend
 FUNCTOR_TYPEDEF (vehicle_startup_message_Log_Writer, void)
 
 DataFlash_Backend (DataFlash_Class &front, class DFMessageWriter_DFLogStart *writer)
 
vehicle_startup_message_Log_Writer vehicle_message_writer ()
 
void internal_error ()
 
bool WriteBlock (const void *pBuffer, uint16_t size)
 
bool WriteCriticalBlock (const void *pBuffer, uint16_t size)
 
bool WritePrioritisedBlock (const void *pBuffer, uint16_t size, bool is_critical)
 
void set_mission (const AP_Mission *mission)
 
virtual void PrepForArming ()
 
void Log_Fill_Format (const struct LogStructure *structure, struct log_Format &pkt)
 
void Log_Fill_Format_Units (const struct LogStructure *s, struct log_Format_Units &pkt)
 
virtual void flush (void)
 
virtual void periodic_tasks ()
 
uint8_t num_types () const
 
const struct LogStructurestructure (uint8_t structure) const
 
uint8_t num_units () const
 
const struct UnitStructureunit (uint8_t unit) const
 
uint8_t num_multipliers () const
 
const struct MultiplierStructuremultiplier (uint8_t multiplier) const
 
void Log_Write_EntireMission (const AP_Mission &mission)
 
bool Log_Write_Format (const struct LogStructure *structure)
 
bool Log_Write_MavCmd (uint16_t cmd_total, const mavlink_mission_item_t &mav_cmd)
 
bool Log_Write_Message (const char *message)
 
bool Log_Write_Mission_Cmd (const AP_Mission &mission, const AP_Mission::Mission_Command &cmd)
 
bool Log_Write_Mode (uint8_t mode, uint8_t reason=0)
 
bool Log_Write_Parameter (const char *name, float value)
 
bool Log_Write_Parameter (const AP_Param *ap, const AP_Param::ParamToken &token, enum ap_var_type type)
 
uint32_t num_dropped (void) const
 
bool Log_Write_Emit_FMT (uint8_t msg_type)
 
bool Log_Write (uint8_t msg_type, va_list arg_list, bool is_critical=false)
 
virtual void vehicle_was_disarmed ()
 
bool Log_Write_Unit (const struct UnitStructure *s)
 
bool Log_Write_Multiplier (const struct MultiplierStructure *s)
 
bool Log_Write_Format_Units (const struct LogStructure *structure)
 

Protected Member Functions

bool WritesOK () const override
 
- Protected Member Functions inherited from DataFlash_Backend
bool ShouldLog (bool is_critical)
 
virtual bool StartNewLogOK () const
 
virtual bool WriteBlockCheckStartupMessages ()
 
virtual void WriteMoreStartupMessages ()
 
virtual void start_new_log_reset_variables ()
 

Private Types

typedef struct dm_block_queue dm_block_queue_t
 

Private Member Functions

bool send_log_block (struct dm_block &block)
 
void handle_ack (mavlink_channel_t chan, mavlink_message_t *msg, uint32_t seqno)
 
void handle_retry (uint32_t block_num)
 
void do_resends (uint32_t now)
 
void free_all_blocks ()
 
void enqueue_block (dm_block_queue_t &queue, struct dm_block *block)
 
bool queue_has_block (dm_block_queue_t &queue, struct dm_block *block)
 
struct dm_blockdequeue_seqno (dm_block_queue_t &queue, uint32_t seqno)
 
bool free_seqno_from_queue (uint32_t seqno, dm_block_queue_t &queue)
 
bool send_log_blocks_from_queue (dm_block_queue_t &queue)
 
uint8_t stack_size (struct dm_block *stack)
 
uint8_t queue_size (dm_block_queue_t queue)
 
bool logging_enabled () const override
 
bool logging_failed () const override
 
void Log_Write_DF_MAV (DataFlash_MAVLink &df)
 
uint32_t bufferspace_available () override
 
uint8_t remaining_space_in_current_block ()
 
struct dm_blocknext_block ()
 
void periodic_10Hz (uint32_t now) override
 
void periodic_1Hz (uint32_t now) override
 
void periodic_fullrate (uint32_t now) override
 
void stats_init ()
 
void stats_reset ()
 
void stats_collect ()
 
void stats_log ()
 
uint16_t start_new_log (void) override
 
bool ReadBlock (void *pkt, uint16_t size) override
 

Private Attributes

struct dm_block_blocks_free
 
dm_block_queue_t _blocks_sent
 
dm_block_queue_t _blocks_pending
 
dm_block_queue_t _blocks_retry
 
struct DataFlash_MAVLink::_stats stats
 
mavlink_channel_t _chan
 
uint8_t _target_system_id
 
uint8_t _target_component_id
 
const uint8_t _max_blocks_per_send_blocks
 
uint32_t _next_seq_num
 
uint16_t _latest_block_len
 
uint32_t _last_response_time
 
uint32_t _last_send_time
 
uint8_t _next_block_number_to_resend
 
bool _sending_to_client
 
uint8_t _blockcount_free
 
uint8_t _blockcount
 
struct dm_block_blocks
 
struct dm_block_current_block
 
uint32_t _stats_last_collected_time
 
uint32_t _stats_last_logged_time
 
uint8_t mavlink_seq
 
AP_HAL::Util::perf_counter_t _perf_errors
 
AP_HAL::Util::perf_counter_t _perf_packing
 
AP_HAL::Util::perf_counter_t _perf_overruns
 
AP_HAL::Semaphoresemaphore
 

Additional Inherited Members

- Protected Attributes inherited from DataFlash_Backend
DataFlash_Class_front
 
DFMessageWriter_DFLogStart_startup_messagewriter
 
bool _writing_startup_messages
 
uint8_t _internal_errors
 
uint32_t _dropped
 
bool _initialised
 

Detailed Description

Definition at line 20 of file DataFlash_MAVLink.h.

Member Typedef Documentation

◆ dm_block_queue_t

Definition at line 90 of file DataFlash_MAVLink.h.

Constructor & Destructor Documentation

◆ DataFlash_MAVLink()

DataFlash_MAVLink::DataFlash_MAVLink ( DataFlash_Class front,
DFMessageWriter_DFLogStart writer 
)
inline

Definition at line 24 of file DataFlash_MAVLink.h.

Here is the call graph for this function:

Member Function Documentation

◆ _WritePrioritisedBlock()

bool DataFlash_MAVLink::_WritePrioritisedBlock ( const void *  pBuffer,
uint16_t  size,
bool  is_critical 
)
overridevirtual

Implements DataFlash_Backend.

Definition at line 129 of file DataFlash_MAVLink.cpp.

Referenced by logging_started().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bufferspace_available()

uint32_t DataFlash_MAVLink::bufferspace_available ( )
overrideprivatevirtual

Implements DataFlash_Backend.

Definition at line 60 of file DataFlash_MAVLink.cpp.

Referenced by _WritePrioritisedBlock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CardInserted()

bool DataFlash_MAVLink::CardInserted ( void  ) const
inlineoverridevirtual

Implements DataFlash_Backend.

Definition at line 47 of file DataFlash_MAVLink.h.

◆ dequeue_seqno()

struct DataFlash_MAVLink::dm_block * DataFlash_MAVLink::dequeue_seqno ( DataFlash_MAVLink::dm_block_queue_t queue,
uint32_t  seqno 
)
private

Definition at line 79 of file DataFlash_MAVLink.cpp.

Referenced by free_seqno_from_queue(), handle_retry(), and send_log_blocks_from_queue().

Here is the caller graph for this function:

◆ do_resends()

void DataFlash_MAVLink::do_resends ( uint32_t  now)
private

Definition at line 497 of file DataFlash_MAVLink.cpp.

Referenced by periodic_10Hz().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enqueue_block()

void DataFlash_MAVLink::enqueue_block ( dm_block_queue_t queue,
struct dm_block block 
)
private

Definition at line 69 of file DataFlash_MAVLink.cpp.

Referenced by _WritePrioritisedBlock(), handle_retry(), and send_log_blocks_from_queue().

Here is the caller graph for this function:

◆ EraseAll()

void DataFlash_MAVLink::EraseAll ( )
inlineoverridevirtual

Implements DataFlash_Backend.

Definition at line 50 of file DataFlash_MAVLink.h.

◆ find_last_log()

uint16_t DataFlash_MAVLink::find_last_log ( void  )
inlineoverridevirtual

Implements DataFlash_Backend.

Definition at line 56 of file DataFlash_MAVLink.h.

◆ free_all_blocks()

void DataFlash_MAVLink::free_all_blocks ( )
private

Definition at line 195 of file DataFlash_MAVLink.cpp.

Referenced by handle_ack(), and Init().

Here is the caller graph for this function:

◆ free_seqno_from_queue()

bool DataFlash_MAVLink::free_seqno_from_queue ( uint32_t  seqno,
dm_block_queue_t queue 
)
private

Definition at line 105 of file DataFlash_MAVLink.cpp.

Referenced by handle_ack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_log_boundaries()

void DataFlash_MAVLink::get_log_boundaries ( uint16_t  log_num,
uint16_t &  start_page,
uint16_t &  end_page 
)
inlineoverridevirtual

Implements DataFlash_Backend.

Definition at line 57 of file DataFlash_MAVLink.h.

◆ get_log_data()

int16_t DataFlash_MAVLink::get_log_data ( uint16_t  log_num,
uint16_t  page,
uint32_t  offset,
uint16_t  len,
uint8_t *  data 
)
inlineoverridevirtual

Implements DataFlash_Backend.

Definition at line 59 of file DataFlash_MAVLink.h.

◆ get_log_info()

void DataFlash_MAVLink::get_log_info ( uint16_t  log_num,
uint32_t &  size,
uint32_t &  time_utc 
)
inlineoverridevirtual

Implements DataFlash_Backend.

Definition at line 58 of file DataFlash_MAVLink.h.

◆ get_num_logs()

uint16_t DataFlash_MAVLink::get_num_logs ( void  )
inlineoverridevirtual

Implements DataFlash_Backend.

Definition at line 60 of file DataFlash_MAVLink.h.

Here is the call graph for this function:

◆ handle_ack()

void DataFlash_MAVLink::handle_ack ( mavlink_channel_t  chan,
mavlink_message_t *  msg,
uint32_t  seqno 
)
private

Definition at line 230 of file DataFlash_MAVLink.cpp.

Referenced by remote_log_block_status_msg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_retry()

void DataFlash_MAVLink::handle_retry ( uint32_t  block_num)
private

Definition at line 292 of file DataFlash_MAVLink.cpp.

Referenced by remote_log_block_status_msg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Init()

void DataFlash_MAVLink::Init ( )
overridevirtual

Reimplemented from DataFlash_Backend.

Definition at line 26 of file DataFlash_MAVLink.cpp.

Referenced by DataFlash_MAVLink().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Log_Write_DF_MAV()

void DataFlash_MAVLink::Log_Write_DF_MAV ( DataFlash_MAVLink df)
private

Definition at line 327 of file DataFlash_MAVLink.cpp.

Referenced by stats_log().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ logging_enabled()

bool DataFlash_MAVLink::logging_enabled ( ) const
inlineoverrideprivatevirtual

Implements DataFlash_Backend.

Definition at line 123 of file DataFlash_MAVLink.h.

Here is the call graph for this function:

◆ logging_failed()

bool DataFlash_MAVLink::logging_failed ( ) const
overrideprivatevirtual

Implements DataFlash_Backend.

Definition at line 55 of file DataFlash_MAVLink.cpp.

Referenced by logging_enabled().

Here is the caller graph for this function:

◆ logging_started()

bool DataFlash_MAVLink::logging_started ( void  ) const
inlineoverridevirtual

Implements DataFlash_Backend.

Definition at line 38 of file DataFlash_MAVLink.h.

Here is the call graph for this function:

◆ NeedPrep()

bool DataFlash_MAVLink::NeedPrep ( void  )
inlineoverridevirtual

Implements DataFlash_Backend.

Definition at line 52 of file DataFlash_MAVLink.h.

◆ next_block()

struct DataFlash_MAVLink::dm_block * DataFlash_MAVLink::next_block ( )
private

Definition at line 181 of file DataFlash_MAVLink.cpp.

Referenced by _WritePrioritisedBlock().

Here is the caller graph for this function:

◆ periodic_10Hz()

void DataFlash_MAVLink::periodic_10Hz ( uint32_t  now)
overrideprivatevirtual

Reimplemented from DataFlash_Backend.

Definition at line 530 of file DataFlash_MAVLink.cpp.

Here is the call graph for this function:

◆ periodic_1Hz()

void DataFlash_MAVLink::periodic_1Hz ( uint32_t  now)
overrideprivatevirtual

Reimplemented from DataFlash_Backend.

Definition at line 535 of file DataFlash_MAVLink.cpp.

Here is the call graph for this function:

◆ periodic_fullrate()

void DataFlash_MAVLink::periodic_fullrate ( uint32_t  now)
overrideprivatevirtual

Reimplemented from DataFlash_Backend.

Definition at line 547 of file DataFlash_MAVLink.cpp.

Here is the call graph for this function:

◆ Prep()

void DataFlash_MAVLink::Prep ( )
inlineoverridevirtual

Implements DataFlash_Backend.

Definition at line 53 of file DataFlash_MAVLink.h.

◆ push_log_blocks()

void DataFlash_MAVLink::push_log_blocks ( )
overridevirtual

Reimplemented from DataFlash_Backend.

Definition at line 473 of file DataFlash_MAVLink.cpp.

Referenced by get_num_logs(), and periodic_fullrate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ queue_has_block()

bool DataFlash_MAVLink::queue_has_block ( dm_block_queue_t queue,
struct dm_block block 
)
private

◆ queue_size()

uint8_t DataFlash_MAVLink::queue_size ( dm_block_queue_t  queue)
private

Definition at line 393 of file DataFlash_MAVLink.cpp.

Referenced by stats_collect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadBlock()

bool DataFlash_MAVLink::ReadBlock ( void *  pkt,
uint16_t  size 
)
inlineoverrideprivatevirtual

Implements DataFlash_Backend.

Definition at line 176 of file DataFlash_MAVLink.h.

◆ remaining_space_in_current_block()

uint8_t DataFlash_MAVLink::remaining_space_in_current_block ( )
private

Definition at line 64 of file DataFlash_MAVLink.cpp.

Referenced by _WritePrioritisedBlock(), and bufferspace_available().

Here is the caller graph for this function:

◆ remote_log_block_status_msg()

void DataFlash_MAVLink::remote_log_block_status_msg ( mavlink_channel_t  chan,
mavlink_message_t *  msg 
)
overridevirtual

Reimplemented from DataFlash_Backend.

Definition at line 276 of file DataFlash_MAVLink.cpp.

Referenced by get_num_logs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_log_block()

bool DataFlash_MAVLink::send_log_block ( struct dm_block block)
private

Definition at line 553 of file DataFlash_MAVLink.cpp.

Referenced by do_resends(), and send_log_blocks_from_queue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_log_blocks_from_queue()

bool DataFlash_MAVLink::send_log_blocks_from_queue ( dm_block_queue_t queue)
private

Definition at line 452 of file DataFlash_MAVLink.cpp.

Referenced by push_log_blocks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stack_size()

uint8_t DataFlash_MAVLink::stack_size ( struct dm_block stack)
private

Definition at line 385 of file DataFlash_MAVLink.cpp.

Referenced by queue_size(), and stats_collect().

Here is the caller graph for this function:

◆ start_new_log()

uint16_t DataFlash_MAVLink::start_new_log ( void  )
inlineoverrideprivatevirtual

Implements DataFlash_Backend.

Definition at line 173 of file DataFlash_MAVLink.h.

◆ stats_collect()

void DataFlash_MAVLink::stats_collect ( )
private

Definition at line 398 of file DataFlash_MAVLink.cpp.

Referenced by periodic_10Hz().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stats_init()

void DataFlash_MAVLink::stats_init ( )
private

Definition at line 305 of file DataFlash_MAVLink.cpp.

Referenced by handle_ack(), and Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stats_log()

void DataFlash_MAVLink::stats_log ( )
private

Definition at line 353 of file DataFlash_MAVLink.cpp.

Referenced by periodic_1Hz().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stats_reset()

void DataFlash_MAVLink::stats_reset ( )
private

Definition at line 311 of file DataFlash_MAVLink.cpp.

Referenced by stats_init(), and stats_log().

Here is the caller graph for this function:

◆ stop_logging()

void DataFlash_MAVLink::stop_logging ( void  )
overridevirtual

Implements DataFlash_Backend.

Definition at line 222 of file DataFlash_MAVLink.cpp.

Referenced by handle_ack(), and logging_started().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WritesOK()

bool DataFlash_MAVLink::WritesOK ( ) const
overrideprotectedvirtual

Implements DataFlash_Backend.

Definition at line 118 of file DataFlash_MAVLink.cpp.

Referenced by get_num_logs().

Here is the caller graph for this function:

Member Data Documentation

◆ _blockcount

uint8_t DataFlash_MAVLink::_blockcount
private

Definition at line 153 of file DataFlash_MAVLink.h.

Referenced by DataFlash_MAVLink(), do_resends(), free_all_blocks(), and Init().

◆ _blockcount_free

uint8_t DataFlash_MAVLink::_blockcount_free
private

◆ _blocks

struct dm_block* DataFlash_MAVLink::_blocks
private

Definition at line 154 of file DataFlash_MAVLink.h.

Referenced by free_all_blocks(), and Init().

◆ _blocks_free

struct dm_block* DataFlash_MAVLink::_blocks_free
private

◆ _blocks_pending

dm_block_queue_t DataFlash_MAVLink::_blocks_pending
private

◆ _blocks_retry

dm_block_queue_t DataFlash_MAVLink::_blocks_retry
private

◆ _blocks_sent

dm_block_queue_t DataFlash_MAVLink::_blocks_sent
private

◆ _chan

mavlink_channel_t DataFlash_MAVLink::_chan
private

Definition at line 126 of file DataFlash_MAVLink.h.

Referenced by handle_ack(), and send_log_block().

◆ _current_block

struct dm_block* DataFlash_MAVLink::_current_block
private

Definition at line 155 of file DataFlash_MAVLink.h.

Referenced by _WritePrioritisedBlock(), and free_all_blocks().

◆ _last_response_time

uint32_t DataFlash_MAVLink::_last_response_time
private

Definition at line 142 of file DataFlash_MAVLink.h.

Referenced by handle_ack(), handle_retry(), periodic_1Hz(), and stop_logging().

◆ _last_send_time

uint32_t DataFlash_MAVLink::_last_send_time
private

Definition at line 143 of file DataFlash_MAVLink.h.

Referenced by periodic_1Hz(), and send_log_block().

◆ _latest_block_len

uint16_t DataFlash_MAVLink::_latest_block_len
private

◆ _max_blocks_per_send_blocks

const uint8_t DataFlash_MAVLink::_max_blocks_per_send_blocks
private

Definition at line 138 of file DataFlash_MAVLink.h.

Referenced by send_log_blocks_from_queue().

◆ _next_block_number_to_resend

uint8_t DataFlash_MAVLink::_next_block_number_to_resend
private

Definition at line 144 of file DataFlash_MAVLink.h.

◆ _next_seq_num

uint32_t DataFlash_MAVLink::_next_seq_num
private

Definition at line 140 of file DataFlash_MAVLink.h.

Referenced by handle_ack(), Log_Write_DF_MAV(), and next_block().

◆ _perf_errors

AP_HAL::Util::perf_counter_t DataFlash_MAVLink::_perf_errors
private

Definition at line 180 of file DataFlash_MAVLink.h.

◆ _perf_overruns

AP_HAL::Util::perf_counter_t DataFlash_MAVLink::_perf_overruns
private

Definition at line 182 of file DataFlash_MAVLink.h.

◆ _perf_packing

AP_HAL::Util::perf_counter_t DataFlash_MAVLink::_perf_packing
private

Definition at line 181 of file DataFlash_MAVLink.h.

Referenced by send_log_block().

◆ _sending_to_client

bool DataFlash_MAVLink::_sending_to_client
private

◆ _stats_last_collected_time

uint32_t DataFlash_MAVLink::_stats_last_collected_time
private

Definition at line 166 of file DataFlash_MAVLink.h.

◆ _stats_last_logged_time

uint32_t DataFlash_MAVLink::_stats_last_logged_time
private

Definition at line 167 of file DataFlash_MAVLink.h.

◆ _target_component_id

uint8_t DataFlash_MAVLink::_target_component_id
private

Definition at line 128 of file DataFlash_MAVLink.h.

Referenced by handle_ack(), and send_log_block().

◆ _target_system_id

uint8_t DataFlash_MAVLink::_target_system_id
private

Definition at line 127 of file DataFlash_MAVLink.h.

Referenced by handle_ack(), and send_log_block().

◆ mavlink_seq

uint8_t DataFlash_MAVLink::mavlink_seq
private

Definition at line 168 of file DataFlash_MAVLink.h.

Referenced by send_log_block().

◆ semaphore

AP_HAL::Semaphore* DataFlash_MAVLink::semaphore
private

◆ stats

struct DataFlash_MAVLink::_stats DataFlash_MAVLink::stats
private

The documentation for this class was generated from the following files: