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
f90b91fe
Commit
f90b91fe
authored
Jan 09, 2019
by
Matej Frančeškin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Taisync android - send telemetry messages to TCP port 8200 instead to UDP 14550.
parent
05e3abe8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
20 deletions
+33
-20
TaiSync.java
android/src/org/mavlink/qgroundcontrol/TaiSync.java
+33
-20
No files found.
android/src/org/mavlink/qgroundcontrol/TaiSync.java
View file @
f90b91fe
...
...
@@ -27,17 +27,19 @@ public class TaiSync
private
static
final
byte
PROTOCOL_CHANNEL
=
0x02
;
private
static
final
byte
PROTOCOL_DATA
=
0x03
;
private
static
final
int
TELEM_PORT
=
14550
;
private
static
final
int
VIDEO_PORT
=
5000
;
private
static
final
int
VIDEO_PORT
=
5600
;
private
static
final
int
TAISYNC_VIDEO_PORT
=
8000
;
private
static
final
int
TAISYNC_SETTINGS_PORT
=
8200
;
private
static
final
int
TAISYNC_TELEMETRY_PORT
=
8400
;
private
boolean
running
=
false
;
private
DatagramSocket
udpSocket
=
null
;
private
Socket
tcpSocket
=
null
;
private
InputStream
tcpInStream
=
null
;
private
OutputStream
tcpOutStream
=
null
;
private
Socket
tcpSettingsSocket
=
null
;
private
InputStream
settingsInStream
=
null
;
private
OutputStream
settingsOutStream
=
null
;
private
Socket
tcpTelemetrySocket
=
null
;
private
InputStream
telemetryInStream
=
null
;
private
OutputStream
telemetryOutStream
=
null
;
private
ParcelFileDescriptor
mParcelFileDescriptor
;
private
FileInputStream
mFileInputStream
;
private
FileOutputStream
mFileOutputStream
;
...
...
@@ -79,9 +81,12 @@ public class TaiSync
udpSocket
=
new
DatagramSocket
();
final
InetAddress
address
=
InetAddress
.
getByName
(
"localhost"
);
tcpSocket
=
new
Socket
(
address
,
TAISYNC_SETTINGS_PORT
);
tcpInStream
=
tcpSocket
.
getInputStream
();
tcpOutStream
=
tcpSocket
.
getOutputStream
();
tcpTelemetrySocket
=
new
Socket
(
address
,
TAISYNC_TELEMETRY_PORT
);
telemetryInStream
=
tcpTelemetrySocket
.
getInputStream
();
telemetryOutStream
=
tcpTelemetrySocket
.
getOutputStream
();
tcpSettingsSocket
=
new
Socket
(
address
,
TAISYNC_SETTINGS_PORT
);
settingsInStream
=
tcpSettingsSocket
.
getInputStream
();
settingsOutStream
=
tcpSettingsSocket
.
getOutputStream
();
// Request connection packet
sendTaiSyncMessage
(
PROTOCOL_REQUEST_CONNECTION
,
0
,
null
,
0
);
...
...
@@ -131,10 +136,9 @@ public class TaiSync
DatagramPacket
packet
=
new
DatagramPacket
(
sBytes
,
sBytes
.
length
,
address
,
VIDEO_PORT
);
udpSocket
.
send
(
packet
);
}
else
if
(
dPort
==
TAISYNC_SETTINGS_PORT
)
{
tcp
OutStream
.
write
(
sBytes
);
settings
OutStream
.
write
(
sBytes
);
}
else
if
(
dPort
==
TAISYNC_TELEMETRY_PORT
)
{
DatagramPacket
packet
=
new
DatagramPacket
(
sBytes
,
sBytes
.
length
,
address
,
TELEM_PORT
);
udpSocket
.
send
(
packet
);
telemetryOutStream
.
write
(
sBytes
);
}
}
}
...
...
@@ -163,9 +167,10 @@ public class TaiSync
}
}
DatagramPacket
packet
=
new
DatagramPacket
(
inbuf
,
inbuf
.
length
);
udpSocket
.
receive
(
packet
);
sendTaiSyncMessage
(
PROTOCOL_DATA
,
TAISYNC_TELEMETRY_PORT
,
packet
.
getData
(),
packet
.
getLength
());
int
bytesRead
=
telemetryInStream
.
read
(
inbuf
,
0
,
inbuf
.
length
);
if
(
bytesRead
>
0
)
{
sendTaiSyncMessage
(
PROTOCOL_DATA
,
TAISYNC_TELEMETRY_PORT
,
inbuf
,
bytesRead
);
}
}
}
catch
(
IOException
e
)
{
Log
.
e
(
"QGC_TaiSync"
,
"Exception: "
+
e
);
...
...
@@ -191,7 +196,7 @@ public class TaiSync
}
}
int
bytesRead
=
tcp
InStream
.
read
(
inbuf
,
0
,
inbuf
.
length
);
int
bytesRead
=
settings
InStream
.
read
(
inbuf
,
0
,
inbuf
.
length
);
if
(
bytesRead
>
0
)
{
sendTaiSyncMessage
(
PROTOCOL_DATA
,
TAISYNC_SETTINGS_PORT
,
inbuf
,
bytesRead
);
}
...
...
@@ -213,6 +218,7 @@ public class TaiSync
byte
[]
lA
=
new
byte
[
4
];
int
len
=
HEADER_SIZE
+
dataLen
;
Log
.
i
(
"QGC_TaiSync"
,
"Sending to "
+
dataPort
+
" length = "
+
len
);
byte
[]
buffer
=
new
byte
[
len
];
for
(
int
i
=
3
;
i
>=
0
;
i
--)
{
...
...
@@ -251,8 +257,14 @@ public class TaiSync
}
catch
(
Exception
e
)
{
}
try
{
if
(
tcpSocket
!=
null
)
{
tcpSocket
.
close
();
if
(
tcpTelemetrySocket
!=
null
)
{
tcpTelemetrySocket
.
close
();
}
}
catch
(
Exception
e
)
{
}
try
{
if
(
tcpSettingsSocket
!=
null
)
{
tcpSettingsSocket
.
close
();
}
}
catch
(
Exception
e
)
{
}
...
...
@@ -263,9 +275,10 @@ public class TaiSync
}
catch
(
Exception
e
)
{
}
udpSocket
=
null
;
tcpSocket
=
null
;
tcpInStream
=
null
;
tcpOutStream
=
null
;
tcpSettingsSocket
=
null
;
tcpTelemetrySocket
=
null
;
settingsInStream
=
null
;
settingsOutStream
=
null
;
mParcelFileDescriptor
=
null
;
}
}
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