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
74f1acf5
Commit
74f1acf5
authored
Aug 07, 2013
by
tstellanova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip-- more mvc refactoring
parent
dd455b95
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
686 additions
and
509 deletions
+686
-509
QGCUASParamManager.cc
src/uas/QGCUASParamManager.cc
+188
-149
QGCUASParamManager.h
src/uas/QGCUASParamManager.h
+17
-21
UAS.cc
src/uas/UAS.cc
+4
-0
UAS.h
src/uas/UAS.h
+6
-0
UASInterface.h
src/uas/UASInterface.h
+3
-0
UASParameterCommsMgr.cc
src/uas/UASParameterCommsMgr.cc
+215
-2
UASParameterCommsMgr.h
src/uas/UASParameterCommsMgr.h
+29
-2
UASParameterDataModel.cc
src/uas/UASParameterDataModel.cc
+5
-5
UASParameterDataModel.h
src/uas/UASParameterDataModel.h
+9
-2
QGCParamWidget.cc
src/ui/QGCParamWidget.cc
+194
-311
QGCParamWidget.h
src/ui/QGCParamWidget.h
+16
-17
No files found.
src/uas/QGCUASParamManager.cc
View file @
74f1acf5
This diff is collapsed.
Click to expand it.
src/uas/QGCUASParamManager.h
View file @
74f1acf5
...
...
@@ -6,7 +6,9 @@
#include <QTimer>
#include <QVariant>
//forward declarations
class
UASInterface
;
class
UASParameterCommsMgr
;
class
UASParameterDataModel
;
class
QGCUASParamManager
:
public
QWidget
...
...
@@ -15,25 +17,29 @@ class QGCUASParamManager : public QWidget
public:
QGCUASParamManager
(
UASInterface
*
uas
,
QWidget
*
parent
=
0
);
/** @brief Get the known, confirmed value of a parameter */
virtual
bool
getParameterValue
(
int
component
,
const
QString
&
parameter
,
QVariant
&
value
)
const
;
/** @brief Provide tooltips / user-visible descriptions for parameters */
virtual
void
setParamDescriptions
(
const
QMap
<
QString
,
QString
>&
paramDescs
);
protected:
/** @brief Activate / deactivate parameter retransmission */
virtual
void
setRetransmissionGuardEnabled
(
bool
enabled
);
/** @brief Get the UAS of this widget
* @return The MAV of this mgr. Unless the MAV object has been destroyed, this is never null.
*/
UASInterface
*
getUAS
();
protected:
//TODO decouple this UI message display further
virtual
void
setParameterStatusMsg
(
const
QString
&
msg
);
/** @brief Load parameter meta information from appropriate CSV file */
virtual
void
loadParamMetaInfoCSV
();
signals:
void
parameterChanged
(
int
component
,
QString
parameter
,
QVariant
value
);
void
parameterChanged
(
int
component
,
int
parameterIndex
,
QVariant
value
);
void
parameterListUpToDate
(
int
component
);
void
parameterUpdateRequested
(
int
component
,
const
QString
&
parameter
);
void
parameterUpdateRequestedById
(
int
componentId
,
int
paramId
);
// void parameterUpdateRequested(int component, const QString& parameter);
// void parameterUpdateRequestedById(int componentId, int paramId);
public
slots
:
...
...
@@ -41,30 +47,20 @@ public slots:
virtual
void
setParameter
(
int
component
,
QString
parameterName
,
QVariant
value
)
=
0
;
/** @brief Request list of parameters from MAV */
virtual
void
requestParameterList
();
/** @brief Check for missing parameters */
virtual
void
retransmissionGuardTick
();
/** @brief Request a single parameter by name */
virtual
void
requestParameterUpdate
(
int
component
,
const
QString
&
parameter
);
virtual
void
handleParameterUpdate
(
int
component
,
int
paramCount
,
int
paramId
,
const
QString
&
parameterName
,
QVariant
value
)
=
0
;
virtual
void
handleParameterListUpToDate
(
int
component
)
=
0
;
protected:
// Parameter data model
UASInterface
*
mav
;
///< The MAV this widget is controlling
UASParameterDataModel
*
paramDataModel
;
///< Shared data model of parameters
// Communications management
QVector
<
bool
>
receivedParamsList
;
///< Successfully received parameters
QMap
<
int
,
QList
<
int
>*
>
transmissionMissingPackets
;
///< Missing packets
QMap
<
int
,
QMap
<
QString
,
QVariant
>*
>
transmissionMissingWriteAckPackets
;
///< Missing write ACK packets
bool
transmissionListMode
;
///< Currently requesting list
QMap
<
int
,
bool
>
transmissionListSizeKnown
;
///< List size initialized?
bool
transmissionActive
;
///< Missing packets, working on list?
quint64
transmissionTimeout
;
///< Timeout
QTimer
retransmissionTimer
;
///< Timer handling parameter retransmission
int
retransmissionTimeout
;
///< Retransmission request timeout, in milliseconds
int
rewriteTimeout
;
///< Write request timeout, in milliseconds
int
retransmissionBurstRequestSize
;
///< Number of packets requested for retransmission per burst
UASParameterCommsMgr
*
paramCommsMgr
;
///< Shared comms mgr for parameters
// Status
QString
parameterStatusMsg
;
...
...
src/uas/UAS.cc
View file @
74f1acf5
...
...
@@ -26,6 +26,7 @@
#include "QGCMAVLink.h"
#include "LinkManager.h"
#include "SerialLink.h"
#include "UASParameterCommsMgr.h"
#include <Eigen/Geometry>
#ifdef QGC_PROTOBUF_ENABLED
...
...
@@ -132,6 +133,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
paramsOnceRequested
(
false
),
paramManager
(
NULL
),
paramDataModel
(
NULL
),
paramCommsMgr
(
NULL
),
simulation
(
0
),
...
...
@@ -155,6 +157,8 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
paramDataModel
=
new
UASParameterDataModel
(
this
);
paramDataModel
->
setUASID
(
this
->
getUASID
());
paramCommsMgr
=
new
UASParameterCommsMgr
(
this
,
this
);
// Store a list of available actions for this UAS.
// Basically everything exposted as a SLOT with no return value or arguments.
...
...
src/uas/UAS.h
View file @
74f1acf5
...
...
@@ -41,6 +41,7 @@ This file is part of the QGROUNDCONTROL project
#include "QGCJSBSimLink.h"
#include "QGCXPlaneLink.h"
/**
* @brief A generic MAVLINK-connected MAV/UAV
*
...
...
@@ -493,6 +494,7 @@ protected: //COMMENTS FOR TEST UNIT
bool
paramsOnceRequested
;
///< If the parameter list has been read at least once
QGCUASParamManager
*
paramManager
;
///< Parameter manager class
UASParameterDataModel
*
paramDataModel
;
///< The parameter data model for this UAS
UASParameterCommsMgr
*
paramCommsMgr
;
/// SIMULATION
QGCHilLink
*
simulation
;
///< Hardware in the loop simulation link
...
...
@@ -526,6 +528,10 @@ public:
return
paramDataModel
;
}
UASParameterCommsMgr
*
getParamCommsMgr
()
{
return
paramCommsMgr
;
}
/** @brief Get the HIL simulation */
QGCHilLink
*
getHILSimulation
()
const
{
...
...
src/uas/UASInterface.h
View file @
74f1acf5
...
...
@@ -157,6 +157,9 @@ public:
/** @brief Access the parameter data model for this UAS (sans widget). This is the same parameter data model used by the parameter manager. **/
virtual
UASParameterDataModel
*
getParamDataModel
()
=
0
;
virtual
UASParameterCommsMgr
*
getParamCommsMgr
()
=
0
;
/** @brief Get reference to the param manager **/
virtual
QGCUASParamManager
*
getParamManager
()
const
=
0
;
...
...
src/uas/UASParameterCommsMgr.cc
View file @
74f1acf5
...
...
@@ -4,9 +4,22 @@
#include "UASInterface.h"
UASParameterCommsMgr
::
UASParameterCommsMgr
(
QObject
*
parent
,
UASInterface
*
uas
)
:
QObject
(
parent
)
QObject
(
parent
),
mav
(
uas
),
transmissionListMode
(
false
),
transmissionActive
(
false
),
transmissionTimeout
(
0
),
retransmissionTimeout
(
350
),
rewriteTimeout
(
500
),
retransmissionBurstRequestSize
(
5
)
{
mav
=
uas
;
loadParamCommsSettings
();
//Requesting parameters one-by-one from mav
connect
(
this
,
SIGNAL
(
parameterUpdateRequestedById
(
int
,
int
)),
mav
,
SLOT
(
requestParameter
(
int
,
int
)));
// Sending params to the UAS
connect
(
this
,
SIGNAL
(
parameterChanged
(
int
,
QString
,
QVariant
)),
mav
,
SLOT
(
setParameter
(
int
,
QString
,
QVariant
)));
...
...
@@ -14,9 +27,29 @@ UASParameterCommsMgr::UASParameterCommsMgr(QObject *parent, UASInterface *uas) :
// New parameters from UAS
connect
(
mav
,
SIGNAL
(
parameterChanged
(
int
,
int
,
int
,
int
,
QString
,
QVariant
)),
this
,
SLOT
(
receivedParameterUpdate
(
int
,
int
,
int
,
int
,
QString
,
QVariant
)));
//connecto retransmissionTimer
connect
(
&
retransmissionTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
retransmissionGuardTick
()));
}
void
UASParameterCommsMgr
::
loadParamCommsSettings
()
{
QSettings
settings
;
settings
.
beginGroup
(
"QGC_MAVLINK_PROTOCOL"
);
bool
valid
;
int
val
=
settings
.
value
(
"PARAMETER_RETRANSMISSION_TIMEOUT"
,
retransmissionTimeout
).
toInt
(
&
ok
);
if
(
valid
)
{
retransmissionTimeout
=
temp
;
}
val
=
settings
.
value
(
"PARAMETER_REWRITE_TIMEOUT"
,
rewriteTimeout
).
toInt
(
&
ok
);
if
(
valid
)
{
rewriteTimeout
=
temp
;
}
settings
.
endGroup
();
}
/**
* Send a request to deliver the list of onboard parameters
* from the MAV.
...
...
@@ -271,8 +304,188 @@ void UASParameterCommsMgr::setParameter(int component, QString parameterName, QV
setRetransmissionGuardEnabled
(
true
);
}
void
UASParameterCommsMgr
::
setParameterStatusMsg
(
const
QString
&
msg
)
void
UASParameterCommsMgr
::
setParameterStatusMsg
(
const
QString
&
msg
,
ParamCommsStatusLevel_t
level
)
{
qDebug
()
<<
"parameterStatusMsg: "
<<
msg
;
parameterStatusMsg
=
msg
;
//TODO indicate OK status somehow (eg color)
// QPalette pal = statusLabel->palette();
// pal.setColor(backgroundRole(), QGC::colorGreen);
// statusLabel->setPalette(pal);
// pal.setColor(backgroundRole(), QGC::colorRed);
// pal.setColor(backgroundRole(), QGC::colorOrange);
}
/**
* @param uas System which has the component
* @param component id of the component
* @param parameterName human friendly name of the parameter
*/
void
UASParameterCommsMgr
::
receivedParameterUpdate
(
int
uas
,
int
compId
,
int
paramCount
,
int
paramId
,
QString
paramName
,
QVariant
value
)
{
// Missing packets list has to be instantiated for all components
if
(
!
transmissionMissingPackets
.
contains
(
compId
))
{
transmissionMissingPackets
.
insert
(
compId
,
new
QList
<
int
>
());
}
// List mode is different from single parameter transfers
if
(
transmissionListMode
)
{
// Only accept the list size once on the first packet from
// each component
if
(
!
transmissionListSizeKnown
.
contains
(
compId
))
{
// Mark list size as known
transmissionListSizeKnown
.
insert
(
compId
,
true
);
// Mark all parameters as missing
for
(
int
i
=
0
;
i
<
paramCount
;
++
i
)
{
if
(
!
transmissionMissingPackets
.
value
(
compId
)
->
contains
(
i
))
{
transmissionMissingPackets
.
value
(
compId
)
->
append
(
i
);
}
}
// There is only one transmission timeout for all components
// since components do not manage their transmission,
// the longest timeout is safe for all components.
quint64
thisTransmissionTimeout
=
QGC
::
groundTimeMilliseconds
()
+
((
paramCount
)
*
retransmissionTimeout
);
if
(
thisTransmissionTimeout
>
transmissionTimeout
)
{
transmissionTimeout
=
thisTransmissionTimeout
;
}
}
// Start retransmission guard
// or reset timer
paramCommsMgr
->
setRetransmissionGuardEnabled
(
true
);
//TODO
}
// Mark this parameter as received in read list
int
index
=
transmissionMissingPackets
.
value
(
compId
)
->
indexOf
(
paramId
);
// If the MAV sent the parameter without request, it wont be in missing list
if
(
index
!=
-
1
)
{
transmissionMissingPackets
.
value
(
compId
)
->
removeAt
(
index
);
}
bool
justWritten
=
false
;
bool
writeMismatch
=
false
;
//bool lastWritten = false;
// Mark this parameter as received in write ACK list
QMap
<
QString
,
QVariant
>*
map
=
transmissionMissingWriteAckPackets
.
value
(
compId
);
if
(
map
&&
map
->
contains
(
paramName
))
{
justWritten
=
true
;
QVariant
newval
=
map
->
value
(
paramName
);
if
(
map
->
value
(
paramName
)
!=
value
)
{
writeMismatch
=
true
;
}
map
->
remove
(
paramName
);
}
int
missCount
=
0
;
foreach
(
int
key
,
transmissionMissingPackets
.
keys
())
{
missCount
+=
transmissionMissingPackets
.
value
(
key
)
->
count
();
}
int
missWriteCount
=
0
;
foreach
(
int
key
,
transmissionMissingWriteAckPackets
.
keys
())
{
missWriteCount
+=
transmissionMissingWriteAckPackets
.
value
(
key
)
->
count
();
}
//TODO simplify this if-else tree
if
(
justWritten
&&
!
writeMismatch
&&
missWriteCount
==
0
)
{
// Just wrote one and count went to 0 - this was the last missing write parameter
setParameterStatusMsg
(
tr
(
"SUCCESS: WROTE ALL PARAMETERS"
));
}
else
if
(
justWritten
&&
!
writeMismatch
)
{
setParameterStatusMsg
(
tr
(
"SUCCESS: Wrote %2 (#%1/%4): %3"
).
arg
(
paramId
+
1
).
arg
(
paramName
).
arg
(
value
.
toDouble
()).
arg
(
paramCount
));
}
else
if
(
justWritten
&&
writeMismatch
)
{
// Mismatch, tell user
setParameterStatusMsg
(
tr
(
"FAILURE: Wrote %1: sent %2 != onboard %3"
).
arg
(
paramName
).
arg
(
map
->
value
(
paramName
).
toDouble
()).
arg
(
value
.
toDouble
()),
ParamCommsStatusLevel_Warning
);
}
else
{
QString
val
=
QString
(
"%1"
).
arg
(
value
.
toFloat
(),
5
,
'f'
,
1
,
QChar
(
' '
));
if
(
missCount
==
0
)
{
// Transmission done
QTime
time
=
QTime
::
currentTime
();
QString
timeString
=
time
.
toString
();
setParameterStatusMsg
(
tr
(
"All received. (updated at %1)"
).
arg
(
timeString
));
}
else
{
// Transmission in progress
setParameterStatusMsg
(
tr
(
"OK: %1 %2 (%3/%4)"
).
arg
(
paramName
).
arg
(
val
).
arg
(
paramCount
-
missCount
).
arg
(
paramCount
),
ParamCommsStatusLevel_Warning
);
}
}
// Check if last parameter was received
if
(
missCount
==
0
&&
missWriteCount
==
0
)
{
this
->
transmissionActive
=
false
;
this
->
transmissionListMode
=
false
;
transmissionListSizeKnown
.
clear
();
foreach
(
int
key
,
transmissionMissingPackets
.
keys
())
{
transmissionMissingPackets
.
value
(
key
)
->
clear
();
}
//all parameters have been received, broadcast to UI
emit
parameterListUpToDate
();
//TODO in UI
// Expand visual tree
//tree->expandItem(tree->topLevelItem(0));
}
}
void
UASParameterCommsMgr
::
writeParamsToPersistentStorage
()
{
if
(
mav
)
{
mav
->
writeParametersToStorage
();
//TODO track timeout, retransmit etc?
}
}
void
UASParameterCommsMgr
::
sendPendingParameters
()
{
// Iterate through all components, through all pending parameters and send them to UAS
int
parametersSent
=
0
;
QMap
<
int
,
QMap
<
QString
,
QVariant
>*>
changedValues
=
paramDataModel
->
getPendingParameters
();
QMap
<
int
,
QMap
<
QString
,
QVariant
>*>::
iterator
i
;
for
(
i
=
changedValues
.
begin
();
i
!=
changedValues
.
end
();
++
i
)
{
// Iterate through the parameters of the component
int
compid
=
i
.
key
();
QMap
<
QString
,
QVariant
>*
comp
=
i
.
value
();
{
QMap
<
QString
,
QVariant
>::
iterator
j
;
for
(
j
=
comp
->
begin
();
j
!=
comp
->
end
();
++
j
)
{
//TODO mavlink command for "set parameter list" ?
setParameter
(
compid
,
j
.
key
(),
j
.
value
());
parametersSent
++
;
}
}
}
// Change transmission status if necessary
if
(
parametersSent
==
0
)
{
setParameterStatusMsg
(
tr
(
"No transmission: No changed values."
),
ParamCommsStatusLevel_Warning
);
}
else
{
setParameterStatusMsg
(
tr
(
"Transmitting %1 parameters."
).
arg
(
parametersSent
));
// Set timeouts
if
(
transmissionActive
)
{
transmissionTimeout
+=
parametersSent
*
rewriteTimeout
;
}
else
{
transmissionActive
=
true
;
quint64
newTransmissionTimeout
=
QGC
::
groundTimeMilliseconds
()
+
parametersSent
*
rewriteTimeout
;
if
(
newTransmissionTimeout
>
transmissionTimeout
)
{
transmissionTimeout
=
newTransmissionTimeout
;
}
}
// Enable guard
setRetransmissionGuardEnabled
(
true
);
}
}
src/uas/UASParameterCommsMgr.h
View file @
74f1acf5
...
...
@@ -10,9 +10,19 @@
class
UASInterface
;
class
UASParameterDataModel
;
class
UASParameterCommsMgr
:
public
QObject
{
Q_OBJECT
typedef
enum
ParamCommsStatusLevel
{
ParamCommsStatusLevel_OK
=
0
,
ParamCommsStatusLevel_Warning
=
2
,
ParamCommsStatusLevel_Error
=
4
,
ParamCommsStatusLevel_Count
}
ParamCommsStatusLevel_t
;
public:
explicit
UASParameterCommsMgr
(
QObject
*
parent
=
0
,
UASInterface
*
uas
=
NULL
);
...
...
@@ -21,19 +31,30 @@ protected:
/** @brief Activate / deactivate parameter retransmission */
virtual
void
setRetransmissionGuardEnabled
(
bool
enabled
);
virtual
void
setParameterStatusMsg
(
const
QString
&
msg
);
virtual
void
setParameterStatusMsg
(
const
QString
&
msg
,
ParamCommsStatusLevel_t
level
=
ParamCommsStatusLevel_OK
);
/** @brief Load settings that control eg retransmission timeouts */
void
loadParamCommsSettings
();
signals:
void
parameterChanged
(
int
component
,
QString
parameter
,
QVariant
value
);
void
parameterChanged
(
int
component
,
int
parameterIndex
,
QVariant
value
);
void
parameterValueConfirmed
(
int
component
,
QString
parameter
,
QVariant
value
);
void
parameterValueConfirmed
(
int
uas
,
int
component
,
int
paramCount
,
int
paramId
,
QString
parameter
,
QVariant
value
);
void
parameterListUpToDate
(
int
component
);
void
parameterUpdateRequested
(
int
component
,
const
QString
&
parameter
);
void
parameterUpdateRequestedById
(
int
componentId
,
int
paramId
);
/** @brief We updated the parameter status message */
void
parameterStatusMsgUpdated
(
QString
msg
,
ParamCommsStatusLevel_t
level
);
public
slots
:
/** @brief Iterate through all components, through all pending parameters and send them to UAS */
virtual
void
sendPendingParameters
();
/** @brief Write the current onboard parameters from transient RAM into persistent storage, e.g. EEPROM or harddisk */
virtual
void
writeParamsToPersistentStorage
();
/** @brief Write one parameter to the MAV */
virtual
void
setParameter
(
int
component
,
QString
parameterName
,
QVariant
value
);
/** @brief Request list of parameters from MAV */
...
...
@@ -44,6 +65,12 @@ public slots:
/** @brief Request a single parameter update by name */
virtual
void
requestParameterUpdate
(
int
component
,
const
QString
&
parameter
);
virtual
void
receivedParameterUpdate
(
int
uas
,
int
compId
,
int
paramCount
,
int
paramId
,
QString
paramName
,
QVariant
value
);
protected
slots
:
void
receivedParameterChange
(
int
uas
,
int
component
,
QString
parameterName
,
QVariant
value
);
void
receivedParameterListChange
(
int
uas
,
int
component
,
int
parameterCount
,
int
parameterId
,
QString
parameterName
,
QVariant
value
);
protected:
UASInterface
*
mav
;
///< The MAV we're talking to
...
...
src/uas/UASParameterDataModel.cc
View file @
74f1acf5
...
...
@@ -103,13 +103,13 @@ void UASParameterDataModel::setOnboardParameterWithType(int componentId, QString
}
}
void
UASParameterDataModel
::
addComponent
(
int
comp
onent
Id
)
void
UASParameterDataModel
::
addComponent
(
int
compId
)
{
if
(
!
onboardParameters
.
contains
(
comp
onent
Id
))
{
onboardParameters
.
insert
(
comp
onent
Id
,
new
QMap
<
QString
,
QVariant
>
());
if
(
!
onboardParameters
.
contains
(
compId
))
{
onboardParameters
.
insert
(
compId
,
new
QMap
<
QString
,
QVariant
>
());
}
if
(
!
pendingParameters
.
contains
(
comp
onent
Id
))
{
pendingParameters
.
insert
(
comp
onent
Id
,
new
QMap
<
QString
,
QVariant
>
());
if
(
!
pendingParameters
.
contains
(
compId
))
{
pendingParameters
.
insert
(
compId
,
new
QMap
<
QString
,
QVariant
>
());
}
}
...
...
src/uas/UASParameterDataModel.h
View file @
74f1acf5
...
...
@@ -14,6 +14,7 @@ public:
explicit
UASParameterDataModel
(
QObject
*
parent
=
0
);
int
getTotalOnboardParams
()
{
return
totalOnboardParameters
;
}
//Parameter meta info
bool
isParamMinKnown
(
const
QString
&
param
)
{
return
paramMin
.
contains
(
param
);
}
virtual
bool
isValueLessThanParamMin
(
const
QString
&
param
,
double
dblVal
);
...
...
@@ -28,8 +29,11 @@ public:
virtual
QString
getParamDescription
(
const
QString
&
param
)
{
return
paramDescriptions
.
value
(
param
,
""
);
}
virtual
void
setParamDescriptions
(
const
QMap
<
QString
,
QString
>&
paramInfo
);
virtual
void
addComponent
(
int
componentId
);
//TODO make this method protected?
/** @brief Ensure that the data model is aware of this component
* @param compId Id of the component
*/
virtual
void
addComponent
(
int
compId
);
/** @brief Write a new pending parameter value that may be eventually sent to the UAS */
virtual
void
setPendingParameter
(
int
componentId
,
QString
&
key
,
const
QVariant
&
value
);
...
...
@@ -83,6 +87,8 @@ public:
signals:
void
parameterUpdated
(
int
compId
,
int
paramId
,
QString
paramName
,
QVariant
value
);
public
slots
:
...
...
@@ -90,6 +96,7 @@ protected:
int
uasId
;
///< The UAS / MAV to which this data model pertains
QMap
<
int
,
QMap
<
QString
,
QVariant
>*
>
pendingParameters
;
///< Changed values that have not yet been transmitted to the UAS, by component ID
QMap
<
int
,
QMap
<
QString
,
QVariant
>*
>
onboardParameters
;
///< All parameters confirmed to be stored onboard the UAS, by component ID
int
totalOnboardParameters
;
///< The known count of onboard parameters, may not match onboardParameters until all params are received
// Tooltip data structures
QMap
<
QString
,
QString
>
paramDescriptions
;
///< Tooltip values
...
...
src/ui/QGCParamWidget.cc
View file @
74f1acf5
This diff is collapsed.
Click to expand it.
src/ui/QGCParamWidget.h
View file @
74f1acf5
...
...
@@ -48,9 +48,6 @@ class QGCParamWidget : public QGCUASParamManager
Q_OBJECT
public:
QGCParamWidget
(
UASInterface
*
uas
,
QWidget
*
parent
=
0
);
/** @brief Get the UAS of this widget */
UASInterface
*
getUAS
();
protected:
virtual
void
setParameterStatusMsg
(
const
QString
&
msg
);
...
...
@@ -61,12 +58,20 @@ signals:
public
slots
:
/** @brief Add a component to the list */
void
addComponentItem
(
int
uas
,
int
component
,
QString
componentName
);
/** @brief Add a component to the list
* @param compId Component id of the component
* @param compName Human friendly name of the component
*/
void
addComponentItem
(
int
compId
,
QString
compName
);
/** @brief Add a parameter to the list with retransmission / safety checks */
void
receivedParameterUpdate
(
int
uas
,
int
component
,
int
paramCount
,
int
paramId
,
QString
parameterName
,
QVariant
value
);
/** @brief Add a parameter to the list */
void
updateParameterDisplay
(
int
uas
,
int
component
,
QString
parameterName
,
QVariant
value
);
// void receivedParameterUpdate(int uas, int component, int paramCount, int paramId, QString parameterName, QVariant value);
virtual
void
handleParameterUpdate
(
int
component
,
int
paramCount
,
int
paramId
,
const
QString
&
parameterName
,
QVariant
value
);
virtual
void
handleParameterListUpToDate
(
int
component
);
/** @brief Ensure that view of parameter matches data in the model */
void
updateParameterDisplay
(
int
component
,
QString
parameterName
,
QVariant
value
);
/** @brief Request list of parameters from MAV */
void
requestAllParamsUpdate
();
/** @brief Set one parameter, changes value in RAM of MAV */
...
...
@@ -91,17 +96,11 @@ public slots:
protected:
QTreeWidget
*
tree
;
///< The parameter tree
QLabel
*
statusLabel
;
///< Parameter transmission label
QMap
<
int
,
QTreeWidgetItem
*>*
componentItems
;
///< The list of component items, stored by component ID
QMap
<
int
,
QMap
<
QString
,
QTreeWidgetItem
*>*
>
paramGroups
;
///< Parameter groups
QLabel
*
statusLabel
;
///< User-facing parameter status label
QMap
<
int
,
QTreeWidgetItem
*>*
componentItems
;
///< The tree of component items, stored by component ID
QMap
<
int
,
QMap
<
QString
,
QTreeWidgetItem
*>*
>
paramGroups
;
///< Parameter groups to organize component items
/** @brief Load settings */
void
loadSettings
();
/** @brief Load meta information from CSV */
void
loadParamMetaInfoCSV
(
const
QString
&
autopilot
,
const
QString
&
airframe
);
};
#endif // QGCPARAMWIDGET_H
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