Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
72cd5d1c
Commit
72cd5d1c
authored
Feb 21, 2017
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for FirmwarePluginFactory::supportedVehicleTypes
parent
12fdb097
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
79 additions
and
28 deletions
+79
-28
APMFirmwarePluginFactory.cc
src/FirmwarePlugin/APM/APMFirmwarePluginFactory.cc
+1
-1
APMFirmwarePluginFactory.h
src/FirmwarePlugin/APM/APMFirmwarePluginFactory.h
+1
-1
FirmwarePlugin.cc
src/FirmwarePlugin/FirmwarePlugin.cc
+7
-0
FirmwarePlugin.h
src/FirmwarePlugin/FirmwarePlugin.h
+5
-2
FirmwarePluginManager.cc
src/FirmwarePlugin/FirmwarePluginManager.cc
+49
-14
FirmwarePluginManager.h
src/FirmwarePlugin/FirmwarePluginManager.h
+11
-5
PX4FirmwarePluginFactory.cc
src/FirmwarePlugin/PX4/PX4FirmwarePluginFactory.cc
+1
-1
PX4FirmwarePluginFactory.h
src/FirmwarePlugin/PX4/PX4FirmwarePluginFactory.h
+1
-1
MissionCommandTree.cc
src/MissionManager/MissionCommandTree.cc
+2
-2
QGroundControlQmlGlobal.cc
src/QmlControls/QGroundControlQmlGlobal.cc
+1
-1
No files found.
src/FirmwarePlugin/APM/APMFirmwarePluginFactory.cc
View file @
72cd5d1c
...
@@ -24,7 +24,7 @@ APMFirmwarePluginFactory::APMFirmwarePluginFactory(void)
...
@@ -24,7 +24,7 @@ APMFirmwarePluginFactory::APMFirmwarePluginFactory(void)
}
}
QList
<
MAV_AUTOPILOT
>
APMFirmwarePluginFactory
::
known
FirmwareTypes
(
void
)
const
QList
<
MAV_AUTOPILOT
>
APMFirmwarePluginFactory
::
supported
FirmwareTypes
(
void
)
const
{
{
QList
<
MAV_AUTOPILOT
>
list
;
QList
<
MAV_AUTOPILOT
>
list
;
...
...
src/FirmwarePlugin/APM/APMFirmwarePluginFactory.h
View file @
72cd5d1c
...
@@ -24,7 +24,7 @@ class APMFirmwarePluginFactory : public FirmwarePluginFactory
...
@@ -24,7 +24,7 @@ class APMFirmwarePluginFactory : public FirmwarePluginFactory
public:
public:
APMFirmwarePluginFactory
(
void
);
APMFirmwarePluginFactory
(
void
);
QList
<
MAV_AUTOPILOT
>
knownFirmwareTypes
(
void
)
const
final
;
QList
<
MAV_AUTOPILOT
>
supportedFirmwareTypes
(
void
)
const
final
;
FirmwarePlugin
*
firmwarePluginForAutopilot
(
MAV_AUTOPILOT
autopilotType
,
MAV_TYPE
vehicleType
)
final
;
FirmwarePlugin
*
firmwarePluginForAutopilot
(
MAV_AUTOPILOT
autopilotType
,
MAV_TYPE
vehicleType
)
final
;
private:
private:
...
...
src/FirmwarePlugin/FirmwarePlugin.cc
View file @
72cd5d1c
...
@@ -24,6 +24,13 @@ FirmwarePluginFactory::FirmwarePluginFactory(void)
...
@@ -24,6 +24,13 @@ FirmwarePluginFactory::FirmwarePluginFactory(void)
FirmwarePluginFactoryRegister
::
instance
()
->
registerPluginFactory
(
this
);
FirmwarePluginFactoryRegister
::
instance
()
->
registerPluginFactory
(
this
);
}
}
QList
<
MAV_TYPE
>
FirmwarePluginFactory
::
supportedVehicleTypes
(
void
)
const
{
QList
<
MAV_TYPE
>
vehicleTypes
;
vehicleTypes
<<
MAV_TYPE_FIXED_WING
<<
MAV_TYPE_QUADROTOR
<<
MAV_TYPE_VTOL_QUADROTOR
<<
MAV_TYPE_GROUND_ROVER
<<
MAV_TYPE_SUBMARINE
;
return
vehicleTypes
;
}
FirmwarePluginFactoryRegister
*
FirmwarePluginFactoryRegister
::
instance
(
void
)
FirmwarePluginFactoryRegister
*
FirmwarePluginFactoryRegister
::
instance
(
void
)
{
{
if
(
!
_instance
)
{
if
(
!
_instance
)
{
...
...
src/FirmwarePlugin/FirmwarePlugin.h
View file @
72cd5d1c
...
@@ -265,8 +265,11 @@ public:
...
@@ -265,8 +265,11 @@ public:
/// @return Singleton FirmwarePlugin instance for the specified MAV_AUTOPILOT.
/// @return Singleton FirmwarePlugin instance for the specified MAV_AUTOPILOT.
virtual
FirmwarePlugin
*
firmwarePluginForAutopilot
(
MAV_AUTOPILOT
autopilotType
,
MAV_TYPE
vehicleType
)
=
0
;
virtual
FirmwarePlugin
*
firmwarePluginForAutopilot
(
MAV_AUTOPILOT
autopilotType
,
MAV_TYPE
vehicleType
)
=
0
;
/// @return List of autopilot types this plugin supports.
/// @return List of firmware types this plugin supports.
virtual
QList
<
MAV_AUTOPILOT
>
knownFirmwareTypes
(
void
)
const
=
0
;
virtual
QList
<
MAV_AUTOPILOT
>
supportedFirmwareTypes
(
void
)
const
=
0
;
/// @return List of vehicle types this plugin supports.
virtual
QList
<
MAV_TYPE
>
supportedVehicleTypes
(
void
)
const
;
};
};
class
FirmwarePluginFactoryRegister
:
public
QObject
class
FirmwarePluginFactoryRegister
:
public
QObject
...
...
src/FirmwarePlugin/FirmwarePluginManager.cc
View file @
72cd5d1c
...
@@ -26,33 +26,68 @@ FirmwarePluginManager::~FirmwarePluginManager()
...
@@ -26,33 +26,68 @@ FirmwarePluginManager::~FirmwarePluginManager()
delete
_genericFirmwarePlugin
;
delete
_genericFirmwarePlugin
;
}
}
QList
<
MAV_AUTOPILOT
>
FirmwarePluginManager
::
known
FirmwareTypes
(
void
)
QList
<
MAV_AUTOPILOT
>
FirmwarePluginManager
::
supported
FirmwareTypes
(
void
)
{
{
if
(
_
known
FirmwareTypes
.
isEmpty
())
{
if
(
_
supported
FirmwareTypes
.
isEmpty
())
{
QList
<
FirmwarePluginFactory
*>
factoryList
=
FirmwarePluginFactoryRegister
::
instance
()
->
pluginFactories
();
QList
<
FirmwarePluginFactory
*>
factoryList
=
FirmwarePluginFactoryRegister
::
instance
()
->
pluginFactories
();
for
(
int
i
=
0
;
i
<
factoryList
.
count
();
i
++
)
{
for
(
int
i
=
0
;
i
<
factoryList
.
count
();
i
++
)
{
_
knownFirmwareTypes
.
append
(
factoryList
[
i
]
->
known
FirmwareTypes
());
_
supportedFirmwareTypes
.
append
(
factoryList
[
i
]
->
supported
FirmwareTypes
());
}
}
_
known
FirmwareTypes
.
append
(
MAV_AUTOPILOT_GENERIC
);
_
supported
FirmwareTypes
.
append
(
MAV_AUTOPILOT_GENERIC
);
}
}
return
_
known
FirmwareTypes
;
return
_
supported
FirmwareTypes
;
}
}
FirmwarePlugin
*
FirmwarePluginManager
::
firmwarePluginForAutopilot
(
MAV_AUTOPILOT
autopilotType
,
MAV_TYPE
vehicl
eType
)
QList
<
MAV_TYPE
>
FirmwarePluginManager
::
supportedVehicleTypes
(
MAV_AUTOPILOT
firmwar
eType
)
{
{
FirmwarePlugin
*
_plugin
=
NULL
;
QList
<
MAV_TYPE
>
vehicleTypes
;
QList
<
FirmwarePluginFactory
*>
factoryList
=
FirmwarePluginFactoryRegister
::
instance
()
->
pluginFactories
();
// Find the plugin which supports this vehicle
FirmwarePluginFactory
*
factory
=
_findPluginFactory
(
firmwareType
);
for
(
int
i
=
0
;
i
<
factoryList
.
count
();
i
++
)
{
if
((
_plugin
=
factoryList
[
i
]
->
firmwarePluginForAutopilot
(
autopilotType
,
vehicleType
)))
{
if
(
factory
)
{
return
_plugin
;
vehicleTypes
=
factory
->
supportedVehicleTypes
();
}
else
if
(
firmwareType
==
MAV_AUTOPILOT_GENERIC
)
{
vehicleTypes
<<
MAV_TYPE_FIXED_WING
<<
MAV_TYPE_QUADROTOR
<<
MAV_TYPE_VTOL_QUADROTOR
<<
MAV_TYPE_GROUND_ROVER
<<
MAV_TYPE_SUBMARINE
;
}
else
{
qWarning
()
<<
"Request for unknown firmware plugin factory"
<<
firmwareType
;
}
}
return
vehicleTypes
;
}
FirmwarePlugin
*
FirmwarePluginManager
::
firmwarePluginForAutopilot
(
MAV_AUTOPILOT
firmwareType
,
MAV_TYPE
vehicleType
)
{
FirmwarePluginFactory
*
factory
=
_findPluginFactory
(
firmwareType
);
FirmwarePlugin
*
plugin
=
NULL
;
if
(
factory
)
{
plugin
=
factory
->
firmwarePluginForAutopilot
(
firmwareType
,
vehicleType
);
}
else
if
(
firmwareType
!=
MAV_AUTOPILOT_GENERIC
)
{
qWarning
()
<<
"Request for unknown firmware plugin factory"
<<
firmwareType
;
}
}
if
(
!
plugin
)
{
// Default plugin fallback
// Default plugin fallback
if
(
!
_genericFirmwarePlugin
)
{
if
(
!
_genericFirmwarePlugin
)
{
_genericFirmwarePlugin
=
new
FirmwarePlugin
;
_genericFirmwarePlugin
=
new
FirmwarePlugin
;
}
}
return
_genericFirmwarePlugin
;
plugin
=
_genericFirmwarePlugin
;
}
return
plugin
;
}
FirmwarePluginFactory
*
FirmwarePluginManager
::
_findPluginFactory
(
MAV_AUTOPILOT
firmwareType
)
{
QList
<
FirmwarePluginFactory
*>
factoryList
=
FirmwarePluginFactoryRegister
::
instance
()
->
pluginFactories
();
// Find the plugin which supports this vehicle
for
(
int
i
=
0
;
i
<
factoryList
.
count
();
i
++
)
{
FirmwarePluginFactory
*
factory
=
factoryList
[
i
];
if
(
factory
->
supportedFirmwareTypes
().
contains
(
firmwareType
))
{
return
factory
;
}
}
return
NULL
;
}
}
src/FirmwarePlugin/FirmwarePluginManager.h
View file @
72cd5d1c
...
@@ -32,17 +32,23 @@ public:
...
@@ -32,17 +32,23 @@ public:
FirmwarePluginManager
(
QGCApplication
*
app
);
FirmwarePluginManager
(
QGCApplication
*
app
);
~
FirmwarePluginManager
();
~
FirmwarePluginManager
();
QList
<
MAV_AUTOPILOT
>
knownFirmwareTypes
(
void
);
/// Returns list of firmwares which are supported by the system
QList
<
MAV_AUTOPILOT
>
supportedFirmwareTypes
(
void
);
/// Returns the list of supported vehicle types for the specified firmware
QList
<
MAV_TYPE
>
supportedVehicleTypes
(
MAV_AUTOPILOT
firmwareType
);
/// Returns appropriate plugin for autopilot type.
/// Returns appropriate plugin for autopilot type.
/// @param
autopilotType Type of autopilot
to return plugin for.
/// @param
firmwareType Type of firmwware
to return plugin for.
/// @param vehicleType Vehicle type
of autopilot
to return plugin for.
/// @param vehicleType Vehicle type to return plugin for.
/// @return Singleton FirmwarePlugin instance for the specified MAV_AUTOPILOT.
/// @return Singleton FirmwarePlugin instance for the specified MAV_AUTOPILOT.
FirmwarePlugin
*
firmwarePluginForAutopilot
(
MAV_AUTOPILOT
autopilot
Type
,
MAV_TYPE
vehicleType
);
FirmwarePlugin
*
firmwarePluginForAutopilot
(
MAV_AUTOPILOT
firmware
Type
,
MAV_TYPE
vehicleType
);
private:
private:
FirmwarePluginFactory
*
_findPluginFactory
(
MAV_AUTOPILOT
firmwareType
);
FirmwarePlugin
*
_genericFirmwarePlugin
;
FirmwarePlugin
*
_genericFirmwarePlugin
;
QList
<
MAV_AUTOPILOT
>
_
known
FirmwareTypes
;
QList
<
MAV_AUTOPILOT
>
_
supported
FirmwareTypes
;
};
};
#endif
#endif
src/FirmwarePlugin/PX4/PX4FirmwarePluginFactory.cc
View file @
72cd5d1c
...
@@ -21,7 +21,7 @@ PX4FirmwarePluginFactory::PX4FirmwarePluginFactory(void)
...
@@ -21,7 +21,7 @@ PX4FirmwarePluginFactory::PX4FirmwarePluginFactory(void)
}
}
QList
<
MAV_AUTOPILOT
>
PX4FirmwarePluginFactory
::
known
FirmwareTypes
(
void
)
const
QList
<
MAV_AUTOPILOT
>
PX4FirmwarePluginFactory
::
supported
FirmwareTypes
(
void
)
const
{
{
QList
<
MAV_AUTOPILOT
>
list
;
QList
<
MAV_AUTOPILOT
>
list
;
...
...
src/FirmwarePlugin/PX4/PX4FirmwarePluginFactory.h
View file @
72cd5d1c
...
@@ -21,7 +21,7 @@ class PX4FirmwarePluginFactory : public FirmwarePluginFactory
...
@@ -21,7 +21,7 @@ class PX4FirmwarePluginFactory : public FirmwarePluginFactory
public:
public:
PX4FirmwarePluginFactory
(
void
);
PX4FirmwarePluginFactory
(
void
);
QList
<
MAV_AUTOPILOT
>
knownFirmwareTypes
(
void
)
const
final
;
QList
<
MAV_AUTOPILOT
>
supportedFirmwareTypes
(
void
)
const
final
;
FirmwarePlugin
*
firmwarePluginForAutopilot
(
MAV_AUTOPILOT
autopilotType
,
MAV_TYPE
vehicleType
)
final
;
FirmwarePlugin
*
firmwarePluginForAutopilot
(
MAV_AUTOPILOT
autopilotType
,
MAV_TYPE
vehicleType
)
final
;
private:
private:
...
...
src/MissionManager/MissionCommandTree.cc
View file @
72cd5d1c
...
@@ -46,7 +46,7 @@ void MissionCommandTree::setToolbox(QGCToolbox* toolbox)
...
@@ -46,7 +46,7 @@ void MissionCommandTree::setToolbox(QGCToolbox* toolbox)
}
else
{
}
else
{
#endif
#endif
// Load all levels of hierarchy
// Load all levels of hierarchy
foreach
(
MAV_AUTOPILOT
firmwareType
,
_toolbox
->
firmwarePluginManager
()
->
known
FirmwareTypes
())
{
foreach
(
MAV_AUTOPILOT
firmwareType
,
_toolbox
->
firmwarePluginManager
()
->
supported
FirmwareTypes
())
{
FirmwarePlugin
*
plugin
=
_toolbox
->
firmwarePluginManager
()
->
firmwarePluginForAutopilot
(
firmwareType
,
MAV_TYPE_QUADROTOR
);
FirmwarePlugin
*
plugin
=
_toolbox
->
firmwarePluginManager
()
->
firmwarePluginForAutopilot
(
firmwareType
,
MAV_TYPE_QUADROTOR
);
QList
<
MAV_TYPE
>
vehicleTypes
;
QList
<
MAV_TYPE
>
vehicleTypes
;
...
@@ -66,7 +66,7 @@ void MissionCommandTree::setToolbox(QGCToolbox* toolbox)
...
@@ -66,7 +66,7 @@ void MissionCommandTree::setToolbox(QGCToolbox* toolbox)
MAV_AUTOPILOT
MissionCommandTree
::
_baseFirmwareType
(
MAV_AUTOPILOT
firmwareType
)
const
MAV_AUTOPILOT
MissionCommandTree
::
_baseFirmwareType
(
MAV_AUTOPILOT
firmwareType
)
const
{
{
if
(
qgcApp
()
->
toolbox
()
->
firmwarePluginManager
()
->
known
FirmwareTypes
().
contains
(
firmwareType
))
{
if
(
qgcApp
()
->
toolbox
()
->
firmwarePluginManager
()
->
supported
FirmwareTypes
().
contains
(
firmwareType
))
{
return
firmwareType
;
return
firmwareType
;
}
else
{
}
else
{
return
MAV_AUTOPILOT_GENERIC
;
return
MAV_AUTOPILOT_GENERIC
;
...
...
src/QmlControls/QGroundControlQmlGlobal.cc
View file @
72cd5d1c
...
@@ -197,7 +197,7 @@ void QGroundControlQmlGlobal::setBaseFontPointSize(qreal size)
...
@@ -197,7 +197,7 @@ void QGroundControlQmlGlobal::setBaseFontPointSize(qreal size)
int
QGroundControlQmlGlobal
::
supportedFirmwareCount
()
int
QGroundControlQmlGlobal
::
supportedFirmwareCount
()
{
{
return
_firmwarePluginManager
->
known
FirmwareTypes
().
count
();
return
_firmwarePluginManager
->
supported
FirmwareTypes
().
count
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment