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
69c7ebb5
Commit
69c7ebb5
authored
Mar 12, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Screen sleep control for iOS
parent
0d7fd3ce
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
124 additions
and
12 deletions
+124
-12
qgroundcontrol.pro
qgroundcontrol.pro
+10
-1
MobileScreenMgr.cc
src/MobileScreenMgr.cc
+36
-0
MobileScreenMgr.h
src/MobileScreenMgr.h
+36
-0
MobileScreenMgr.mm
src/MobileScreenMgr.mm
+32
-0
MultiVehicleManager.cc
src/Vehicle/MultiVehicleManager.cc
+10
-11
No files found.
qgroundcontrol.pro
View file @
69c7ebb5
...
...
@@ -109,7 +109,6 @@ iOSBuild {
BUNDLE
.
files
=
$$
files
(
$$
PWD
/
ios
/
AppIcon
*.
png
)
$$
PWD
/
ios
/
QGCLaunchScreen
.
xib
QMAKE_BUNDLE_DATA
+=
BUNDLE
LIBS
+=
-
framework
AVFoundation
OBJECTIVE_SOURCES
+=
src
/
audio
/
QGCAudioWorker_iOS
.
mm
#--
Info
.
plist
(
need
an
"official"
one
for
the
App
Store
)
ForAppStore
{
message
(
App
Store
Build
)
...
...
@@ -365,6 +364,16 @@ HEADERS += \
src
/
ViewWidgets
/
ViewWidgetController
.
h
\
}
iOSBuild
{
OBJECTIVE_SOURCES
+=
\
src
/
audio
/
QGCAudioWorker_iOS
.
mm
\
src
/
MobileScreenMgr
.
mm
\
}
androidBuild
{
SOURCES
+=
src
/
MobileScreenMgr
.
cc
\
}
SOURCES
+=
\
src
/
audio
/
QGCAudioWorker
.
cpp
\
src
/
CmdLineOptParser
.
cc
\
...
...
src/MobileScreenMgr.cc
0 → 100644
View file @
69c7ebb5
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#include "MobileScreenMgr.h"
#include <QtAndroidExtras/QtAndroidExtras>
#include <QtAndroidExtras/QAndroidJniObject>
void
MobileScreenMgr
::
setKeepScreenOn
(
bool
keepScreenOn
)
{
if
(
keepScreenOn
)
{
QAndroidJniObject
::
callStaticMethod
<
void
>
(
kJniClassName
,
"keepScreenOn"
,
"()V"
);
}
else
{
QAndroidJniObject
::
callStaticMethod
<
void
>
(
kJniClassName
,
"restoreScreenOn"
,
"()V"
);
}
}
src/MobileScreenMgr.h
0 → 100644
View file @
69c7ebb5
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef MobileScreenMgr_H
#define MobileScreenMgr_H
#ifdef __mobile__
class
MobileScreenMgr
{
public:
/// Turns on/off screen sleep on mobile devices
static
void
setKeepScreenOn
(
bool
keepScreenOn
);
};
#endif
#endif
src/MobileScreenMgr.mm
0 → 100644
View file @
69c7ebb5
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#include "MobileScreenMgr.h"
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
void MobileScreenMgr::setKeepScreenOn(bool keepScreenOn)
{
[[UIApplication sharedApplication] setIdleTimerDisabled: (keepScreenOn ? YES : NO)];
}
src/Vehicle/MultiVehicleManager.cc
View file @
69c7ebb5
...
...
@@ -30,13 +30,12 @@
#include "UAS.h"
#include "QGCApplication.h"
#include <QQmlEngine>
#if defined __android__
#include <QtAndroidExtras/QtAndroidExtras>
#include <QtAndroidExtras/QAndroidJniObject>
#ifdef __mobile__
#include "MobileScreenMgr.h"
#endif
#include <QQmlEngine>
QGC_LOGGING_CATEGORY
(
MultiVehicleManagerLog
,
"MultiVehicleManagerLog"
)
const
char
*
MultiVehicleManager
::
_gcsHeartbeatEnabledKey
=
"gcsHeartbeatEnabled"
;
...
...
@@ -126,11 +125,11 @@ void MultiVehicleManager::_vehicleHeartbeatInfo(LinkInterface* link, int vehicle
// Mark link as active
link
->
setActive
(
true
);
#if
defined __android
__
#if
def __mobile
__
if
(
_vehicles
.
count
()
==
1
)
{
//-- Once a vehicle is connected, keep
Android
screen from going off
//-- Once a vehicle is connected, keep screen from going off
qCDebug
(
MultiVehicleManagerLog
)
<<
"QAndroidJniObject::keepScreenOn"
;
QAndroidJniObject
::
callStaticMethod
<
void
>
(
kJniClassName
,
"keepScreenOn"
,
"()V"
);
MobileScreenMgr
::
setKeepScreenOn
(
true
);
}
#endif
...
...
@@ -167,11 +166,11 @@ void MultiVehicleManager::_deleteVehiclePhase1(Vehicle* vehicle)
emit
parameterReadyVehicleAvailableChanged
(
false
);
emit
vehicleRemoved
(
vehicle
);
#if
defined __android
__
#if
def __mobile
__
if
(
_vehicles
.
count
()
==
0
)
{
//-- Once no vehicles are connected, we no longer need to keep
Android
screen from going off
//-- Once no vehicles are connected, we no longer need to keep screen from going off
qCDebug
(
MultiVehicleManagerLog
)
<<
"QAndroidJniObject::restoreScreenOn"
;
QAndroidJniObject
::
callStaticMethod
<
void
>
(
kJniClassName
,
"restoreScreenOn"
,
"()V"
);
MobileScreenMgr
::
setKeepScreenOn
(
true
);
}
#endif
...
...
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