From ac17c2cc46daac618353f2a1d61833529b1efa4e Mon Sep 17 00:00:00 2001 From: Antti Virtanen Date: Fri, 10 Dec 2010 14:56:51 +0200 Subject: [PATCH] Refactoring: - Fixed doxygen errors - filters/* content not copied to libsensord-dev anymore. - GyroscopeSensorChannelInterface and GyroscopeSensorChannel cleaned. --- .../alsadaptor-sysfs/alsadaptor-sysfsplugin.h | 2 +- .../proximityadaptor-asciiplugin.h | 2 +- adaptors/touchadaptor/touchadaptor.h | 3 +- c-api/sensorfw-c.h | 6 +-- .../accelerometerchain/accelerometerchain.h | 2 +- debian/api | 1 - debian/libsensord-dev.install | 1 - qt-api/accelerometersensor_i.cpp | 2 +- qt-api/accelerometersensor_i.h | 4 +- qt-api/compasssensor_i.h | 2 +- qt-api/gyroscopesensor_i.cpp | 49 ++++++++++--------- qt-api/gyroscopesensor_i.h | 27 ++++------ qt-api/magnetometersensor_i.h | 2 +- qt-api/proximitysensor_i.h | 2 +- qt-api/rotationsensor_i.cpp | 2 +- qt-api/rotationsensor_i.h | 2 +- qt-api/socketreader.h | 2 +- qt-api/tapsensor_i.h | 4 +- sensord/filterproperty.h | 4 +- sensord/inputdevadaptor.h | 2 - sensord/nodebase.h | 3 +- sensord/sysfsadaptor.h | 2 +- sensors/gyroscopesensor/gyroscopeplugin.cpp | 2 +- sensors/gyroscopesensor/gyroscopesensor.cpp | 9 ---- sensors/gyroscopesensor/gyroscopesensor.h | 17 ------- 25 files changed, 60 insertions(+), 94 deletions(-) diff --git a/adaptors/alsadaptor-sysfs/alsadaptor-sysfsplugin.h b/adaptors/alsadaptor-sysfs/alsadaptor-sysfsplugin.h index d80203ba..75d746c8 100644 --- a/adaptors/alsadaptor-sysfs/alsadaptor-sysfsplugin.h +++ b/adaptors/alsadaptor-sysfs/alsadaptor-sysfsplugin.h @@ -1,5 +1,5 @@ /** - @file alsadaptorplugin-sysfs.h + @file alsadaptor-sysfsplugin.h @brief Plugin for ALSAdaptorSysfs

diff --git a/adaptors/proximityadaptor-ascii/proximityadaptor-asciiplugin.h b/adaptors/proximityadaptor-ascii/proximityadaptor-asciiplugin.h index 8a6232ec..2e7a8cb2 100644 --- a/adaptors/proximityadaptor-ascii/proximityadaptor-asciiplugin.h +++ b/adaptors/proximityadaptor-ascii/proximityadaptor-asciiplugin.h @@ -1,5 +1,5 @@ /** - @file proximityadaptor-asciiplugin.cpp + @file proximityadaptor-asciiplugin.h @brief plugin for ProximityAdaptorAscii

diff --git a/adaptors/touchadaptor/touchadaptor.h b/adaptors/touchadaptor/touchadaptor.h index 0281f732..981d29f9 100644 --- a/adaptors/touchadaptor/touchadaptor.h +++ b/adaptors/touchadaptor/touchadaptor.h @@ -40,7 +40,7 @@ * Provides input data from touchscreen input device. * * @todo

*/ class TouchAdaptor : public InputDevAdaptor { @@ -118,4 +118,3 @@ class TouchAdaptor : public InputDevAdaptor }; #endif - diff --git a/c-api/sensorfw-c.h b/c-api/sensorfw-c.h index 7f38e6f6..35a1ed9e 100644 --- a/c-api/sensorfw-c.h +++ b/c-api/sensorfw-c.h @@ -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 @@ -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. @@ -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. diff --git a/chains/accelerometerchain/accelerometerchain.h b/chains/accelerometerchain/accelerometerchain.h index 909b1e4f..b6cd7a2f 100644 --- a/chains/accelerometerchain/accelerometerchain.h +++ b/chains/accelerometerchain/accelerometerchain.h @@ -41,7 +41,7 @@ class FilterBase; * * Output buffers: * - * + * * For direct raw data (no coordinate correction) use #AccelerometerAdaptor. */ class AccelerometerChain : public AbstractChain diff --git a/debian/api b/debian/api index 2640ddda..4bc8e16e 100644 --- a/debian/api +++ b/debian/api @@ -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 diff --git a/debian/libsensord-dev.install b/debian/libsensord-dev.install index 772c7949..7b9b59e2 100644 --- a/debian/libsensord-dev.install +++ b/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 diff --git a/qt-api/accelerometersensor_i.cpp b/qt-api/accelerometersensor_i.cpp index 814e2232..184d4aca 100644 --- a/qt-api/accelerometersensor_i.cpp +++ b/qt-api/accelerometersensor_i.cpp @@ -69,7 +69,7 @@ void AccelerometerSensorChannelInterface::dataReceived() QVector values; while (read(values)) { - if(frameAvailableConnected || values.size() == 1) + if(!frameAvailableConnected || values.size() == 1) { foreach(AccelerationData data, values) emit dataAvailable(XYZ(data)); diff --git a/qt-api/accelerometersensor_i.h b/qt-api/accelerometersensor_i.h index 32e7cb9f..ef58da45 100644 --- a/qt-api/accelerometersensor_i.h +++ b/qt-api/accelerometersensor_i.h @@ -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); @@ -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& frame); }; diff --git a/qt-api/compasssensor_i.h b/qt-api/compasssensor_i.h index d4fdda82..b9764270 100644 --- a/qt-api/compasssensor_i.h +++ b/qt-api/compasssensor_i.h @@ -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); }; diff --git a/qt-api/gyroscopesensor_i.cpp b/qt-api/gyroscopesensor_i.cpp index 2b4884ec..77687348 100644 --- a/qt-api/gyroscopesensor_i.cpp +++ b/qt-api/gyroscopesensor_i.cpp @@ -7,6 +7,7 @@ @author Timo Rongas @author Samuli Piippo + @author Antti Virtanen This file is part of Sensord. @@ -22,15 +23,23 @@ You should have received a copy of the GNU Lesser General Public License along with Sensord. If not, see .

- */ +*/ #include "sensormanagerinterface.h" #include "gyroscopesensor_i.h" #include +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) { } @@ -57,32 +66,25 @@ GyroscopeSensorChannelInterface* GyroscopeSensorChannelInterface::controlInterfa return dynamic_cast(sm.controlInterface(id)); } - - void GyroscopeSensorChannelInterface::dataReceived() { QVector values; while (read(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 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 realValues; + realValues.reserve(values.size()); + foreach(AngularVelocityData data, values) + realValues.push_back(XYZ(data)); + emit frameAvailable(realValues); } + values.clear(); } } @@ -100,4 +102,7 @@ QDBusReply GyroscopeSensorChannelInterface::reset() return callWithArgumentList(QDBus::Block, QLatin1String("reset"), argumentList); } - +XYZ GyroscopeSensorChannelInterface::get() const +{ + return qvariant_cast(internalPropGet("value")); +} diff --git a/qt-api/gyroscopesensor_i.h b/qt-api/gyroscopesensor_i.h index 91846f2a..2387d467 100644 --- a/qt-api/gyroscopesensor_i.h +++ b/qt-api/gyroscopesensor_i.h @@ -7,6 +7,7 @@ @author Timo Rongas @author Samuli Piippo + @author Antti Virtanen This file is part of Sensord. @@ -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(internalPropGet("value")); } + XYZ get() const; -public: /** * Constructor. * @param path path. - * @param sessionid session id. + * @param sessionId session id. */ GyroscopeSensorChannelInterface(const QString &path, int sessionId); @@ -90,16 +85,13 @@ class GyroscopeSensorChannelInterface: public AbstractSensorChannelInterface protected: virtual void connectNotify(const char* signal); - private: bool frameAvailableConnected; - public Q_SLOTS: // METHODS void dataReceived(); QDBusReply reset(); - Q_SIGNALS: // SIGNALS /** * Sent when new measurement data has become available. @@ -107,12 +99,11 @@ public Q_SLOTS: // METHODS */ 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& frame); diff --git a/qt-api/magnetometersensor_i.h b/qt-api/magnetometersensor_i.h index af5a7857..28875144 100644 --- a/qt-api/magnetometersensor_i.h +++ b/qt-api/magnetometersensor_i.h @@ -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& frame); }; diff --git a/qt-api/proximitysensor_i.h b/qt-api/proximitysensor_i.h index e34b2f83..e1c67dd5 100644 --- a/qt-api/proximitysensor_i.h +++ b/qt-api/proximitysensor_i.h @@ -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); diff --git a/qt-api/rotationsensor_i.cpp b/qt-api/rotationsensor_i.cpp index 773012f8..a12ca56d 100644 --- a/qt-api/rotationsensor_i.cpp +++ b/qt-api/rotationsensor_i.cpp @@ -69,7 +69,7 @@ void RotationSensorChannelInterface::dataReceived() QVector values; while (read(values)) { - if(frameAvailableConnected || values.size() == 1) + if(!frameAvailableConnected || values.size() == 1) { foreach(TimedXyzData data, values) emit dataAvailable(XYZ(data)); diff --git a/qt-api/rotationsensor_i.h b/qt-api/rotationsensor_i.h index 7e5905de..43455c0c 100644 --- a/qt-api/rotationsensor_i.h +++ b/qt-api/rotationsensor_i.h @@ -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& frame); }; diff --git a/qt-api/socketreader.h b/qt-api/socketreader.h index 17326c86..f5c766ed 100644 --- a/qt-api/socketreader.h +++ b/qt-api/socketreader.h @@ -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. */ diff --git a/qt-api/tapsensor_i.h b/qt-api/tapsensor_i.h index af7ea801..a9df1e7d 100644 --- a/qt-api/tapsensor_i.h +++ b/qt-api/tapsensor_i.h @@ -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: diff --git a/sensord/filterproperty.h b/sensord/filterproperty.h index bbcf915b..2f648d47 100644 --- a/sensord/filterproperty.h +++ b/sensord/filterproperty.h @@ -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) {} }; diff --git a/sensord/inputdevadaptor.h b/sensord/inputdevadaptor.h index 7ec0ea4b..2d06dbde 100644 --- a/sensord/inputdevadaptor.h +++ b/sensord/inputdevadaptor.h @@ -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. * diff --git a/sensord/nodebase.h b/sensord/nodebase.h index f145b25e..fccec13f 100644 --- a/sensord/nodebase.h +++ b/sensord/nodebase.h @@ -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); @@ -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. */ diff --git a/sensord/sysfsadaptor.h b/sensord/sysfsadaptor.h index fa8da8fb..b8eb501a 100644 --- a/sensord/sysfsadaptor.h +++ b/sensord/sysfsadaptor.h @@ -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); diff --git a/sensors/gyroscopesensor/gyroscopeplugin.cpp b/sensors/gyroscopesensor/gyroscopeplugin.cpp index 7e1a9246..73264606 100644 --- a/sensors/gyroscopesensor/gyroscopeplugin.cpp +++ b/sensors/gyroscopesensor/gyroscopeplugin.cpp @@ -31,7 +31,7 @@ void GyroscopePlugin::Register(class Loader&) { - qDebug() << "registering gyroscopesensor"; + sensordLogD() << "registering gyroscopesensor"; SensorManager& sm = SensorManager::instance(); sm.registerSensor("gyroscopesensor"); } diff --git a/sensors/gyroscopesensor/gyroscopesensor.cpp b/sensors/gyroscopesensor/gyroscopesensor.cpp index fdcfee19..09c3ecea 100644 --- a/sensors/gyroscopesensor/gyroscopesensor.cpp +++ b/sensors/gyroscopesensor/gyroscopesensor.cpp @@ -30,7 +30,6 @@ #include "sensord/bin.h" #include "sensord/bufferreader.h" - GyroscopeSensorChannel::GyroscopeSensorChannel(const QString& id) : AbstractSensorChannel(id), DbusEmitter(10), @@ -73,20 +72,16 @@ GyroscopeSensorChannel::~GyroscopeSensorChannel() { SensorManager& sm = SensorManager::instance(); - // Disconnect reader disconnectFromSource(gyroscopeAdaptor_, "gyroscope", gyroscopeReader_); - // Release chain (dont delete!) sm.releaseDeviceAdaptor("gyroscopeadaptor"); - // ...and delete locally owned things delete gyroscopeReader_; delete outputBuffer_; delete marshallingBin_; delete filterBin_; } -// Start bins and sources bool GyroscopeSensorChannel::start() { sensordLogD() << "Starting GyroscopeSensorChannel"; @@ -99,7 +94,6 @@ bool GyroscopeSensorChannel::start() return true; } -// Stopping is start() in reverse. bool GyroscopeSensorChannel::stop() { sensordLogD() << "Stopping GyroscopeSensorChannel"; @@ -112,9 +106,6 @@ bool GyroscopeSensorChannel::stop() return true; } -// Store the previous value for use by the accessor function, and -// push data towards clients (the data will be pushed to socket(s) by -// sensormanager). void GyroscopeSensorChannel::emitToDbus(const AngularVelocityData& value) { previousSample_ = value; diff --git a/sensors/gyroscopesensor/gyroscopesensor.h b/sensors/gyroscopesensor/gyroscopesensor.h index d42a481c..3cd06578 100644 --- a/sensors/gyroscopesensor/gyroscopesensor.h +++ b/sensors/gyroscopesensor/gyroscopesensor.h @@ -30,30 +30,21 @@ #include "abstractsensor.h" #include "sensord/deviceadaptor.h" - -// Include the dbus adaptor and dbusemitter base class #include "gyroscopesensor_a.h" #include "sensord/dbusemitter.h" -// Include required datatypes #include "datatypes/orientationdata.h" #include "datatypes/xyz.h" -// Included in .cpp, introduced here. class Bin; template class BufferReader; class FilterBase; -// Sensors inherit also DbusEmitter class GyroscopeSensorChannel : public AbstractSensorChannel, public DbusEmitter { Q_OBJECT; - - // Accessor function for the value for clients. Type must be based - // on QObject and marshallable over D-Bus. Usually it just wraps the - // POD that is used internally. Q_PROPERTY(XYZ value READ get); public: @@ -64,15 +55,11 @@ class GyroscopeSensorChannel : static AbstractSensorChannel* factoryMethod(const QString& id) { GyroscopeSensorChannel* sc = new GyroscopeSensorChannel(id); - - // This creates the dbus adaptor - qobject parent relation - // makes sure it gets destructed correctly. new GyroscopeSensorChannelAdaptor(sc); return sc; } - // Implementation of the accessor function. XYZ get() const { return previousSample_; } public Q_SLOTS: @@ -80,7 +67,6 @@ public Q_SLOTS: bool stop(); signals: - // Signal is used whenever we have new data. void dataAvailable(const AngularVelocityData& data); protected: @@ -91,15 +77,12 @@ public Q_SLOTS: Bin* filterBin_; Bin* marshallingBin_; - // Pointer to chain and a reader for it. DeviceAdaptor* gyroscopeAdaptor_; BufferReader* gyroscopeReader_; RingBuffer* outputBuffer_; - // We need to store the previous sample for accessor. AngularVelocityData previousSample_; - // Function that takes care of pushing the data to clients void emitToDbus(const AngularVelocityData& value); };