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
8799b498
Commit
8799b498
authored
Mar 06, 2019
by
Matej Frančeškin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Taisync - remove probing timer, use onResume as plug in detection event
parent
9c6b1ea7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
QGCActivity.java
android/src/org/mavlink/qgroundcontrol/QGCActivity.java
+17
-12
No files found.
android/src/org/mavlink/qgroundcontrol/QGCActivity.java
View file @
8799b498
...
...
@@ -225,13 +225,21 @@ public class QGCActivity extends QtActivity
IntentFilter
accessoryFilter
=
new
IntentFilter
(
ACTION_USB_PERMISSION
);
filter
.
addAction
(
UsbManager
.
ACTION_USB_ACCESSORY_DETACHED
);
registerReceiver
(
mOpenAccessoryReceiver
,
accessoryFilter
);
probeAccessories
();
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"Exception: "
+
e
);
}
}
@Override
public
void
onResume
()
{
super
.
onResume
();
// Plug in of USB ACCESSORY triggers only onResume event.
// Then we scan if there is actually anything new
probeAccessories
();
}
@Override
protected
void
onDestroy
()
{
...
...
@@ -701,14 +709,11 @@ public class QGCActivity extends QtActivity
private
void
probeAccessories
()
{
final
PendingIntent
pendingIntent
=
PendingIntent
.
getBroadcast
(
this
,
0
,
new
Intent
(
ACTION_USB_PERMISSION
),
0
);
Timer
timer
=
new
Timer
();
timer
.
schedule
(
new
TimerTask
()
{
@Override
public
void
run
()
{
// Log.i(TAG, "probeAccessories");
UsbAccessory
[]
accessories
=
_usbManager
.
getAccessoryList
();
if
(
accessories
!=
null
)
{
new
Thread
(
new
Runnable
()
{
public
void
run
()
{
Log
.
i
(
TAG
,
"probeAccessories"
);
UsbAccessory
[]
accessories
=
_usbManager
.
getAccessoryList
();
if
(
accessories
!=
null
)
{
for
(
UsbAccessory
usbAccessory
:
accessories
)
{
if
(
_usbManager
.
hasPermission
(
usbAccessory
))
{
openAccessory
(
usbAccessory
);
...
...
@@ -717,9 +722,9 @@ public class QGCActivity extends QtActivity
_usbManager
.
requestPermission
(
usbAccessory
,
pendingIntent
);
}
}
}
}
}
,
0
,
3000
);
}
}
}
).
start
(
);
}
}
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