QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
MissionCommandTree.h
Go to the documentation of this file.
1#pragma once
2
3#include "QGCMAVLink.h"
4
5#include <QtCore/QLoggingCategory>
6#include <QtCore/QMap>
7#include <QtCore/QObject>
8#include <QtCore/QVariantList>
9#include <QtQmlIntegration/QtQmlIntegration>
10
12class MissionCommandTreeTest;
14class Vehicle;
15
35class MissionCommandTree : public QObject
36{
37 Q_OBJECT
38 QML_ELEMENT
39 QML_UNCREATABLE("")
40 Q_MOC_INCLUDE("Vehicle.h")
41
42#ifdef QGC_UNITTEST_BUILD
43 friend class MissionCommandTreeTest;
44#endif
45
46public:
50 explicit MissionCommandTree(bool unitTest = false, QObject *parent = nullptr);
51
54
58
59 Q_INVOKABLE QStringList categoriesForVehicle(Vehicle *vehicle);
60
62 Q_INVOKABLE QVariantList getCommandsForCategory(Vehicle *vehicle, const QString &category, bool showFlyThroughCommands);
63
65 QString friendlyName(MAV_CMD command) const;
66
68 QString rawName(MAV_CMD command) const;
69
70 bool isLandCommand(MAV_CMD command) const;
71 bool isTakeoffCommand(MAV_CMD command) const;
72
73 const QList<MAV_CMD> &allCommandIds() const;
74
75 const MissionCommandUIInfo *getUIInfo(Vehicle *vehicle, QGCMAVLink::VehicleClass_t vtolMode, MAV_CMD command);
76
77private:
81 void _collapseHierarchy(const MissionCommandList *cmdList, QMap<MAV_CMD, MissionCommandUIInfo*> &collapsedTree) const;
82 void _buildAllCommands(Vehicle *vehicle, QGCMAVLink::VehicleClass_t vtolMode);
83 QStringList _availableCategoriesForVehicle(Vehicle *vehicle);
84 void _firmwareAndVehicleClassInfo(Vehicle *vehicle, QGCMAVLink::VehicleClass_t vtolMode, QGCMAVLink::FirmwareClass_t &firmwareClass, QGCMAVLink::VehicleClass_t &vehicleClass) const;
85
86 const QString _allCommandsCategory = tr("All commands");
87
89 QMap<QGCMAVLink::FirmwareClass_t, QMap<QGCMAVLink::VehicleClass_t, MissionCommandList*>> _staticCommandTree;
90
92 QMap<QGCMAVLink::FirmwareClass_t, QMap<QGCMAVLink::VehicleClass_t, QMap<MAV_CMD, MissionCommandUIInfo*>>> _allCommands;
93
95 QMap<QGCMAVLink::FirmwareClass_t, QMap<QGCMAVLink::VehicleClass_t, QStringList /* category */>> _supportedCategories;
96};
Maintains a list of MissionCommandUIInfo objects loaded from a json file.
bool isTakeoffCommand(MAV_CMD command) const
bool isLandCommand(MAV_CMD command) const
~MissionCommandTree()
Destructor for the MissionCommandTree class.
const QList< MAV_CMD > & allCommandIds() const
static MissionCommandTree * instance()
QString rawName(MAV_CMD command) const
Returns the raw name for the specified command.
QVariantList getCommandsForCategory(Vehicle *vehicle, const QString &category, bool showFlyThroughCommands)
QString friendlyName(MAV_CMD command) const
Returns the friendly name for the specified command.
QStringList categoriesForVehicle(Vehicle *vehicle)
const MissionCommandUIInfo * getUIInfo(Vehicle *vehicle, QGCMAVLink::VehicleClass_t vtolMode, MAV_CMD command)