sensorfw
AbstractSensorChannelInterface Class Referenceabstract

Base-class for client facades of different sensor types. More...

#include <abstractsensor_i.h>

Inheritance diagram for AbstractSensorChannelInterface:
ALSSensorChannelInterface AccelerometerSensorChannelInterface CompassSensorChannelInterface GyroscopeSensorChannelInterface HrmSensorChannelInterface HumiditySensorChannelInterface LidSensorChannelInterface MagnetometerSensorChannelInterface OrientationSensorChannelInterface PressureSensorChannelInterface ProximitySensorChannelInterface RotationSensorChannelInterface StepCounterSensorChannelInterface TapSensorChannelInterface TemperatureSensorChannelInterface

Public Member Functions

virtual ~AbstractSensorChannelInterface ()
 Destructor. More...
 
bool release ()
 Release the sensor instance. More...
 
int sessionId () const
 Get ID of the current session. More...
 
SensorError errorCode ()
 Get error code of occured local or remote error. More...
 
QString errorString ()
 Get error description of occured local or remote error. More...
 
QString description ()
 Get description of the sensor. More...
 
QString id ()
 Get ID of the sensor. More...
 
int interval ()
 Get used sensor sampling interval (in millisecs). More...
 
void setInterval (int value)
 Set sensor sampling interval (in millisecs). More...
 
bool standbyOverride ()
 Is standby-override enabled or not. More...
 
bool setStandbyOverride (bool override)
 Enable or disable standby-override. More...
 
unsigned int bufferInterval ()
 Used buffer interval. More...
 
void setBufferInterval (unsigned int value)
 Set buffer interval. More...
 
bool downsampling ()
 Is downsampling enabled or not. More...
 
bool setDownsampling (bool value)
 Enable or disable downsampling. More...
 
IntegerRangeList getAvailableBufferIntervals ()
 Returns list of available buffer interval ranges. More...
 
unsigned int bufferSize ()
 Get used buffer size. More...
 
void setBufferSize (unsigned int value)
 Set buffer size. More...
 
IntegerRangeList getAvailableBufferSizes ()
 Returns list of available buffer sizes. More...
 
QString type ()
 Textual description about sensor type. More...
 
virtual QDBusReply< void > start ()
 Start sensor. More...
 
virtual QDBusReply< void > stop ()
 Stop sensor. More...
 
DataRangeList getAvailableIntervals ()
 Get the list of available intervals ranges for the sensor. More...
 
DataRangeList getAvailableDataRanges ()
 Get the list of available data ranges for the sensor. More...
 
DataRange getCurrentDataRange ()
 Get current used data range. More...
 
void requestDataRange (DataRange range)
 Request data range. More...
 
void removeDataRangeRequest ()
 Remove set data range request. More...
 
bool setDataRangeIndex (int dataRangeIndex)
 Request data range by using index which points to the list returned by getAvailableDataRanges(). More...
 
bool hwBuffering ()
 Does the sensor driver support buffering or not. More...
 
bool isValid () const
 Does the current instance have valid connection established to sensor daemon. More...
 

Protected Slots

void startFinished (QDBusPendingCallWatcher *watch)
 
void stopFinished (QDBusPendingCallWatcher *watch)
 
void setIntervalFinished (QDBusPendingCallWatcher *watch)
 
void setBufferIntervalFinished (QDBusPendingCallWatcher *watch)
 
void setBufferSizeFinished (QDBusPendingCallWatcher *watch)
 
void setStandbyOverrideFinished (QDBusPendingCallWatcher *watch)
 
void setDownsamplingFinished (QDBusPendingCallWatcher *watch)
 
void setDataRangeIndexFinished (QDBusPendingCallWatcher *watch)
 

Protected Member Functions

 AbstractSensorChannelInterface (const QString &path, const char *interfaceName, int sessionId)
 Constructor. More...
 
bool read (void *buffer, int size)
 Read data from socket into buffer. More...
 
template<typename T >
bool read (QVector< T > &values)
 Read data from socket into passed container. More...
 
virtual bool dataReceivedImpl ()=0
 Callback for subclasses in which they must read their expected data from socket. More...
 
template<typename T >
getAccessor (const char *name)
 Utility for calling DBus methods from current connection which return value and take no args. More...
 
template<typename T >
void setAccessor (const char *name, const T &value)
 Utility for calling DBus methods from current connection which return nothing and take one arg. More...
 
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. More...
 
QDBusMessage callWithArgumentList (QDBus::CallMode mode, const QString &method, const QList< QVariant > &args)
 Wrapper for function of QDBusAbstractInterface. More...
 
void dbusConnectNotify (const QMetaMethod &signal)
 Wrapper for function of QDBusAbstractInterface. More...
 

Properties

int sessionId
 
SensorError errorCode
 
QString errorString
 
QString description
 
QString id
 
int interval
 
bool standbyOverride
 
QString type
 
unsigned int bufferInterval
 
unsigned int bufferSize
 
bool hwBuffering
 
bool downsampling
 

Detailed Description

Base-class for client facades of different sensor types.

Definition at line 45 of file abstractsensor_i.h.

Constructor & Destructor Documentation

◆ ~AbstractSensorChannelInterface()

virtual AbstractSensorChannelInterface::~AbstractSensorChannelInterface ( )
virtual

Destructor.

◆ AbstractSensorChannelInterface()

AbstractSensorChannelInterface::AbstractSensorChannelInterface ( const QString &  path,
const char *  interfaceName,
int  sessionId 
)
protected

Constructor.

Parameters
pathDBus object path.
interfaceNameDBus object name.
sessionIdSession ID.

Member Function Documentation

◆ bufferInterval()

unsigned int AbstractSensorChannelInterface::bufferInterval ( )

Used buffer interval.

Buffer interval defines the timeout for buffered data to be flushed unless the buffer is filled before it.

Returns
interval in millisecs.

◆ bufferSize()

unsigned int AbstractSensorChannelInterface::bufferSize ( )

Get used buffer size.

Buffer size is used to control how many samples are collected before signaling application about them.

Returns
used buffer size.

◆ call()

QDBusMessage AbstractSensorChannelInterface::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() 
)
protected

Wrapper for function of QDBusAbstractInterface.

For more details see QDBusAbstractInterface docs.

◆ callWithArgumentList()

QDBusMessage AbstractSensorChannelInterface::callWithArgumentList ( QDBus::CallMode  mode,
const QString &  method,
const QList< QVariant > &  args 
)
protected

Wrapper for function of QDBusAbstractInterface.

For more details see QDBusAbstractInterface docs.

◆ dataReceivedImpl()

◆ dbusConnectNotify()

void AbstractSensorChannelInterface::dbusConnectNotify ( const QMetaMethod &  signal)
protected

Wrapper for function of QDBusAbstractInterface.

For more details see QDBusAbstractInterface docs.

◆ description()

QString AbstractSensorChannelInterface::description ( )

Get description of the sensor.

Returns
description of the sensor.

◆ downsampling()

bool AbstractSensorChannelInterface::downsampling ( )

Is downsampling enabled or not.

Downsampling is used to fit requested measurement interval setInterval(int) to effective interval.

Returns
downsampling state.

◆ errorCode()

SensorError AbstractSensorChannelInterface::errorCode ( )

Get error code of occured local or remote error.

Returns
error code.

◆ errorString()

QString AbstractSensorChannelInterface::errorString ( )

Get error description of occured local or remote error.

Returns
error description.

◆ getAccessor()

template<typename T >
T AbstractSensorChannelInterface::getAccessor ( const char *  name)
protected

Utility for calling DBus methods from current connection which return value and take no args.

Template Parameters
returntype.
Parameters
namemethod name.
Returns
called method return value.

Definition at line 495 of file abstractsensor_i.h.

◆ getAvailableBufferIntervals()

IntegerRangeList AbstractSensorChannelInterface::getAvailableBufferIntervals ( )

Returns list of available buffer interval ranges.

Returns
The list of supported buffer interval ranges.

◆ getAvailableBufferSizes()

IntegerRangeList AbstractSensorChannelInterface::getAvailableBufferSizes ( )

Returns list of available buffer sizes.

The list is ordered by efficiency of the size.

Returns
The list of supported buffer sizes ordered by efficiency.

◆ getAvailableDataRanges()

DataRangeList AbstractSensorChannelInterface::getAvailableDataRanges ( )

Get the list of available data ranges for the sensor.

Returns
List of available data ranges.

◆ getAvailableIntervals()

DataRangeList AbstractSensorChannelInterface::getAvailableIntervals ( )

Get the list of available intervals ranges for the sensor.

Returns
List of available intervals ranges.

◆ getCurrentDataRange()

DataRange AbstractSensorChannelInterface::getCurrentDataRange ( )

Get current used data range.

Returns
currently used data range.

◆ hwBuffering()

bool AbstractSensorChannelInterface::hwBuffering ( )

Does the sensor driver support buffering or not.

Returns
Does the sensor driver support buffering or not.

◆ id()

QString AbstractSensorChannelInterface::id ( )

Get ID of the sensor.

Returns
ID of the sensor.

◆ interval()

int AbstractSensorChannelInterface::interval ( )

Get used sensor sampling interval (in millisecs).

If sensor has been started (by start()) effective interval is returned.

Returns
used sampling interval (in millisecs)

◆ isValid()

bool AbstractSensorChannelInterface::isValid ( ) const

Does the current instance have valid connection established to sensor daemon.

Returns
is the established connection valid.

◆ read() [1/2]

template<typename T >
bool AbstractSensorChannelInterface::read ( QVector< T > &  values)
protected

Read data from socket into passed container.

Template Parameters
Typeto which to convert raw data.
Parameters
valuesContainer for data.
Returns
was read successful.

Definition at line 489 of file abstractsensor_i.h.

◆ read() [2/2]

bool AbstractSensorChannelInterface::read ( void *  buffer,
int  size 
)
protected

Read data from socket into buffer.

Parameters
bufferPointer to buffer where to write.
sizeNumber of bytes to read.

◆ release()

bool AbstractSensorChannelInterface::release ( )

Release the sensor instance.

Returns
true always.
Deprecated:
Session lifecycle ends by destructing this object.

◆ removeDataRangeRequest()

void AbstractSensorChannelInterface::removeDataRangeRequest ( )

Remove set data range request.

◆ requestDataRange()

void AbstractSensorChannelInterface::requestDataRange ( DataRange  range)

Request data range.

Usable ranges are listed by getAvailableDataRanges().

Parameters
rangerequested range.

◆ sessionId()

int AbstractSensorChannelInterface::sessionId ( ) const

Get ID of the current session.

Returns
current session ID.

◆ setAccessor()

template<typename T >
void AbstractSensorChannelInterface::setAccessor ( const char *  name,
const T &  value 
)
protected

Utility for calling DBus methods from current connection which return nothing and take one arg.

Template Parameters
argumenttype.
Parameters
namemethod name.
valuemethod argument.

Definition at line 507 of file abstractsensor_i.h.

◆ setBufferInterval()

void AbstractSensorChannelInterface::setBufferInterval ( unsigned int  value)

Set buffer interval.

Buffer interval defines the timeout for buffered data to be flushed unless the buffer is filled before it. Supported intervals are listed by getAvailableBufferIntervals().

Parameters
valueinterval in millisecs.

◆ setBufferIntervalFinished

void AbstractSensorChannelInterface::setBufferIntervalFinished ( QDBusPendingCallWatcher *  watch)
protectedslot

◆ setBufferSize()

void AbstractSensorChannelInterface::setBufferSize ( unsigned int  value)

Set buffer size.

Buffer size is used to control how many samples are collected before signaling application about them.

Parameters
valuebuffer size.

◆ setBufferSizeFinished

void AbstractSensorChannelInterface::setBufferSizeFinished ( QDBusPendingCallWatcher *  watch)
protectedslot

◆ setDataRangeIndex()

bool AbstractSensorChannelInterface::setDataRangeIndex ( int  dataRangeIndex)

Request data range by using index which points to the list returned by getAvailableDataRanges().

Parameters
dataRangeIndexrequeted data range index.
Returns
false if given index is invalid.

◆ setDataRangeIndexFinished

void AbstractSensorChannelInterface::setDataRangeIndexFinished ( QDBusPendingCallWatcher *  watch)
protectedslot

◆ setDownsampling()

bool AbstractSensorChannelInterface::setDownsampling ( bool  value)

Enable or disable downsampling.

Downsampling is used to fit requested measurement interval setInterval(int) to effective interval. Not all sensors support downsampling so the call will fail for those.

Parameters
valueenable or disable downsampling.
Returns
was downsampling state succesfully changed.

◆ setDownsamplingFinished

void AbstractSensorChannelInterface::setDownsamplingFinished ( QDBusPendingCallWatcher *  watch)
protectedslot

◆ setInterval()

void AbstractSensorChannelInterface::setInterval ( int  value)

Set sensor sampling interval (in millisecs).

Value "0" will clear previously set interval. Supported intervals are listed by getAvailableIntervals().

Parameters
valuesampling interval (in millisecs).

◆ setIntervalFinished

void AbstractSensorChannelInterface::setIntervalFinished ( QDBusPendingCallWatcher *  watch)
protectedslot

◆ setStandbyOverride()

bool AbstractSensorChannelInterface::setStandbyOverride ( bool  override)

Enable or disable standby-override.

Standby-override is used to keep sensor enabled when display is blanked.

Parameters
overridestandby-override state
Returns
true if succesfully set.

◆ setStandbyOverrideFinished

void AbstractSensorChannelInterface::setStandbyOverrideFinished ( QDBusPendingCallWatcher *  watch)
protectedslot

◆ standbyOverride()

bool AbstractSensorChannelInterface::standbyOverride ( )

Is standby-override enabled or not.

Standby-override is used to keep sensor enabled when display is blanked.

Returns
enabled or not.

◆ start()

virtual QDBusReply< void > AbstractSensorChannelInterface::start ( )
virtual

Start sensor.

This will cause necessary resources to be acquired so the sensor readings can be received.

Returns
object from which the success of call can be seen.

◆ startFinished

void AbstractSensorChannelInterface::startFinished ( QDBusPendingCallWatcher *  watch)
protectedslot

◆ stop()

virtual QDBusReply< void > AbstractSensorChannelInterface::stop ( )
virtual

Stop sensor.

This will cause acquired resourced to be released.

Returns
object from which the success of call can be seen.

◆ stopFinished

void AbstractSensorChannelInterface::stopFinished ( QDBusPendingCallWatcher *  watch)
protectedslot

◆ type()

QString AbstractSensorChannelInterface::type ( )

Textual description about sensor type.

Returns
sensor type description.

Property Documentation

◆ bufferInterval

unsigned int AbstractSensorChannelInterface::bufferInterval
readwrite

Definition at line 507 of file abstractsensor_i.h.

◆ bufferSize

unsigned int AbstractSensorChannelInterface::bufferSize
readwrite

Definition at line 507 of file abstractsensor_i.h.

◆ description

QString AbstractSensorChannelInterface::description
read

Definition at line 507 of file abstractsensor_i.h.

◆ downsampling

bool AbstractSensorChannelInterface::downsampling
readwrite

Definition at line 507 of file abstractsensor_i.h.

◆ errorCode

SensorError AbstractSensorChannelInterface::errorCode
read

Definition at line 507 of file abstractsensor_i.h.

◆ errorString

QString AbstractSensorChannelInterface::errorString
read

Definition at line 507 of file abstractsensor_i.h.

◆ hwBuffering

bool AbstractSensorChannelInterface::hwBuffering
read

Definition at line 507 of file abstractsensor_i.h.

◆ id

QString AbstractSensorChannelInterface::id
read

Definition at line 507 of file abstractsensor_i.h.

◆ interval

int AbstractSensorChannelInterface::interval
readwrite

Definition at line 507 of file abstractsensor_i.h.

◆ sessionId

int AbstractSensorChannelInterface::sessionId
read

Definition at line 507 of file abstractsensor_i.h.

◆ standbyOverride

bool AbstractSensorChannelInterface::standbyOverride
readwrite

Definition at line 507 of file abstractsensor_i.h.

◆ type

QString AbstractSensorChannelInterface::type
read

Definition at line 507 of file abstractsensor_i.h.


The documentation for this class was generated from the following file: