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
bba55d01
Commit
bba55d01
authored
May 02, 2011
by
James Goppert
Browse files
Options
Browse Files
Download
Plain Diff
Merge
git://git.samba.org/tridge/UAV/qgroundcontrol
into dev-lin
parents
4db3f78d
87d277ff
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
201 additions
and
74 deletions
+201
-74
.gitignore
.gitignore
+4
-0
qgroundcontrol.pro
qgroundcontrol.pro
+24
-9
MAVLinkProtocol.cc
src/comm/MAVLinkProtocol.cc
+8
-0
MAVLinkXMLParser.cc
src/comm/MAVLinkXMLParser.cc
+61
-1
SerialInterface.h
src/comm/SerialInterface.h
+17
-10
SerialLink.cc
src/comm/SerialLink.cc
+5
-23
UDPLink.cc
src/comm/UDPLink.cc
+35
-31
qgroundcontrol-qserialport.pri
thirdParty/qserialport/qgroundcontrol-qserialport.pri
+47
-0
No files found.
.gitignore
View file @
bba55d01
...
@@ -44,3 +44,7 @@ user_config.pri
...
@@ -44,3 +44,7 @@ user_config.pri
*.cproject
*.cproject
*.sln
*.sln
*.suo
*.suo
thirdParty/qserialport-build-desktop/
thirdParty/qserialport/bin/
thirdParty/qserialport/lib/
qgroundcontrol.pro
View file @
bba55d01
...
@@ -58,36 +58,47 @@ exists(user_config.pri) {
...
@@ -58,36 +58,47 @@ exists(user_config.pri) {
}
}
INCLUDEPATH
+=
$$
BASEDIR
/../
mavlink
/
include
/
common
INCLUDEPATH
+=
$$
BASEDIR
/../
mavlink
/
include
/
common
INCLUDEPATH
+=
$$
BASEDIR
/../
mavlink
/
include
INCLUDEPATH
+=
$$
BASEDIR
/
thirdParty
/
mavlink
/
include
/
common
INCLUDEPATH
+=
$$
BASEDIR
/
thirdParty
/
mavlink
/
include
contains
(
MAVLINK_CONF
,
pixhawk
)
{
contains
(
MAVLINK_CONF
,
pixhawk
)
{
#
Remove
the
default
set
-
it
is
included
anyway
#
Remove
the
default
set
-
it
is
included
anyway
INCLUDEPATH
-=
$$
BASEDIR
/../
mavlink
/
include
/
common
INCLUDEPATH
-=
$$
BASEDIR
/../
mavlink
/
include
/
common
INCLUDEPATH
-=
$$
BASEDIR
/
thirdParty
/
mavlink
/
include
/
common
#
PIXHAWK
SPECIAL
MESSAGES
#
PIXHAWK
SPECIAL
MESSAGES
INCLUDEPATH
+=
$$
BASEDIR
/../
mavlink
/
include
/
pixhawk
INCLUDEPATH
+=
$$
BASEDIR
/../
mavlink
/
include
/
pixhawk
INCLUDEPATH
+=
$$
BASEDIR
/
thirdParty
/
mavlink
/
include
/
pixhawk
DEFINES
+=
QGC_USE_PIXHAWK_MESSAGES
DEFINES
+=
QGC_USE_PIXHAWK_MESSAGES
}
}
contains
(
MAVLINK_CONF
,
slugs
)
{
contains
(
MAVLINK_CONF
,
slugs
)
{
#
Remove
the
default
set
-
it
is
included
anyway
#
Remove
the
default
set
-
it
is
included
anyway
INCLUDEPATH
-=
$$
BASEDIR
/../
mavlink
/
include
/
common
INCLUDEPATH
-=
$$
BASEDIR
/../
mavlink
/
include
/
common
INCLUDEPATH
-=
$$
BASEDIR
/
thirdParty
/
mavlink
/
include
/
common
#
SLUGS
SPECIAL
MESSAGES
#
SLUGS
SPECIAL
MESSAGES
INCLUDEPATH
+=
$$
BASEDIR
/../
mavlink
/
include
/
slugs
INCLUDEPATH
+=
$$
BASEDIR
/../
mavlink
/
include
/
slugs
INCLUDEPATH
+=
$$
BASEDIR
/
thirdParty
/
mavlink
/
include
/
slugs
DEFINES
+=
QGC_USE_SLUGS_MESSAGES
DEFINES
+=
QGC_USE_SLUGS_MESSAGES
}
}
contains
(
MAVLINK_CONF
,
ualberta
)
{
contains
(
MAVLINK_CONF
,
ualberta
)
{
#
Remove
the
default
set
-
it
is
included
anyway
#
Remove
the
default
set
-
it
is
included
anyway
INCLUDEPATH
-=
$$
BASEDIR
/../
mavlink
/
include
/
common
INCLUDEPATH
-=
$$
BASEDIR
/../
mavlink
/
include
/
common
INCLUDEPATH
-=
$$
BASEDIR
/
thirdParty
/
mavlink
/
include
/
common
#
UALBERTA
SPECIAL
MESSAGES
#
UALBERTA
SPECIAL
MESSAGES
INCLUDEPATH
+=
$$
BASEDIR
/../
mavlink
/
include
/
ualberta
INCLUDEPATH
+=
$$
BASEDIR
/../
mavlink
/
include
/
ualberta
INCLUDEPATH
+=
$$
BASEDIR
/
thirdParty
/
mavlink
/
include
/
ualberta
DEFINES
+=
QGC_USE_UALBERTA_MESSAGES
DEFINES
+=
QGC_USE_UALBERTA_MESSAGES
}
}
contains
(
MAVLINK_CONF
,
ardupilotmega
)
{
contains
(
MAVLINK_CONF
,
ardupilotmega
)
{
#
Remove
the
default
set
-
it
is
included
anyway
#
Remove
the
default
set
-
it
is
included
anyway
INCLUDEPATH
-=
$$
BASEDIR
/../
mavlink
/
include
/
common
INCLUDEPATH
-=
$$
BASEDIR
/../
mavlink
/
include
/
common
INCLUDEPATH
-=
$$
BASEDIR
/
thirdParty
/
mavlink
/
include
/
common
#
UALBERTA
SPECIAL
MESSAGES
#
UALBERTA
SPECIAL
MESSAGES
INCLUDEPATH
+=
$$
BASEDIR
/../
mavlink
/
include
/
ardupilotmega
INCLUDEPATH
+=
$$
BASEDIR
/../
mavlink
/
include
/
ardupilotmega
INCLUDEPATH
+=
$$
BASEDIR
/
thirdParty
/
mavlink
/
include
/
ardupilotmega
DEFINES
+=
QGC_USE_ARDUPILOTMEGA_MESSAGES
DEFINES
+=
QGC_USE_ARDUPILOTMEGA_MESSAGES
}
}
...
@@ -97,13 +108,6 @@ contains(MAVLINK_CONF, ardupilotmega) {
...
@@ -97,13 +108,6 @@ contains(MAVLINK_CONF, ardupilotmega) {
#
done
by
the
plugins
above
#
done
by
the
plugins
above
include
(
qgroundcontrol
.
pri
)
include
(
qgroundcontrol
.
pri
)
#
QWT
plot
and
QExtSerial
depend
on
paths
set
by
qgroundcontrol
.
pri
#
Include
serial
port
library
include
(
src
/
lib
/
qextserialport
/
qextserialport
.
pri
)
#
include
qserial
library
include
(
thirdParty
/
qserial
/
qserialport
.
prf
)
#
Include
QWT
plotting
library
#
Include
QWT
plotting
library
include
(
src
/
lib
/
qwt
/
qwt
.
pri
)
include
(
src
/
lib
/
qwt
/
qwt
.
pri
)
DEPENDPATH
+=
.
\
DEPENDPATH
+=
.
\
...
@@ -111,11 +115,22 @@ DEPENDPATH += . \
...
@@ -111,11 +115,22 @@ DEPENDPATH += . \
lib
/
QMapControl
/
src
\
lib
/
QMapControl
/
src
\
lib
/
opmapcontrol
\
lib
/
opmapcontrol
\
lib
/
opmapcontrol
/
src
\
lib
/
opmapcontrol
/
src
\
plugins
plugins
\
thirdParty
/
qserialport
/
include
\
thirdParty
/
qserialport
/
include
/
QtSerialPort
\
thirdParty
/
qserialport
INCLUDEPATH
+=
.
\
INCLUDEPATH
+=
.
\
lib
/
QMapControl
\
lib
/
QMapControl
\
lib
/
opmapcontrol
\
lib
/
opmapcontrol
\
$$
BASEDIR
/../
mavlink
/
include
thirdParty
/
qserialport
/
include
\
thirdParty
/
qserialport
/
include
/
QtSerialPort
\
thirdParty
/
qserialport
/
src
#
Include
serial
port
library
include
(
src
/
lib
/
qextserialport
/
qextserialport
.
pri
)
#
include
qserial
library
include
(
thirdParty
/
qserialport
/
qgroundcontrol
-
qserialport
.
pri
)
#
..
/
mavlink
/
include
\
#
..
/
mavlink
/
include
\
#
MAVLink
/
include
\
#
MAVLink
/
include
\
...
...
src/comm/MAVLinkProtocol.cc
View file @
bba55d01
...
@@ -182,6 +182,14 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
...
@@ -182,6 +182,14 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
unsigned
int
decodeState
=
mavlink_parse_char
(
link
->
getId
(),
(
uint8_t
)(
b
.
at
(
position
)),
&
message
,
&
status
);
unsigned
int
decodeState
=
mavlink_parse_char
(
link
->
getId
(),
(
uint8_t
)(
b
.
at
(
position
)),
&
message
,
&
status
);
if
(
decodeState
==
1
)
{
if
(
decodeState
==
1
)
{
#ifdef MAVLINK_MESSAGE_LENGTHS
const
uint8_t
message_lengths
[]
=
MAVLINK_MESSAGE_LENGTHS
;
if
(
message
.
msgid
>=
sizeof
(
message_lengths
)
||
message
.
len
!=
message_lengths
[
message
.
msgid
])
{
qDebug
()
<<
"MAVLink message "
<<
message
.
msgid
<<
" length incorrect (was "
<<
message
.
len
<<
" expected "
<<
message_lengths
[
message
.
msgid
]
<<
")"
;
continue
;
}
#endif
// Log data
// Log data
if
(
m_loggingEnabled
&&
m_logfile
)
{
if
(
m_loggingEnabled
&&
m_logfile
)
{
const
int
len
=
MAVLINK_MAX_PACKET_LEN
+
sizeof
(
quint64
);
const
int
len
=
MAVLINK_MAX_PACKET_LEN
+
sizeof
(
quint64
);
...
...
src/comm/MAVLinkXMLParser.cc
View file @
bba55d01
...
@@ -90,6 +90,16 @@ bool MAVLinkXMLParser::generate()
...
@@ -90,6 +90,16 @@ bool MAVLinkXMLParser::generate()
int
mavlinkVersion
=
0
;
int
mavlinkVersion
=
0
;
// we need to gather the message lengths across multiple includes,
// which we can do via detecting recursion
static
unsigned
message_lengths
[
256
];
static
int
highest_message_id
;
static
int
recursion_level
;
if
(
recursion_level
==
0
)
{
highest_message_id
=
0
;
memset
(
message_lengths
,
0
,
sizeof
(
message_lengths
));
}
// Start main header
// Start main header
...
@@ -138,7 +148,9 @@ bool MAVLinkXMLParser::generate()
...
@@ -138,7 +148,9 @@ bool MAVLinkXMLParser::generate()
MAVLinkXMLParser
includeParser
(
incFilePath
,
topLevelOutputDirName
,
this
);
MAVLinkXMLParser
includeParser
(
incFilePath
,
topLevelOutputDirName
,
this
);
connect
(
&
includeParser
,
SIGNAL
(
parseState
(
QString
)),
this
,
SIGNAL
(
parseState
(
QString
)));
connect
(
&
includeParser
,
SIGNAL
(
parseState
(
QString
)),
this
,
SIGNAL
(
parseState
(
QString
)));
// Generate and write
// Generate and write
recursion_level
++
;
includeParser
.
generate
();
includeParser
.
generate
();
recursion_level
--
;
mainHeader
+=
"
\n
#include
\"
../"
+
pureIncludeFileName
+
"/"
+
pureIncludeFileName
+
".h
\"\n
"
;
mainHeader
+=
"
\n
#include
\"
../"
+
pureIncludeFileName
+
"/"
+
pureIncludeFileName
+
".h
\"\n
"
;
...
@@ -340,7 +352,7 @@ bool MAVLinkXMLParser::generate()
...
@@ -340,7 +352,7 @@ bool MAVLinkXMLParser::generate()
QString
decodeLines
;
QString
decodeLines
;
QString
sendArguments
;
QString
sendArguments
;
QString
commentLines
;
QString
commentLines
;
unsigned
message_length
=
0
;
// Get the message fields
// Get the message fields
...
@@ -437,6 +449,40 @@ bool MAVLinkXMLParser::generate()
...
@@ -437,6 +449,40 @@ bool MAVLinkXMLParser::generate()
}
}
// message length calculation
unsigned
element_multiplier
=
1
;
unsigned
element_length
=
0
;
const
struct
{
const
char
*
prefix
;
unsigned
length
;
}
length_map
[]
=
{
{
"array"
,
1
},
{
"char"
,
1
},
{
"uint8"
,
1
},
{
"int8"
,
1
},
{
"uint16"
,
2
},
{
"int16"
,
2
},
{
"uint32"
,
4
},
{
"int32"
,
4
},
{
"uint64"
,
8
},
{
"int64"
,
8
},
{
"float"
,
4
},
{
"double"
,
8
},
};
if
(
fieldType
.
contains
(
"["
))
{
element_multiplier
=
fieldType
.
split
(
"["
).
at
(
1
).
split
(
"]"
).
first
().
toInt
();
}
for
(
unsigned
i
=
0
;
i
<
sizeof
(
length_map
)
/
sizeof
(
length_map
[
0
]);
i
++
)
{
if
(
fieldType
.
startsWith
(
length_map
[
i
].
prefix
))
{
element_length
=
length_map
[
i
].
length
*
element_multiplier
;
break
;
}
}
if
(
element_length
==
0
)
{
emit
parseState
(
tr
(
"<font color=
\"
red
\"
>ERROR: Unable to calculate length for %2 near line %1
\n
Abort.</font>"
).
arg
(
QString
::
number
(
e
.
lineNumber
()),
fieldType
));
}
message_length
+=
element_length
;
//
//
// QString unpackingCode;
// QString unpackingCode;
...
@@ -489,6 +535,11 @@ bool MAVLinkXMLParser::generate()
...
@@ -489,6 +535,11 @@ bool MAVLinkXMLParser::generate()
f
=
f
.
nextSibling
();
f
=
f
.
nextSibling
();
}
}
if
(
messageId
>
highest_message_id
)
{
highest_message_id
=
messageId
;
}
message_lengths
[
messageId
]
=
message_length
;
cStruct
=
cStruct
.
arg
(
cStructName
,
cStructLines
);
cStruct
=
cStruct
.
arg
(
cStructName
,
cStructLines
);
lcmStructDefs
.
append
(
"
\n
"
).
append
(
cStruct
).
append
(
"
\n
"
);
lcmStructDefs
.
append
(
"
\n
"
).
append
(
cStruct
).
append
(
"
\n
"
);
pack
=
pack
.
arg
(
messageName
,
packParameters
,
messageName
.
toUpper
(),
packLines
);
pack
=
pack
.
arg
(
messageName
,
packParameters
,
messageName
.
toUpper
(),
packLines
);
...
@@ -540,6 +591,15 @@ bool MAVLinkXMLParser::generate()
...
@@ -540,6 +591,15 @@ bool MAVLinkXMLParser::generate()
mainHeader
+=
includeLine
.
arg
(
messagesDirName
+
"/"
+
cFiles
.
at
(
i
).
first
);
mainHeader
+=
includeLine
.
arg
(
messagesDirName
+
"/"
+
cFiles
.
at
(
i
).
first
);
}
}
mainHeader
+=
"
\n\n
// MESSAGE LENGTHS
\n\n
"
;
mainHeader
+=
"#undef MAVLINK_MESSAGE_LENGTHS
\n
"
;
mainHeader
+=
"#define MAVLINK_MESSAGE_LENGTHS { "
;
for
(
int
i
=
0
;
i
<
highest_message_id
;
i
++
)
{
mainHeader
+=
QString
::
number
(
message_lengths
[
i
]);
if
(
i
<
highest_message_id
-
1
)
mainHeader
+=
", "
;
}
mainHeader
+=
" }
\n\n
"
;
mainHeader
+=
"#ifdef __cplusplus
\n
}
\n
#endif
\n
"
;
mainHeader
+=
"#ifdef __cplusplus
\n
}
\n
#endif
\n
"
;
mainHeader
+=
"#endif"
;
mainHeader
+=
"#endif"
;
// Newline to make compiler happy
// Newline to make compiler happy
...
...
src/comm/SerialInterface.h
View file @
bba55d01
...
@@ -49,7 +49,8 @@ signals:
...
@@ -49,7 +49,8 @@ signals:
public:
public:
enum
baudRateType
{
enum
baudRateType
{
BAUD50
,
//POSIX ONLY
BAUD50
,
//POSIX ONLY
BAUD75
,
//POSIX ONLY
BAUD75
,
//POSIX ONLY
BAUD110
,
BAUD110
,
...
@@ -77,14 +78,16 @@ public:
...
@@ -77,14 +78,16 @@ public:
BAUD921600
// WINDOWS ONLY
BAUD921600
// WINDOWS ONLY
};
};
enum
dataBitsType
{
enum
dataBitsType
{
DATA_5
,
DATA_5
,
DATA_6
,
DATA_6
,
DATA_7
,
DATA_7
,
DATA_8
DATA_8
};
};
enum
parityType
{
enum
parityType
{
PAR_NONE
,
PAR_NONE
,
PAR_ODD
,
PAR_ODD
,
PAR_EVEN
,
PAR_EVEN
,
...
@@ -92,13 +95,15 @@ public:
...
@@ -92,13 +95,15 @@ public:
PAR_SPACE
PAR_SPACE
};
};
enum
stopBitsType
{
enum
stopBitsType
{
STOP_1
,
STOP_1
,
STOP_1_5
,
//WINDOWS ONLY
STOP_1_5
,
//WINDOWS ONLY
STOP_2
STOP_2
};
};
enum
flowType
{
enum
flowType
{
FLOW_OFF
,
FLOW_OFF
,
FLOW_HARDWARE
,
FLOW_HARDWARE
,
FLOW_XONXOFF
FLOW_XONXOFF
...
@@ -107,7 +112,8 @@ public:
...
@@ -107,7 +112,8 @@ public:
/**
/**
* structure to contain port settings
* structure to contain port settings
*/
*/
struct
portSettings
{
struct
portSettings
{
baudRateType
BaudRate
;
baudRateType
BaudRate
;
dataBitsType
DataBits
;
dataBitsType
DataBits
;
parityType
Parity
;
parityType
Parity
;
...
@@ -186,10 +192,11 @@ public:
...
@@ -186,10 +192,11 @@ public:
}
}
virtual
void
setTimeout
(
qint64
timeout
)
{
virtual
void
setTimeout
(
qint64
timeout
)
{
_port
->
setTimeout
(
timeout
);
_port
->
setTimeout
(
timeout
);
}
;
}
virtual
void
setFlow
(
SerialInterface
::
flowType
flow
)
{
virtual
void
setFlow
(
SerialInterface
::
flowType
flow
)
{
// TODO implement
// TODO implement
};
_port
->
setFlowControl
((
FlowType
)
flow
);
}
};
};
using
namespace
TNX
;
using
namespace
TNX
;
...
@@ -262,11 +269,11 @@ public:
...
@@ -262,11 +269,11 @@ public:
virtual
void
setTimeout
(
qint64
timeout
)
{
virtual
void
setTimeout
(
qint64
timeout
)
{
// TODO implement
// TODO implement
//_port->setTimeout(timeout);
//_port->setTimeout(timeout);
}
;
}
virtual
void
setFlow
(
SerialInterface
::
flowType
flow
)
{
virtual
void
setFlow
(
SerialInterface
::
flowType
flow
)
{
// TODO map
// TODO map
settings
.
setFlowControl
(
QPortSettings
::
FLOW_OFF
);
settings
.
setFlowControl
(
QPortSettings
::
FLOW_OFF
);
}
;
}
};
};
#endif // SERIALINTERFACE_H
#endif // SERIALINTERFACE_H
...
...
src/comm/SerialLink.cc
View file @
bba55d01
...
@@ -48,32 +48,14 @@ SerialLink::SerialLink(QString portname, SerialInterface::baudRateType baudrate,
...
@@ -48,32 +48,14 @@ SerialLink::SerialLink(QString portname, SerialInterface::baudRateType baudrate,
this
->
timeout
=
1
;
///< The timeout controls how long the program flow should wait for new serial bytes. As we're polling, we don't want to wait at all.
this
->
timeout
=
1
;
///< The timeout controls how long the program flow should wait for new serial bytes. As we're polling, we don't want to wait at all.
// Set the port name
// Set the port name
if
(
porthandle
==
""
)
{
if
(
porthandle
==
""
)
// name = tr("serial link ") + QString::number(getId()) + tr(" (unconfigured)");
{
name
=
tr
(
"Serial Link "
)
+
QString
::
number
(
getId
());
name
=
tr
(
"Serial Link "
)
+
QString
::
number
(
getId
());
}
else
{
name
=
portname
.
trimmed
();
}
}
else
#ifdef _WIN3232
{
// Windows 32bit & 64bit serial connection
name
=
portname
.
trimmed
();
winPort
=
CreateFile
(
porthandle
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
0
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
0
);
if
(
winPort
==
INVALID_HANDLE_VALUE
)
{
if
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
)
{
//serial port does not exist. Inform user.
}
//some other error occurred. Inform user.
}
}
#else
#endif
loadSettings
();
loadSettings
();
}
}
...
...
src/comm/UDPLink.cc
View file @
bba55d01
...
@@ -85,29 +85,32 @@ void UDPLink::setPort(int port)
...
@@ -85,29 +85,32 @@ void UDPLink::setPort(int port)
*/
*/
void
UDPLink
::
addHost
(
const
QString
&
host
)
void
UDPLink
::
addHost
(
const
QString
&
host
)
{
{
qDebug
()
<<
"UDP:"
<<
"ADDING HOST:"
<<
host
;
if
(
host
!=
""
)
if
(
host
.
contains
(
":"
))
{
{
qDebug
()
<<
"HOST: "
<<
host
.
split
(
":"
).
first
();
qDebug
()
<<
"UDP:"
<<
"ADDING HOST:"
<<
host
;
QHostInfo
info
=
QHostInfo
::
fromName
(
host
.
split
(
":"
).
first
());
if
(
host
.
contains
(
":"
))
{
// Add host
qDebug
()
<<
"HOST: "
<<
host
.
split
(
":"
).
first
();
QList
<
QHostAddress
>
hostAddresses
=
info
.
addresses
();
QHostInfo
info
=
QHostInfo
::
fromName
(
host
.
split
(
":"
).
first
());
QHostAddress
address
;
// Add host
for
(
int
i
=
0
;
i
<
hostAddresses
.
size
();
i
++
)
{
QList
<
QHostAddress
>
hostAddresses
=
info
.
addresses
();
// Exclude loopback IPv4 and all IPv6 addresses
QHostAddress
address
;
if
(
!
hostAddresses
.
at
(
i
).
toString
().
contains
(
":"
))
{
for
(
int
i
=
0
;
i
<
hostAddresses
.
size
();
i
++
)
{
address
=
hostAddresses
.
at
(
i
);
// Exclude loopback IPv4 and all IPv6 addresses
if
(
!
hostAddresses
.
at
(
i
).
toString
().
contains
(
":"
))
{
address
=
hostAddresses
.
at
(
i
);
}
}
}
hosts
.
append
(
address
);
qDebug
()
<<
"Address:"
<<
address
.
toString
();
// Set port according to user input
ports
.
append
(
host
.
split
(
":"
).
last
().
toInt
());
}
else
{
QHostInfo
info
=
QHostInfo
::
fromName
(
host
);
// Add host
hosts
.
append
(
info
.
addresses
().
first
());
// Set port according to default (this port)
ports
.
append
(
port
);
}
}
hosts
.
append
(
address
);
qDebug
()
<<
"Address:"
<<
address
.
toString
();
// Set port according to user input
ports
.
append
(
host
.
split
(
":"
).
last
().
toInt
());
}
else
{
QHostInfo
info
=
QHostInfo
::
fromName
(
host
);
// Add host
hosts
.
append
(
info
.
addresses
().
first
());
// Set port according to default (this port)
ports
.
append
(
port
);
}
}
}
}
...
@@ -137,20 +140,21 @@ void UDPLink::removeHost(const QString& hostname)
...
@@ -137,20 +140,21 @@ void UDPLink::removeHost(const QString& hostname)
void
UDPLink
::
writeBytes
(
const
char
*
data
,
qint64
size
)
void
UDPLink
::
writeBytes
(
const
char
*
data
,
qint64
size
)
{
{
// Broadcast to all connected systems
// Broadcast to all connected systems
//QList<QHostAddress>::iterator h;
for
(
int
h
=
0
;
h
<
hosts
.
size
();
h
++
)
// for (h = hosts->begin(); h != hosts->end(); ++h)
{
for
(
int
h
=
0
;
h
<
hosts
.
size
();
h
++
)
{
QHostAddress
currentHost
=
hosts
.
at
(
h
);
QHostAddress
currentHost
=
hosts
.
at
(
h
);
quint16
currentPort
=
ports
.
at
(
h
);
quint16
currentPort
=
ports
.
at
(
h
);
QString
bytes
;
qDebug
()
<<
"WRITING TO"
<<
currentHost
.
toIPv4Address
()
<<
currentPort
;
QString
ascii
;
//qDebug() << "WRITING DATA TO" << currentHost.toString() << currentPort;
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
unsigned
char
v
=
data
[
i
];
unsigned
char
v
=
data
[
i
];
qDebug
(
"%02x "
,
v
);
bytes
.
append
(
QString
().
sprintf
(
"%02x "
,
v
));
ascii
.
append
(
data
[
i
]);
}
}
qDebug
()
<<
"Sent to "
<<
currentHost
.
toString
()
<<
":"
<<
currentPort
;
qDebug
()
<<
"Sent"
<<
size
<<
"bytes to"
<<
currentHost
.
toString
()
<<
":"
<<
currentPort
<<
"data:"
;
qDebug
()
<<
bytes
;
qDebug
()
<<
"ASCII:"
<<
ascii
;
socket
->
writeDatagram
(
data
,
size
,
currentHost
,
currentPort
);
socket
->
writeDatagram
(
data
,
size
,
currentHost
,
currentPort
);
}
}
...
...
thirdParty/qserialport/qgroundcontrol-qserialport.pri
0 → 100644
View file @
bba55d01
######################################################################
# Automatically generated by qmake (2.01a) Sa. Apr 2 10:42:30 2011
######################################################################
DEPENDPATH += . \
include/QtSerialPort \
src/common \
src/posix \
src/win32
INCLUDEPATH += include \
include/QtSerialPort \
src/posix \
src/win32
# Input
HEADERS += include/QtSerialPort/qportsettings.h \
include/QtSerialPort/qserialport.h \
include/QtSerialPort/qserialport_export.h \
include/QtSerialPort/qserialportnative.h
macx|linux-g++|linux-g++-64 {
HEADERS += src/posix/termioshelper.h
}
win32-msvc2008|win32-g++ {
HEADERS += src/win32/commdcbhelper.h \
src/win32/qwincommevtnotifier.h \
src/win32/wincommevtbreaker.h \
src/win32/commdcbhelper.h \
src/win32/qwincommevtnotifier.h \
src/win32/wincommevtbreaker.h
}
SOURCES += src/common/qportsettings.cpp \
src/common/qserialport.cpp
macx|linux-g++|linux-g++-64 {
SOURCES += src/posix/qserialportnative_posix.cpp \
src/posix/termioshelper.cpp
}
win32-msvc2008|win32-g++ {
SOURCES += src/win32/commdcbhelper.cpp \
src/win32/qserialportnative_win32.cpp \
src/win32/qwincommevtnotifier.cpp \
src/win32/wincommevtbreaker.cpp
}
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