Skip to content

Commit

Permalink
Removed libfilters
Browse files Browse the repository at this point in the history
  • Loading branch information
Timo Rongas committed Sep 6, 2010
1 parent b6b149f commit 98cf0f9
Show file tree
Hide file tree
Showing 68 changed files with 634 additions and 466 deletions.
2 changes: 1 addition & 1 deletion adaptors/accelerometeradaptor/accelerometeradaptor.cpp
Expand Up @@ -32,7 +32,7 @@
#include <fcntl.h>
#include <linux/input.h>

#include "filters/utils.h"
#include "datatypes/utils.h"

#define DEVICE_MATCH_STRING "accelerometer"

Expand Down
2 changes: 1 addition & 1 deletion adaptors/accelerometeradaptor/accelerometeradaptor.h
Expand Up @@ -29,7 +29,7 @@

#include "inputdevadaptor.h"
#include "sensord/deviceadaptorringbuffer.h"
#include "filters/orientationdata.h"
#include "datatypes/orientationdata.h"
#include <QTime>

/**
Expand Down
2 changes: 1 addition & 1 deletion adaptors/alsadaptor/alsadaptor.cpp
Expand Up @@ -30,7 +30,7 @@
#include "config.h"
#include "alsadaptor.h"
#include <errno.h>
#include "filters/utils.h"
#include "datatypes/utils.h"
#include <linux/types.h>

struct bh1770glc_als {
Expand Down
2 changes: 1 addition & 1 deletion adaptors/alsadaptor/alsadaptor.h
Expand Up @@ -29,7 +29,7 @@

#include "sysfsadaptor.h"
#include "sensord/deviceadaptorringbuffer.h"
#include "filters/timedunsigned.h"
#include "datatypes/timedunsigned.h"
#include <QTime>

/**
Expand Down
2 changes: 1 addition & 1 deletion adaptors/magnetometeradaptor/magnetometeradaptor.cpp
Expand Up @@ -30,7 +30,7 @@
#include <errno.h>
#include <fcntl.h>
#include <linux/input.h>
#include "filters/utils.h"
#include "datatypes/utils.h"
#include <QFile>

/* Device name: /dev/ak8974n, where n is a running number (0 in case on single chip configuration) */
Expand Down
2 changes: 1 addition & 1 deletion adaptors/magnetometeradaptor/magnetometeradaptor.h
Expand Up @@ -29,7 +29,7 @@

#include "sensord/sysfsadaptor.h"
#include "sensord/deviceadaptorringbuffer.h"
#include "filters/genericdata.h"
#include "datatypes/genericdata.h"
#include <QTime>
#include <QString>

Expand Down
2 changes: 1 addition & 1 deletion adaptors/mrstaccelerometer/mrstaccelerometeradaptor.cpp
Expand Up @@ -5,7 +5,7 @@
#include "config.h"
#include "mrstaccelerometeradaptor.h"
#include "logging.h"
#include "filters/utils.h"
#include "datatypes/utils.h"

MRSTAccelAdaptor::MRSTAccelAdaptor (const QString& id) :
SysfsAdaptor (id, SysfsAdaptor::IntervalMode)
Expand Down
2 changes: 1 addition & 1 deletion adaptors/mrstaccelerometer/mrstaccelerometeradaptor.h
Expand Up @@ -6,7 +6,7 @@
#include <linux/input.h>
#include <sensord/filterproperty.h>
#include "sensord/deviceadaptorringbuffer.h"
#include "filters/orientationdata.h"
#include "datatypes/orientationdata.h"
#include <QTime>

class MRSTAccelAdaptor : public SysfsAdaptor {
Expand Down
2 changes: 1 addition & 1 deletion adaptors/proximityadaptor/proximityadaptor.cpp
Expand Up @@ -26,7 +26,7 @@
*/
#include "proximityadaptor.h"
#include <errno.h>
#include "filters/utils.h"
#include "datatypes/utils.h"
#include "sensord/logging.h"
#include "sensord/config.h"
#include <linux/types.h>
Expand Down
2 changes: 1 addition & 1 deletion adaptors/proximityadaptor/proximityadaptor.h
Expand Up @@ -29,7 +29,7 @@

#include "sysfsadaptor.h"
#include "sensord/deviceadaptorringbuffer.h"
#include "filters/timedunsigned.h"
#include "datatypes/timedunsigned.h"

/**
* @brief Adaptor for proximity sensor.
Expand Down
2 changes: 1 addition & 1 deletion adaptors/tapadaptor/tapadaptor.cpp
Expand Up @@ -30,7 +30,7 @@

#include "tapadaptor.h"
#include "config.h"
#include "filters/utils.h"
#include "datatypes/utils.h"

#include <errno.h>

Expand Down
2 changes: 1 addition & 1 deletion adaptors/tapadaptor/tapadaptor.h
Expand Up @@ -29,7 +29,7 @@

#include "inputdevadaptor.h"
#include "sensord/deviceadaptorringbuffer.h"
#include "filters/tapdata.h"
#include "datatypes/tapdata.h"

/**
* @brief Adaptor class for detecting device tap events.
Expand Down
2 changes: 1 addition & 1 deletion adaptors/touchadaptor/touchadaptor.cpp
Expand Up @@ -26,7 +26,7 @@

#include <QtDebug>
#include "touchadaptor.h"
#include "filters/utils.h"
#include "datatypes/utils.h"
#include <errno.h>
#include <fcntl.h>
#include <linux/input.h>
Expand Down
2 changes: 1 addition & 1 deletion datatypes/compass.h
Expand Up @@ -29,7 +29,7 @@
#include <QtDebug>
#include <QDBusArgument>

#include <filters/orientationdata.h>
#include <datatypes/orientationdata.h>

/**
* @brief Compass is a wrapper class for #CompassData.
Expand Down
20 changes: 17 additions & 3 deletions datatypes/datatypes.pro
Expand Up @@ -15,15 +15,29 @@ HEADERS += xyz.h \
unsigned.h \
magneticfield.h \
compass.h \
datarange.h
datarange.h \
utils.h \
timedunsigned.h \
genericdata.h \
orientationdata.h


SOURCES += xyz.cpp \
orientation.cpp \
unsigned.cpp \
compass.cpp
compass.cpp \
utils.cpp


LIBS += -lrt


internal {
HEADERS += tap.h
HEADERS += tap.h \
posedata.h \
tapdata.h \
touchdata.h

SOURCES += tap.cpp
}

Expand Down
58 changes: 58 additions & 0 deletions datatypes/genericdata.h
@@ -0,0 +1,58 @@
/**
@file genericdata.h
@brief Basic datatypes for filters
<p>
Copyright (C) 2009-2010 Nokia Corporation
@author Joep van Gassel <joep.van.gassel@nokia.com>
@author Timo Rongas <ext-timo.2.rongas@nokia.com>
This file is part of Sensord.
Sensord is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License
version 2.1 as published by the Free Software Foundation.
Sensord 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with Sensord. If not, see <http://www.gnu.org/licenses/>.
</p>
*/

#ifndef GENERICDATA_H
#define GENERICDATA_H

#include <QMetaType>

/**
* A base class for measurements that contain timestamp.
*/
class TimedData {
public:
TimedData(quint64 timestamp) : timestamp_(timestamp) {}

quint64 timestamp_; /**< Timestamp value */
};

/**
* Class for vector type measurement data (timestamp, x, y, z). Can easily be
* extended.
*/
class TimedXyzData : public TimedData
{
public:
TimedXyzData() : TimedData(0), x_(0), y_(0), z_(0) {}
TimedXyzData(quint64 timestamp, int x, int y, int z) : TimedData(timestamp), x_(x), y_(y), z_(z) {}

int x_; /**< X value */
int y_; /**< Y value */
int z_; /**< Z value */
};
Q_DECLARE_METATYPE ( TimedXyzData )

#endif // GENERICDATA_H
2 changes: 1 addition & 1 deletion datatypes/magneticfield.h
Expand Up @@ -31,7 +31,7 @@
#include <QtDebug>
#include <QDBusArgument>

#include <filters/orientationdata.h>
#include <datatypes/orientationdata.h>

/**
*/
Expand Down
2 changes: 1 addition & 1 deletion datatypes/orientation.h
Expand Up @@ -30,7 +30,7 @@
#include <QtDebug>
#include <QDBusArgument>

#include <filters/orientationdata.h>
#include <datatypes/orientationdata.h>

// TODO: derive from AbstractSensorData
class Orientation : public QObject //AbstractSensorData
Expand Down
96 changes: 96 additions & 0 deletions datatypes/orientationdata.h
@@ -0,0 +1,96 @@
/**
@file orientationdata.h
@brief Datatypes for different filters
<p>
Copyright (C) 2009-2010 Nokia Corporation
@author Joep van Gassel <joep.van.gassel@nokia.com>
@author Timo Rongas <ext-timo.2.rongas@nokia.com>
@author Ustun Ergenoglu <ext-ustun.ergenoglu@nokia.com>
This file is part of Sensord.
Sensord is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License
version 2.1 as published by the Free Software Foundation.
Sensord 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with Sensord. If not, see <http://www.gnu.org/licenses/>.
</p>
@todo Split datatypes into separate files or rename this to something more
generic.<br>
Drop out unnecessary typedefs.
*/

#ifndef ORIENTATIONDATA_H
#define ORIENTATIONDATA_H

#include <QMetaType>

#include <datatypes/genericdata.h>

typedef TimedXyzData AccelerationData;
typedef TimedXyzData MagneticFieldData;
typedef TimedXyzData AngularVelocityData;

typedef TimedXyzData OrientationData;
typedef TimedXyzData MagnetometerData;

/**
* @brief Container for calibrated magnetic field measurements.
*
*/
class CalibratedMagneticFieldData : public TimedData {
public:
CalibratedMagneticFieldData() : TimedData(0),
x_(0), y_(0), z_(0),
rx_(0), ry_(0), rz_(0),
level_(0) {}

CalibratedMagneticFieldData(quint64 timestamp, int x, int y, int z, int rx, int ry, int rz, int level) :
TimedData(timestamp),
x_(x), y_(y), z_(z),
rx_(rx), ry_(ry), rz_(rz),
level_(level) {}

CalibratedMagneticFieldData(TimedXyzData magData, int level) :
TimedData(magData.timestamp_),
x_(0), y_(0), z_(0),
rx_(magData.x_), ry_(magData.y_), rz_(magData.z_),
level_(level) {}

int x_;
int y_;
int z_;
int rx_;
int ry_;
int rz_;

int level_; /**< Magnetometer calibration level */
};

/**
* @brief Container for Compass measurements.
*
* Holds measurement timestamp, compass direction and magnetometer calibration
* level.
*/
class CompassData : public TimedData {
public:
CompassData() : TimedData(0), degrees_(0), level_(0) {}

CompassData(quint64 timestamp, int degrees, int level) :
TimedData(timestamp), degrees_(degrees), level_(level) {}

int degrees_; /**< Angle to north */
int level_; /**< Magnetometer calibration level */
};

#endif // ORIENTATIONDATA_H

0 comments on commit 98cf0f9

Please sign in to comment.