PX4 Firmware
PX4 Autopilot Software http://px4.io
events::rc_loss::RC_Loss_Alarm Class Reference

#include <rc_loss_alarm.h>

Collaboration diagram for events::rc_loss::RC_Loss_Alarm:

Public Member Functions

 RC_Loss_Alarm (const events::SubscriberHandler &subscriber_handler)
 
void process ()
 regularily called to handle state updates More...
 

Private Member Functions

bool check_for_updates ()
 check for topic updates More...
 
void play_tune ()
 Publish tune control to sound alarm. More...
 
void stop_tune ()
 Publish tune control to interrupt any sound. More...
 

Private Attributes

struct vehicle_status_s _vehicle_status = {}
 
bool _was_armed = false
 
bool _had_rc = false
 
bool _alarm_playing = false
 
orb_advert_t _tune_control_pub = nullptr
 
const events::SubscriberHandler_subscriber_handler
 

Detailed Description

Definition at line 52 of file rc_loss_alarm.h.

Constructor & Destructor Documentation

◆ RC_Loss_Alarm()

events::rc_loss::RC_Loss_Alarm::RC_Loss_Alarm ( const events::SubscriberHandler subscriber_handler)

Definition at line 55 of file rc_loss_alarm.cpp.

Member Function Documentation

◆ check_for_updates()

bool events::rc_loss::RC_Loss_Alarm::check_for_updates ( )
private

check for topic updates

Returns
true if one or more topics got updated

Definition at line 60 of file rc_loss_alarm.cpp.

References _subscriber_handler, _vehicle_status, events::SubscriberHandler::get_vehicle_status_sub(), orb_copy(), ORB_ID, and events::SubscriberHandler::vehicle_status_updated().

Referenced by process().

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

◆ play_tune()

void events::rc_loss::RC_Loss_Alarm::play_tune ( )
private

Publish tune control to sound alarm.

Definition at line 98 of file rc_loss_alarm.cpp.

References _tune_control_pub, hrt_absolute_time(), orb_advertise_queue(), ORB_ID, orb_publish(), tune_control_s::timestamp, tune_control_s::tune_id, tune_control_s::tune_override, and tune_control_s::volume.

Referenced by process().

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

◆ process()

void events::rc_loss::RC_Loss_Alarm::process ( )

regularily called to handle state updates

Definition at line 70 of file rc_loss_alarm.cpp.

References _alarm_playing, _had_rc, _vehicle_status, _was_armed, vehicle_status_s::arming_state, check_for_updates(), play_tune(), vehicle_status_s::rc_signal_lost, and stop_tune().

Referenced by events::SendEvent::cycle().

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

◆ stop_tune()

void events::rc_loss::RC_Loss_Alarm::stop_tune ( )
private

Publish tune control to interrupt any sound.

Definition at line 114 of file rc_loss_alarm.cpp.

References _tune_control_pub, hrt_absolute_time(), orb_advertise_queue(), ORB_ID, orb_publish(), tune_control_s::timestamp, and tune_control_s::tune_override.

Referenced by process().

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

Member Data Documentation

◆ _alarm_playing

bool events::rc_loss::RC_Loss_Alarm::_alarm_playing = false
private

Definition at line 77 of file rc_loss_alarm.h.

Referenced by process().

◆ _had_rc

bool events::rc_loss::RC_Loss_Alarm::_had_rc = false
private

Definition at line 76 of file rc_loss_alarm.h.

Referenced by process().

◆ _subscriber_handler

const events::SubscriberHandler& events::rc_loss::RC_Loss_Alarm::_subscriber_handler
private

Definition at line 79 of file rc_loss_alarm.h.

Referenced by check_for_updates().

◆ _tune_control_pub

orb_advert_t events::rc_loss::RC_Loss_Alarm::_tune_control_pub = nullptr
private

Definition at line 78 of file rc_loss_alarm.h.

Referenced by play_tune(), and stop_tune().

◆ _vehicle_status

struct vehicle_status_s events::rc_loss::RC_Loss_Alarm::_vehicle_status = {}
private

Definition at line 74 of file rc_loss_alarm.h.

Referenced by check_for_updates(), and process().

◆ _was_armed

bool events::rc_loss::RC_Loss_Alarm::_was_armed = false
private

Definition at line 75 of file rc_loss_alarm.h.

Referenced by process().


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