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

Master controller for mission, fence, rally. More...

#include <PlanMasterController.h>

+ Inheritance diagram for PlanMasterController:
+ Collaboration diagram for PlanMasterController:

Signals

void containsItemsChanged ()
 
void showCreateFromTemplateChanged ()
 
void syncInProgressChanged (void)
 
void dirtyForSaveChanged (bool dirtyForSave)
 
void dirtyForUploadChanged (bool dirtyForUpload)
 
void offlineChanged (bool offlineEditing)
 
void currentPlanFileChanged (void)
 
void currentPlanFileNameChanged (void)
 
void originalPlanFileNameChanged (void)
 
void planFileRenamedChanged (void)
 
void planCreatorsChanged (QmlObjectListModel *planCreators)
 
void managerVehicleChanged (Vehicle *managerVehicle)
 
void promptForPlanUsageOnVehicleChange (void)
 
void userSelectedManualCreationChanged ()
 

Public Member Functions

 PlanMasterController (QObject *parent=nullptr)
 
 ~PlanMasterController ()
 Either active vehicle or _controllerVehicle if no active vehicle.
 
Q_INVOKABLE void start (void)
 Should be called immediately upon Component.onCompleted.
 
Q_INVOKABLE void startStaticActiveVehicle (Vehicle *vehicle, bool deleteWhenSendCompleted=false)
 
Q_INVOKABLE int readyForSaveState (void) const
 
Q_INVOKABLE void showPlanFromManagerVehicle (void)
 Replaces any current plan with the plan from the manager vehicle even if offline.
 
Q_INVOKABLE void loadFromVehicle (void)
 
Q_INVOKABLE void sendToVehicle (void)
 
Q_INVOKABLE void loadFromFile (const QString &filename)
 
Q_INVOKABLE void loadFromArchive (const QString &archivePath)
 
Q_INVOKABLE bool saveToCurrent ()
 
Q_INVOKABLE bool saveToFile (const QString &filename)
 
Q_INVOKABLE void saveToKml (const QString &filename)
 
Q_INVOKABLE bool saveWithCurrentName ()
 Save using the (possibly renamed) currentPlanFileName.
 
Q_INVOKABLE bool resolvedPlanFileExists () const
 true if a file at the renamed path already exists on disk
 
Q_INVOKABLE void removeAll (void)
 Removes all from controller only, sync required to remove from vehicle.
 
Q_INVOKABLE void removeAllFromVehicle (void)
 Removes all from vehicle and controller.
 
MissionControllermissionController (void)
 
GeoFenceControllergeoFenceController (void)
 
RallyPointControllerrallyPointController (void)
 
bool offline (void) const
 
bool containsItems (void) const
 
bool showCreateFromTemplate (void) const
 
bool syncInProgress (void) const
 
bool dirtyForSave (void) const
 
bool dirtyForUpload (void) const
 
QString fileExtension (void) const
 
QString kmlFileExtension (void) const
 
QString currentPlanFile (void) const
 
QString currentPlanFileName (void) const
 
void setCurrentPlanFileName (const QString &name)
 
QString originalPlanFileName (void) const
 
bool planFileRenamed (void) const
 
QStringList loadNameFilters (void) const
 
QStringList saveNameFilters (void) const
 
bool isEmpty (void) const
 
bool userSelectedManualCreation (void) const
 
QmlObjectListModelplanCreators (void) const
 
void setFlyView (bool flyView)
 
void setUserSelectedManualCreation (bool userSelectedManualCreation)
 
QJsonDocument saveToJson ()
 
VehiclecontrollerVehicle (void)
 
VehiclemanagerVehicle (void)
 

Static Public Member Functions

static void sendPlanToVehicle (Vehicle *vehicle, const QString &filename)
 

Static Public Attributes

static constexpr int kPlanFileVersion = 1
 
static constexpr const char * kPlanFileType = "Plan"
 
static constexpr const char * kJsonMissionObjectKey = "mission"
 
static constexpr const char * kJsonGeoFenceObjectKey = "geoFence"
 
static constexpr const char * kJsonRallyPointsObjectKey = "rallyPoints"
 

Detailed Description

Master controller for mission, fence, rally.

Definition at line 21 of file PlanMasterController.h.

Constructor & Destructor Documentation

◆ PlanMasterController()

PlanMasterController::PlanMasterController ( QObject *  parent = nullptr)

Definition at line 28 of file PlanMasterController.cc.

◆ ~PlanMasterController()

PlanMasterController::~PlanMasterController ( )

Either active vehicle or _controllerVehicle if no active vehicle.

Offline controller vehicle true: controller is not connected to an active vehicle true: Elemement is non-empty true: No plan items and not in manual-creation mode; UI should show "create new plan" template selection true: Information is currently being saved/sent, false: no active save/send in progress true: Unsaved changes to disk are present, false: no changes since last save to disk true: Unsent changes are present, false: no changes since last upload/download sync File extension for missions Fully qualified path, empty if not yet saved Editable base name, no path or extension On-disk name when last loaded/saved true if currentPlanFileName differs from originalPlanFileName File filter list loading plan files File filter list saving plan files true: User is not using a template to create the plan

Definition at line 75 of file PlanMasterController.cc.

Member Function Documentation

◆ containsItems()

bool PlanMasterController::containsItems ( void  ) const

◆ containsItemsChanged

void PlanMasterController::containsItemsChanged ( )
signal

◆ controllerVehicle()

◆ currentPlanFile()

QString PlanMasterController::currentPlanFile ( void  ) const
inline

Definition at line 114 of file PlanMasterController.h.

◆ currentPlanFileChanged

void PlanMasterController::currentPlanFileChanged ( void  )
signal

Referenced by loadFromFile(), and saveToFile().

◆ currentPlanFileName()

QString PlanMasterController::currentPlanFileName ( void  ) const
inline

Definition at line 115 of file PlanMasterController.h.

◆ currentPlanFileNameChanged

void PlanMasterController::currentPlanFileNameChanged ( void  )
signal

◆ dirtyForSave()

bool PlanMasterController::dirtyForSave ( void  ) const
inline

Definition at line 110 of file PlanMasterController.h.

◆ dirtyForSaveChanged

void PlanMasterController::dirtyForSaveChanged ( bool  dirtyForSave)
signal

◆ dirtyForUpload()

bool PlanMasterController::dirtyForUpload ( void  ) const
inline

Definition at line 111 of file PlanMasterController.h.

◆ dirtyForUploadChanged

void PlanMasterController::dirtyForUploadChanged ( bool  dirtyForUpload)
signal

◆ fileExtension()

QString PlanMasterController::fileExtension ( void  ) const

◆ geoFenceController()

GeoFenceController * PlanMasterController::geoFenceController ( void  )
inline

Definition at line 103 of file PlanMasterController.h.

◆ isEmpty()

bool PlanMasterController::isEmpty ( void  ) const

◆ kmlFileExtension()

QString PlanMasterController::kmlFileExtension ( void  ) const

Definition at line 670 of file PlanMasterController.cc.

References AppSettings::kmlFileExtension.

Referenced by saveToKml().

◆ loadFromArchive()

void PlanMasterController::loadFromArchive ( const QString &  archivePath)

Load a plan from an archive file (.zip, .tar.gz, etc.) Extracts the archive and loads the first .plan file found.

Parameters
archivePathPath to the archive file

Definition at line 849 of file PlanMasterController.cc.

References QGCCompressionJob::extractArchive(), QGCCompressionJob::finished(), QGCCompression::isArchiveFile(), and QGC::showAppMessage().

◆ loadFromFile()

◆ loadFromVehicle()

◆ loadNameFilters()

QStringList PlanMasterController::loadNameFilters ( void  ) const

◆ managerVehicle()

◆ managerVehicleChanged

void PlanMasterController::managerVehicleChanged ( Vehicle managerVehicle)
signal

◆ missionController()

MissionController * PlanMasterController::missionController ( void  )
inline

◆ offline()

◆ offlineChanged

void PlanMasterController::offlineChanged ( bool  offlineEditing)
signal

◆ originalPlanFileName()

QString PlanMasterController::originalPlanFileName ( void  ) const
inline

Definition at line 117 of file PlanMasterController.h.

◆ originalPlanFileNameChanged

void PlanMasterController::originalPlanFileNameChanged ( void  )
signal

Referenced by loadFromFile(), and saveToFile().

◆ planCreators()

QmlObjectListModel * PlanMasterController::planCreators ( void  ) const
inline

Definition at line 123 of file PlanMasterController.h.

◆ planCreatorsChanged

void PlanMasterController::planCreatorsChanged ( QmlObjectListModel planCreators)
signal

◆ planFileRenamed()

bool PlanMasterController::planFileRenamed ( void  ) const

Definition at line 626 of file PlanMasterController.cc.

Referenced by loadFromFile(), saveToFile(), and setCurrentPlanFileName().

◆ planFileRenamedChanged

void PlanMasterController::planFileRenamedChanged ( void  )
signal

◆ promptForPlanUsageOnVehicleChange

void PlanMasterController::promptForPlanUsageOnVehicleChange ( void  )
signal

◆ rallyPointController()

RallyPointController * PlanMasterController::rallyPointController ( void  )
inline

Definition at line 104 of file PlanMasterController.h.

◆ readyForSaveState()

Q_INVOKABLE int PlanMasterController::readyForSaveState ( void  ) const
inline

Determines if the plan has all information needed to be saved or sent to the vehicle. IMPORTANT NOTE: The return value is a VisualMissionItem::ReadForSaveState value. It is an int here to work around a nightmare of circular header dependency problems.

Definition at line 74 of file PlanMasterController.h.

References MissionController::readyForSaveState().

◆ removeAll()

◆ removeAllFromVehicle()

◆ resolvedPlanFileExists()

bool PlanMasterController::resolvedPlanFileExists ( ) const

true if a file at the renamed path already exists on disk

Definition at line 631 of file PlanMasterController.cc.

◆ saveNameFilters()

QStringList PlanMasterController::saveNameFilters ( void  ) const

Definition at line 685 of file PlanMasterController.cc.

References fileExtension().

◆ saveToCurrent()

bool PlanMasterController::saveToCurrent ( )

Definition at line 457 of file PlanMasterController.cc.

References saveToFile().

◆ saveToFile()

◆ saveToJson()

◆ saveToKml()

void PlanMasterController::saveToKml ( const QString &  filename)

◆ saveWithCurrentName()

bool PlanMasterController::saveWithCurrentName ( )

Save using the (possibly renamed) currentPlanFileName.

Definition at line 618 of file PlanMasterController.cc.

References saveToFile().

◆ sendPlanToVehicle()

void PlanMasterController::sendPlanToVehicle ( Vehicle vehicle,
const QString &  filename 
)
static

Sends a plan to the specified file

Parameters
[in]vehicleVehicle we are sending a plan to
[in]filenamePlan file to load

Definition at line 693 of file PlanMasterController.cc.

References loadFromFile(), sendToVehicle(), and startStaticActiveVehicle().

Referenced by Vehicle::sendPlan().

◆ sendToVehicle()

void PlanMasterController::sendToVehicle ( void  )

◆ setCurrentPlanFileName()

void PlanMasterController::setCurrentPlanFileName ( const QString &  name)

◆ setFlyView()

void PlanMasterController::setFlyView ( bool  flyView)
inline

Definition at line 125 of file PlanMasterController.h.

◆ setUserSelectedManualCreation()

void PlanMasterController::setUserSelectedManualCreation ( bool  userSelectedManualCreation)

◆ showCreateFromTemplate()

bool PlanMasterController::showCreateFromTemplate ( void  ) const
inline

Definition at line 108 of file PlanMasterController.h.

References containsItems().

Referenced by setUserSelectedManualCreation().

◆ showCreateFromTemplateChanged

void PlanMasterController::showCreateFromTemplateChanged ( )
signal

◆ showPlanFromManagerVehicle()

void PlanMasterController::showPlanFromManagerVehicle ( void  )

Replaces any current plan with the plan from the manager vehicle even if offline.

Definition at line 821 of file PlanMasterController.cc.

References offline(), and removeAll().

◆ start()

void PlanMasterController::start ( void  )

◆ startStaticActiveVehicle()

void PlanMasterController::startStaticActiveVehicle ( Vehicle vehicle,
bool  deleteWhenSendCompleted = false 
)

Starts the controller using a single static active vehicle. Will not track global active vehicle changes.

Parameters
deleteWhenSendCmpleteThe PlanMasterController object should be deleted after the first send is completed.

Definition at line 92 of file PlanMasterController.cc.

References GeoFenceController::start(), MissionController::start(), and RallyPointController::start().

Referenced by sendPlanToVehicle().

◆ syncInProgress()

bool PlanMasterController::syncInProgress ( void  ) const

◆ syncInProgressChanged

void PlanMasterController::syncInProgressChanged ( void  )
signal

◆ userSelectedManualCreation()

bool PlanMasterController::userSelectedManualCreation ( void  ) const
inline

Definition at line 122 of file PlanMasterController.h.

Referenced by setUserSelectedManualCreation().

◆ userSelectedManualCreationChanged

void PlanMasterController::userSelectedManualCreationChanged ( )
signal

Member Data Documentation

◆ kJsonGeoFenceObjectKey

constexpr const char* PlanMasterController::kJsonGeoFenceObjectKey = "geoFence"
staticconstexpr

Definition at line 136 of file PlanMasterController.h.

Referenced by loadFromFile(), and saveToJson().

◆ kJsonMissionObjectKey

constexpr const char* PlanMasterController::kJsonMissionObjectKey = "mission"
staticconstexpr

Definition at line 135 of file PlanMasterController.h.

Referenced by loadFromFile(), and saveToJson().

◆ kJsonRallyPointsObjectKey

constexpr const char* PlanMasterController::kJsonRallyPointsObjectKey = "rallyPoints"
staticconstexpr

Definition at line 137 of file PlanMasterController.h.

Referenced by loadFromFile(), and saveToJson().

◆ kPlanFileType

constexpr const char* PlanMasterController::kPlanFileType = "Plan"
staticconstexpr

Definition at line 134 of file PlanMasterController.h.

Referenced by loadFromFile(), and saveToJson().

◆ kPlanFileVersion

constexpr int PlanMasterController::kPlanFileVersion = 1
staticconstexpr

Definition at line 133 of file PlanMasterController.h.

Referenced by loadFromFile(), and saveToJson().


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