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
03b34ca5
Commit
03b34ca5
authored
Sep 09, 2017
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Stable_V3.2' of
https://github.com/mavlink/qgroundcontrol
into StableMerge
parents
affbaef0
7634204f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
262 deletions
+11
-262
qserialport_p.h
libs/qtandroidserialport/src/qserialport_p.h
+6
-257
qtandroidserialport.pri
libs/qtandroidserialport/src/qtandroidserialport.pri
+1
-1
QGCApplication.cc
src/QGCApplication.cc
+1
-1
Vehicle.cc
src/Vehicle/Vehicle.cc
+3
-3
No files found.
libs/qtandroidserialport/src/qserialport_p.h
View file @
03b34ca5
...
...
@@ -48,265 +48,14 @@
//
#include "qserialport.h"
#include "private/qringbuffer_p.h"
QT_BEGIN_NAMESPACE
class
QGCRingBuffer
{
public:
explicit
inline
QGCRingBuffer
(
int
growth
=
4096
)
:
head
(
0
),
tail
(
0
),
tailBuffer
(
0
),
basicBlockSize
(
growth
),
bufferSize
(
0
)
{
buffers
.
append
(
QByteArray
());
}
inline
int
nextDataBlockSize
()
const
{
return
(
tailBuffer
==
0
?
tail
:
buffers
.
first
().
size
())
-
head
;
}
inline
const
char
*
readPointer
()
const
{
return
buffers
.
isEmpty
()
?
0
:
(
buffers
.
first
().
constData
()
+
head
);
}
// access the bytes at a specified position
// the out-variable length will contain the amount of bytes readable
// from there, e.g. the amount still the same QByteArray
inline
const
char
*
readPointerAtPosition
(
qint64
pos
,
qint64
&
length
)
const
{
if
(
pos
>=
0
)
{
pos
+=
head
;
for
(
int
i
=
0
;
i
<
buffers
.
size
();
++
i
)
{
length
=
(
i
==
tailBuffer
?
tail
:
buffers
[
i
].
size
());
if
(
length
>
pos
)
{
length
-=
pos
;
return
buffers
[
i
].
constData
()
+
pos
;
}
pos
-=
length
;
}
}
length
=
0
;
return
0
;
}
inline
void
free
(
int
bytes
)
{
while
(
bytes
>
0
)
{
int
blockSize
=
buffers
.
first
().
size
()
-
head
;
if
(
tailBuffer
==
0
||
blockSize
>
bytes
)
{
bufferSize
-=
bytes
;
if
(
bufferSize
<=
0
)
clear
();
// try to minify/squeeze us
else
head
+=
bytes
;
return
;
}
bufferSize
-=
blockSize
;
bytes
-=
blockSize
;
buffers
.
removeFirst
();
--
tailBuffer
;
head
=
0
;
}
}
inline
char
*
reserve
(
int
bytes
)
{
if
(
bytes
<=
0
)
return
0
;
// if need buffer reallocation
if
(
tail
+
bytes
>
buffers
.
last
().
size
())
{
if
(
tail
>=
basicBlockSize
)
{
// shrink this buffer to its current size
buffers
.
last
().
resize
(
tail
);
// create a new QByteArray
buffers
.
append
(
QByteArray
());
++
tailBuffer
;
tail
=
0
;
}
buffers
.
last
().
resize
(
qMax
(
basicBlockSize
,
tail
+
bytes
));
}
char
*
writePtr
=
buffers
.
last
().
data
()
+
tail
;
bufferSize
+=
bytes
;
tail
+=
bytes
;
return
writePtr
;
}
inline
void
truncate
(
int
pos
)
{
if
(
pos
<
size
())
chop
(
size
()
-
pos
);
}
inline
void
chop
(
int
bytes
)
{
while
(
bytes
>
0
)
{
if
(
tailBuffer
==
0
||
tail
>
bytes
)
{
bufferSize
-=
bytes
;
if
(
bufferSize
<=
0
)
clear
();
// try to minify/squeeze us
else
tail
-=
bytes
;
return
;
}
bufferSize
-=
tail
;
bytes
-=
tail
;
buffers
.
removeLast
();
--
tailBuffer
;
tail
=
buffers
.
last
().
size
();
}
}
inline
bool
isEmpty
()
const
{
return
tailBuffer
==
0
&&
tail
==
0
;
}
inline
int
getChar
()
{
if
(
isEmpty
())
return
-
1
;
char
c
=
*
readPointer
();
free
(
1
);
return
int
(
uchar
(
c
));
}
inline
void
putChar
(
char
c
)
{
char
*
ptr
=
reserve
(
1
);
*
ptr
=
c
;
}
#include <QDebug>
inline
void
ungetChar
(
char
c
)
{
--
head
;
if
(
head
<
0
)
{
buffers
.
prepend
(
QByteArray
());
buffers
.
first
().
resize
(
basicBlockSize
);
head
=
basicBlockSize
-
1
;
++
tailBuffer
;
}
buffers
.
first
()[
head
]
=
c
;
++
bufferSize
;
}
inline
int
size
()
const
{
return
bufferSize
;
}
inline
void
clear
()
{
buffers
.
erase
(
buffers
.
begin
()
+
1
,
buffers
.
end
());
buffers
.
first
().
clear
();
head
=
tail
=
0
;
tailBuffer
=
0
;
bufferSize
=
0
;
}
inline
int
indexOf
(
char
c
)
const
{
int
index
=
0
;
int
j
=
head
;
for
(
int
i
=
0
;
i
<
buffers
.
size
();
++
i
)
{
const
char
*
ptr
=
buffers
[
i
].
constData
()
+
j
;
j
=
index
+
(
i
==
tailBuffer
?
tail
:
buffers
[
i
].
size
())
-
j
;
while
(
index
<
j
)
{
if
(
*
ptr
++
==
c
)
return
index
;
++
index
;
}
j
=
0
;
}
return
-
1
;
}
inline
int
indexOf
(
char
c
,
int
maxLength
)
const
{
int
index
=
0
;
int
j
=
head
;
for
(
int
i
=
0
;
index
<
maxLength
&&
i
<
buffers
.
size
();
++
i
)
{
const
char
*
ptr
=
buffers
[
i
].
constData
()
+
j
;
j
=
qMin
(
index
+
(
i
==
tailBuffer
?
tail
:
buffers
[
i
].
size
())
-
j
,
maxLength
);
while
(
index
<
j
)
{
if
(
*
ptr
++
==
c
)
return
index
;
++
index
;
}
j
=
0
;
}
return
-
1
;
}
inline
int
read
(
char
*
data
,
int
maxLength
)
{
int
bytesToRead
=
qMin
(
size
(),
maxLength
);
int
readSoFar
=
0
;
while
(
readSoFar
<
bytesToRead
)
{
int
bytesToReadFromThisBlock
=
qMin
(
bytesToRead
-
readSoFar
,
nextDataBlockSize
());
if
(
data
)
memcpy
(
data
+
readSoFar
,
readPointer
(),
bytesToReadFromThisBlock
);
readSoFar
+=
bytesToReadFromThisBlock
;
free
(
bytesToReadFromThisBlock
);
}
return
readSoFar
;
}
// read an unspecified amount (will read the first buffer)
inline
QByteArray
read
()
{
if
(
bufferSize
==
0
)
return
QByteArray
();
QByteArray
qba
(
buffers
.
takeFirst
());
qba
.
reserve
(
0
);
// avoid that resizing needlessly reallocates
if
(
tailBuffer
==
0
)
{
qba
.
resize
(
tail
);
tail
=
0
;
buffers
.
append
(
QByteArray
());
}
else
{
--
tailBuffer
;
}
qba
.
remove
(
0
,
head
);
// does nothing if head is 0
head
=
0
;
bufferSize
-=
qba
.
size
();
return
qba
;
}
// append a new buffer to the end
inline
void
append
(
const
QByteArray
&
qba
)
{
if
(
tail
==
0
)
{
buffers
.
last
()
=
qba
;
}
else
{
buffers
.
last
().
resize
(
tail
);
buffers
.
append
(
qba
);
++
tailBuffer
;
}
tail
=
qba
.
size
();
bufferSize
+=
tail
;
}
inline
int
skip
(
int
length
)
{
return
read
(
0
,
length
);
}
inline
int
readLine
(
char
*
data
,
int
maxLength
)
{
if
(
!
data
||
--
maxLength
<=
0
)
return
-
1
;
int
i
=
indexOf
(
'\n'
,
maxLength
);
i
=
read
(
data
,
i
>=
0
?
(
i
+
1
)
:
maxLength
);
// Terminate it.
data
[
i
]
=
'\0'
;
return
i
;
}
inline
bool
canReadLine
()
const
{
return
indexOf
(
'\n'
)
>=
0
;
}
private:
QList
<
QByteArray
>
buffers
;
int
head
,
tail
;
int
tailBuffer
;
// always buffers.size() - 1
const
int
basicBlockSize
;
int
bufferSize
;
};
QT_BEGIN_NAMESPACE
class
QSerialPortPrivateData
{
public:
...
...
@@ -318,8 +67,8 @@ public:
int
timeoutValue
(
int
msecs
,
int
elapsed
);
qint64
readBufferMaxSize
;
Q
GC
RingBuffer
readBuffer
;
Q
GC
RingBuffer
writeBuffer
;
QRingBuffer
readBuffer
;
QRingBuffer
writeBuffer
;
QSerialPort
::
SerialPortError
error
;
QString
systemLocation
;
qint32
inputBaudRate
;
...
...
libs/qtandroidserialport/src/qtandroidserialport.pri
View file @
03b34ca5
android {
QT += androidextras
QT += androidextras
core-private
INCLUDEPATH += $$PWD
...
...
src/QGCApplication.cc
View file @
03b34ca5
...
...
@@ -401,11 +401,11 @@ bool QGCApplication::_initForNormalAppBoot(void)
// Start the user interface
MainWindow
*
mainWindow
=
MainWindow
::
_create
();
Q_CHECK_PTR
(
mainWindow
);
#endif
// Now that main window is up check for lost log files
connect
(
this
,
&
QGCApplication
::
checkForLostLogFiles
,
toolbox
()
->
mavlinkProtocol
(),
&
MAVLinkProtocol
::
checkForLostLogFiles
);
emit
checkForLostLogFiles
();
#endif
// Load known link configurations
toolbox
()
->
linkManager
()
->
loadLinkConfigurationList
();
...
...
src/Vehicle/Vehicle.cc
View file @
03b34ca5
...
...
@@ -1836,19 +1836,19 @@ void Vehicle::sendMessageMultiple(mavlink_message_t message)
void
Vehicle
::
_missionManagerError
(
int
errorCode
,
const
QString
&
errorMsg
)
{
Q_UNUSED
(
errorCode
);
qgcApp
()
->
showMessage
(
QString
(
"
Error during Mission communication with Vehicle
: %1"
).
arg
(
errorMsg
));
qgcApp
()
->
showMessage
(
QString
(
"
Mission transfer failed. Retry transfer. Error
: %1"
).
arg
(
errorMsg
));
}
void
Vehicle
::
_geoFenceManagerError
(
int
errorCode
,
const
QString
&
errorMsg
)
{
Q_UNUSED
(
errorCode
);
qgcApp
()
->
showMessage
(
QString
(
"
Error during GeoFence communication with Vehicle
: %1"
).
arg
(
errorMsg
));
qgcApp
()
->
showMessage
(
QString
(
"
GeoFence transfer failed. Retry transfer. Error
: %1"
).
arg
(
errorMsg
));
}
void
Vehicle
::
_rallyPointManagerError
(
int
errorCode
,
const
QString
&
errorMsg
)
{
Q_UNUSED
(
errorCode
);
qgcApp
()
->
showMessage
(
QString
(
"
Error during Rally Point communication with Vehicle
: %1"
).
arg
(
errorMsg
));
qgcApp
()
->
showMessage
(
QString
(
"
Rally Point transfer failed. Retry transfer. Error
: %1"
).
arg
(
errorMsg
));
}
void
Vehicle
::
_addNewMapTrajectoryPoint
(
void
)
...
...
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