Skip to content

Commit

Permalink
Merge tag '0.12.4' into tama
Browse files Browse the repository at this point in the history
[sensorfw] Remove /usr/include/filters from pkgconfig file as it is not installed. JB#47730
  • Loading branch information
rinigus committed Nov 28, 2021
2 parents 7b014a3 + 53f7bf5 commit 7d78aa5
Show file tree
Hide file tree
Showing 28 changed files with 69 additions and 75 deletions.
8 changes: 0 additions & 8 deletions adaptors/hybrisaccelerometer/hybrisaccelerometeradaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,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)
{
Expand Down Expand Up @@ -77,9 +75,3 @@ void HybrisAccelerometerAdaptor::processSample(const sensors_event_t& data)
buffer->commit();
buffer->wakeUpReaders();
}

//void HybrisAccelerometerAdaptor::init()
//{
//// introduceAvailableDataRange(DataRange(-HybrisAdaptor::maxRange, HybrisAdaptor::maxRange , 1));
//// introduceAvailableInterval(DataRange(10, 586, 0));
//}
1 change: 0 additions & 1 deletion adaptors/hybrisaccelerometer/hybrisaccelerometeradaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class HybrisAccelerometerAdaptor : public HybrisAdaptor

protected:
void processSample(const sensors_event_t& data);
// void init();

private:
DeviceAdaptorRingBuffer<AccelerationData>* buffer;
Expand Down
4 changes: 0 additions & 4 deletions adaptors/hybrisalsadaptor/hybrisalsadaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,3 @@ void HybrisAlsAdaptor::processSample(const sensors_event_t& data)
buffer->commit();
buffer->wakeUpReaders();
}

void HybrisAlsAdaptor::init()
{
}
1 change: 0 additions & 1 deletion adaptors/hybrisalsadaptor/hybrisalsadaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class HybrisAlsAdaptor : public HybrisAdaptor

protected:
void processSample(const sensors_event_t& data);
void init();

private:
DeviceAdaptorRingBuffer<TimedUnsigned>* buffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
#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).
Expand Down Expand Up @@ -112,7 +110,3 @@ void HybrisGeoRotationAdaptor::processSample(const sensors_event_t& data)
m_buffer->commit();
m_buffer->wakeUpReaders();
}

void HybrisGeoRotationAdaptor::init()
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class HybrisGeoRotationAdaptor : public HybrisAdaptor

protected:
void processSample(const sensors_event_t& data);
void init();

private:
DeviceAdaptorRingBuffer<CompassData>* m_buffer;
Expand Down
9 changes: 0 additions & 9 deletions adaptors/hybrisgyroscopeadaptor/hybrisgyroscopeadaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,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)
{
Expand Down Expand Up @@ -83,9 +80,3 @@ void HybrisGyroscopeAdaptor::processSample(const sensors_event_t& data)
buffer->commit();
buffer->wakeUpReaders();
}


void HybrisGyroscopeAdaptor::init()
{

}
1 change: 0 additions & 1 deletion adaptors/hybrisgyroscopeadaptor/hybrisgyroscopeadaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class HybrisGyroscopeAdaptor : public HybrisAdaptor

protected:
void processSample(const sensors_event_t& data);
void init();

private:
DeviceAdaptorRingBuffer<TimedXyzData>* buffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,3 @@ void HybrisMagnetometerAdaptor::processSample(const sensors_event_t& data)
buffer->commit();
buffer->wakeUpReaders();
}

void HybrisMagnetometerAdaptor::init()
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class HybrisMagnetometerAdaptor : public HybrisAdaptor

protected:
void processSample(const sensors_event_t& data);
void init();

private:
DeviceAdaptorRingBuffer<CalibratedMagneticFieldData>* buffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,3 @@ void HybrisOrientationAdaptor::processSample(const sensors_event_t& data)
buffer->commit();
buffer->wakeUpReaders();
}

void HybrisOrientationAdaptor::init()
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class HybrisOrientationAdaptor : public HybrisAdaptor

protected:
void processSample(const sensors_event_t& data);
void init();

private:
DeviceAdaptorRingBuffer<CompassData>* buffer;
Expand Down
4 changes: 0 additions & 4 deletions adaptors/hybrispressureadaptor/hybrispressureadaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,3 @@ void HybrisPressureAdaptor::processSample(const sensors_event_t& data)
buffer->commit();
buffer->wakeUpReaders();
}

void HybrisPressureAdaptor::init()
{
}
1 change: 0 additions & 1 deletion adaptors/hybrispressureadaptor/hybrispressureadaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class HybrisPressureAdaptor : public HybrisAdaptor

protected:
void processSample(const sensors_event_t& data);
void init();

private:
DeviceAdaptorRingBuffer<TimedUnsigned>* buffer;
Expand Down
4 changes: 0 additions & 4 deletions adaptors/hybrisproximityadaptor/hybrisproximityadaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,3 @@ void HybrisProximityAdaptor::processSample(const sensors_event_t& data)
buffer->commit();
buffer->wakeUpReaders();
}

void HybrisProximityAdaptor::init()
{
}
1 change: 0 additions & 1 deletion adaptors/hybrisproximityadaptor/hybrisproximityadaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class HybrisProximityAdaptor : public HybrisAdaptor

protected:
void processSample(const sensors_event_t& data);
void init();

private:
DeviceAdaptorRingBuffer<ProximityData>* buffer;
Expand Down
4 changes: 0 additions & 4 deletions adaptors/hybrisrotationadaptor/hybrisrotationadaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,3 @@ void HybrisRotationAdaptor::processSample(const sensors_event_t& data)
m_buffer->commit();
m_buffer->wakeUpReaders();
}

void HybrisRotationAdaptor::init()
{
}
1 change: 0 additions & 1 deletion adaptors/hybrisrotationadaptor/hybrisrotationadaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class HybrisRotationAdaptor : public HybrisAdaptor

protected:
void processSample(const sensors_event_t& data);
void init();

private:
DeviceAdaptorRingBuffer<CompassData>* m_buffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,3 @@ void HybrisStepCounterAdaptor::processSample(const sensors_event_t& data)
buffer->commit();
buffer->wakeUpReaders();
}

void HybrisStepCounterAdaptor::init()
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class HybrisStepCounterAdaptor : public HybrisAdaptor

protected:
void processSample(const sensors_event_t& data);
void init();

private:
DeviceAdaptorRingBuffer<TimedUnsigned>* buffer;
Expand Down
35 changes: 33 additions & 2 deletions core/hybrisadaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,37 @@ void HybrisManager::registerAdaptor(HybrisAdaptor *adaptor)
}
}

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;
Expand All @@ -627,7 +658,7 @@ float HybrisManager::getMaxRange(int handle) const
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);
}
Expand All @@ -643,7 +674,7 @@ float HybrisManager::getResolution(int handle) const
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);
}
Expand Down
5 changes: 5 additions & 0 deletions core/hybrisadaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@
#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;
Expand Down Expand Up @@ -221,6 +225,7 @@ class HybrisManager : public QObject
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);
};
Expand Down
26 changes: 20 additions & 6 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
sensorfw-qt5 (0.12.4) unstable; urgency=medium

* [sensorfw] Remove /usr/include/filters from pkgconfig file as it is not installed

-- Matti Lehtimäki <[email protected]> Thu, 26 Aug 2021 16:52:00 +0300

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 <[email protected]> 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
* [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 <[email protected]> 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
* [hybrisadaptor] Fix building rotation vector adaptors with old Android versions

-- Matti Lehtimäki <[email protected]> Wed, 09 Sep 2020 16:14:31 +0300

sensorfw-qt5 (0.12.0) unstable; urgency=medium

[hybrisadaptor] Use of hybris rotation vectors for compass
* [hybrisadaptor] Use of hybris rotation vectors for compass

-- Simo Piiroinen <[email protected]> Wed, 02 Sep 2020 15:12:31 +0300

Expand Down
5 changes: 5 additions & 0 deletions qt-api/abstractsensor_i.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ QDBusReply<void> AbstractSensorChannelInterface::start(int sessionId)
}
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;
Expand Down
2 changes: 1 addition & 1 deletion rpm/sensorfw-qt5-binder.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: hybris-libsensorfw-qt5-binder
Version: 0.12.2
Version: 0.12.4
Release: 0
Provides: hybris-libsensorfw-qt5 = %{version}-%{release}
Conflicts: hybris-libsensorfw-qt5 <= 0.10.9
Expand Down
2 changes: 1 addition & 1 deletion rpm/sensorfw-qt5-hybris.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: hybris-libsensorfw-qt5-hal
Version: 0.12.2
Version: 0.12.4
Release: 0
Provides: hybris-libsensorfw-qt5 = %{version}-%{release}
Conflicts: hybris-libsensorfw-qt5 <= 0.10.9
Expand Down
4 changes: 2 additions & 2 deletions rpm/sensorfw-qt5.spec
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Name: sensorfw-qt5
Summary: Sensor Framework Qt5
Version: 0.12.2
Version: 0.12.4
Release: 0
License: LGPLv2+
URL: https://git.sailfishos.org/mer-core/sensorfw
URL: https://github.com/sailfishos/sensorfw
Source0: %{name}-%{version}.tar.bz2
Source1: sensorfwd.service
Source2: sensorfw-qt5-hybris.inc
Expand Down
4 changes: 2 additions & 2 deletions sensord-qt5.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ libdir=${prefix}/@LIB@

Name: Sensorfw-qt5
Description: Sensord for Qt 5
Version: 0.12.2
Version: 0.12.4
Requires:
Libs: -L${libdir} -lsensorclient-qt5 -lsensordatatypes-qt5
Cflags: -I${includedir} -I${includedir}/datatypes -I${includedir}/filters
Cflags: -I${includedir} -I${includedir}/datatypes

0 comments on commit 7d78aa5

Please sign in to comment.