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
8b99f516
Commit
8b99f516
authored
Aug 10, 2010
by
Bryan Godbolt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working on opal link
parent
ed0fd7c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
150 additions
and
0 deletions
+150
-0
OpalLink.cc
src/comm/OpalLink.cc
+66
-0
OpalLink.h
src/comm/OpalLink.h
+84
-0
No files found.
src/comm/OpalLink.cc
View file @
8b99f516
...
...
@@ -2,4 +2,70 @@
OpalLink
::
OpalLink
()
{
// Set unique ID and add link to the list of links
this
->
id
=
getNextLinkId
();
this
->
name
=
tr
(
"OpalRT link "
)
+
QString
::
number
(
getId
());
LinkManager
::
instance
()
->
add
(
this
);
}
int
OpalLink
::
getId
()
{
return
id
;
}
QString
OpalLink
::
getName
()
{
return
name
;
}
void
OpalLink
::
setName
(
QString
name
)
{
this
->
name
=
name
;
emit
nameChanged
(
this
->
name
);
}
bool
OpalLink
::
isConnected
()
{
return
connectState
;
}
qint64
OpalLink
::
getNominalDataRate
()
{
return
0
;
//unknown
}
int
OpalLink
::
getLinkQuality
()
{
return
-
1
;
//not supported
}
qint64
OpalLink
::
getTotalUpstream
()
{
statisticsMutex
.
lock
();
return
bitsSentTotal
/
((
MG
::
TIME
::
getGroundTimeNow
()
-
connectionStartTime
)
/
1000
);
statisticsMutex
.
unlock
();
}
qint64
OpalLink
::
getCurrentUpstream
()
{
return
0
;
//unknown
}
qint64
OpalLink
::
getMaxUpstream
()
{
return
0
;
//unknown
}
qint64
OpalLink
::
getBitsSent
()
{
return
bitsSentTotal
;
}
qint64
OpalLink
::
getBitsReceived
()
{
return
bitsReceivedTotal
;
}
bool
OpalLink
::
isFullDuplex
()
{
return
false
;
}
src/comm/OpalLink.h
View file @
8b99f516
#ifndef OPALLINK_H
#define OPALLINK_H
/**
Connection to OpalRT. This class receives MAVLink packets as if it is a true link, but it
interprets the packets internally, and calls the appropriate api functions.
\author Bryan Godbolt <godbolt@ualberta.ca>
*/
#include <QMutex>
#include "LinkInterface.h"
#include "LinkManager.h"
#include "MG.h"
class
OpalLink
:
public
LinkInterface
{
Q_OBJECT
/* Connection management */
int
getId
();
QString
getName
();
bool
isConnected
();
/* Connection characteristics */
qint64
getNominalDataRate
();
bool
isFullDuplex
();
int
getLinkQuality
();
qint64
getTotalUpstream
();
qint64
getCurrentUpstream
();
qint64
getMaxUpstream
();
qint64
getBitsSent
();
qint64
getBitsReceived
();
virtual
bool
connect
()
=
0
;
virtual
bool
disconnect
()
=
0
;
virtual
qint64
bytesAvailable
()
=
0
;
public
slots
:
virtual
void
writeBytes
(
const
char
*
bytes
,
qint64
length
)
=
0
;
virtual
void
readBytes
(
char
*
bytes
,
qint64
maxLength
)
=
0
;
signals:
void
bytesReady
(
LinkInterface
*
link
);
void
bytesReceived
(
LinkInterface
*
link
,
QByteArray
data
);
void
connected
();
void
disconnected
();
void
connected
(
bool
connected
);
void
nameChanged
(
QString
name
);
public:
OpalLink
();
protected:
QString
name
;
int
id
;
bool
connectState
;
quint64
bitsSentTotal
;
quint64
bitsSentCurrent
;
quint64
bitsSentMax
;
quint64
bitsReceivedTotal
;
quint64
bitsReceivedCurrent
;
quint64
bitsReceivedMax
;
quint64
connectionStartTime
;
QMutex
statisticsMutex
;
void
setName
(
QString
name
);
};
#endif // OPALLINK_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