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/QMap>
6#include <QtCore/QObject>
7#include <QtCore/QVariantList>
8#include <QtQmlIntegration/QtQmlIntegration>
9
11class MissionCommandTreeTest;
13class Vehicle;
14
34class MissionCommandTree : public QObject
35{
36 Q_OBJECT
37 QML_ELEMENT
38 QML_UNCREATABLE("")
39 Q_MOC_INCLUDE("Vehicle.h")
40
41#ifdef QGC_UNITTEST_BUILD
42 friend class MissionCommandTreeTest;
43#endif
44
45public:
49 explicit MissionCommandTree(bool unitTest = false, QObject *parent = nullptr);
50
53
57
58 Q_INVOKABLE QStringList categoriesForVehicle(Vehicle *vehicle);
59
61 Q_INVOKABLE QVariantList getCommandsForCategory(Vehicle *vehicle, const QString &category, bool showFlyThroughCommands);
62
64 QString friendlyName(MAV_CMD command) const;
65
67 QString rawName(MAV_CMD command) const;
68
69 bool isLandCommand(MAV_CMD command) const;
70 bool isTakeoffCommand(MAV_CMD command) const;
71
72 const QList<MAV_CMD> &allCommandIds() const;
73
74 const MissionCommandUIInfo *getUIInfo(Vehicle *vehicle, QGCMAVLink::VehicleClass_t vtolMode, MAV_CMD command);
75
76private:
80 void _collapseHierarchy(const MissionCommandList *cmdList, QMap<MAV_CMD, MissionCommandUIInfo*> &collapsedTree) const;
81 void _buildAllCommands(Vehicle *vehicle, QGCMAVLink::VehicleClass_t vtolMode);
82 QStringList _availableCategoriesForVehicle(Vehicle *vehicle);
83 void _firmwareAndVehicleClassInfo(Vehicle *vehicle, QGCMAVLink::VehicleClass_t vtolMode, QGCMAVLink::FirmwareClass_t &firmwareClass, QGCMAVLink::VehicleClass_t &vehicleClass) const;
84
85 const QString _allCommandsCategory = tr("All commands");
86
88 QMap<QGCMAVLink::FirmwareClass_t, QMap<QGCMAVLink::VehicleClass_t, MissionCommandList*>> _staticCommandTree;
89
91 QMap<QGCMAVLink::FirmwareClass_t, QMap<QGCMAVLink::VehicleClass_t, QMap<MAV_CMD, MissionCommandUIInfo*>>> _allCommands;
92
94 QMap<QGCMAVLink::FirmwareClass_t, QMap<QGCMAVLink::VehicleClass_t, QStringList /* category */>> _supportedCategories;
95};
Maintains a list of MissionCommandUIInfo objects loaded from a json file.
Manages a hierarchy of MissionCommandUIInfo.
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.
Q_INVOKABLE QVariantList getCommandsForCategory(Vehicle *vehicle, const QString &category, bool showFlyThroughCommands)
QString friendlyName(MAV_CMD command) const
Returns the friendly name for the specified command.
Q_INVOKABLE QStringList categoriesForVehicle(Vehicle *vehicle)
const MissionCommandUIInfo * getUIInfo(Vehicle *vehicle, QGCMAVLink::VehicleClass_t vtolMode, MAV_CMD command)
UI Information associated with a mission command (MAV_CMD)