Skip to content

Commit

Permalink
Refactoring:
Browse files Browse the repository at this point in the history
 - Fixed doxygen errors
 - filters/* content not copied to libsensord-dev anymore.
 - GyroscopeSensorChannelInterface and GyroscopeSensorChannel cleaned.
  • Loading branch information
Antti Virtanen committed Dec 10, 2010
1 parent 8a48c93 commit ac17c2c
Show file tree
Hide file tree
Showing 25 changed files with 60 additions and 94 deletions.
2 changes: 1 addition & 1 deletion adaptors/alsadaptor-sysfs/alsadaptor-sysfsplugin.h
@@ -1,5 +1,5 @@
/**
@file alsadaptorplugin-sysfs.h
@file alsadaptor-sysfsplugin.h
@brief Plugin for ALSAdaptorSysfs
<p>
Expand Down
@@ -1,5 +1,5 @@
/**
@file proximityadaptor-asciiplugin.cpp
@file proximityadaptor-asciiplugin.h
@brief plugin for ProximityAdaptorAscii
<p>
Expand Down
3 changes: 1 addition & 2 deletions adaptors/touchadaptor/touchadaptor.h
Expand Up @@ -40,7 +40,7 @@
* Provides input data from touchscreen input device.
*
* @todo <ul><li>Kernel update will change all the traffic into one handle,
* separated by sync messages. Change accordingly.</li>
* separated by sync messages. Change accordingly.</li></ul>
*/
class TouchAdaptor : public InputDevAdaptor
{
Expand Down Expand Up @@ -118,4 +118,3 @@ class TouchAdaptor : public InputDevAdaptor
};

#endif

6 changes: 3 additions & 3 deletions c-api/sensorfw-c.h
Expand Up @@ -46,7 +46,7 @@ typedef struct {
} sensorfw_interval_t;

/**
* @brier Structure containing data range information for sensor.
* @brief Structure containing data range information for sensor.
*/
typedef struct {
int min; ///< Minimum value
Expand Down Expand Up @@ -122,7 +122,7 @@ int sensorfw_get_interval(int sessionId);
* @brief Sets the sample interval for sensor.
*
* See sensorfw_get_interval.
*
*
* @param sessionId Session ID to run this request on.
* @param interval Milliseconds to wait between measurements.
* @return \c true on success, \c false on failure or invalid session ID.
Expand Down Expand Up @@ -167,7 +167,7 @@ bool sensorfw_get_description(int sessionId, char** description);
* @brief Registers a callback function to handle sensor output.
*
* @todo Description of callback requirements.
*
*
* @param sessionId Session ID to run this request on.
* @param cb_func Pointer to function to use as callback.
* @return \c true on success, \c false on failure or invalid session ID.
Expand Down
2 changes: 1 addition & 1 deletion chains/accelerometerchain/accelerometerchain.h
Expand Up @@ -41,7 +41,7 @@ class FilterBase;
*
* <b>Output buffers:</b>
* <ul><li>\em accelerometer</li></ul>
*
*
* For direct raw data (no coordinate correction) use #AccelerometerAdaptor.
*/
class AccelerometerChain : public AbstractChain
Expand Down
1 change: 0 additions & 1 deletion debian/api
Expand Up @@ -6,7 +6,6 @@ libs-pkg: sensord
dev-pkg: libsensord-dev
headers:
/usr/include/sensord/datatypes/*
/usr/include/sensord/filters/*
/usr/include/sensord/*_i.h
libs:
/usr/lib/libsensorclient.so.1.0.0
Expand Down
1 change: 0 additions & 1 deletion debian/libsensord-dev.install
@@ -1,5 +1,4 @@
/usr/include/sensord/*.h
/usr/include/sensord/datatypes/*.h
/usr/include/sensord/filters/*.h
/usr/lib/pkgconfig/*.pc
/usr/share/qt4/mkspecs/features/*.prf
2 changes: 1 addition & 1 deletion qt-api/accelerometersensor_i.cpp
Expand Up @@ -69,7 +69,7 @@ void AccelerometerSensorChannelInterface::dataReceived()
QVector<AccelerationData> values;
while (read<AccelerationData>(values))
{
if(frameAvailableConnected || values.size() == 1)
if(!frameAvailableConnected || values.size() == 1)
{
foreach(AccelerationData data, values)
emit dataAvailable(XYZ(data));
Expand Down
4 changes: 2 additions & 2 deletions qt-api/accelerometersensor_i.h
Expand Up @@ -63,7 +63,7 @@ class AccelerometerSensorChannelInterface: public AbstractSensorChannelInterface
/**
* Constructor.
* @param path path.
* @param sessionid session id.
* @param sessionId session id.
*/
AccelerometerSensorChannelInterface(const QString& path, int sessionId);

Expand Down Expand Up @@ -101,7 +101,7 @@ public Q_SLOTS: // METHODS
* Sent when new measurement frame has become available.
* If app doesn't connect to this signal content of frames
* will be sent through dataAvailable signal.
* @param data New measurement frame.
* @param frame New measurement frame.
*/
void frameAvailable(const QVector<XYZ>& frame);
};
Expand Down
2 changes: 1 addition & 1 deletion qt-api/compasssensor_i.h
Expand Up @@ -85,7 +85,7 @@ public Q_SLOTS: // METHODS

/**
* Sent when compass direction or calibration level has changed.
* @param level Current compass measurement.
* @param value Current compass measurement.
*/
void dataAvailable(const Compass& value);
};
Expand Down
49 changes: 27 additions & 22 deletions qt-api/gyroscopesensor_i.cpp
Expand Up @@ -7,6 +7,7 @@
@author Timo Rongas <ext-timo.2.rongas@nokia.com>
@author Samuli Piippo <ext-samuli.1.piippo@nokia.com>
@author Antti Virtanen <antti.i.virtanen@nokia.com>
This file is part of Sensord.
Expand All @@ -22,15 +23,23 @@
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>
*/
*/

#include "sensormanagerinterface.h"
#include "gyroscopesensor_i.h"
#include <datatypes/orientationdata.h>

const char* GyroscopeSensorChannelInterface::staticInterfaceName = "local.GyroscopeSensor";

QDBusAbstractInterface* GyroscopeSensorChannelInterface::factoryMethod(const QString& id, int sessionId)
{
// ToDo: see which arguments can be made explicit
return new GyroscopeSensorChannelInterface(OBJECT_PATH + "/" + id, sessionId);
}

GyroscopeSensorChannelInterface::GyroscopeSensorChannelInterface(const QString &path, int sessionId)
: AbstractSensorChannelInterface(path, GyroscopeSensorChannelInterface::staticInterfaceName(), sessionId),
frameAvailableConnected(false)
: AbstractSensorChannelInterface(path, GyroscopeSensorChannelInterface::staticInterfaceName, sessionId),
frameAvailableConnected(false)
{
}

Expand All @@ -57,32 +66,25 @@ GyroscopeSensorChannelInterface* GyroscopeSensorChannelInterface::controlInterfa
return dynamic_cast<GyroscopeSensorChannelInterface*>(sm.controlInterface(id));
}



void GyroscopeSensorChannelInterface::dataReceived()
{
QVector<AngularVelocityData> values;
while (read<AngularVelocityData>(values))
{
if(values.size() == 1)
emit dataAvailable(XYZ(values.back()));
if(!frameAvailableConnected || values.size() == 1)
{
foreach(AngularVelocityData data, values)
emit dataAvailable(XYZ(data));
}
else
{
if(frameAvailableConnected)
{
QVector<XYZ> realValues;
realValues.reserve(values.size());
foreach(AngularVelocityData data, values)
realValues.push_back(XYZ(data));
emit frameAvailable(realValues);
values.clear();
}
else
{
foreach(AngularVelocityData data, values)
emit dataAvailable(XYZ(data));
}
QVector<XYZ> realValues;
realValues.reserve(values.size());
foreach(AngularVelocityData data, values)
realValues.push_back(XYZ(data));
emit frameAvailable(realValues);
}
values.clear();
}
}

Expand All @@ -100,4 +102,7 @@ QDBusReply<void> GyroscopeSensorChannelInterface::reset()
return callWithArgumentList(QDBus::Block, QLatin1String("reset"), argumentList);
}


XYZ GyroscopeSensorChannelInterface::get() const
{
return qvariant_cast<XYZ>(internalPropGet("value"));
}
27 changes: 9 additions & 18 deletions qt-api/gyroscopesensor_i.h
Expand Up @@ -7,6 +7,7 @@
@author Timo Rongas <ext-timo.2.rongas@nokia.com>
@author Samuli Piippo <ext-samuli.1.piippo@nokia.com>
@author Antti Virtanen <antti.i.virtanen@nokia.com>
This file is part of Sensord.
Expand Down Expand Up @@ -43,33 +44,27 @@
class GyroscopeSensorChannelInterface: public AbstractSensorChannelInterface
{
Q_OBJECT;
Q_DISABLE_COPY(GyroscopeSensorChannelInterface)
Q_PROPERTY(XYZ value READ get)

public:
/**
* Get name of the D-Bus interface for this class.
* @return Name of the interface.
* Name of the D-Bus interface for this class.
*/
static inline const char *staticInterfaceName()
{ return "local.GyroscopeSensor"; }
static const char* staticInterfaceName;

/**
* Get an instance of the class.
* @return Pointer to new instance of the class.
*/
static QDBusAbstractInterface* factoryMethod(const QString& id, int sessionId)
{
// ToDo: see which arguments can be made explicit
return new GyroscopeSensorChannelInterface(OBJECT_PATH + "/" + id, sessionId);
}
static QDBusAbstractInterface* factoryMethod(const QString& id, int sessionId);

Q_PROPERTY(XYZ value READ get);
inline XYZ get() const { return qvariant_cast<XYZ>(internalPropGet("value")); }
XYZ get() const;

public:
/**
* Constructor.
* @param path path.
* @param sessionid session id.
* @param sessionId session id.
*/
GyroscopeSensorChannelInterface(const QString &path, int sessionId);

Expand All @@ -90,29 +85,25 @@ class GyroscopeSensorChannelInterface: public AbstractSensorChannelInterface
protected:
virtual void connectNotify(const char* signal);


private:
bool frameAvailableConnected;


public Q_SLOTS: // METHODS
void dataReceived();
QDBusReply<void> reset();


Q_SIGNALS: // SIGNALS
/**
* Sent when new measurement data has become available.
* @param data New measurement data.
*/
void dataAvailable(const XYZ& data);


/**
* Sent when new measurement frame has become available.
* If app doesn't connect to this signal content of frames
* will be sent through dataAvailable signal.
* @param data New measurement frame.
* @param frame New measurement frame.
*/
void frameAvailable(const QVector<XYZ>& frame);

Expand Down
2 changes: 1 addition & 1 deletion qt-api/magnetometersensor_i.h
Expand Up @@ -93,7 +93,7 @@ public Q_SLOTS: // METHODS
* Sent when new measurement frame has become available.
* If app doesn't connect to this signal content of frames
* will be sent through dataAvailable signal.
* @param data New measurement frame.
* @param frame New measurement frame.
*/
void frameAvailable(const QVector<MagneticField>& frame);
};
Expand Down
2 changes: 1 addition & 1 deletion qt-api/proximitysensor_i.h
Expand Up @@ -64,7 +64,7 @@ class ProximitySensorChannelInterface: public AbstractSensorChannelInterface
/**
* Constructor.
* @param path path.
* @param sessionid session id.
* @param sessionId session id.
*/
ProximitySensorChannelInterface(const QString& path, int sessionId);

Expand Down
2 changes: 1 addition & 1 deletion qt-api/rotationsensor_i.cpp
Expand Up @@ -69,7 +69,7 @@ void RotationSensorChannelInterface::dataReceived()
QVector<TimedXyzData> values;
while (read<TimedXyzData>(values))
{
if(frameAvailableConnected || values.size() == 1)
if(!frameAvailableConnected || values.size() == 1)
{
foreach(TimedXyzData data, values)
emit dataAvailable(XYZ(data));
Expand Down
2 changes: 1 addition & 1 deletion qt-api/rotationsensor_i.h
Expand Up @@ -92,7 +92,7 @@ public Q_SLOTS: // METHODS
* Sent when new measurement frame has become available.
* If app doesn't connect to this signal content of frames
* will be sent through dataAvailable signal.
* @param data New measurement frame.
* @param frame New measurement frame.
*/
void frameAvailable(const QVector<XYZ>& frame);
};
Expand Down
2 changes: 1 addition & 1 deletion qt-api/socketreader.h
Expand Up @@ -77,7 +77,7 @@ class SocketReader : public QObject
* written in single operation are available for immediate reading
* with a single operation.
*
* @param unitSize Number of bytes to read.
* @param size Number of bytes to read.
* @param buffer Location for storing the data.
* @return \c true if any bytes were read, \c false otherwise.
*/
Expand Down
4 changes: 2 additions & 2 deletions qt-api/tapsensor_i.h
Expand Up @@ -79,9 +79,9 @@ private Q_SLOTS: // METHODS
Q_SIGNALS: // SIGNALS
/**
* Sent when new tap event has occurred.
* @param The tap event.
* @param data The tap event.
*/
void dataAvailable(const Tap&);
void dataAvailable(const Tap& data);

public:

Expand Down
4 changes: 2 additions & 2 deletions sensord/filterproperty.h
Expand Up @@ -53,9 +53,9 @@ class PropertyTracker
/**
* Run when a property value has been set in a FilterProperty this tracker
* is monitoring.
* @param Pointer to the calling FilterPropertyBase.
* @param property Pointer to the calling FilterPropertyBase.
*/
virtual void trackWrite(FilterPropertyBase*) {}
virtual void trackWrite(FilterPropertyBase* property) {}
};


Expand Down
2 changes: 0 additions & 2 deletions sensord/inputdevadaptor.h
Expand Up @@ -95,8 +95,6 @@ class InputDevAdaptor : public SysfsAdaptor {
* Scans through the /dev/input/event* device handles and registers the
* ones that pass the test with the #checkInputDevice method.
* @param matchString String to match in device name fields.
* @param matchingDeviceNumber Pointer to integer where to store the
* last found matching device number.
*
* @return Number of devices detected.
*
Expand Down
3 changes: 2 additions & 1 deletion sensord/nodebase.h
Expand Up @@ -64,7 +64,7 @@ public Q_SLOTS:

/**
* Remove a range request.
* @param sessionID ID of the session whose request to remove.
* @param sessionId ID of the session whose request to remove.
*/
void removeDataRangeRequest(int sessionId);

Expand Down Expand Up @@ -230,6 +230,7 @@ public Q_SLOTS:
* it. For nodes which merely get several options from previous nodes
* this won't get invoked.
* @param range The range to set
* @param sessionId The session Id
* @return \c true on succesfull set, \c false otherwise. The base
* class implementation always returns false.
*/
Expand Down
2 changes: 1 addition & 1 deletion sensord/sysfsadaptor.h
Expand Up @@ -88,7 +88,7 @@ class SysfsAdaptor : public DeviceAdaptor, public PropertyTracker
* @param mode Mode to use for monitoring.
* @param seek Whether lseek() should be called to rewind the monitored fds.
* @param path Path to the sysfs file device to monitor.
* @param id Identifier for the path (used as parameter to processSample).
* @param pathId Identifier for the path (used as parameter to processSample).
*/
SysfsAdaptor(const QString& id, PollMode mode = SelectMode, bool seek = true, const QString& path = "", const int pathId = 0);

Expand Down
2 changes: 1 addition & 1 deletion sensors/gyroscopesensor/gyroscopeplugin.cpp
Expand Up @@ -31,7 +31,7 @@

void GyroscopePlugin::Register(class Loader&)
{
qDebug() << "registering gyroscopesensor";
sensordLogD() << "registering gyroscopesensor";
SensorManager& sm = SensorManager::instance();
sm.registerSensor<GyroscopeSensorChannel>("gyroscopesensor");
}
Expand Down

0 comments on commit ac17c2c

Please sign in to comment.