VSM C++ SDK
Vehicle Specific Modules SDK
ugcs::vsm::Mavlink_decoder< Mavlink_kind > Class Template Reference

Decodes Mavlink 1.0 messages from byte stream. More...

#include <mavlink_decoder.h>

Public Types

typedef mavlink::Header< Mavlink_kind > Header
 Mavlink header type. More...
 
typedef Callback_proxy< void, Io_buffer::Ptr, mavlink::MESSAGE_ID_TYPE, typename Mavlink_kind::System_id, uint8_t, uint32_t > Handler
 Handler type of the received Mavlink message. More...
 
typedef Callback_proxy< void, Io_buffer::PtrRaw_data_handler
 Handler for the raw data going through the decoder. More...
 

Public Member Functions

template<class __Callable , typename... __Args>
 __DEFINE_CALLBACK_BUILDER_BODY (Make_decoder_handler,(Io_buffer::Ptr, mavlink::MESSAGE_ID_TYPE, typename Mavlink_kind::System_id, uint8_t, uint32_t),(nullptr, mavlink::MESSAGE_ID::DEBUG_VALUE, mavlink::SYSTEM_ID_NONE, 0, 0)) template< class __Callable
 Convenience builder for Mavlink decoder handlers. More...
 
typename __Args __DEFINE_CALLBACK_BUILDER_BODY (Make_raw_data_handler,(Io_buffer::Ptr),(nullptr)) struct Stats
 Decoder statistics. More...
 
 Mavlink_decoder ()
 Default constructor. More...
 
 Mavlink_decoder (const Mavlink_decoder &)=delete
 Delete copy constructor. More...
 
void Disable ()
 Should be called prior to intention to delete the instance. More...
 
void Register_handler (Handler handler)
 Register handler for successfully decoded Mavlink messages.
 
void Register_raw_data_handler (Raw_data_handler handler)
 
void Decode (Io_buffer::Ptr buffer)
 Decode buffer from the wire. More...
 
void Reset (bool reset_stats=true)
 Reset decoder to initial state. More...
 
size_t Get_next_read_size () const
 Get the exact number of bytes which should be read by underlying I/O subsystem and fed to the decoder. More...
 
const Mavlink_decoder::Stats & Get_stats () const
 Get read-only access to statistics. More...
 

Detailed Description

template<typename Mavlink_kind>
class ugcs::vsm::Mavlink_decoder< Mavlink_kind >

Decodes Mavlink 1.0 messages from byte stream.

Member Typedef Documentation

template<typename Mavlink_kind >
typedef Callback_proxy<void, Io_buffer::Ptr, mavlink::MESSAGE_ID_TYPE, typename Mavlink_kind::System_id, uint8_t, uint32_t> ugcs::vsm::Mavlink_decoder< Mavlink_kind >::Handler

Handler type of the received Mavlink message.

Arguments are:

  • Payload buffer
  • Message id
  • Sending system id
  • Sending component id
template<typename Mavlink_kind >
typedef mavlink::Header<Mavlink_kind> ugcs::vsm::Mavlink_decoder< Mavlink_kind >::Header

Mavlink header type.

template<typename Mavlink_kind >
typedef Callback_proxy<void, Io_buffer::Ptr> ugcs::vsm::Mavlink_decoder< Mavlink_kind >::Raw_data_handler

Handler for the raw data going through the decoder.

Constructor & Destructor Documentation

template<typename Mavlink_kind >
ugcs::vsm::Mavlink_decoder< Mavlink_kind >::Mavlink_decoder ( )
inline

Default constructor.

template<typename Mavlink_kind >
ugcs::vsm::Mavlink_decoder< Mavlink_kind >::Mavlink_decoder ( const Mavlink_decoder< Mavlink_kind > &  )
delete

Delete copy constructor.

Member Function Documentation

template<typename Mavlink_kind >
template<class __Callable , typename... __Args>
ugcs::vsm::Mavlink_decoder< Mavlink_kind >::__DEFINE_CALLBACK_BUILDER_BODY ( Make_decoder_handler  ,
(Io_buffer::Ptr, mavlink::MESSAGE_ID_TYPE, typename Mavlink_kind::System_id, uint8_t, uint32_t)  ,
(nullptr, mavlink::MESSAGE_ID::DEBUG_VALUE, mavlink::SYSTEM_ID_NONE, 0, 0)   
)

Convenience builder for Mavlink decoder handlers.

Convenience builder for raw data handlers.

template<typename Mavlink_kind >
typename __Args ugcs::vsm::Mavlink_decoder< Mavlink_kind >::__DEFINE_CALLBACK_BUILDER_BODY ( Make_raw_data_handler  ,
(Io_buffer::Ptr ,
(nullptr)   
)
inline

Decoder statistics.

Messages processed by registered handler.

Messages without handler, dropped.

Messages with wrong checksum.

Messages with wrong length, but correct checksum.

Messages with unknown id. Note that checksum is not verified for such messages.

Total received bytes, including any error or not handled messages.

Number of STX bytes found during decoding, i.e. how many times packet decode was tried to be started.

template<typename Mavlink_kind >
void ugcs::vsm::Mavlink_decoder< Mavlink_kind >::Decode ( Io_buffer::Ptr  buffer)
inline

Decode buffer from the wire.

template<typename Mavlink_kind >
void ugcs::vsm::Mavlink_decoder< Mavlink_kind >::Disable ( )
inline

Should be called prior to intention to delete the instance.

template<typename Mavlink_kind >
size_t ugcs::vsm::Mavlink_decoder< Mavlink_kind >::Get_next_read_size ( ) const
inline

Get the exact number of bytes which should be read by underlying I/O subsystem and fed to the decoder.

Returns
Exact number of bytes to be read by next read operation.
template<typename Mavlink_kind >
const Mavlink_decoder::Stats& ugcs::vsm::Mavlink_decoder< Mavlink_kind >::Get_stats ( ) const
inline

Get read-only access to statistics.

template<typename Mavlink_kind >
void ugcs::vsm::Mavlink_decoder< Mavlink_kind >::Reset ( bool  reset_stats = true)
inline

Reset decoder to initial state.

Parameters
reset_statstrue if statistics should also be reset.

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