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
a02927bf
Commit
a02927bf
authored
Aug 26, 2011
by
lm
Browse files
Working on MAVLink inspector
parent
09d4e8ec
Changes
6
Hide whitespace changes
Inline
Side-by-side
qgroundcontrol.pro
View file @
a02927bf
...
...
@@ -208,7 +208,8 @@ FORMS += src/ui/MainWindow.ui \
src
/
ui
/
mission
/
QGCMissionDoWidget
.
ui
\
src
/
ui
/
mission
/
QGCMissionConditionWidget
.
ui
\
src
/
ui
/
map
/
QGCMapTool
.
ui
\
src
/
ui
/
map
/
QGCMapToolBar
.
ui
src
/
ui
/
map
/
QGCMapToolBar
.
ui
\
src
/
ui
/
QGCMAVLinkInspector
.
ui
INCLUDEPATH
+=
src
\
src
/
ui
\
src
/
ui
/
linechart
\
...
...
@@ -320,7 +321,8 @@ HEADERS += src/MG.h \
src
/
ui
/
map
/
QGCMapToolBar
.
h
\
src
/
libs
/
qextserialport
/
qextserialenumerator
.
h
\
src
/
QGCGeo
.
h
\
src
/
ui
/
QGCToolBar
.
h
src
/
ui
/
QGCToolBar
.
h
\
src
/
ui
/
QGCMAVLinkInspector
.
h
#
Google
Earth
is
only
supported
on
Mac
OS
and
Windows
with
Visual
Studio
Compiler
macx
|
win32
-
msvc2008
|
win32
-
msvc2010
::
HEADERS
+=
src
/
ui
/
map3D
/
QGCGoogleEarthView
.
h
...
...
@@ -444,7 +446,8 @@ SOURCES += src/main.cc \
src
/
ui
/
map
/
Waypoint2DIcon
.
cc
\
src
/
ui
/
map
/
QGCMapTool
.
cc
\
src
/
ui
/
map
/
QGCMapToolBar
.
cc
\
src
/
ui
/
QGCToolBar
.
cc
src
/
ui
/
QGCToolBar
.
cc
\
src
/
ui
/
QGCMAVLinkInspector
.
cc
#
Enable
Google
Earth
only
on
Mac
OS
and
Windows
with
Visual
Studio
compiler
macx
|
win32
-
msvc2008
|
win32
-
msvc2010
::
SOURCES
+=
src
/
ui
/
map3D
/
QGCGoogleEarthView
.
cc
...
...
src/ui/MainWindow.cc
View file @
a02927bf
...
...
@@ -376,6 +376,14 @@ void MainWindow::buildCommonWidgets()
addToToolsMenu
(
logPlayerDockWidget
,
tr
(
"MAVLink Log Replay"
),
SLOT
(
showToolWidget
(
bool
)),
MENU_MAVLINK_LOG_PLAYER
,
Qt
::
RightDockWidgetArea
);
}
if
(
!
mavlinkInspectorWidget
)
{
mavlinkInspectorWidget
=
new
QDockWidget
(
tr
(
"MAVLink Message Inspector"
),
this
);
mavlinkInspectorWidget
->
setWidget
(
new
QGCMAVLinkInspector
(
mavlink
,
this
)
);
mavlinkInspectorWidget
->
setObjectName
(
"MAVLINK_INSPECTOR_DOCKWIDGET"
);
addToToolsMenu
(
mavlinkInspectorWidget
,
tr
(
"MAVLink Inspector"
),
SLOT
(
showToolWidget
(
bool
)),
MENU_MAVLINK_INSPECTOR
,
Qt
::
RightDockWidgetArea
);
}
// Center widgets
if
(
!
mapWidget
)
{
...
...
src/ui/MainWindow.h
View file @
a02927bf
...
...
@@ -75,7 +75,7 @@ This file is part of the QGROUNDCONTROL project
#include
"SlugsPadCameraControl.h"
#include
"UASControlParameters.h"
#include
"QGC
FlightGearLink
.h"
#include
"QGC
MAVLinkInspector
.h"
class
QGCMapTool
;
...
...
@@ -254,6 +254,7 @@ protected:
MENU_MAVLINK_LOG_PLAYER
,
MENU_VIDEO_STREAM_1
,
MENU_VIDEO_STREAM_2
,
MENU_MAVLINK_INSPECTOR
,
CENTRAL_SEPARATOR
=
255
,
// do not change
CENTRAL_LINECHART
,
CENTRAL_PROTOCOL
,
...
...
@@ -424,6 +425,8 @@ protected:
QPointer
<
QGCToolBar
>
toolBar
;
QPointer
<
QDockWidget
>
mavlinkInspectorWidget
;
// Popup widgets
JoystickWidget
*
joystickWidget
;
...
...
src/ui/QGCMAVLinkInspector.cc
0 → 100644
View file @
a02927bf
#include
<QList>
#include
"QGCMAVLinkInspector.h"
#include
"ui_QGCMAVLinkInspector.h"
#include
<QDebug>
QGCMAVLinkInspector
::
QGCMAVLinkInspector
(
MAVLinkProtocol
*
protocol
,
QWidget
*
parent
)
:
QWidget
(
parent
),
ui
(
new
Ui
::
QGCMAVLinkInspector
)
{
ui
->
setupUi
(
this
);
connect
(
protocol
,
SIGNAL
(
messageReceived
(
LinkInterface
*
,
mavlink_message_t
)),
this
,
SLOT
(
receiveMessage
(
LinkInterface
*
,
mavlink_message_t
)));
ui
->
treeWidget
->
setColumnCount
(
3
);
connect
(
&
updateTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
refreshView
()));
updateTimer
.
start
(
1000
);
}
void
QGCMAVLinkInspector
::
refreshView
()
{
foreach
(
mavlink_message_t
msg
,
receivedMessages
.
values
())
{
// Update the tree view
if
(
!
treeWidgetItems
.
contains
(
msg
.
msgid
))
{
QString
messageName
(
"MSG (#%1)"
);
messageName
=
messageName
.
arg
(
msg
.
msgid
);
QStringList
fields
;
fields
<<
messageName
;
fields
<<
""
;
fields
<<
""
;
QTreeWidgetItem
*
widget
=
new
QTreeWidgetItem
(
fields
);
treeWidgetItems
.
insert
(
msg
.
msgid
,
widget
);
ui
->
treeWidget
->
addTopLevelItem
(
widget
);
}
}
// // List all available MAVLink messages
// QList<QTreeWidgetItem *> items;
// for (int i = 0; i < 256; ++i)
// {
// QStringList stringList;
// stringList << QString("message: %1").arg(i) << QString("") << QString("Not received yet.");
// items.append(new QTreeWidgetItem((QTreeWidget*)0, stringList));
// }
// ui->treeWidget->insertTopLevelItems(0, items);
}
void
QGCMAVLinkInspector
::
receiveMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
)
{
Q_UNUSED
(
link
);
receivedMessages
.
insert
(
message
.
msgid
,
message
);
// Q_UNUSED(link);
// qDebug() << __FILE__ << __LINE__ << "GOT MAVLINK MESSAGE";
// // Check if children exist
// const QObjectList& fields = ui->treeWidget->children().at(message.msgid)->children();
// if (fields.length() == 0)
// {
// // Create children
// }
// for (int i = 0; i < fields.length(); ++i)
// {
// // Fill in field data
// }
}
QGCMAVLinkInspector
::~
QGCMAVLinkInspector
()
{
delete
ui
;
}
src/ui/QGCMAVLinkInspector.h
0 → 100644
View file @
a02927bf
#ifndef QGCMAVLINKINSPECTOR_H
#define QGCMAVLINKINSPECTOR_H
#include
<QWidget>
#include
<QMap>
#include
<QTimer>
#include
"MAVLinkProtocol.h"
namespace
Ui
{
class
QGCMAVLinkInspector
;
}
class
QTreeWidgetItem
;
class
QGCMAVLinkInspector
:
public
QWidget
{
Q_OBJECT
public:
explicit
QGCMAVLinkInspector
(
MAVLinkProtocol
*
protocol
,
QWidget
*
parent
=
0
);
~
QGCMAVLinkInspector
();
public
slots
:
void
receiveMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
);
void
refreshView
();
protected:
QMap
<
int
,
quint64
>
lastFieldUpdate
;
///< Used to switch between highlight and non-highlighting color
QMap
<
int
,
mavlink_message_t
>
receivedMessages
;
///< Available / known messages
QMap
<
int
,
QTreeWidgetItem
*>
treeWidgetItems
;
///< Available tree widget items
QTimer
updateTimer
;
///< Only update at 1 Hz to not overload the GUI
private:
Ui
::
QGCMAVLinkInspector
*
ui
;
};
#endif // QGCMAVLINKINSPECTOR_H
src/ui/QGCMAVLinkInspector.ui
0 → 100644
View file @
a02927bf
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
QGCMAVLinkInspector
</class>
<widget
class=
"QWidget"
name=
"QGCMAVLinkInspector"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
400
</width>
<height>
300
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<property
name=
"margin"
>
<number>
6
</number>
</property>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QTreeWidget"
name=
"treeWidget"
>
<column>
<property
name=
"text"
>
<string
notr=
"true"
>
1
</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
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