QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
SendMavlinkCommandState Class Reference

Sends the specified MAVLink command to the vehicle and waits for the result. More...

#include <SendMavlinkCommandState.h>

+ Inheritance diagram for SendMavlinkCommandState:
+ Collaboration diagram for SendMavlinkCommandState:

Signals

void success ()
 
- Signals inherited from WaitStateBase
void completed ()
 
void timeout ()
 
void timedOut ()
 
- Signals inherited from QGCAbstractState
void advance ()
 
void error ()
 

Public Member Functions

 SendMavlinkCommandState (QState *parent, MAV_CMD command, double param1=0.0, double param2=0.0, double param3=0.0, double param4=0.0, double param5=0.0, double param6=0.0, double param7=0.0)
 
 SendMavlinkCommandState (QState *parent)
 
void setup (MAV_CMD command, double param1=0.0, double param2=0.0, double param3=0.0, double param4=0.0, double param5=0.0, double param6=0.0, double param7=0.0)
 
- Public Member Functions inherited from WaitStateBase
 WaitStateBase (const QString &stateName, QState *parent, int timeoutMsecs=0)
 
void restartWait ()
 
- Public Member Functions inherited from QGCState
 QGCState (const QString &stateName, QState *parentState)
 
template<typename PointerToMemberFunction >
QSignalTransition * addThisTransition (PointerToMemberFunction signal, QAbstractState *target)
 Simpler version of QState::addTransition which assumes the sender is this.
 
void setLocalErrorState (QAbstractState *errorState)
 
QAbstractState * localErrorState () const
 Get the per-state error state (nullptr if using global)
 
void setProperty (QObject *object, const char *name, const QVariant &value)
 
void setEnabled (QObject *object, bool enabled)
 Convenience overload for setting enabled state on widgets/controls.
 
void setVisible (QObject *object, bool visible)
 Convenience overload for setting visible state on widgets/controls.
 
- Public Member Functions inherited from QGCAbstractState
 QGCAbstractState (const QString &stateName, QState *parent)
 
QGCStateMachinemachine () const
 
Vehiclevehicle () const
 
QString stateName () const
 
class StateContextcontext () const
 
void setOnEntry (EntryCallback callback)
 Set a callback to be invoked when the state is entered.
 
void setOnExit (ExitCallback callback)
 Set a callback to be invoked when the state is exited.
 
void setCallbacks (EntryCallback onEntry, ExitCallback onExit=nullptr)
 Set both entry and exit callbacks.
 
void setEventHandler (EventHandler handler)
 Set a custom event handler for this state.
 

Protected Member Functions

void connectWaitSignal () override
 Subclasses override to set up their signal connections.
 
void disconnectWaitSignal () override
 Subclasses override to tear down their signal connections.
 
void onWaitEntered () override
 Called when the state is entered - subclasses should call base implementation.
 
- Protected Member Functions inherited from WaitStateBase
virtual void onWaitExited ()
 Called when the state is exited - subclasses should call base implementation.
 
virtual void onWaitTimeout ()
 Called when the timeout expires - default emits timeout(), subclasses can override.
 
void waitComplete ()
 
void waitFailed ()
 
int timeoutMsecs () const
 
- Protected Member Functions inherited from QGCAbstractState
virtual void onEnter ()
 Override to perform actions on state entry.
 
virtual void onLeave ()
 Override to perform actions on state exit.
 
void onEntry (QEvent *event) override
 
void onExit (QEvent *event) override
 
bool event (QEvent *event) override
 

Additional Inherited Members

- Public Types inherited from QGCAbstractState
using EntryCallback = std::function< void()>
 
using ExitCallback = std::function< void()>
 
using EventHandler = std::function< bool(QEvent *)>
 

Detailed Description

Sends the specified MAVLink command to the vehicle and waits for the result.

Definition at line 9 of file SendMavlinkCommandState.h.

Constructor & Destructor Documentation

◆ SendMavlinkCommandState() [1/2]

SendMavlinkCommandState::SendMavlinkCommandState ( QState *  parent,
MAV_CMD  command,
double  param1 = 0.0,
double  param2 = 0.0,
double  param3 = 0.0,
double  param4 = 0.0,
double  param5 = 0.0,
double  param6 = 0.0,
double  param7 = 0.0 
)

Definition at line 6 of file SendMavlinkCommandState.cc.

References setup().

◆ SendMavlinkCommandState() [2/2]

SendMavlinkCommandState::SendMavlinkCommandState ( QState *  parent)

Definition at line 12 of file SendMavlinkCommandState.cc.

Member Function Documentation

◆ connectWaitSignal()

void SendMavlinkCommandState::connectWaitSignal ( )
overrideprotectedvirtual

Subclasses override to set up their signal connections.

Implements WaitStateBase.

Definition at line 30 of file SendMavlinkCommandState.cc.

References Vehicle::mavCommandResult(), and QGCAbstractState::vehicle().

◆ disconnectWaitSignal()

void SendMavlinkCommandState::disconnectWaitSignal ( )
overrideprotectedvirtual

Subclasses override to tear down their signal connections.

Implements WaitStateBase.

Definition at line 35 of file SendMavlinkCommandState.cc.

References Vehicle::mavCommandResult(), and QGCAbstractState::vehicle().

◆ onWaitEntered()

void SendMavlinkCommandState::onWaitEntered ( )
overrideprotectedvirtual

Called when the state is entered - subclasses should call base implementation.

Reimplemented from WaitStateBase.

Definition at line 42 of file SendMavlinkCommandState.cc.

References MissionCommandTree::instance(), Vehicle::sendMavCommand(), QGCAbstractState::vehicle(), and WaitStateBase::waitFailed().

◆ setup()

void SendMavlinkCommandState::setup ( MAV_CMD  command,
double  param1 = 0.0,
double  param2 = 0.0,
double  param3 = 0.0,
double  param4 = 0.0,
double  param5 = 0.0,
double  param6 = 0.0,
double  param7 = 0.0 
)

Definition at line 17 of file SendMavlinkCommandState.cc.

Referenced by SendMavlinkCommandState().

◆ success

void SendMavlinkCommandState::success ( )
signal

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