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
3e0cd207
Commit
3e0cd207
authored
Oct 28, 2014
by
Lorenz Meier
Browse files
Use a local variable for the port list, use correct null ptr macro
parent
252b70de
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/comm/SerialLink.cc
View file @
3e0cd207
...
...
@@ -22,7 +22,7 @@
SerialLink
::
SerialLink
(
QString
portname
,
int
baudRate
,
bool
hardwareFlowControl
,
bool
parity
,
int
dataBits
,
int
stopBits
)
:
m_bytesRead
(
0
),
m_port
(
NULL
),
m_port
(
Q_
NULL
PTR
),
type
(
""
),
m_is_cdc
(
true
),
m_stopp
(
false
),
...
...
@@ -34,9 +34,10 @@ SerialLink::SerialLink(QString portname, int baudRate, bool hardwareFlowControl,
// Get the name of the current port in use.
m_portName
=
portname
.
trimmed
();
if
(
m_portName
==
""
&&
getCurrentPorts
().
size
()
>
0
)
QList
<
QString
>
ports
=
getCurrentPorts
();
if
(
m_portName
==
""
&&
ports
.
size
()
>
0
)
{
m_portName
=
m_
ports
.
first
().
trimmed
();
m_portName
=
ports
.
first
().
trimmed
();
}
checkIfCDC
();
...
...
@@ -96,15 +97,15 @@ SerialLink::~SerialLink()
QList
<
QString
>
SerialLink
::
getCurrentPorts
()
{
m_ports
.
clear
()
;
QList
<
QString
>
ports
;
QList
<
QSerialPortInfo
>
portList
=
QSerialPortInfo
::
availablePorts
();
foreach
(
const
QSerialPortInfo
&
info
,
portList
)
{
m_
ports
.
append
(
info
.
portName
());
ports
.
append
(
info
.
portName
());
}
return
m_
ports
;
return
ports
;
}
bool
SerialLink
::
isBootloader
()
...
...
src/comm/SerialLink.h
View file @
3e0cd207
...
...
@@ -158,7 +158,6 @@ protected:
int
m_id
;
QMutex
m_dataMutex
;
// Mutex for reading data from m_port
QMutex
m_writeMutex
;
// Mutex for accessing the m_transmitBuffer.
QList
<
QString
>
m_ports
;
QString
type
;
bool
m_is_cdc
;
...
...
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