29#ifndef ABSTRACTSENSOR_I_H
30#define ABSTRACTSENSOR_I_H
32#include <QtDBus/QtDBus>
53 Q_PROPERTY(QString
id READ
id)
237 virtual QDBusReply<void>
stop();
318 void displayStateChanged(
bool displayState);
402 bool read(
void* buffer,
int size);
412 bool read(QVector<T>& values);
442 void setAccessor(
const char* name,
const T& value);
448 QDBusMessage
call(QDBus::CallMode mode,
449 const QString& method,
450 const QVariant& arg1 = QVariant(),
451 const QVariant& arg2 = QVariant(),
452 const QVariant& arg3 = QVariant(),
453 const QVariant& arg4 = QVariant(),
454 const QVariant& arg5 = QVariant(),
455 const QVariant& arg6 = QVariant(),
456 const QVariant& arg7 = QVariant(),
457 const QVariant& arg8 = QVariant());
483 struct AbstractSensorChannelInterfaceImpl;
485 AbstractSensorChannelInterfaceImpl* pimpl_;
491 return getSocketReader().
read(values);
497 QDBusReply<T> reply(
call(QDBus::Block, QLatin1String(name)));
500 qDebug() <<
"Failed to get '" << name <<
"' from sensord: " << reply.error().message();
503 return reply.value();
509 QDBusReply<void> reply(
call(QDBus::NoBlock, QLatin1String(name), qVariantFromValue(value)));
512 qDebug() <<
"Failed to set '" << name <<
" = " << value <<
"' to sensord: " << reply.error().message();
Base-class for client facades of different sensor types.
void setBufferIntervalFinished(QDBusPendingCallWatcher *watch)
void setAccessor(const char *name, const T &value)
Utility for calling DBus methods from current connection which return nothing and take one arg.
DataRangeList getAvailableDataRanges()
Get the list of available data ranges for the sensor.
bool read(void *buffer, int size)
Read data from socket into buffer.
virtual QDBusReply< void > start()
Start sensor.
void startFinished(QDBusPendingCallWatcher *watch)
bool isValid() const
Does the current instance have valid connection established to sensor daemon.
virtual QDBusReply< void > stop()
Stop sensor.
QDBusMessage call(QDBus::CallMode mode, const QString &method, const QVariant &arg1=QVariant(), const QVariant &arg2=QVariant(), const QVariant &arg3=QVariant(), const QVariant &arg4=QVariant(), const QVariant &arg5=QVariant(), const QVariant &arg6=QVariant(), const QVariant &arg7=QVariant(), const QVariant &arg8=QVariant())
Wrapper for function of QDBusAbstractInterface.
QString description()
Get description of the sensor.
IntegerRangeList getAvailableBufferSizes()
Returns list of available buffer sizes.
bool standbyOverride()
Is standby-override enabled or not.
T getAccessor(const char *name)
Utility for calling DBus methods from current connection which return value and take no args.
int interval()
Get used sensor sampling interval (in millisecs).
void setBufferSizeFinished(QDBusPendingCallWatcher *watch)
void setIntervalFinished(QDBusPendingCallWatcher *watch)
unsigned int bufferSize()
Get used buffer size.
QString errorString()
Get error description of occured local or remote error.
void setBufferInterval(unsigned int value)
Set buffer interval.
void setBufferSize(unsigned int value)
Set buffer size.
QString type()
Textual description about sensor type.
void dbusConnectNotify(const QMetaMethod &signal)
Wrapper for function of QDBusAbstractInterface.
bool hwBuffering()
Does the sensor driver support buffering or not.
bool setDownsampling(bool value)
Enable or disable downsampling.
DataRangeList getAvailableIntervals()
Get the list of available intervals ranges for the sensor.
virtual ~AbstractSensorChannelInterface()
Destructor.
bool downsampling()
Is downsampling enabled or not.
void setDataRangeIndexFinished(QDBusPendingCallWatcher *watch)
void requestDataRange(DataRange range)
Request data range.
void removeDataRangeRequest()
Remove set data range request.
unsigned int bufferInterval()
Used buffer interval.
bool setStandbyOverride(bool override)
Enable or disable standby-override.
bool release()
Release the sensor instance.
unsigned int bufferInterval
DataRange getCurrentDataRange()
Get current used data range.
QString id()
Get ID of the sensor.
bool setDataRangeIndex(int dataRangeIndex)
Request data range by using index which points to the list returned by getAvailableDataRanges().
void stopFinished(QDBusPendingCallWatcher *watch)
int sessionId() const
Get ID of the current session.
void setStandbyOverrideFinished(QDBusPendingCallWatcher *watch)
IntegerRangeList getAvailableBufferIntervals()
Returns list of available buffer interval ranges.
QDBusMessage callWithArgumentList(QDBus::CallMode mode, const QString &method, const QList< QVariant > &args)
Wrapper for function of QDBusAbstractInterface.
SensorError errorCode()
Get error code of occured local or remote error.
AbstractSensorChannelInterface(const QString &path, const char *interfaceName, int sessionId)
Constructor.
void setInterval(int value)
Set sensor sampling interval (in millisecs).
void setDownsamplingFinished(QDBusPendingCallWatcher *watch)
virtual bool dataReceivedImpl()=0
Callback for subclasses in which they must read their expected data from socket.
Datatype for storing sensor data range information.
Helper class for reading socket datachannel from sensord.
bool read(void *buffer, int size)
Attempt to read given number of bytes from the socket.
Datatype containing sensor data range and resolution.
QList< IntegerRange > IntegerRangeList
QList< DataRange > DataRangeList
::AbstractSensorChannelInterface AbstractSensor
Sensor service information.
SensorError
Enumeration about sensor error states.
SocketReader helper class for sensor interface.