Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
ce98f3f1
Commit
ce98f3f1
authored
Dec 05, 2015
by
Don Gagne
Browse files
Move MockLink start methods to MockLink
parent
70cdbaf2
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/QmlControls/QGroundControlQmlGlobal.cc
View file @
ce98f3f1
...
@@ -74,28 +74,10 @@ bool QGroundControlQmlGlobal::loadBoolGlobalSetting (const QString& key, bool de
...
@@ -74,28 +74,10 @@ bool QGroundControlQmlGlobal::loadBoolGlobalSetting (const QString& key, bool de
return
settings
.
value
(
key
,
defaultValue
).
toBool
();
return
settings
.
value
(
key
,
defaultValue
).
toBool
();
}
}
#ifdef QT_DEBUG
void
QGroundControlQmlGlobal
::
_startMockLink
(
MockConfiguration
*
mockConfig
)
{
LinkManager
*
linkManager
=
qgcApp
()
->
toolbox
()
->
linkManager
();
mockConfig
->
setDynamic
(
true
);
linkManager
->
linkConfigurations
()
->
append
(
mockConfig
);
linkManager
->
createConnectedLink
(
mockConfig
);
}
#endif
void
QGroundControlQmlGlobal
::
startPX4MockLink
(
bool
sendStatusText
)
void
QGroundControlQmlGlobal
::
startPX4MockLink
(
bool
sendStatusText
)
{
{
#ifdef QT_DEBUG
#ifdef QT_DEBUG
MockConfiguration
*
mockConfig
=
new
MockConfiguration
(
"PX4 MockLink"
);
MockLink
::
startPX4MockLink
(
sendStatusText
);
mockConfig
->
setFirmwareType
(
MAV_AUTOPILOT_PX4
);
mockConfig
->
setVehicleType
(
MAV_TYPE_QUADROTOR
);
mockConfig
->
setSendStatusText
(
sendStatusText
);
_startMockLink
(
mockConfig
);
#else
#else
Q_UNUSED
(
sendStatusText
);
Q_UNUSED
(
sendStatusText
);
#endif
#endif
...
@@ -104,13 +86,7 @@ void QGroundControlQmlGlobal::startPX4MockLink(bool sendStatusText)
...
@@ -104,13 +86,7 @@ void QGroundControlQmlGlobal::startPX4MockLink(bool sendStatusText)
void
QGroundControlQmlGlobal
::
startGenericMockLink
(
bool
sendStatusText
)
void
QGroundControlQmlGlobal
::
startGenericMockLink
(
bool
sendStatusText
)
{
{
#ifdef QT_DEBUG
#ifdef QT_DEBUG
MockConfiguration
*
mockConfig
=
new
MockConfiguration
(
"Generic MockLink"
);
MockLink
::
startGenericMockLink
(
sendStatusText
);
mockConfig
->
setFirmwareType
(
MAV_AUTOPILOT_GENERIC
);
mockConfig
->
setVehicleType
(
MAV_TYPE_QUADROTOR
);
mockConfig
->
setSendStatusText
(
sendStatusText
);
_startMockLink
(
mockConfig
);
#else
#else
Q_UNUSED
(
sendStatusText
);
Q_UNUSED
(
sendStatusText
);
#endif
#endif
...
@@ -119,13 +95,7 @@ void QGroundControlQmlGlobal::startGenericMockLink(bool sendStatusText)
...
@@ -119,13 +95,7 @@ void QGroundControlQmlGlobal::startGenericMockLink(bool sendStatusText)
void
QGroundControlQmlGlobal
::
startAPMArduCopterMockLink
(
bool
sendStatusText
)
void
QGroundControlQmlGlobal
::
startAPMArduCopterMockLink
(
bool
sendStatusText
)
{
{
#ifdef QT_DEBUG
#ifdef QT_DEBUG
MockConfiguration
*
mockConfig
=
new
MockConfiguration
(
"APM ArduCopter MockLink"
);
MockLink
::
startAPMArduCopterMockLink
(
sendStatusText
);
mockConfig
->
setFirmwareType
(
MAV_AUTOPILOT_ARDUPILOTMEGA
);
mockConfig
->
setVehicleType
(
MAV_TYPE_QUADROTOR
);
mockConfig
->
setSendStatusText
(
sendStatusText
);
_startMockLink
(
mockConfig
);
#else
#else
Q_UNUSED
(
sendStatusText
);
Q_UNUSED
(
sendStatusText
);
#endif
#endif
...
@@ -134,13 +104,7 @@ void QGroundControlQmlGlobal::startAPMArduCopterMockLink(bool sendStatusText)
...
@@ -134,13 +104,7 @@ void QGroundControlQmlGlobal::startAPMArduCopterMockLink(bool sendStatusText)
void
QGroundControlQmlGlobal
::
startAPMArduPlaneMockLink
(
bool
sendStatusText
)
void
QGroundControlQmlGlobal
::
startAPMArduPlaneMockLink
(
bool
sendStatusText
)
{
{
#ifdef QT_DEBUG
#ifdef QT_DEBUG
MockConfiguration
*
mockConfig
=
new
MockConfiguration
(
"APM ArduPlane MockLink"
);
MockLink
::
startAPMArduPlaneMockLink
(
sendStatusText
);
mockConfig
->
setFirmwareType
(
MAV_AUTOPILOT_ARDUPILOTMEGA
);
mockConfig
->
setVehicleType
(
MAV_TYPE_FIXED_WING
);
mockConfig
->
setSendStatusText
(
sendStatusText
);
_startMockLink
(
mockConfig
);
#else
#else
Q_UNUSED
(
sendStatusText
);
Q_UNUSED
(
sendStatusText
);
#endif
#endif
...
...
src/QmlControls/QGroundControlQmlGlobal.h
View file @
ce98f3f1
...
@@ -132,9 +132,6 @@ signals:
...
@@ -132,9 +132,6 @@ signals:
void
virtualTabletJoystickChanged
(
bool
enabled
);
void
virtualTabletJoystickChanged
(
bool
enabled
);
private:
private:
#ifdef QT_DEBUG
void
_startMockLink
(
MockConfiguration
*
mockConfig
);
#endif
FlightMapSettings
*
_flightMapSettings
;
FlightMapSettings
*
_flightMapSettings
;
HomePositionManager
*
_homePositionManager
;
HomePositionManager
*
_homePositionManager
;
...
...
src/comm/MockLink.cc
View file @
ce98f3f1
...
@@ -929,3 +929,58 @@ void MockConfiguration::updateSettings()
...
@@ -929,3 +929,58 @@ void MockConfiguration::updateSettings()
}
}
}
}
}
}
MockLink
*
MockLink
::
_startMockLink
(
MockConfiguration
*
mockConfig
)
{
LinkManager
*
linkManager
=
qgcApp
()
->
toolbox
()
->
linkManager
();
mockConfig
->
setDynamic
(
true
);
linkManager
->
linkConfigurations
()
->
append
(
mockConfig
);
return
qobject_cast
<
MockLink
*>
(
linkManager
->
createConnectedLink
(
mockConfig
));
}
MockLink
*
MockLink
::
startPX4MockLink
(
bool
sendStatusText
)
{
MockConfiguration
*
mockConfig
=
new
MockConfiguration
(
"PX4 MockLink"
);
mockConfig
->
setFirmwareType
(
MAV_AUTOPILOT_PX4
);
mockConfig
->
setVehicleType
(
MAV_TYPE_QUADROTOR
);
mockConfig
->
setSendStatusText
(
sendStatusText
);
return
_startMockLink
(
mockConfig
);
}
MockLink
*
MockLink
::
startGenericMockLink
(
bool
sendStatusText
)
{
MockConfiguration
*
mockConfig
=
new
MockConfiguration
(
"Generic MockLink"
);
mockConfig
->
setFirmwareType
(
MAV_AUTOPILOT_GENERIC
);
mockConfig
->
setVehicleType
(
MAV_TYPE_QUADROTOR
);
mockConfig
->
setSendStatusText
(
sendStatusText
);
return
_startMockLink
(
mockConfig
);
}
MockLink
*
MockLink
::
startAPMArduCopterMockLink
(
bool
sendStatusText
)
{
MockConfiguration
*
mockConfig
=
new
MockConfiguration
(
"APM ArduCopter MockLink"
);
mockConfig
->
setFirmwareType
(
MAV_AUTOPILOT_ARDUPILOTMEGA
);
mockConfig
->
setVehicleType
(
MAV_TYPE_QUADROTOR
);
mockConfig
->
setSendStatusText
(
sendStatusText
);
return
_startMockLink
(
mockConfig
);
}
MockLink
*
MockLink
::
startAPMArduPlaneMockLink
(
bool
sendStatusText
)
{
MockConfiguration
*
mockConfig
=
new
MockConfiguration
(
"APM ArduPlane MockLink"
);
mockConfig
->
setFirmwareType
(
MAV_AUTOPILOT_ARDUPILOTMEGA
);
mockConfig
->
setVehicleType
(
MAV_TYPE_FIXED_WING
);
mockConfig
->
setSendStatusText
(
sendStatusText
);
return
_startMockLink
(
mockConfig
);
}
src/comm/MockLink.h
View file @
ce98f3f1
...
@@ -146,6 +146,11 @@ public:
...
@@ -146,6 +146,11 @@ public:
/// Reset the state of the MissionItemHandler to no items, no transactions in progress.
/// Reset the state of the MissionItemHandler to no items, no transactions in progress.
void
resetMissionItemHandler
(
void
)
{
_missionItemHandler
.
reset
();
}
void
resetMissionItemHandler
(
void
)
{
_missionItemHandler
.
reset
();
}
static
MockLink
*
startPX4MockLink
(
bool
sendStatusText
);
static
MockLink
*
startGenericMockLink
(
bool
sendStatusText
);
static
MockLink
*
startAPMArduCopterMockLink
(
bool
sendStatusText
);
static
MockLink
*
startAPMArduPlaneMockLink
(
bool
sendStatusText
);
signals:
signals:
/// @brief Used internally to move data to the thread.
/// @brief Used internally to move data to the thread.
void
_incomingBytes
(
const
QByteArray
bytes
);
void
_incomingBytes
(
const
QByteArray
bytes
);
...
@@ -189,6 +194,8 @@ private:
...
@@ -189,6 +194,8 @@ private:
void
_sendGpsRawInt
(
void
);
void
_sendGpsRawInt
(
void
);
void
_sendStatusTextMessages
(
void
);
void
_sendStatusTextMessages
(
void
);
static
MockLink
*
_startMockLink
(
MockConfiguration
*
mockConfig
);
MockLinkMissionItemHandler
_missionItemHandler
;
MockLinkMissionItemHandler
_missionItemHandler
;
QString
_name
;
QString
_name
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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