PX4 Firmware
PX4 Autopilot Software http://px4.io
MavlinkParametersManager Class Reference

#include <mavlink_parameters.h>

Collaboration diagram for MavlinkParametersManager:

Classes

struct  _uavcan_open_request_list_item
 

Public Member Functions

 MavlinkParametersManager (Mavlink *mavlink)
 
 ~MavlinkParametersManager ()=default
 
void send (const hrt_abstime t)
 Handle sending of messages. More...
 
unsigned get_size ()
 
void handle_message (const mavlink_message_t *msg)
 

Protected Member Functions

bool send_one ()
 send a single param if a PARAM_REQUEST_LIST is in progress More...
 
bool send_params ()
 Handle any open param send transfer. More...
 
bool send_uavcan ()
 Send UAVCAN params. More...
 
bool send_untransmitted ()
 Send untransmitted params. More...
 
int send_param (param_t param, int component_id=-1)
 
void request_next_uavcan_parameter ()
 Request the next uavcan parameter. More...
 
void enque_uavcan_request (uavcan_parameter_request_s *req)
 Enqueue one uavcan parameter reqest. More...
 
void dequeue_uavcan_request ()
 Drop the first reqest from the list. More...
 

Protected Attributes

_uavcan_open_request_list_item_uavcan_open_request_list {nullptr}
 Pointer to the first item in the linked list. More...
 
bool _uavcan_waiting_for_request_response {false}
 We have reqested a parameter and wait for the response. More...
 
uint16_t _uavcan_queued_request_items {0}
 Number of stored parameter requests currently in the list. More...
 
uORB::Publication< rc_parameter_map_s_rc_param_map_pub {ORB_ID(rc_parameter_map)}
 
rc_parameter_map_s _rc_param_map {}
 
uORB::PublicationQueued< uavcan_parameter_request_s_uavcan_parameter_request_pub {ORB_ID(uavcan_parameter_request)}
 
uORB::Subscription _uavcan_parameter_value_sub {ORB_ID(uavcan_parameter_value)}
 
uORB::Subscription _mavlink_parameter_sub {ORB_ID(parameter_update)}
 
hrt_abstime _param_update_time {0}
 
int _param_update_index {0}
 
Mavlink_mavlink
 

Private Member Functions

 MavlinkParametersManager (MavlinkParametersManager &)
 
MavlinkParametersManageroperator= (const MavlinkParametersManager &)
 

Private Attributes

int _send_all_index {-1}
 

Detailed Description

Definition at line 59 of file mavlink_parameters.h.

Constructor & Destructor Documentation

◆ MavlinkParametersManager() [1/2]

MavlinkParametersManager::MavlinkParametersManager ( Mavlink mavlink)
explicit

Definition at line 48 of file mavlink_parameters.cpp.

◆ ~MavlinkParametersManager()

MavlinkParametersManager::~MavlinkParametersManager ( )
default

◆ MavlinkParametersManager() [2/2]

MavlinkParametersManager::MavlinkParametersManager ( MavlinkParametersManager )
private

Member Function Documentation

◆ dequeue_uavcan_request()

void MavlinkParametersManager::dequeue_uavcan_request ( )
protected

Drop the first reqest from the list.

Definition at line 592 of file mavlink_parameters.cpp.

References _uavcan_open_request_list, _uavcan_queued_request_items, _uavcan_waiting_for_request_response, and MavlinkParametersManager::_uavcan_open_request_list_item::next.

Referenced by send_uavcan().

Here is the caller graph for this function:

◆ enque_uavcan_request()

void MavlinkParametersManager::enque_uavcan_request ( uavcan_parameter_request_s req)
protected

Enqueue one uavcan parameter reqest.

We store 10 at max.

Definition at line 563 of file mavlink_parameters.cpp.

References _uavcan_open_request_list, _uavcan_queued_request_items, MavlinkParametersManager::_uavcan_open_request_list_item::next, and MavlinkParametersManager::_uavcan_open_request_list_item::req.

Referenced by handle_message().

Here is the caller graph for this function:

◆ get_size()

unsigned MavlinkParametersManager::get_size ( )

Definition at line 54 of file mavlink_parameters.cpp.

Referenced by send(), and send_untransmitted().

Here is the caller graph for this function:

◆ handle_message()

void MavlinkParametersManager::handle_message ( const mavlink_message_t *  msg)

Definition at line 60 of file mavlink_parameters.cpp.

References _mavlink, _rc_param_map, _rc_param_map_pub, _send_all_index, _uavcan_parameter_request_pub, enque_uavcan_request(), Mavlink::get_channel(), Mavlink::hash_check_enabled(), HASH_PARAM, hrt_absolute_time(), uavcan_parameter_request_s::int_value, mavlink_system, uavcan_parameter_request_s::message_type, name, uavcan_parameter_request_s::node_id, param_count_used(), param_find_no_notification(), param_for_used_index(), PARAM_HASH, param_hash_check(), uavcan_parameter_request_s::param_id, rc_parameter_map_s::param_id, rc_parameter_map_s::param_index, uavcan_parameter_request_s::param_index, PARAM_INVALID, param_set(), uavcan_parameter_request_s::param_type, param_type(), PARAM_TYPE_FLOAT, PARAM_TYPE_INT32, param_value, uORB::Publication< T >::publish(), uORB::PublicationQueued< T >::publish(), uavcan_parameter_request_s::real_value, request_next_uavcan_parameter(), rc_parameter_map_s::scale, send_param(), Mavlink::send_statustext_info(), uavcan_parameter_request_s::timestamp, rc_parameter_map_s::timestamp, rc_parameter_map_s::valid, rc_parameter_map_s::value0, rc_parameter_map_s::value_max, and rc_parameter_map_s::value_min.

Referenced by MavlinkReceiver::Run().

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

◆ operator=()

MavlinkParametersManager& MavlinkParametersManager::operator= ( const MavlinkParametersManager )
private

◆ request_next_uavcan_parameter()

void MavlinkParametersManager::request_next_uavcan_parameter ( )
protected

Request the next uavcan parameter.

Definition at line 551 of file mavlink_parameters.cpp.

References _uavcan_open_request_list, _uavcan_parameter_request_pub, _uavcan_waiting_for_request_response, uORB::PublicationQueued< T >::publish(), and MavlinkParametersManager::_uavcan_open_request_list_item::req.

Referenced by handle_message(), and send_uavcan().

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

◆ send()

void MavlinkParametersManager::send ( const hrt_abstime  t)

Handle sending of messages.

Call this regularly at a fixed frequency.

Parameters
tcurrent time

Definition at line 277 of file mavlink_parameters.cpp.

References _mavlink, Mavlink::get_free_tx_buf(), Mavlink::get_protocol(), get_size(), Mavlink::is_usb_uart(), send_params(), and SERIAL.

Referenced by MavlinkReceiver::Run().

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

◆ send_one()

bool MavlinkParametersManager::send_one ( )
protected

send a single param if a PARAM_REQUEST_LIST is in progress

Returns
true if a parameter was sent

Definition at line 422 of file mavlink_parameters.cpp.

References _mavlink, _send_all_index, Mavlink::get_channel(), HASH_PARAM, msg, param_count(), param_count_used(), param_for_index(), PARAM_HASH, param_hash_check(), PARAM_INVALID, param_used(), and send_param().

Referenced by send_params().

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

◆ send_param()

int MavlinkParametersManager::send_param ( param_t  param,
int  component_id = -1 
)
protected

Definition at line 476 of file mavlink_parameters.cpp.

References _mavlink, Mavlink::get_channel(), Mavlink::get_free_tx_buf(), mavlink_system, msg, OK, param_count_used(), param_get(), param_get_used_index(), PARAM_INVALID, param_name(), param_type(), PARAM_TYPE_FLOAT, PARAM_TYPE_INT32, and param_value.

Referenced by handle_message(), send_one(), and send_untransmitted().

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

◆ send_params()

bool MavlinkParametersManager::send_params ( )
protected

Handle any open param send transfer.

Definition at line 296 of file mavlink_parameters.cpp.

References send_one(), send_uavcan(), and send_untransmitted().

Referenced by send().

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

◆ send_uavcan()

bool MavlinkParametersManager::send_uavcan ( )
protected

Send UAVCAN params.

Definition at line 365 of file mavlink_parameters.cpp.

References _mavlink, _uavcan_open_request_list, _uavcan_parameter_value_sub, dequeue_uavcan_request(), Mavlink::get_channel(), mavlink_system, msg, uavcan_parameter_request_s::node_id, uavcan_parameter_request_s::param_index, MavlinkParametersManager::_uavcan_open_request_list_item::req, request_next_uavcan_parameter(), and uORB::Subscription::update().

Referenced by send_params().

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

◆ send_untransmitted()

bool MavlinkParametersManager::send_untransmitted ( )
protected

Send untransmitted params.

Definition at line 313 of file mavlink_parameters.cpp.

References _mavlink, _mavlink_parameter_sub, _param_update_index, _param_update_time, Mavlink::get_free_tx_buf(), get_size(), hrt_absolute_time(), param_count(), param_for_index(), PARAM_INVALID, param_name(), param_used(), param_value_unsaved(), send_param(), parameter_update_s::timestamp, uORB::Subscription::update(), and uORB::Subscription::updated().

Referenced by send_params().

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

Member Data Documentation

◆ _mavlink

Mavlink* MavlinkParametersManager::_mavlink
protected

◆ _mavlink_parameter_sub

uORB::Subscription MavlinkParametersManager::_mavlink_parameter_sub {ORB_ID(parameter_update)}
protected

Definition at line 136 of file mavlink_parameters.h.

Referenced by send_untransmitted().

◆ _param_update_index

int MavlinkParametersManager::_param_update_index {0}
protected

Definition at line 138 of file mavlink_parameters.h.

Referenced by send_untransmitted().

◆ _param_update_time

hrt_abstime MavlinkParametersManager::_param_update_time {0}
protected

Definition at line 137 of file mavlink_parameters.h.

Referenced by send_untransmitted().

◆ _rc_param_map

rc_parameter_map_s MavlinkParametersManager::_rc_param_map {}
protected

Definition at line 130 of file mavlink_parameters.h.

Referenced by handle_message().

◆ _rc_param_map_pub

uORB::Publication<rc_parameter_map_s> MavlinkParametersManager::_rc_param_map_pub {ORB_ID(rc_parameter_map)}
protected

Definition at line 129 of file mavlink_parameters.h.

Referenced by handle_message().

◆ _send_all_index

int MavlinkParametersManager::_send_all_index {-1}
private

Definition at line 76 of file mavlink_parameters.h.

Referenced by handle_message(), and send_one().

◆ _uavcan_open_request_list

_uavcan_open_request_list_item* MavlinkParametersManager::_uavcan_open_request_list {nullptr}
protected

Pointer to the first item in the linked list.

Definition at line 125 of file mavlink_parameters.h.

Referenced by dequeue_uavcan_request(), enque_uavcan_request(), request_next_uavcan_parameter(), and send_uavcan().

◆ _uavcan_parameter_request_pub

uORB::PublicationQueued<uavcan_parameter_request_s> MavlinkParametersManager::_uavcan_parameter_request_pub {ORB_ID(uavcan_parameter_request)}
protected

Definition at line 132 of file mavlink_parameters.h.

Referenced by handle_message(), and request_next_uavcan_parameter().

◆ _uavcan_parameter_value_sub

uORB::Subscription MavlinkParametersManager::_uavcan_parameter_value_sub {ORB_ID(uavcan_parameter_value)}
protected

Definition at line 134 of file mavlink_parameters.h.

Referenced by send_uavcan().

◆ _uavcan_queued_request_items

uint16_t MavlinkParametersManager::_uavcan_queued_request_items {0}
protected

Number of stored parameter requests currently in the list.

Definition at line 127 of file mavlink_parameters.h.

Referenced by dequeue_uavcan_request(), and enque_uavcan_request().

◆ _uavcan_waiting_for_request_response

bool MavlinkParametersManager::_uavcan_waiting_for_request_response {false}
protected

We have reqested a parameter and wait for the response.

Definition at line 126 of file mavlink_parameters.h.

Referenced by dequeue_uavcan_request(), and request_next_uavcan_parameter().


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