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
6641fcad
Commit
6641fcad
authored
Oct 27, 2010
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nothing changed
parent
dedaa377
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
2 deletions
+42
-2
Core.cc
src/Core.cc
+3
-0
UDPLink.cc
src/comm/UDPLink.cc
+38
-2
UDPLink.h
src/comm/UDPLink.h
+1
-0
No files found.
src/Core.cc
View file @
6641fcad
...
...
@@ -114,6 +114,9 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv)
// to make sure that all components are initialized when the
// first messages arrive
UDPLink
*
udpLink
=
new
UDPLink
(
QHostAddress
::
Any
,
14550
);
// Listen on Multicast-Address 239.255.77.77, Port 14550
//QHostAddress * multicast_udp = new QHostAddress("239.255.77.77");
//UDPLink* udpLink = new UDPLink(*multicast_udp, 14550);
mainWindow
->
addLink
(
udpLink
);
// Check if link could be connected
...
...
src/comm/UDPLink.cc
View file @
6641fcad
...
...
@@ -36,6 +36,7 @@ This file is part of the QGROUNDCONTROL project
#include "UDPLink.h"
#include "LinkManager.h"
#include "MG.h"
#include <netinet/in.h>
UDPLink
::
UDPLink
(
QHostAddress
host
,
quint16
port
)
{
...
...
@@ -197,11 +198,46 @@ bool UDPLink::connect()
{
socket
=
new
QUdpSocket
(
this
);
//Check if we are using a multicast-address
// bool multicast = false;
// if (host.isInSubnet(QHostAddress("224.0.0.0"),4))
// {
// multicast = true;
// connectState = socket->bind(port, QUdpSocket::ShareAddress);
// }
// else
// {
connectState
=
socket
->
bind
(
host
,
port
);
// }
//Provides Multicast functionality to UdpSocket
/* not working yet
if (multicast)
{
int sendingFd = socket->socketDescriptor();
if (sendingFd != -1)
{
// set up destination address
struct sockaddr_in sendAddr;
memset(&sendAddr,0,sizeof(sendAddr));
sendAddr.sin_family=AF_INET;
sendAddr.sin_addr.s_addr=inet_addr(HELLO_GROUP);
sendAddr.sin_port=htons(port);
// set TTL
unsigned int ttl = 1; // restricted to the same subnet
if (setsockopt(sendingFd, IPPROTO_IP, IP_MULTICAST_TTL, (unsigned int*)&ttl, sizeof(ttl) ) < 0)
{
std::cout << "TTL failed\n";
}
}
}
*/
//QObject::connect(socket, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams()));
QObject
::
connect
(
socket
,
SIGNAL
(
readyRead
()),
this
,
SLOT
(
readBytes
()));
connectState
=
socket
->
bind
(
host
,
port
);
emit
connected
(
connectState
);
if
(
connectState
)
{
...
...
src/comm/UDPLink.h
View file @
6641fcad
...
...
@@ -46,6 +46,7 @@ class UDPLink : public LinkInterface
public:
UDPLink
(
QHostAddress
host
=
QHostAddress
::
Any
,
quint16
port
=
14550
);
//UDPLink(QHostAddress host = "239.255.76.67", quint16 port = 7667);
~
UDPLink
();
bool
isConnected
();
...
...
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