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