[-]
[+]
|
Changed |
_service:tar_git:sensorfw.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:sensorfw-qt5-hybris.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -1,6 +1,6 @@
<services>
<service name="tar_git">
- <param name="url">https://git.merproject.org/mer-core/sensorfw.git</param>
+ <param name="url">https://github.com/sailfishos/sensorfw.git</param>
<param name="branch">master</param>
<param name="revision">HEAD</param>
</service>
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/adaptor-config.pri
^
|
@@ -16,7 +16,3 @@
target.path = $$PLUGINPATH
INSTALLS += target
-
-config_hybris {
- CONFIG += link_pkgconfig
-}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/adaptors.pro
^
|
@@ -10,9 +10,11 @@
SUBDIRS += hybrispressureadaptor
SUBDIRS += hybrisproximityadaptor
SUBDIRS += hybrisorientationadaptor
+ SUBDIRS += hybrisrotationadaptor
+ SUBDIRS += hybrisgeorotationadaptor
SUBDIRS += hybrisstepcounteradaptor
- } else {
+} else {
SUBDIRS = alsadaptor \
alsadaptor-evdev \
@@ -23,16 +25,24 @@
magnetometeradaptor \
magnetometeradaptor-ascii \
magnetometeradaptor-evdev \
- magnetometeradaptor-ncdk \
touchadaptor \
kbslideradaptor \
proximityadaptor \
proximityadaptor-evdev \
proximityadaptor-ascii \
- mrstaccelerometer \
gyroscopeadaptor \
gyroscopeadaptor-evdev
+SUBDIRS += lidsensoradaptor-evdev
+SUBDIRS += iioadaptor
+SUBDIRS += humidityadaptor
+SUBDIRS += pressureadaptor
+SUBDIRS += temperatureadaptor
+
+contains(CONFIG,legacy) {
+
+SUBDIRS += mrstaccelerometer
+SUBDIRS += magnetometeradaptor-ncdk
SUDBIRS += oemtabletmagnetometeradaptor
SUBDIRS += pegatronaccelerometeradaptor
SUBDIRS += oemtabletalsadaptor-ascii
@@ -41,22 +51,9 @@
SUDBIRS += oemtabletgyroscopeadaptor
SUBDIRS += steaccelerometeradaptor
SUBDIRS += mpu6050accelerometer
-SUBDIRS += lidsensoradaptor-evdev
-SUBDIRS += iioadaptor
-SUBDIRS += humidityadaptor
-SUBDIRS += pressureadaptor
-SUBDIRS += temperatureadaptor
-config_hybris {
- SUBDIRS += hybrisaccelerometer
- SUBDIRS += hybrisalsadaptor
- SUBDIRS += hybrisgyroscopeadaptor
- SUBDIRS += hybrismagnetometeradaptor
- SUBDIRS += hybrispressureadaptor
- SUBDIRS += hybrisproximityadaptor
- SUBDIRS += hybrisorientationadaptor
- SUBDIRS += hybrisstepcounteradaptor
- }
+}
+
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisaccelerometer/hybrisaccelerometeradaptor.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
@@ -23,8 +22,6 @@
#include "datatypes/utils.h"
#include "config.h"
-#define GRAVITY_RECIPROCAL_THOUSANDS 101.971621298
-
HybrisAccelerometerAdaptor::HybrisAccelerometerAdaptor(const QString& id) :
HybrisAdaptor(id,SENSOR_TYPE_ACCELEROMETER)
{
@@ -78,9 +75,3 @@
buffer->commit();
buffer->wakeUpReaders();
}
-
-//void HybrisAccelerometerAdaptor::init()
-//{
-//// introduceAvailableDataRange(DataRange(-HybrisAdaptor::maxRange, HybrisAdaptor::maxRange , 1));
-//// introduceAvailableInterval(DataRange(10, 586, 0));
-//}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisaccelerometer/hybrisaccelerometeradaptor.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
@@ -52,7 +51,6 @@
protected:
void processSample(const sensors_event_t& data);
- // void init();
private:
DeviceAdaptorRingBuffer<AccelerationData>* buffer;
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisaccelerometer/hybrisaccelerometeradaptorplugin.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisaccelerometer/hybrisaccelerometeradaptorplugin.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisalsadaptor/hybrisalsadaptor.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
@@ -137,7 +136,3 @@
buffer->commit();
buffer->wakeUpReaders();
}
-
-void HybrisAlsAdaptor::init()
-{
-}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisalsadaptor/hybrisalsadaptor.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
@@ -57,7 +56,6 @@
protected:
void processSample(const sensors_event_t& data);
- void init();
private:
DeviceAdaptorRingBuffer<TimedUnsigned>* buffer;
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisalsadaptor/hybrisalsadaptorplugin.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisalsadaptor/hybrisalsadaptorplugin.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
|
[-]
[+]
|
Added |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisgeorotationadaptor/hybrisgeorotationadaptor.cpp
^
|
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Jolla Ltd
+**
+** Copyright (C) 2020 Rinigus
+**
+**
+** $QT_BEGIN_LICENSE:LGPL$
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "hybrisgeorotationadaptor.h"
+#include "logging.h"
+#include "datatypes/utils.h"
+#include "config.h"
+
+#include <QtCore/qmath.h>
+#include <QtGlobal>
+
+/*
+ * azimuth: angle between the magnetic north direction and the Y axis, around
+ * the Z axis (0<=azimuth<360).
+ * 0=North, 90=East, 180=South, 270=West
+ *
+ **/
+
+HybrisGeoRotationAdaptor::HybrisGeoRotationAdaptor(const QString& id) :
+ HybrisAdaptor(id,SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR)
+{
+ m_buffer = new DeviceAdaptorRingBuffer<CompassData>(1);
+ setAdaptedSensor("hybrisgeorotation", "Internal rotation coordinates using geo rotation vector", m_buffer);
+
+ setDescription("Hybris georotation");
+ m_powerStatePath = SensorFrameworkConfig::configuration()->value("georotation/powerstate_path").toByteArray();
+ if (!m_powerStatePath.isEmpty() && !QFile::exists(m_powerStatePath)) {
+ sensordLogW() << "Path does not exists: " << m_powerStatePath;
+ m_powerStatePath.clear();
+ }
+}
+
+HybrisGeoRotationAdaptor::~HybrisGeoRotationAdaptor()
+{
+ delete m_buffer;
+}
+
+bool HybrisGeoRotationAdaptor::startSensor()
+{
+ if (!(HybrisAdaptor::startSensor()))
+ return false;
+ if (isRunning() && !m_powerStatePath.isEmpty())
+ writeToFile(m_powerStatePath, "1");
+ sensordLogD() << "Hybris GeoRotationAdaptor start";
+ return true;
+}
+
+void HybrisGeoRotationAdaptor::stopSensor()
+{
+ HybrisAdaptor::stopSensor();
+ if (!isRunning() && !m_powerStatePath.isEmpty())
+ writeToFile(m_powerStatePath, "0");
+ sensordLogD() << "Hybris GeoRotationAdaptor stop";
+}
+
+void HybrisGeoRotationAdaptor::processSample(const sensors_event_t& data)
+{
+ CompassData *d = m_buffer->nextSlot();
+ d->timestamp_ = quint64(data.timestamp * .001);
+#ifdef USE_BINDER
+ const float *rotationVector = data.u.data;
+#else
+ const float *rotationVector = data.data;
+#endif
+ // Calculations are based on Android methods
+ // getRotationMatrixFromVector and getOrientation
+ // of SensorManager.java
+ float q0 = rotationVector[3];
+ float q1 = rotationVector[0];
+ float q2 = rotationVector[1];
+ float q3 = rotationVector[2];
+ float accuracy = rotationVector[4];
+
+ float sq_q1 = 2 * q1 * q1;
+ float sq_q3 = 2 * q3 * q3;
+ float q1_q2 = 2 * q1 * q2;
+ float q3_q0 = 2 * q3 * q0;
+
+ float R1 = q1_q2 - q3_q0;
+ float R4 = 1 - sq_q1 - sq_q3;
+ float azimuth = qAtan2(R1, R4) * RADIANS_TO_DEGREES;
+ d->degrees_ = (int)(azimuth + 360) % 360;
+ d->rawDegrees_ = d->degrees_;
+
+ // level_ is set to 3 (pass csd) when accuracy is higher than 10 degrees
+ const int maxLevel = 3;
+ if (accuracy < 0) d->level_ = 0;
+ else d->level_ = (accuracy > 1e-5) ?
+ (int)(qMin(qFloor(maxLevel * 0.174533/accuracy), maxLevel)) :
+ maxLevel;
+
+ m_buffer->commit();
+ m_buffer->wakeUpReaders();
+}
|
[-]
[+]
|
Added |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisgeorotationadaptor/hybrisgeorotationadaptor.h
^
|
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Jolla Ltd
+**
+**
+** $QT_BEGIN_LICENSE:LGPL$
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef HYBRISGEOROTATIONADAPTOR_H
+#define HYBRISGEOROTATIONADAPTOR_H
+#include "hybrisadaptor.h"
+
+#include <QString>
+#include <QStringList>
+#include "deviceadaptorringbuffer.h"
+#include "datatypes/orientationdata.h"
+
+/**
+ * @brief Adaptor for hybris compass.
+ *
+ * Adaptor for internal compass
+ * Uses hybris sensor daemon driver interface in interval
+ * polling mode, i.e. values are read with given constant interval.
+ */
+class HybrisGeoRotationAdaptor : public HybrisAdaptor
+{
+ Q_OBJECT
+
+public:
+ static DeviceAdaptor* factoryMethod(const QString& id) {
+ return new HybrisGeoRotationAdaptor(id);
+ }
+ HybrisGeoRotationAdaptor(const QString& id);
+ ~HybrisGeoRotationAdaptor();
+
+ bool startSensor();
+ void stopSensor();
+
+protected:
+ void processSample(const sensors_event_t& data);
+
+private:
+ DeviceAdaptorRingBuffer<CompassData>* m_buffer;
+ QByteArray m_powerStatePath;
+
+};
+#endif
|
[-]
[+]
|
Added |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisgeorotationadaptor/hybrisgeorotationadaptor.pro
^
|
@@ -0,0 +1,14 @@
+TARGET = hybrisgeorotationadaptor
+
+HEADERS += hybrisgeorotationadaptor.h \
+ hybrisgeorotationadaptorplugin.h
+
+SOURCES += hybrisgeorotationadaptor.cpp \
+ hybrisgeorotationadaptorplugin.cpp
+
+LIBS+= -L../../core -lhybrissensorfw-qt5
+
+include( ../adaptor-config.pri )
+config_hybris {
+ PKGCONFIG += android-headers
+}
|
[-]
[+]
|
Added |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisgeorotationadaptor/hybrisgeorotationadaptorplugin.cpp
^
|
@@ -0,0 +1,30 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Jolla Ltd
+**
+**
+** $QT_BEGIN_LICENSE:LGPL$
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "hybrisgeorotationadaptorplugin.h"
+#include "hybrisgeorotationadaptor.h"
+#include "sensormanager.h"
+#include "logging.h"
+
+void HybrisGeoRotationAdaptorPlugin::Register(class Loader&)
+{
+ sensordLogD() << "registering hybrisgeorotationadaptor";
+ SensorManager& sm = SensorManager::instance();
+ sm.registerDeviceAdaptor<HybrisGeoRotationAdaptor>("orientationadaptor");
+}
|
[-]
[+]
|
Added |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisgeorotationadaptor/hybrisgeorotationadaptorplugin.h
^
|
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Jolla Ltd
+**
+**
+** $QT_BEGIN_LICENSE:LGPL$
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef HYBRISGEOROTATIONADAPTORPLUGIN_H
+#define HYBRISGEOROTATIONADAPTORPLUGIN_H
+
+#include "plugin.h"
+
+class HybrisGeoRotationAdaptorPlugin : public Plugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "com.nokia.SensorService.Plugin/1.0")
+
+private:
+ void Register(class Loader& l);
+};
+
+#endif
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisgyroscopeadaptor/hybrisgyroscopeadaptor.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
@@ -24,9 +23,6 @@
#include "config.h"
#include <math.h>
-#define RADIANS_TO_DEGREESECONDS 57295.7795
-#define RADIANS_TO_DEGREES 57.2957795
-
HybrisGyroscopeAdaptor::HybrisGyroscopeAdaptor(const QString& id) :
HybrisAdaptor(id,SENSOR_TYPE_GYROSCOPE)
{
@@ -84,9 +80,3 @@
buffer->commit();
buffer->wakeUpReaders();
}
-
-
-void HybrisGyroscopeAdaptor::init()
-{
-
-}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisgyroscopeadaptor/hybrisgyroscopeadaptor.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
@@ -52,7 +51,6 @@
protected:
void processSample(const sensors_event_t& data);
- void init();
private:
DeviceAdaptorRingBuffer<TimedXyzData>* buffer;
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisgyroscopeadaptor/hybrisgyroscopeadaptorplugin.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisgyroscopeadaptor/hybrisgyroscopeadaptorplugin.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrismagnetometeradaptor/hybrismagnetometeradaptor.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
@@ -95,7 +94,3 @@
buffer->commit();
buffer->wakeUpReaders();
}
-
-void HybrisMagnetometerAdaptor::init()
-{
-}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrismagnetometeradaptor/hybrismagnetometeradaptor.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
@@ -52,7 +51,6 @@
protected:
void processSample(const sensors_event_t& data);
- void init();
private:
DeviceAdaptorRingBuffer<CalibratedMagneticFieldData>* buffer;
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrismagnetometeradaptor/hybrismagnetometeradaptorplugin.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrismagnetometeradaptor/hybrismagnetometeradaptorplugin.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisorientationadaptor/hybrisorientationadaptor.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
@@ -95,7 +94,3 @@
buffer->commit();
buffer->wakeUpReaders();
}
-
-void HybrisOrientationAdaptor::init()
-{
-}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisorientationadaptor/hybrisorientationadaptor.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
@@ -50,7 +49,6 @@
protected:
void processSample(const sensors_event_t& data);
- void init();
private:
DeviceAdaptorRingBuffer<CompassData>* buffer;
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisorientationadaptor/hybrisorientationadaptorplugin.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisorientationadaptor/hybrisorientationadaptorplugin.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrispressureadaptor/hybrispressureadaptor.cpp
^
|
@@ -1,10 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
** Copyright (C) 2017 Matti Lehtimäki
-** Contact: matti.lehtimaki@gmail.com
**
** $QT_BEGIN_LICENSE:LGPL$
**
@@ -77,7 +75,3 @@
buffer->commit();
buffer->wakeUpReaders();
}
-
-void HybrisPressureAdaptor::init()
-{
-}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrispressureadaptor/hybrispressureadaptor.h
^
|
@@ -1,10 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
** Copyright (C) 2017 Matti Lehtimäki
-** Contact: matti.lehtimaki@gmail.com
**
** $QT_BEGIN_LICENSE:LGPL$
**
@@ -57,7 +55,6 @@
protected:
void processSample(const sensors_event_t& data);
- void init();
private:
DeviceAdaptorRingBuffer<TimedUnsigned>* buffer;
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrispressureadaptor/hybrispressureadaptorplugin.cpp
^
|
@@ -1,10 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
** Copyright (C) 2017 Matti Lehtimäki
-** Contact: matti.lehtimaki@gmail.com
**
** $QT_BEGIN_LICENSE:LGPL$
**
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrispressureadaptor/hybrispressureadaptorplugin.h
^
|
@@ -1,10 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
** Copyright (C) 2017 Matti Lehtimäki
-** Contact: matti.lehtimaki@gmail.com
**
** $QT_BEGIN_LICENSE:LGPL$
**
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisproximityadaptor/hybrisproximityadaptor.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
@@ -154,7 +153,3 @@
buffer->commit();
buffer->wakeUpReaders();
}
-
-void HybrisProximityAdaptor::init()
-{
-}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisproximityadaptor/hybrisproximityadaptor.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
@@ -56,7 +55,6 @@
protected:
void processSample(const sensors_event_t& data);
- void init();
private:
DeviceAdaptorRingBuffer<ProximityData>* buffer;
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisproximityadaptor/hybrisproximityadaptorplugin.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisproximityadaptor/hybrisproximityadaptorplugin.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
|
[-]
[+]
|
Added |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisrotationadaptor/hybrisrotationadaptor.cpp
^
|
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Jolla Ltd
+**
+** Copyright (C) 2020 Rinigus
+**
+**
+** $QT_BEGIN_LICENSE:LGPL$
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "hybrisrotationadaptor.h"
+#include "logging.h"
+#include "datatypes/utils.h"
+#include "config.h"
+
+#include <QtCore/qmath.h>
+#include <QtGlobal>
+
+#define RADIANS_TO_DEGREES 57.2957795
+
+/*
+ * azimuth: angle between the magnetic north direction and the Y axis, around
+ * the Z axis (0<=azimuth<360).
+ * 0=North, 90=East, 180=South, 270=West
+ *
+ **/
+
+HybrisRotationAdaptor::HybrisRotationAdaptor(const QString& id) :
+ HybrisAdaptor(id,SENSOR_TYPE_ROTATION_VECTOR)
+{
+ m_buffer = new DeviceAdaptorRingBuffer<CompassData>(1);
+ setAdaptedSensor("hybrisrotation", "Internal rotation coordinates", m_buffer);
+
+ setDescription("Hybris rotation");
+ m_powerStatePath = SensorFrameworkConfig::configuration()->value("rotation/powerstate_path").toByteArray();
+ if (!m_powerStatePath.isEmpty() && !QFile::exists(m_powerStatePath)) {
+ sensordLogW() << "Path does not exists: " << m_powerStatePath;
+ m_powerStatePath.clear();
+ }
+}
+
+HybrisRotationAdaptor::~HybrisRotationAdaptor()
+{
+ delete m_buffer;
+}
+
+bool HybrisRotationAdaptor::startSensor()
+{
+ if (!(HybrisAdaptor::startSensor()))
+ return false;
+ if (isRunning() && !m_powerStatePath.isEmpty())
+ writeToFile(m_powerStatePath, "1");
+ sensordLogD() << "Hybris RotationAdaptor start";
+ return true;
+}
+
+void HybrisRotationAdaptor::stopSensor()
+{
+ HybrisAdaptor::stopSensor();
+ if (!isRunning() && !m_powerStatePath.isEmpty())
+ writeToFile(m_powerStatePath, "0");
+ sensordLogD() << "Hybris RotationAdaptor stop";
+}
+
+void HybrisRotationAdaptor::processSample(const sensors_event_t& data)
+{
+ CompassData *d = m_buffer->nextSlot();
+ d->timestamp_ = quint64(data.timestamp * .001);
+#ifdef USE_BINDER
+ const float *rotationVector = data.u.data;
+#else
+ const float *rotationVector = data.data;
+#endif
+ // Calculations are based on Android methods
+ // getRotationMatrixFromVector and getOrientation
+ // of SensorManager.java
+ float q0 = rotationVector[3];
+ float q1 = rotationVector[0];
+ float q2 = rotationVector[1];
+ float q3 = rotationVector[2];
+ float accuracy = rotationVector[4];
+
+ float sq_q1 = 2 * q1 * q1;
+ float sq_q3 = 2 * q3 * q3;
+ float q1_q2 = 2 * q1 * q2;
+ float q3_q0 = 2 * q3 * q0;
+
+ float R1 = q1_q2 - q3_q0;
+ float R4 = 1 - sq_q1 - sq_q3;
+ float azimuth = qAtan2(R1, R4) * RADIANS_TO_DEGREES;
+ d->degrees_ = (int)(azimuth + 360) % 360;
+ d->rawDegrees_ = d->degrees_;
+
+ // level_ is set to 3 (pass csd) when accuracy is higher than 10 degrees
+ const int maxLevel = 3;
+ if (accuracy < 0) d->level_ = 0;
+ else d->level_ = (accuracy > 1e-5) ? (int)(qMin(qFloor(maxLevel * 0.174533/accuracy), maxLevel)) : maxLevel;
+
+ m_buffer->commit();
+ m_buffer->wakeUpReaders();
+}
|
[-]
[+]
|
Added |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisrotationadaptor/hybrisrotationadaptor.h
^
|
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Jolla Ltd
+**
+**
+** $QT_BEGIN_LICENSE:LGPL$
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef HYBRISROTATIONADAPTOR_H
+#define HYBRISROTATIONADAPTOR_H
+#include "hybrisadaptor.h"
+
+#include <QString>
+#include <QStringList>
+#include "deviceadaptorringbuffer.h"
+#include "datatypes/orientationdata.h"
+
+/**
+ * @brief Adaptor for hybris compass.
+ *
+ * Adaptor for internal compass
+ * Uses hybris sensor daemon driver interface in interval
+ * polling mode, i.e. values are read with given constant interval.
+ */
+class HybrisRotationAdaptor : public HybrisAdaptor
+{
+ Q_OBJECT
+
+public:
+ static DeviceAdaptor* factoryMethod(const QString& id) {
+ return new HybrisRotationAdaptor(id);
+ }
+ HybrisRotationAdaptor(const QString& id);
+ ~HybrisRotationAdaptor();
+
+ bool startSensor();
+ void stopSensor();
+
+protected:
+ void processSample(const sensors_event_t& data);
+
+private:
+ DeviceAdaptorRingBuffer<CompassData>* m_buffer;
+ QByteArray m_powerStatePath;
+
+};
+#endif
|
[-]
[+]
|
Added |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisrotationadaptor/hybrisrotationadaptor.pro
^
|
@@ -0,0 +1,14 @@
+TARGET = hybrisrotationadaptor
+
+HEADERS += hybrisrotationadaptor.h \
+ hybrisrotationadaptorplugin.h
+
+SOURCES += hybrisrotationadaptor.cpp \
+ hybrisrotationadaptorplugin.cpp
+
+LIBS+= -L../../core -lhybrissensorfw-qt5
+
+include( ../adaptor-config.pri )
+config_hybris {
+ PKGCONFIG += android-headers
+}
|
[-]
[+]
|
Added |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisrotationadaptor/hybrisrotationadaptorplugin.cpp
^
|
@@ -0,0 +1,30 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Jolla Ltd
+**
+**
+** $QT_BEGIN_LICENSE:LGPL$
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "hybrisrotationadaptorplugin.h"
+#include "hybrisrotationadaptor.h"
+#include "sensormanager.h"
+#include "logging.h"
+
+void HybrisRotationAdaptorPlugin::Register(class Loader&)
+{
+ sensordLogD() << "registering hybrisrotationadaptor";
+ SensorManager& sm = SensorManager::instance();
+ sm.registerDeviceAdaptor<HybrisRotationAdaptor>("orientationadaptor");
+}
|
[-]
[+]
|
Added |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisrotationadaptor/hybrisrotationadaptorplugin.h
^
|
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Jolla Ltd
+**
+**
+** $QT_BEGIN_LICENSE:LGPL$
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef HYBRISROTATIONADAPTORPLUGIN_H
+#define HYBRISROTATIONADAPTORPLUGIN_H
+
+#include "plugin.h"
+
+class HybrisRotationAdaptorPlugin : public Plugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "com.nokia.SensorService.Plugin/1.0")
+
+private:
+ void Register(class Loader& l);
+};
+
+#endif
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisstepcounteradaptor/hybrisstepcounteradaptor.cpp
^
|
@@ -1,10 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
** Copyright (C) 2016 kimmoli
-** Contact: kimmo.lindholm@eke.fi
**
**
** $QT_BEGIN_LICENSE:LGPL$
@@ -26,12 +24,8 @@
#include "datatypes/utils.h"
#include "config.h"
-#ifndef SENSOR_TYPE_STEP_COUNTER
-#define SENSOR_TYPE_STEP_COUNTER (19)
-/* If hardware/sensors.h does not define SENSOR_TYPE_STEP_COUNTER, assume
- * a) the event structure is missing u64 union too, and b) u64.step_counter
- * would be located at the same address as non-u64 data array. */
-#define NO_SENSORS_EVENT_U64
+#ifndef USE_BINDER
+#include <android-version.h>
#endif
HybrisStepCounterAdaptor::HybrisStepCounterAdaptor(const QString& id) :
@@ -83,7 +77,10 @@
#ifdef USE_BINDER
d->value_ = data.u.stepCount;
#else
-#ifdef NO_SENSORS_EVENT_U64
+#if ANDROID_VERSION_MAJOR == 4 && ANDROID_VERSION_MINOR < 4
+/* In Android versions 4.3 and older hardware/sensors.h does not
+ * contain u64 union and values are located at the same
+ * address as non-u64 data array. */
uint64_t value = 0;
memcpy(&value, data.data, sizeof value);
d->value_ = value;
@@ -94,7 +91,3 @@
buffer->commit();
buffer->wakeUpReaders();
}
-
-void HybrisStepCounterAdaptor::init()
-{
-}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisstepcounteradaptor/hybrisstepcounteradaptor.h
^
|
@@ -1,10 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
** Copyright (C) 2016 kimmoli
-** Contact: kimmo.lindholm@eke.fi
**
**
** $QT_BEGIN_LICENSE:LGPL$
@@ -60,7 +58,6 @@
protected:
void processSample(const sensors_event_t& data);
- void init();
private:
DeviceAdaptorRingBuffer<TimedUnsigned>* buffer;
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisstepcounteradaptor/hybrisstepcounteradaptorplugin.cpp
^
|
@@ -1,10 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
** Copyright (C) 2016 kimmoli
-** Contact: kimmo.lindholm@eke.fi
**
**
** $QT_BEGIN_LICENSE:LGPL$
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/hybrisstepcounteradaptor/hybrisstepcounteradaptorplugin.h
^
|
@@ -1,10 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
** Copyright (C) 2016 kimmoli
-** Contact: kimmo.lindholm@eke.fi
**
**
** $QT_BEGIN_LICENSE:LGPL$
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/adaptors/iioadaptor/iioadaptor.pro
^
|
@@ -8,8 +8,6 @@
CONFIG += qt debug warn_on link_prl link_pkgconfig plugin
-CONFIG += link_pkgconfig
-PKGCONFIG += udev
-LIBS += -ludev
+PKGCONFIG += libudev
include( ../adaptor-config.pri )
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/chains/compasschain/compasschain.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/chains/compasschain/compasschain.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/chains/compasschain/compasschainplugin.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/chains/compasschain/compasschainplugin.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/chains/compasschain/compassfilter.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
@@ -27,11 +26,12 @@
#define DEGREES_TO_RADIANS 0.017453292
#define GRAVITY_EARTH 9.80665f
#define FILTER_FACTOR 0.24f
-#define LIST_COUNT 10
CompassFilter::CompassFilter() :
magDataSink(this, &CompassFilter::magDataAvailable),
accelSink(this, &CompassFilter::accelDataAvailable),
+ magX(0), magY(0), magZ(0),
+ oldMagX(0), oldMagY(0), oldMagZ(0),
level(0),
oldHeading(0)
{
@@ -61,7 +61,7 @@
// the x/y are switched as compass expects it in aero coordinates
qreal Gx = data->y_ * .001f; //convert to g
qreal Gy = data->x_ * .001f;
- qreal Gz = -data->z_ * .001f;
+ qreal Gz = data->z_ * .001f;
qreal divisor = qSqrt(Gx * Gx + Gy * Gy + Gz * Gz);
qreal normalizedGx = Gx / divisor;
@@ -105,11 +105,19 @@
/* calculate yaw = ecompass angle psi (-180deg, 180deg) */
Psi = (qAtan2(-fBfy, fBfx) * RADIANS_TO_DEGREES); /* Equation 7 */
- qreal heading = Psi * FILTER_FACTOR + oldHeading * (1.0 - FILTER_FACTOR);
+ qreal heading;
+ if (Psi < -90.0f && oldHeading > 90.0f) {
+ heading = (Psi + 360.0f) * FILTER_FACTOR + oldHeading * (1.0 - FILTER_FACTOR);
+ } else if (Psi > 90.0f && oldHeading < -90.0f) {
+ heading = Psi * FILTER_FACTOR + (oldHeading + 360.0f) * (1.0 - FILTER_FACTOR);
+ } else {
+ heading = Psi * FILTER_FACTOR + oldHeading * (1.0 - FILTER_FACTOR);
+ }
CompassData compassData; //north angle
compassData.timestamp_ = data->timestamp_;
compassData.degrees_ = (int)(heading + 360) % 360;
+ compassData.rawDegrees_ = compassData.degrees_;
compassData.level_ = level;
magSource.propagate(1, &compassData);
oldHeading = heading;
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/chains/compasschain/compassfilter.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
@@ -49,8 +48,6 @@
void magDataAvailable(unsigned, const CalibratedMagneticFieldData*);
void accelDataAvailable(unsigned, const AccelerationData*);
- CalibratedMagneticFieldData magData;
-
qreal magX;
qreal magY;
qreal magZ;
@@ -60,10 +57,6 @@
int level;
qreal oldHeading;
- QList <int> averagingBuffer;
- QList <const CalibratedMagneticFieldData *> magAvgBuffer;
- QList <const AccelerationData *> accelAvgBuffer;
-// MagAvgBuffer magAvgBuffer;
};
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/chains/compasschain/orientationfilter.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/chains/compasschain/orientationfilter.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/chains/magcalibrationchain/calibrationfilter.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013-2015 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/chains/magcalibrationchain/calibrationfilter.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/chains/magcalibrationchain/magcalibrationchain.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/chains/magcalibrationchain/magcalibrationchain.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/chains/magcalibrationchain/magcalibrationchainplugin.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/chains/magcalibrationchain/magcalibrationchainplugin.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/core/hybrisadaptor.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
@@ -35,98 +34,6 @@
#include <time.h>
#include <signal.h>
-
-/* Older devices probably have old android hal and thus do
- * not define sensor all sensor types that have been added
- * later on -> In order to both use symbolic names and
- * compile for all devices we need to fill in holes that
- * android hal for some particular device might have.
- */
-#ifndef SENSOR_TYPE_META_DATA
-#define SENSOR_TYPE_META_DATA (0)
-#endif
-#ifndef SENSOR_TYPE_ACCELEROMETER
-#define SENSOR_TYPE_ACCELEROMETER (1)
-#endif
-#ifndef SENSOR_TYPE_GEOMAGNETIC_FIELD
-#define SENSOR_TYPE_GEOMAGNETIC_FIELD (2) // alias for SENSOR_TYPE_MAGNETIC_FIELD
-#endif
-#ifndef SENSOR_TYPE_MAGNETIC_FIELD
-#define SENSOR_TYPE_MAGNETIC_FIELD (2) // alias for SENSOR_TYPE_GEOMAGNETIC_FIELD
-#endif
-#ifndef SENSOR_TYPE_ORIENTATION
-#define SENSOR_TYPE_ORIENTATION (3)
-#endif
-#ifndef SENSOR_TYPE_GYROSCOPE
-#define SENSOR_TYPE_GYROSCOPE (4)
-#endif
-#ifndef SENSOR_TYPE_LIGHT
-#define SENSOR_TYPE_LIGHT (5)
-#endif
-#ifndef SENSOR_TYPE_PRESSURE
-#define SENSOR_TYPE_PRESSURE (6)
-#endif
-#ifndef SENSOR_TYPE_TEMPERATURE
-#define SENSOR_TYPE_TEMPERATURE (7)
-#endif
-#ifndef SENSOR_TYPE_PROXIMITY
-#define SENSOR_TYPE_PROXIMITY (8)
-#endif
-#ifndef SENSOR_TYPE_GRAVITY
-#define SENSOR_TYPE_GRAVITY (9)
-#endif
-#ifndef SENSOR_TYPE_LINEAR_ACCELERATION
-#define SENSOR_TYPE_LINEAR_ACCELERATION (10)
-#endif
-#ifndef SENSOR_TYPE_ROTATION_VECTOR
-#define SENSOR_TYPE_ROTATION_VECTOR (11)
-#endif
-#ifndef SENSOR_TYPE_RELATIVE_HUMIDITY
-#define SENSOR_TYPE_RELATIVE_HUMIDITY (12)
-#endif
-#ifndef SENSOR_TYPE_AMBIENT_TEMPERATURE
-#define SENSOR_TYPE_AMBIENT_TEMPERATURE (13)
-#endif
-#ifndef SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED
-#define SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED (14)
-#endif
-#ifndef SENSOR_TYPE_GAME_ROTATION_VECTOR
-#define SENSOR_TYPE_GAME_ROTATION_VECTOR (15)
-#endif
-#ifndef SENSOR_TYPE_GYROSCOPE_UNCALIBRATED
-#define SENSOR_TYPE_GYROSCOPE_UNCALIBRATED (16)
-#endif
-#ifndef SENSOR_TYPE_SIGNIFICANT_MOTION
-#define SENSOR_TYPE_SIGNIFICANT_MOTION (17)
-#endif
-#ifndef SENSOR_TYPE_STEP_DETECTOR
-#define SENSOR_TYPE_STEP_DETECTOR (18)
-#endif
-#ifndef SENSOR_TYPE_STEP_COUNTER
-#define SENSOR_TYPE_STEP_COUNTER (19)
-#endif
-#ifndef SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR
-#define SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR (20)
-#endif
-#ifndef SENSOR_TYPE_HEART_RATE
-#define SENSOR_TYPE_HEART_RATE (21)
-#endif
-#ifndef SENSOR_TYPE_TILT_DETECTOR
-#define SENSOR_TYPE_TILT_DETECTOR (22)
-#endif
-#ifndef SENSOR_TYPE_WAKE_GESTURE
-#define SENSOR_TYPE_WAKE_GESTURE (23)
-#endif
-#ifndef SENSOR_TYPE_GLANCE_GESTURE
-#define SENSOR_TYPE_GLANCE_GESTURE (24)
-#endif
-#ifndef SENSOR_TYPE_PICK_UP_GESTURE
-#define SENSOR_TYPE_PICK_UP_GESTURE (25)
-#endif
-#ifndef SENSOR_TYPE_WRIST_TILT_GESTURE
-#define SENSOR_TYPE_WRIST_TILT_GESTURE (26)
-#endif
-
#ifdef USE_BINDER
#define SENSOR_BINDER_SERVICE_DEVICE "/dev/hwbinder"
#define SENSOR_BINDER_SERVICE_IFACE "android.hardware.sensors@1.0::ISensors"
@@ -712,6 +619,37 @@
}
}
+float HybrisManager::scaleSensorValue(const float value, const int type) const
+{
+ float outValue;
+ switch (type) {
+ case SENSOR_TYPE_ACCELEROMETER:
+ case SENSOR_TYPE_GRAVITY:
+ case SENSOR_TYPE_LINEAR_ACCELERATION:
+ //sensorfw wants milli-G'
+ outValue = value * GRAVITY_RECIPROCAL_THOUSANDS;
+ break;
+ case SENSOR_TYPE_MAGNETIC_FIELD:
+ case SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED:
+ // uT to nT
+ outValue = value * 1000;
+ break;
+ case SENSOR_TYPE_GYROSCOPE:
+ case SENSOR_TYPE_GYROSCOPE_UNCALIBRATED:
+ // From rad/s to mdeg/s
+ outValue = value * RADIANS_TO_DEGREES * 1000;
+ break;
+ case SENSOR_TYPE_PRESSURE:
+ // From hPa to Pa
+ outValue = value * 100;
+ break;
+ default:
+ outValue = value;
+ break;
+ }
+ return outValue;
+}
+
float HybrisManager::getMaxRange(int handle) const
{
float range = 0;
@@ -720,7 +658,7 @@
if (index != -1) {
const struct sensor_t *sensor = &m_sensorArray[index];
- range = sensor->maxRange;
+ range = scaleSensorValue(sensor->maxRange, sensor->type);
sensordLogT("HYBRIS CTL getMaxRange(%d=%s) -> %g",
sensor->handle, sensorTypeName(sensor->type), range);
}
@@ -736,7 +674,7 @@
if (index != -1) {
const struct sensor_t *sensor = &m_sensorArray[index];
- resolution = sensor->resolution;
+ resolution = scaleSensorValue(sensor->resolution, sensor->type);
sensordLogT("HYBRIS CTL getResolution(%d=%s) -> %g",
sensor->handle, sensorTypeName(sensor->type), resolution);
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/core/hybrisadaptor.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
@@ -36,6 +35,101 @@
#include <pthread.h>
#endif
+/* Older devices probably have old android hal and thus do
+ * not define sensor all sensor types that have been added
+ * later on -> In order to both use symbolic names and
+ * compile for all devices we need to fill in holes that
+ * android hal for some particular device might have.
+ */
+#ifndef SENSOR_TYPE_META_DATA
+#define SENSOR_TYPE_META_DATA (0)
+#endif
+#ifndef SENSOR_TYPE_ACCELEROMETER
+#define SENSOR_TYPE_ACCELEROMETER (1)
+#endif
+#ifndef SENSOR_TYPE_GEOMAGNETIC_FIELD
+#define SENSOR_TYPE_GEOMAGNETIC_FIELD (2) // alias for SENSOR_TYPE_MAGNETIC_FIELD
+#endif
+#ifndef SENSOR_TYPE_MAGNETIC_FIELD
+#define SENSOR_TYPE_MAGNETIC_FIELD (2) // alias for SENSOR_TYPE_GEOMAGNETIC_FIELD
+#endif
+#ifndef SENSOR_TYPE_ORIENTATION
+#define SENSOR_TYPE_ORIENTATION (3)
+#endif
+#ifndef SENSOR_TYPE_GYROSCOPE
+#define SENSOR_TYPE_GYROSCOPE (4)
+#endif
+#ifndef SENSOR_TYPE_LIGHT
+#define SENSOR_TYPE_LIGHT (5)
+#endif
+#ifndef SENSOR_TYPE_PRESSURE
+#define SENSOR_TYPE_PRESSURE (6)
+#endif
+#ifndef SENSOR_TYPE_TEMPERATURE
+#define SENSOR_TYPE_TEMPERATURE (7)
+#endif
+#ifndef SENSOR_TYPE_PROXIMITY
+#define SENSOR_TYPE_PROXIMITY (8)
+#endif
+#ifndef SENSOR_TYPE_GRAVITY
+#define SENSOR_TYPE_GRAVITY (9)
+#endif
+#ifndef SENSOR_TYPE_LINEAR_ACCELERATION
+#define SENSOR_TYPE_LINEAR_ACCELERATION (10)
+#endif
+#ifndef SENSOR_TYPE_ROTATION_VECTOR
+#define SENSOR_TYPE_ROTATION_VECTOR (11)
+#endif
+#ifndef SENSOR_TYPE_RELATIVE_HUMIDITY
+#define SENSOR_TYPE_RELATIVE_HUMIDITY (12)
+#endif
+#ifndef SENSOR_TYPE_AMBIENT_TEMPERATURE
+#define SENSOR_TYPE_AMBIENT_TEMPERATURE (13)
+#endif
+#ifndef SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED
+#define SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED (14)
+#endif
+#ifndef SENSOR_TYPE_GAME_ROTATION_VECTOR
+#define SENSOR_TYPE_GAME_ROTATION_VECTOR (15)
+#endif
+#ifndef SENSOR_TYPE_GYROSCOPE_UNCALIBRATED
+#define SENSOR_TYPE_GYROSCOPE_UNCALIBRATED (16)
+#endif
+#ifndef SENSOR_TYPE_SIGNIFICANT_MOTION
+#define SENSOR_TYPE_SIGNIFICANT_MOTION (17)
+#endif
+#ifndef SENSOR_TYPE_STEP_DETECTOR
+#define SENSOR_TYPE_STEP_DETECTOR (18)
+#endif
+#ifndef SENSOR_TYPE_STEP_COUNTER
+#define SENSOR_TYPE_STEP_COUNTER (19)
+#endif
+#ifndef SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR
+#define SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR (20)
+#endif
+#ifndef SENSOR_TYPE_HEART_RATE
+#define SENSOR_TYPE_HEART_RATE (21)
+#endif
+#ifndef SENSOR_TYPE_TILT_DETECTOR
+#define SENSOR_TYPE_TILT_DETECTOR (22)
+#endif
+#ifndef SENSOR_TYPE_WAKE_GESTURE
+#define SENSOR_TYPE_WAKE_GESTURE (23)
+#endif
+#ifndef SENSOR_TYPE_GLANCE_GESTURE
+#define SENSOR_TYPE_GLANCE_GESTURE (24)
+#endif
+#ifndef SENSOR_TYPE_PICK_UP_GESTURE
+#define SENSOR_TYPE_PICK_UP_GESTURE (25)
+#endif
+#ifndef SENSOR_TYPE_WRIST_TILT_GESTURE
+#define SENSOR_TYPE_WRIST_TILT_GESTURE (26)
+#endif
+
+#define GRAVITY_RECIPROCAL_THOUSANDS 101.971621298
+#define RADIANS_TO_DEGREESECONDS 57295.7795
+#define RADIANS_TO_DEGREES 57.2957795
+
#define SENSORFW_MCE_WATCHER
class HybrisAdaptor;
@@ -131,6 +225,7 @@
private:
static void *halEventReaderThread(void *aptr);
#endif
+ float scaleSensorValue(const float value, const int type) const;
void processEvents(const sensors_event_t *buffer,
int numberOfEvents, bool &blockSuspend, bool &errorInInput);
};
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/core/hybrisbindertypes.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2019 Jolla Ltd
-** Contact: matti.lehtimaki@jolla.com
**
**
** $QT_BEGIN_LICENSE:LGPL$
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/core/sensormanager.cpp
^
|
@@ -41,11 +41,13 @@
#endif // SENSORFW_LUNA_SERVICE_CLIENT
#include <QSocketNotifier>
#include <errno.h>
+#include <functional>
#include "sockethandler.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
+#include <QTimer>
#include <QSettings>
@@ -55,6 +57,8 @@
void* buffer;
} PipeData;
+const int SensorManager::SOCKET_CONNECTION_TIMEOUT_MS = 10000;
+
SensorManager* SensorManager::instance_ = NULL;
int SensorManager::sessionIdCount_ = 0;
@@ -91,6 +95,59 @@
{
}
+SessionInstanceEntry::SessionInstanceEntry(QObject* parent, int sessionId, const QString& clientName)
+ : QObject(parent)
+ , m_sessionId(sessionId)
+ , m_clientName(clientName)
+ , m_timer(nullptr)
+{
+}
+
+SessionInstanceEntry::~SessionInstanceEntry()
+{
+ if (m_timer) {
+ delete m_timer;
+ m_timer = nullptr;
+ }
+}
+
+void SessionInstanceEntry::expectConnection(int msec)
+{
+ m_timer = new QTimer(this);
+ m_timer->setSingleShot(true);
+ m_timer->setInterval(msec);
+ connect(m_timer, &QTimer::timeout, this, &SessionInstanceEntry::timerTimeout);
+ m_timer->start();
+
+ SocketHandler& socketHandler = SensorManager::instance().socketHandler();
+ connect(&socketHandler, &SocketHandler::connectedSession,
+ this, &SessionInstanceEntry::sessionConnected);
+}
+
+void SessionInstanceEntry::timerTimeout()
+{
+ m_timer->deleteLater();
+ m_timer = nullptr;
+
+ SocketHandler& socketHandler = SensorManager::instance().socketHandler();
+ disconnect(&socketHandler, &SocketHandler::connectedSession, this, nullptr);
+ socketHandler.checkConnectionEstablished(m_sessionId);
+}
+
+void SessionInstanceEntry::sessionConnected(int sessionId)
+{
+ if (sessionId == m_sessionId) {
+ if (m_timer) {
+ m_timer->stop();
+ m_timer->deleteLater();
+ m_timer = nullptr;
+ }
+
+ SocketHandler& socketHandler = SensorManager::instance().socketHandler();
+ disconnect(&socketHandler, &SocketHandler::connectedSession, this, nullptr);
+ }
+}
+
inline QDBusConnection bus()
{
return QDBusConnection::systemBus();
@@ -112,7 +169,7 @@
deviation(0)
{
QString pluginPath;
- const char* SOCKET_NAME = "/var/run/sensord.sock";
+ const char* SOCKET_NAME = "/run/sensord.sock";
QByteArray env = qgetenv("SENSORFW_SOCKET_PATH");
if (!env.isEmpty()) {
env += SOCKET_NAME;
@@ -138,6 +195,11 @@
sensordLogW() << "Error setting socket permissions! " << SOCKET_NAME;
}
+ serviceWatcher_ = new QDBusServiceWatcher(this);
+ serviceWatcher_->setWatchMode(QDBusServiceWatcher::WatchForUnregistration);
+ QObject::connect(serviceWatcher_, &QDBusServiceWatcher::serviceUnregistered,
+ this, &SensorManager::dbusClientUnregistered);
+
#ifdef SENSORFW_MCE_WATCHER
mceWatcher_ = new MceWatcher(this);
connect(mceWatcher_, SIGNAL(displayStateChanged(const bool)),
@@ -211,6 +273,7 @@
delete socketHandler_;
delete pipeNotifier_;
+ delete serviceWatcher_;
if (pipefds_[0]) close(pipefds_[0]);
if (pipefds_[1]) close(pipefds_[1]);
@@ -260,6 +323,7 @@
setError(SmCanNotRegisterService, error.message());
return false;
}
+ serviceWatcher_->setConnection(bus());
return true;
}
@@ -368,8 +432,12 @@
return INVALID_SESSION;
}
+ QString clientName = "";
+ if ( calledFromDBus() )
+ clientName = message().service();
+
int sessionId = createNewSessionId();
- if(!entryIt.value().sensor_)
+ if (!entryIt.value().sensor_)
{
AbstractSensorChannel* sensor = addSensor(id);
if ( sensor == NULL )
@@ -380,12 +448,32 @@
entryIt.value().sensor_ = sensor;
}
entryIt.value().sessions_.insert(sessionId);
+ if ( !clientName.isEmpty() )
+ {
+ QMap<int, SessionInstanceEntry*>::iterator sessionIt = sessionInstanceMap_.insert(
+ sessionId, new SessionInstanceEntry(this, sessionId, clientName));
+ serviceWatcher_->addWatchedService(clientName);
+ sessionIt.value()->expectConnection(SOCKET_CONNECTION_TIMEOUT_MS);
+ }
return sessionId;
}
bool SensorManager::releaseSensor(const QString& id, int sessionId)
{
+ QString clientName = "";
+ QMap<int, SessionInstanceEntry*>::iterator sessionIt = sessionInstanceMap_.find(sessionId);
+ if ( calledFromDBus() )
+ {
+ clientName = message().service();
+ if ( sessionIt == sessionInstanceMap_.end() || sessionIt.value()->m_clientName != clientName )
+ {
+ sensordLogW() << "Ignoring attempt to release session" << sessionId
+ << "that wasn't previously registered for D-Bus client" << clientName;
+ return false;
+ }
+ }
+
sensordLogD() << "Releasing sensor '" << id << "' for session: " << sessionId;
clearError();
@@ -431,6 +519,28 @@
setError( SmNotInstantiated, tr("invalid sessionId, no session to release") );
}
+ if ( sessionIt != sessionInstanceMap_.end() )
+ {
+ delete sessionIt.value();
+ sessionInstanceMap_.erase(sessionIt);
+ }
+
+ if (!clientName.isEmpty())
+ {
+ bool hasMoreSessions = false;
+ for (sessionIt = sessionInstanceMap_.begin(); sessionIt != sessionInstanceMap_.end(); ++sessionIt)
+ {
+ if (sessionIt.value()->m_clientName == clientName)
+ {
+ hasMoreSessions = true;
+ break;
+ }
+ }
+
+ if (!hasMoreSessions)
+ serviceWatcher_->removeWatchedService(clientName);
+ }
+
socketHandler_->removeSession(sessionId);
return returnValue;
@@ -689,6 +799,19 @@
sensordLogW() << "[SensorManager]: Lost session " << sessionId << " detected, but not found from session list";
}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/core/sensormanager.h
^
|
@@ -30,6 +30,9 @@
#ifndef SENSORMANAGER_H
#define SENSORMANAGER_H
+#include <QDBusContext>
+#include <QDBusServiceWatcher>
+
#include "abstractsensor.h"
#include "abstractchain.h"
#include "deviceadaptor.h"
@@ -50,6 +53,7 @@
#endif
class QSocketNotifier;
+class QTimer;
class SocketHandler;
/**
@@ -124,10 +128,56 @@
};
/**
+ * Sensor session instance entry. Contains session ID, D-Bus service name of
+ * connecting side and timer for initial connection timeout.
+ */
+class SessionInstanceEntry : public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(SessionInstanceEntry)
+public:
+ /**
+ * Constructor.
+ *
+ * @param sessionId Sensor ID
+ * @param clientName D-Bus service name of requesting side
+ */
+ SessionInstanceEntry(QObject* parent, int sessionId, const QString& clientName);
+
+ /**
+ * Destructor.
+ */
+ ~SessionInstanceEntry();
+
+ /**
+ * Start timer to check if socket connection has been established after timeout.
+ *
+ * @param msec time to wait for socket connection.
+ */
+ void expectConnection(int msec);
+
+ int m_sessionId; /**< Session ID */
+ QString m_clientName; /**< D-Bus private client name */
+ QTimer* m_timer; /**< timer for initial connection */
+
+public slots:
+
+ /**
+ * Callback for initial connection timer.
+ */
+ void timerTimeout();
+
+ /**
+ * Callback for session socket connection getting established.
+ */
+ void sessionConnected(int sessionId);
+};
+
+/**
* Sensor manager. Singleton class which manages client sessions and
* track existence and usage of sensors, chains and adaptors.
*/
-class SensorManager : public QObject
+class SensorManager : public QObject, protected QDBusContext
{
Q_OBJECT
Q_DISABLE_COPY(SensorManager)
@@ -368,6 +418,13 @@
void lostClient(int sessionId);
/**
+ * Callback for D-Bus service unregistration.
+ *
+ * @param sessionId Session ID.
+ */
+ void dbusClientUnregistered(const QString &clientName);
+
+ /**
* Callback for MCE or LS display state change event.
*
* @param displayState display state.
@@ -473,6 +530,7 @@
QMap<QString, SensorChannelFactoryMethod> sensorFactoryMap_; /**< factories for sensor types */
QMap<QString, SensorInstanceEntry> sensorInstanceMap_; /**< sensor instances */
+ QMap<int, SessionInstanceEntry*> sessionInstanceMap_; /**< sensor session instances */
QMap<QString, DeviceAdaptorFactoryMethod> deviceAdaptorFactoryMap_; /**< factories for adaptor types. */
QMap<QString, DeviceAdaptorInstanceEntry> deviceAdaptorInstanceMap_; /**< adaptor instances */
@@ -483,6 +541,7 @@
QMap<QString, FilterFactoryMethod> filterFactoryMap_; /**< factories for filter types */
SocketHandler* socketHandler_; /**< socket handler */
+ QDBusServiceWatcher* serviceWatcher_; /**< D-Bus service watcher */
MceWatcher* mceWatcher_; /**< MCE watcher */
#ifdef SENSORFW_LUNA_SERVICE_CLIENT
LSClient* lsClient_; /**< LS client */
@@ -496,6 +555,8 @@
static int sessionIdCount_; /** session ID counter */
double deviation;
+
+ static const int SOCKET_CONNECTION_TIMEOUT_MS;
};
template<class SENSOR_TYPE>
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/core/sockethandler.cpp
^
|
@@ -276,6 +276,15 @@
return true;
}
+void SocketHandler::checkConnectionEstablished(int sessionId)
+{
+ if (!(m_idMap.keys().contains(sessionId))) {
+ sensordLogW() << "[SocketHandler]: Socket connection for session" << sessionId
+ << "hasn't been estabilished. Considering session lost";
+ emit lostSession(sessionId);
+ }
+}
+
void SocketHandler::newConnection()
{
sensordLogT() << "[SocketHandler]: New connection received.";
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/core/sockethandler.h
^
|
@@ -237,6 +237,15 @@
bool removeSession(int sessionId);
/**
+ * Verify if socket connection for a given session has been established.
+ * If there has been no connection, session is considered lost and
+ * lostSession signal is emitted.
+ *
+ * @param sessionId Session ID.
+ */
+ void checkConnectionEstablished(int sessionId);
+
+ /**
* Get socket file descriptor for given session.
*
* @param sessionId Session ID.
@@ -339,6 +348,14 @@
Q_SIGNALS:
/**
+ * Signal is emitted for new client connection after it sent the
+ session id.
+ *
+ * @param sessionId Session ID.
+ */
+ void connectedSession(int sessionId);
+
+ /**
* Signal is emitted for lost sessions which can happen for example
* if application using sensorfw crashes.
*
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/debian/changelog
^
|
@@ -1,3 +1,32 @@
+sensorfw-qt5 (0.12.3) unstable; urgency=medium
+
+ * [sensorfw] Discard any old sensor data before starting sensor
+ * [hybrisadaptor] Fix initialization of ranges and intervals
+ * [hybrisadaptor] Fix scaling of data ranges
+
+ -- Matti Lehtimäki <matti.lehtimaki@jolla.com> Thu, 22 Jul 2021 01:18:00 +0300
+
+sensorfw-qt5 (0.12.2) unstable; urgency=medium
+
+ * [sensorfw] Move sensord.sock to /run
+ * [sensorfw] Properly handle angle rollover in built-in compass support
+ * [sensorfw] Cleanup Qt project files
+ * [packaging] Refine systemd unit install and test cleanup
+
+ -- Matti Lehtimäki <matti.lehtimaki@jolla.com> Thu, 21 Jan 2021 22:34:31 +0300
+
+sensorfw-qt5 (0.12.1) unstable; urgency=medium
+
+ * [hybrisadaptor] Fix building rotation vector adaptors with old Android versions
+
+ -- Matti Lehtimäki <matti.lehtimaki@jolla.com> Wed, 09 Sep 2020 16:14:31 +0300
+
+sensorfw-qt5 (0.12.0) unstable; urgency=medium
+
+ * [hybrisadaptor] Use of hybris rotation vectors for compass
+
+ -- Simo Piiroinen <simo.piiroinen@jollamobile.com> Wed, 02 Sep 2020 15:12:31 +0300
+
sensorfw-qt5 (0.11.1) unstable; urgency=medium
* [packaging] Add missing debian build dependencies. Fixes MER#2060
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/debian/rules
^
|
@@ -48,7 +48,7 @@
dh_testdir
# Add here commands to configure the package.
- cd $(BUILD_DIR) && qmake $(QMAKECONFIG) CONFIG+="configs" CONFIG+="autohybris" "QMAKE_CXXFLAGS=$(CFLAGS)" "MAKE_DOCS=$(MAKE_DOCS)" ../$(PROJECT_NAME).pro
+ cd $(BUILD_DIR) && qmake $(QMAKECONFIG) CONFIG+="configs" CONFIG+="autohybris" CONFIG+="legacy" CONFIG+="systemdunit" "QMAKE_CXXFLAGS=$(CFLAGS)" "MAKE_DOCS=$(MAKE_DOCS)" ../$(PROJECT_NAME).pro
export LD_RUN_PATH=/usr/lib/sensord-qt5/
touch configure-stamp
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/filters/avgaccfilter/avgaccfilter.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/filters/avgaccfilter/avgaccfilter.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/filters/avgaccfilter/avgaccfilterplugin.cpp
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/filters/avgaccfilter/avgaccfilterplugin.h
^
|
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd
-** Contact: lorn.potter@jollamobile.com
This file is part of Sensord.
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/qt-api/abstractsensor_i.cpp
^
|
@@ -131,6 +131,11 @@
}
pimpl_->running_ = true;
+ // Discard any old data already in the socket
+ if (pimpl_->socketReader_.socket()->bytesAvailable() > 0) {
+ pimpl_->socketReader_.socket()->readAll();
+ }
+
connect(pimpl_->socketReader_.socket(), SIGNAL(readyRead()), this, SLOT(dataReceived()));
QList<QVariant> argumentList;
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/qt-api/socketreader.cpp
^
|
@@ -50,7 +50,7 @@
}
socket_ = new QLocalSocket(this);
- const char* SOCKET_NAME = "/var/run/sensord.sock";
+ const char* SOCKET_NAME = "/run/sensord.sock";
QByteArray env = qgetenv("SENSORFW_SOCKET_PATH");
if (!env.isEmpty()) {
env += SOCKET_NAME;
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/sensord-qt5.pc.in
^
|
@@ -4,7 +4,7 @@
Name: Sensorfw-qt5
Description: Sensord for Qt 5
-Version: 0.11.6
+Version: 0.12.3
Requires:
Libs: -L${libdir} -lsensorclient-qt5 -lsensordatatypes-qt5
Cflags: -I${includedir} -I${includedir}/datatypes -I${includedir}/filters
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/sensorfw.pro
^
|
@@ -27,11 +27,14 @@
examples
contains(CONFIG,configs) {
- # !contains(CONFIG,hybris) {
+ contains(CONFIG,hybris) {
SENSORDHYBRISCONFIGFILE.files = config/sensord-hybris.conf
SENSORDHYBRISCONFIGFILE.path = /etc/sensorfw
INSTALLS += SENSORDHYBRISCONFIGFILE
- # }
+ }
+
+ contains(CONFIG,legacy) {
+
SENSORFWCONFIGFILES.files = config/sensord-rx_51.conf \
config/sensord-oaktrail.conf \
config/sensord-exopc.conf \
@@ -46,12 +49,14 @@
config/sensord-u8500.conf \
SENSORFWCONFIGFILES.path = /etc/sensorfw
+ INSTALLS += SENSORFWCONFIGFILES
+ }
SENSORCONFIG_SETUP.files = config/sensord-daemon-conf-setup
SENSORCONFIG_SETUP.path = /usr/bin
- INSTALLS += SENSORFWCONFIGFILES SENSORCONFIG_SETUP
- }
+ INSTALLS += SENSORCONFIG_SETUP
+}
contains(CONFIG,hybris) {
@@ -96,7 +101,11 @@
SENSORDCONFIGFILES.files += config/20-sensors-default.conf
SENSORDCONFIGFILES.path = /etc/sensorfw/sensord.conf.d
INSTALLS += SENSORDCONFIGFILES
+}
+contains(CONFIG,systemdunit) {
+ # Install service files through packaging to take into account
+ # units file location unless called with CONFIG+=systemdunit
SENSORSYSTEMD.files = rpm/sensorfwd.service
SENSORSYSTEMD.path = /lib/systemd/system
INSTALLS += SENSORSYSTEMD
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/tests/contextfw/als/testals.py
^
|
@@ -2,11 +2,6 @@
##
## Copyright (C) 2009-2010 Nokia Corporation
##
-## Contact: Jean-Luc Lamadon <jean-luc.lamadon@nokia.com>
-## Matias Muhonen <ext-matias.muhonen@nokia.com>
-## Tapio Rantala <ext-tapio.rantala@nokia.com>
-## Lihan Guo <ext-lihan.4.guo@nokia.com>
-##
## This file is part of Sensord.
##
## Sensord is free software; you can redistribute it and/or modify
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/tests/contextfw/orientation/testorientation-manual.sh
^
|
@@ -5,9 +5,6 @@
## Test different accelerometer input values manually.
## As a result, screen should rotate.
##
-## Contact: Matias Muhonen <ext-matias.muhonen@nokia.com>
-## Contact: Tapio Rantala <ext-tapio.rantala@nokia.com>
-##
INPUT_DEV_NUM=`ls /sys/class/input/event?/device/name | xargs grep -i accelerometer | cut -c23`
INPUT_DEV=/dev/input/event${INPUT_DEV_NUM}
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/tests/contextfw/orientation/testorientation.py
^
|
@@ -2,11 +2,6 @@
##
## Copyright (C) 2009-2010 Nokia Corporation
##
-## Contact: Jean-Luc Lamadon <jean-luc.lamadon@nokia.com>
-## Matias Muhonen <ext-matias.muhonen@nokia.com>
-## Tapio Rantala <ext-tapio.rantala@nokia.com>
-## Lihan Guo <ext-lihan.4.guo@nokia.com>
-##
## This file is part of Sensord.
##
## Sensord is free software; you can redistribute it and/or modify
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/tests/contextfw/stationary/teststationary.py
^
|
@@ -2,8 +2,6 @@
##
## Copyright (C) 2009-2010 Nokia Corporation
##
-## Contact: Lihan Guo <ext-lihan.4.guo@nokia.com>
-##
## This file is part of Sensord.
##
## Sensord is free software; you can redistribute it and/or modify
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/tests/deadclient/sensord-deadclienttest.py
^
|
@@ -1,9 +1,7 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
##
## Copyright (C) 2009-2010 Nokia Corporation
##
-## Contact: Ustun Ergenoglu <ext-ustun.ergenoglu@nokia.com>
-##
## This file is part of Sensord.
##
## Sensord is free software; you can redistribute it and/or modify
|
[-]
[+]
|
Changed |
_service:tar_git:hybris-libsensorfw-qt5-hal-0.12.3.tar.bz2/tests/testutils/sensordiverter.sh
^
|
@@ -2,8 +2,6 @@
##
## Copyright (C) 2009-2010 Nokia Corporation
##
-## Contact: Tapio Rantala <ext-tapio.rantala@nokia.com>
-##
## This file is part of Sensord.
##
## Sensord is free software; you can redistribute it and/or modify
|
[-]
[+]
|
Changed |
_service:tar_git:sensorfw-qt5-hybris.inc
^
|
@@ -1,7 +1,6 @@
Summary: Sensor Framework Qt5
-Group: System/Sensor Framework
License: LGPLv2+
-URL: http://gitorious.org/sensorfw
+URL: https://git.sailfishos.org/mer-core/sensorfw
Source0: %{name}-%{version}.tar.bz2
# Eventhough this is not really needed we have this here
# as this is added to packaging dir by tar_git.
@@ -23,7 +22,6 @@
%package devel
Summary: Sensor framework daemon libraries development headers
-Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: qt5-qtcore-devel
Requires: qt5-qtdbus-devel
@@ -33,20 +31,17 @@
Development headers for sensor framework daemon and libraries.
%prep
-%setup -q -n %{name}-%{version}
+%autosetup -n %{name}-%{version}
%build
unset LD_AS_NEEDED
export LD_RUN_PATH=%{_libdir}/sensord-qt5/
-export QT_SELECT=5
%qmake5 CONFIG+=hybris %{qmake_extra_parameters} PC_VERSION=`echo %{version} | sed 's/+.*//'`
-make %{?_smp_mflags}
+%make_build
%install
-rm -rf %{buildroot}
-export QT_SELECT=5
%qmake5_install
%post
@@ -57,6 +52,7 @@
%files
%defattr(-,root,root,-)
+%license COPYING
%{_libdir}/libhybrissensorfw*.so.*
%{_libdir}/libhybrissensorfw*.so
%{_libdir}/sensord-qt5/*.so
|