summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens.qnx@kdab.com>2012-05-24 14:56:11 +0200
committerLorn Potter <lorn.potter@gmail.com>2012-11-28 18:21:52 +0100
commite788464f2c698daa618108d45feeec1c23815900 (patch)
treecc2b5700619e683224f5cd236aded5e05251c7ae
parentdf9d1ef798bcb9356fbc898a13f190a9fa63da25 (diff)
Prefer to use the BBNDK sensor.h if present
(This is a backport from qtsensors repository, revision e9fb333408058add56dcf53238675ec185001771) Change-Id: I87e834b64a1fbb7233976730aae35375f46462fd Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
-rw-r--r--config.tests/bbsensor_header/bbsensor_header.pro5
-rw-r--r--config.tests/bbsensor_header/main.cpp56
-rwxr-xr-xconfigure1
-rw-r--r--configure.bat1
-rw-r--r--plugins/sensors/blackberry/bbsensorbackend.h11
5 files changed, 74 insertions, 0 deletions
diff --git a/config.tests/bbsensor_header/bbsensor_header.pro b/config.tests/bbsensor_header/bbsensor_header.pro
new file mode 100644
index 0000000000..362ae67bd9
--- /dev/null
+++ b/config.tests/bbsensor_header/bbsensor_header.pro
@@ -0,0 +1,5 @@
+TEMPLATE = app
+DEPENDPATH += .
+INCLUDEPATH += .
+
+SOURCES += main.cpp
diff --git a/config.tests/bbsensor_header/main.cpp b/config.tests/bbsensor_header/main.cpp
new file mode 100644
index 0000000000..bfb42ce71b
--- /dev/null
+++ b/config.tests/bbsensor_header/main.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Research In Motion <blackberry-qt@qnx.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtCore/qglobal.h>
+
+#ifdef Q_OS_BLACKBERRY
+#include <sensor/sensor.h>
+#endif
+
+int main(int argc, char** argv)
+{
+ Q_UNUSED(argc);
+ Q_UNUSED(argv);
+#ifdef Q_OS_BLACKBERRY
+ sensor_event_t event;
+ Q_UNUSED(event);
+#endif
+ return 0;
+}
diff --git a/configure b/configure
index 9a457bbb1d..bf63bc9878 100755
--- a/configure
+++ b/configure
@@ -618,6 +618,7 @@ if [ -z "$PLATFORM_CONFIG" ]; then
compileTest "Pulse Audio" pulseaudio
compileTest "udev" udev
compileTest "Maemo Heartbeat" iphb
+ compileTest "BlackBerry NDK sensor header" bbsensor_header
if [ "$NFC_SYMBIAN" = auto ]; then
compileTest "Symbian NFC" nfc_symbian
diff --git a/configure.bat b/configure.bat
index 707f5377ae..3402e79f7b 100644
--- a/configure.bat
+++ b/configure.bat
@@ -742,6 +742,7 @@ if "%MODULE_SENSORS_REQUESTED%" == "yes" (
call :compileTest S60_Sensor_API sensors_s60_31
call :compileTest Symbian_Sensor_Framework sensors_symbian
call :compileTest Sensor_Framework_Light sensors_symbian_light
+ call :compileTest BlackBerry_NDK_sensor_header bbsensor_header
)
if "%MODULE_SERVICEFRAMEWORK_REQUESTED%" == "yes" (
diff --git a/plugins/sensors/blackberry/bbsensorbackend.h b/plugins/sensors/blackberry/bbsensorbackend.h
index abc50f76ae..45a703ee5a 100644
--- a/plugins/sensors/blackberry/bbsensorbackend.h
+++ b/plugins/sensors/blackberry/bbsensorbackend.h
@@ -56,6 +56,17 @@
#include "sensor.h"
#endif
+// Earlier NDK versions did not ship sensor.h, that is why we have our own copy in
+// here.
+// We prefer the NDK version if that exists, as that is more up-to-date.
+#ifdef HAVE_NDK_SENSOR_H
+#include <sensor/sensor.h>
+#include <devctl.h>
+#include <errno.h>
+#else
+#include "sensor.h"
+#endif
+
QTM_USE_NAMESPACE
class BbGuiHelper;