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
ef75a925
Commit
ef75a925
authored
Jan 07, 2019
by
Matej Frančeškin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enabled TaiSync for Android & fixed race condition on USB accessory stream.
parent
545f6353
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
12 deletions
+10
-12
QGCCommon.pri
QGCCommon.pri
+1
-0
TaiSync.java
android/src/org/mavlink/qgroundcontrol/TaiSync.java
+9
-12
No files found.
QGCCommon.pri
View file @
ef75a925
...
...
@@ -36,6 +36,7 @@ linux {
DEFINES += __android__
DEFINES += __STDC_LIMIT_MACROS
DEFINES += QGC_ENABLE_BLUETOOTH
DEFINES += QGC_GST_TAISYNC_ENABLED
target.path = $$DESTDIR
equals(ANDROID_TARGET_ARCH, x86) {
CONFIG += Androidx86Build
...
...
android/src/org/mavlink/qgroundcontrol/TaiSync.java
View file @
ef75a925
...
...
@@ -84,8 +84,7 @@ public class TaiSync
tcpOutStream
=
tcpSocket
.
getOutputStream
();
// Request connection packet
byte
[]
msg
=
constructTaiSyncMessage
(
PROTOCOL_REQUEST_CONNECTION
,
0
,
null
,
0
);
mFileOutputStream
.
write
(
msg
);
sendTaiSyncMessage
(
PROTOCOL_REQUEST_CONNECTION
,
0
,
null
,
0
);
// Read multiplexed data stream coming from TaiSync accessory
mThreadPool
.
execute
(
new
Runnable
()
{
...
...
@@ -110,15 +109,13 @@ public class TaiSync
{
vMaj
=
mBytes
[
19
];
Log
.
i
(
"QGC_TaiSync"
,
"Got protocol version message vMaj = "
+
mBytes
[
19
]);
byte
[]
msg
=
constructTaiSyncMessage
(
PROTOCOL_VERSION
,
0
,
null
,
0
);
mFileOutputStream
.
write
(
msg
);
sendTaiSyncMessage
(
PROTOCOL_VERSION
,
0
,
null
,
0
);
}
else
if
(
mBytes
[
3
]
==
PROTOCOL_CHANNEL
)
{
int
dPort
=
((
mBytes
[
4
]
&
0xff
)<<
24
)
|
((
mBytes
[
5
]&
0xff
)
<<
16
)
|
((
mBytes
[
6
]&
0xff
)
<<
8
)
|
(
mBytes
[
7
]
&
0xff
);
int
dLength
=
((
mBytes
[
8
]
&
0xff
)<<
24
)
|
((
mBytes
[
9
]&
0xff
)
<<
16
)
|
((
mBytes
[
10
]&
0xff
)
<<
8
)
|
(
mBytes
[
11
]
&
0xff
);
Log
.
i
(
"QGC_TaiSync"
,
"Read 2 port = "
+
dPort
+
" length = "
+
dLength
);
byte
[]
msg
=
constructTaiSyncMessage
(
PROTOCOL_CHANNEL
,
dPort
,
null
,
0
);
mFileOutputStream
.
write
(
msg
);
sendTaiSyncMessage
(
PROTOCOL_CHANNEL
,
dPort
,
null
,
0
);
}
else
if
(
mBytes
[
3
]
==
PROTOCOL_DATA
)
{
int
dPort
=
((
mBytes
[
4
]
&
0xff
)<<
24
)
|
((
mBytes
[
5
]&
0xff
)
<<
16
)
|
((
mBytes
[
6
]&
0xff
)
<<
8
)
|
(
mBytes
[
7
]
&
0xff
);
...
...
@@ -168,8 +165,7 @@ public class TaiSync
DatagramPacket
packet
=
new
DatagramPacket
(
inbuf
,
inbuf
.
length
);
udpSocket
.
receive
(
packet
);
byte
[]
msg
=
constructTaiSyncMessage
(
PROTOCOL_DATA
,
TAISYNC_TELEMETRY_PORT
,
packet
.
getData
(),
packet
.
getLength
());
mFileOutputStream
.
write
(
msg
);
sendTaiSyncMessage
(
PROTOCOL_DATA
,
TAISYNC_TELEMETRY_PORT
,
packet
.
getData
(),
packet
.
getLength
());
}
}
catch
(
IOException
e
)
{
Log
.
e
(
"QGC_TaiSync"
,
"Exception: "
+
e
);
...
...
@@ -197,8 +193,7 @@ public class TaiSync
int
bytesRead
=
tcpInStream
.
read
(
inbuf
,
0
,
inbuf
.
length
);
if
(
bytesRead
>
0
)
{
byte
[]
msg
=
constructTaiSyncMessage
(
PROTOCOL_DATA
,
TAISYNC_SETTINGS_PORT
,
inbuf
,
bytesRead
);
mFileOutputStream
.
write
(
msg
);
sendTaiSyncMessage
(
PROTOCOL_DATA
,
TAISYNC_SETTINGS_PORT
,
inbuf
,
bytesRead
);
}
}
}
catch
(
IOException
e
)
{
...
...
@@ -211,7 +206,7 @@ public class TaiSync
});
}
private
byte
[]
constructTaiSyncMessage
(
byte
protocol
,
int
dataPort
,
byte
[]
data
,
int
dataLen
)
private
void
sendTaiSyncMessage
(
byte
protocol
,
int
dataPort
,
byte
[]
data
,
int
dataLen
)
throws
IOException
{
byte
portMSB
=
(
byte
)((
dataPort
>>
8
)
&
0xFF
);
byte
portLSB
=
(
byte
)(
dataPort
&
0xFF
);
...
...
@@ -238,7 +233,9 @@ public class TaiSync
System
.
arraycopy
(
data
,
0
,
buffer
,
header
.
length
,
dataLen
);
}
return
buffer
;
synchronized
(
this
)
{
mFileOutputStream
.
write
(
buffer
);
}
}
public
void
close
()
...
...
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