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
6a9060b9
Commit
6a9060b9
authored
Aug 19, 2019
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
ea63d012
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
20 deletions
+20
-20
QGCActivity.java
android/src/org/mavlink/qgroundcontrol/QGCActivity.java
+8
-8
UsbIoManager.java
android/src/org/mavlink/qgroundcontrol/UsbIoManager.java
+4
-4
qserialport_android.cpp
libs/qtandroidserialport/src/qserialport_android.cpp
+8
-8
No files found.
android/src/org/mavlink/qgroundcontrol/QGCActivity.java
View file @
6a9060b9
...
...
@@ -69,7 +69,7 @@ public class QGCActivity extends QtActivity
private
static
UsbManager
_usbManager
=
null
;
private
static
List
<
UsbSerialDriver
>
_drivers
;
private
static
HashMap
<
Integer
,
UsbIoManager
>
m_ioManager
;
private
static
HashMap
<
Integer
,
Integer
>
_userDataHashByDeviceId
;
private
static
HashMap
<
Integer
,
Long
>
_userDataHashByDeviceId
;
private
static
final
String
TAG
=
"QGC_QGCActivity"
;
private
static
PowerManager
.
WakeLock
_wakeLock
;
private
static
final
String
ACTION_USB_PERMISSION
=
"org.mavlink.qgroundcontrol.action.USB_PERMISSION"
;
...
...
@@ -85,14 +85,14 @@ public class QGCActivity extends QtActivity
new
UsbIoManager
.
Listener
()
{
@Override
public
void
onRunError
(
Exception
eA
,
int
userData
)
public
void
onRunError
(
Exception
eA
,
long
userData
)
{
Log
.
e
(
TAG
,
"onRunError Exception"
);
nativeDeviceException
(
userData
,
eA
.
getMessage
());
}
@Override
public
void
onNewData
(
final
byte
[]
dataA
,
int
userData
)
public
void
onNewData
(
final
byte
[]
dataA
,
long
userData
)
{
nativeDeviceNewData
(
userData
,
dataA
);
}
...
...
@@ -174,9 +174,9 @@ public class QGCActivity extends QtActivity
};
// Native C++ functions which connect back to QSerialPort code
private
static
native
void
nativeDeviceHasDisconnected
(
int
userData
);
private
static
native
void
nativeDeviceException
(
int
userData
,
String
messageA
);
private
static
native
void
nativeDeviceNewData
(
int
userData
,
byte
[]
dataA
);
private
static
native
void
nativeDeviceHasDisconnected
(
long
userData
);
private
static
native
void
nativeDeviceException
(
long
userData
,
String
messageA
);
private
static
native
void
nativeDeviceNewData
(
long
userData
,
byte
[]
dataA
);
private
static
native
void
nativeUpdateAvailableJoysticks
();
// Native C++ functions called to log output
...
...
@@ -190,7 +190,7 @@ public class QGCActivity extends QtActivity
{
_instance
=
this
;
_drivers
=
new
ArrayList
<
UsbSerialDriver
>();
_userDataHashByDeviceId
=
new
HashMap
<
Integer
,
Integer
>();
_userDataHashByDeviceId
=
new
HashMap
<
Integer
,
Long
>();
m_ioManager
=
new
HashMap
<
Integer
,
UsbIoManager
>();
}
...
...
@@ -375,7 +375,7 @@ public class QGCActivity extends QtActivity
/// Open the specified device
/// @param userData Data to associate with device and pass back through to native calls.
/// @return Device id
public
static
int
open
(
Context
parentContext
,
String
deviceName
,
int
userData
)
public
static
int
open
(
Context
parentContext
,
String
deviceName
,
long
userData
)
{
int
deviceId
=
BAD_DEVICE_ID
;
...
...
android/src/org/mavlink/qgroundcontrol/UsbIoManager.java
View file @
6a9060b9
...
...
@@ -40,7 +40,7 @@ public class UsbIoManager implements Runnable {
private
static
final
String
TAG
=
"QGC_UsbIoManager"
;
private
final
UsbSerialDriver
mDriver
;
private
int
mUserData
;
private
long
mUserData
;
private
final
ByteBuffer
mReadBuffer
=
ByteBuffer
.
allocate
(
BUFSIZ
);
private
final
ByteBuffer
mWriteBuffer
=
ByteBuffer
.
allocate
(
BUFSIZ
);
...
...
@@ -62,13 +62,13 @@ public class UsbIoManager implements Runnable {
/**
* Called when new incoming data is available.
*/
public
void
onNewData
(
byte
[]
data
,
int
userData
);
public
void
onNewData
(
byte
[]
data
,
long
userData
);
/**
* Called when {@link SerialInputOutputManager#run()} aborts due to an
* error.
*/
public
void
onRunError
(
Exception
e
,
int
userData
);
public
void
onRunError
(
Exception
e
,
long
userData
);
}
...
...
@@ -87,7 +87,7 @@ public class UsbIoManager implements Runnable {
/**
* Creates a new instance with the provided listener.
*/
public
UsbIoManager
(
UsbSerialDriver
driver
,
Listener
listener
,
int
userData
)
public
UsbIoManager
(
UsbSerialDriver
driver
,
Listener
listener
,
long
userData
)
{
mDriver
=
driver
;
mListener
=
listener
;
...
...
libs/qtandroidserialport/src/qserialport_android.cpp
View file @
6a9060b9
...
...
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
static
const
char
kJniClassName
[]
{
"org/mavlink/qgroundcontrol/QGCActivity"
};
static
void
jniDeviceHasDisconnected
(
JNIEnv
*
envA
,
jobject
thizA
,
j
int
userDataA
)
static
void
jniDeviceHasDisconnected
(
JNIEnv
*
envA
,
jobject
thizA
,
j
long
userDataA
)
{
Q_UNUSED
(
envA
);
Q_UNUSED
(
thizA
);
...
...
@@ -64,7 +64,7 @@ static void jniDeviceHasDisconnected(JNIEnv *envA, jobject thizA, jint userDataA
(
reinterpret_cast
<
QSerialPortPrivate
*>
(
userDataA
))
->
q_ptr
->
close
();
}
static
void
jniDeviceNewData
(
JNIEnv
*
envA
,
jobject
thizA
,
j
int
userDataA
,
jbyteArray
dataA
)
static
void
jniDeviceNewData
(
JNIEnv
*
envA
,
jobject
thizA
,
j
long
userDataA
,
jbyteArray
dataA
)
{
Q_UNUSED
(
thizA
);
if
(
userDataA
!=
0
)
...
...
@@ -76,7 +76,7 @@ static void jniDeviceNewData(JNIEnv *envA, jobject thizA, jint userDataA, jbyteA
}
}
static
void
jniDeviceException
(
JNIEnv
*
envA
,
jobject
thizA
,
j
int
userDataA
,
jstring
messageA
)
static
void
jniDeviceException
(
JNIEnv
*
envA
,
jobject
thizA
,
j
long
userDataA
,
jstring
messageA
)
{
Q_UNUSED
(
thizA
);
if
(
userDataA
!=
0
)
...
...
@@ -143,9 +143,9 @@ void QSerialPortPrivate::setNativeMethods(void)
// REGISTER THE C++ FUNCTION WITH JNI
JNINativeMethod
javaMethods
[]
{
{
"nativeDeviceHasDisconnected"
,
"(
I
)V"
,
reinterpret_cast
<
void
*>
(
jniDeviceHasDisconnected
)},
{
"nativeDeviceNewData"
,
"(
I
[B)V"
,
reinterpret_cast
<
void
*>
(
jniDeviceNewData
)},
{
"nativeDeviceException"
,
"(
I
Ljava/lang/String;)V"
,
reinterpret_cast
<
void
*>
(
jniDeviceException
)},
{
"nativeDeviceHasDisconnected"
,
"(
J
)V"
,
reinterpret_cast
<
void
*>
(
jniDeviceHasDisconnected
)},
{
"nativeDeviceNewData"
,
"(
J
[B)V"
,
reinterpret_cast
<
void
*>
(
jniDeviceNewData
)},
{
"nativeDeviceException"
,
"(
J
Ljava/lang/String;)V"
,
reinterpret_cast
<
void
*>
(
jniDeviceException
)},
{
"qgcLogDebug"
,
"(Ljava/lang/String;)V"
,
reinterpret_cast
<
void
*>
(
jniLogDebug
)},
{
"qgcLogWarning"
,
"(Ljava/lang/String;)V"
,
reinterpret_cast
<
void
*>
(
jniLogWarning
)}
};
...
...
@@ -186,10 +186,10 @@ bool QSerialPortPrivate::open(QIODevice::OpenMode mode)
deviceId
=
QAndroidJniObject
::
callStaticMethod
<
jint
>
(
kJniClassName
,
"open"
,
"(Landroid/content/Context;Ljava/lang/String;
I
)I"
,
"(Landroid/content/Context;Ljava/lang/String;
J
)I"
,
QtAndroid
::
androidActivity
().
object
(),
jnameL
.
object
<
jstring
>
(),
reinterpret_cast
<
j
int
>
(
this
));
reinterpret_cast
<
j
long
>
(
this
));
cleanJavaException
();
isReadStopped
=
false
;
...
...
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