|
luna-sysmgr-common
|
#include <NyxSensorConnector.h>
Public Types | |
| enum | Sensor { SensorIllegal = 0, SensorFirst, SensorAcceleration = SensorFirst, SensorOrientation, SensorShake, SensorALS, SensorAngularVelocity, SensorBearing, SensorGravity, SensorLinearAcceleration, SensorMagneticField, SensorScreenProximity, SensorRotation, SensorLogicalAccelerometer, SensorLogicalOrientation, SensorLogicalDeviceOrientation, SensorLogicalMotion, SensorLast = SensorLogicalMotion } |
| enum | SensorReportRate { SensorReportRateUnknown = NYX_REPORT_RATE_UNKNOWN, SensorReportRateDefault = NYX_REPORT_RATE_DEFAULT, SensorReportRateLow = NYX_REPORT_RATE_LOW, SensorReportRateMedium = NYX_REPORT_RATE_MEDIUM, SensorReportRateHigh = NYX_REPORT_RATE_HIGH, SensorReportRateHighest = NYX_REPORT_RATE_HIGHEST, SensorReportRateCount = NYX_REPORT_RATE_COUNT } |
| Defines all valid poll rates for sensors. More... | |
Signals | |
| virtual void | sensorDataAvailable () |
Public Member Functions | |
| virtual | ~NYXConnectorBase () |
| virtual bool | on () |
| virtual bool | off () |
| virtual bool | setRate (SensorReportRate aRate) |
| virtual void | setOrientationAngle (int aAngle) |
| virtual std::string | toJSONString () |
| virtual json_object * | toJSONObject ()=0 |
| virtual QEvent * | getQSensorData ()=0 |
| virtual nyx_device_handle_t | getHandle () |
| Sensor | type () |
| virtual void | scheduleDeletion () |
Static Public Member Functions | |
| static std::vector < NYXConnectorBase::Sensor > | getSupportedSensors () |
| static std::string | getSupportedSensors (bool bJson) |
| static NYXConnectorBase * | getSensor (Sensor aSensorType, NYXConnectorObserver *aObserver=0, bool bCanPostEvent=true) |
Protected Slots | |
| virtual void | readSensorData (int aSocket)=0 |
Protected Member Functions | |
| NYXConnectorBase (Sensor aSensorType, nyx_device_type_t aDevType, nyx_device_id_t aDevID, NYXConnectorObserver *aObserver, bool bCanPostEvent) | |
| virtual nyx_error_t | openSensor () |
| virtual void | connectSensorSignalToSlot () |
| void | callObserver (bool aShouldEmit=true) |
| bool | canPostEvent () |
| virtual void | postProcessSensorData () |
Protected Attributes | |
| Sensor | m_SensorType |
| QSocketNotifier * | m_NYXSensorNotifier |
| nyx_device_handle_t | m_Handle |
| nyx_device_type_t | m_NYXDeviceType |
| nyx_device_id_t | m_NYXDeviceId |
| NYXConnectorObserver * | m_Observer |
| int | m_SensorFD |
| bool | m_CanPostEvent |
| int | m_OrientationAngle |
| bool | m_Finished |
Base Class for a connector to physical Sensors/devices using NYX APIs
Defines all valid poll rates for sensors.
Each sensor module that polls for events defines a corresponding rate (in samples per second) for each of these values.
|
virtual |
default destructor
|
protected |
Parameterize constructor
| [in] | aSensorType | - Sensor Type |
| [in] | aDevType | - NYX device Type |
| [in] | aDevID | - NYX device ID |
| [in] | aObserver | - Observer for the NYX device |
| [in] | bCanPostEvent | - Defines whether a particular sensor can post event data or not |
|
protected |
Function emits sensorDataAvailable() signal based on the passed argument Once the signal is emitted it calls the observer
| [in] | aShouldEmit | - Whether to emit signal or not. Default to true. |
|
inlineprotected |
Find out whether a particular sensor can post event data or not
|
protectedvirtual |
Connects the Sensor FD to a SLOT Override this method if a sensor has some other slot to register than the default one
Reimplemented in NYXLogicalSensorConnectorBase.
|
inlinevirtual |
Gets the low level NYX handle for the sensor
|
pure virtual |
Gets the sensor data in Qt (QEvent) format
Implemented in NYXLogicalDeviceMotionSensorConnector, NYXLogicalDeviceOrientationSensorConnector, NYXLogicalOrientationSensorConnector, NYXLogicalAccelerometerSensorConnector, NYXShakeSensorConnector, NYXRotationSensorConnector, NYXScreenProximitySensorConnector, NYXOrientationSensorConnector, NYXMagneticFieldSensorConnector, NYXLinearAccelearationSensorConnector, NYXGravitySensorConnector, NYXBearingSensorConnector, NYXAngularVelocitySensorConnector, NYXAlsSensorConnector, and NYXAccelerationSensorConnector.
|
static |
Factory method which initializes(opens) the appropriate sensor and returns a valid instance.
| [in] | aSensorType | - Sensor Type |
| [in] | bCanPostEvent | - Control whether sensor can post event data to applications or not By default it sends sensor data. |
| [in] | aObserver | - Observer for the NYX Connectors. |
|
static |
Function returns the available sensors for the current device
|
static |
Function returns the available sensors for the current device
| aJson | - This is a Fake argument and won't be used. This is just to re-use the method name |
|
virtual |
Stop the appropriate sensor
Reimplemented in NYXLogicalSensorConnectorBase.
|
virtual |
Start the appropriate sensor
Reimplemented in NYXLogicalSensorConnectorBase.
|
protectedvirtual |
Opens a given sensor. Override this method if a sensor doesn't wants to be opened in a default way.
Reimplemented in NYXLogicalSensorConnectorBase.
|
inlineprotectedvirtual |
Implement this method, if a sensor requires post processing of the sensor data before sending it for App consumption
Reimplemented in NYXRotationSensorConnector, NYXOrientationSensorConnector, and NYXAccelerationSensorConnector.
|
protectedpure virtualslot |
SLOT gets called whenever there is some sensor data available to read.
| [in] | aSocket | - Socket identifier |
|
virtual |
Function marks this object for deletion As Qt deleteLater() is not working as expected, we will add an idle runloop callback which will help us delete this object
Reimplemented in NYXLogicalSensorConnectorBase.
|
virtualsignal |
SIGNAL is emitted whenever sensor data is available to consume
|
inlinevirtual |
Sets the Orientation angle, which will be taken into account while processing sensor data for Accelerometer, Rotation, Bearing (Compass) and Gyro
| aAngle | - Angle |
Reimplemented in NYXLogicalSensorConnectorBase.
|
virtual |
Sets the report rate for the sensor
| [in] | aRate | - report rate |
Reimplemented in NYXLogicalSensorConnectorBase.
|
pure virtual |
Gets the sensor data as a json Object
Implemented in NYXLogicalSensorConnectorBase, NYXShakeSensorConnector, NYXRotationSensorConnector, NYXScreenProximitySensorConnector, NYXOrientationSensorConnector, NYXMagneticFieldSensorConnector, NYXLinearAccelearationSensorConnector, NYXGravitySensorConnector, NYXBearingSensorConnector, NYXAngularVelocitySensorConnector, NYXAlsSensorConnector, and NYXAccelerationSensorConnector.
|
virtual |
Gets the sensor data in json format
|
inline |
Gets the Sensor Type
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |