luna-sysmgr-common
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NYXLogicalSensorConnectorBase Class Reference

#include <NyxSensorConnector.h>

Inheritance diagram for NYXLogicalSensorConnectorBase:
[legend]
Collaboration diagram for NYXLogicalSensorConnectorBase:
[legend]

Public Member Functions

virtual ~NYXLogicalSensorConnectorBase ()
 
virtual bool on ()
 
virtual bool off ()
 
virtual bool setRate (SensorReportRate aRate)
 
virtual void setOrientationAngle (int aAngle)
 
virtual void scheduleDeletion ()
 
virtual json_object * toJSONObject ()
 
- Public Member Functions inherited from NYXConnectorBase
virtual ~NYXConnectorBase ()
 
virtual std::string toJSONString ()
 
virtual QEventgetQSensorData ()=0
 
virtual nyx_device_handle_t getHandle ()
 
Sensor type ()
 

Protected Slots

virtual void readSensorData (int)
 
void logicalSensorDataAvailable ()
 
- Protected Slots inherited from NYXConnectorBase
virtual void readSensorData (int aSocket)=0
 

Protected Member Functions

 NYXLogicalSensorConnectorBase (Sensor aSensorType, NYXConnectorObserver *aObserver, bool bCanPostEvent)
 
virtual nyx_error_t openSensor ()
 
virtual void connectSensorSignalToSlot ()
 
- Protected Member Functions inherited from NYXConnectorBase
 NYXConnectorBase (Sensor aSensorType, nyx_device_type_t aDevType, nyx_device_id_t aDevID, NYXConnectorObserver *aObserver, bool bCanPostEvent)
 
void callObserver (bool aShouldEmit=true)
 
bool canPostEvent ()
 
virtual void postProcessSensorData ()
 

Protected Attributes

std::vector< NYXConnectorBase * > m_SensorList
 
- Protected Attributes inherited from NYXConnectorBase
Sensor m_SensorType
 
QSocketNotifier * m_NYXSensorNotifier
 
nyx_device_handle_t m_Handle
 
nyx_device_type_t m_NYXDeviceType
 
nyx_device_id_t m_NYXDeviceId
 
NYXConnectorObserverm_Observer
 
int m_SensorFD
 
bool m_CanPostEvent
 
int m_OrientationAngle
 
bool m_Finished
 

Additional Inherited Members

- Public Types inherited from NYXConnectorBase
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 inherited from NYXConnectorBase
virtual void sensorDataAvailable ()
 
- Static Public Member Functions inherited from NYXConnectorBase
static std::vector
< NYXConnectorBase::Sensor
getSupportedSensors ()
 
static std::string getSupportedSensors (bool bJson)
 
static NYXConnectorBasegetSensor (Sensor aSensorType, NYXConnectorObserver *aObserver=0, bool bCanPostEvent=true)
 

Detailed Description

NYX Logical sensor connector base class A logical sensor is the one which combines more than one physical sensors and generates useful data

Constructor & Destructor Documentation

NYXLogicalSensorConnectorBase::~NYXLogicalSensorConnectorBase ( )
virtual

default destructor

NYXLogicalSensorConnectorBase::NYXLogicalSensorConnectorBase ( Sensor  aSensorType,
NYXConnectorObserver aObserver,
bool  bCanPostEvent 
)
protected

Parameterize constructor

Parameters
[in]aSensorType- Sensor Type
[in]aObserver- Observer for the NYX device
[in]bCanPostEvent- Defines whether a particular sensor can post event data or not

NYX Logical sensor connector base class

Member Function Documentation

virtual void NYXLogicalSensorConnectorBase::connectSensorSignalToSlot ( )
inlineprotectedvirtual

Connects the Sensor FD to a SLOT Override this method if a sensor has some other slot to register than the default one

Reimplemented from NYXConnectorBase.

void NYXLogicalSensorConnectorBase::logicalSensorDataAvailable ( )
protectedslot

SLOT gets called whenever any of the one sensor has data available to read.

bool NYXLogicalSensorConnectorBase::off ( )
virtual

Stop the apropriate sensor

Returns
true if successful, false otherwise

Reimplemented from NYXConnectorBase.

bool NYXLogicalSensorConnectorBase::on ( )
virtual

Start the appropriate sensor

Returns
true if sucessful, false otherwise

Reimplemented from NYXConnectorBase.

virtual nyx_error_t NYXLogicalSensorConnectorBase::openSensor ( )
inlineprotectedvirtual

Opens a given sensor. Override this method if a sensor doesn't wants to be opened in a default way.

Reimplemented from NYXConnectorBase.

virtual void NYXLogicalSensorConnectorBase::readSensorData ( int  )
inlineprotectedvirtualslot

SLOT gets called whenever there is some sensor data available to read.

Parameters
[in]aSocket- Socket identifier
void NYXLogicalSensorConnectorBase::scheduleDeletion ( )
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 from NYXConnectorBase.

void NYXLogicalSensorConnectorBase::setOrientationAngle ( int  aAngle)
virtual

Sets the Orientation angle, which will be taken into account while processing sensor data for Accelerometer, Rotation, Bearing (Compass) and Gyro

Parameters
aAngle- Angle

Reimplemented from NYXConnectorBase.

bool NYXLogicalSensorConnectorBase::setRate ( SensorReportRate  aRate)
virtual

Sets the report rate for the sensor

Parameters
[in]aRate- report rate
Returns
appropriate Sensor instance if successful, NULL otherwise

Reimplemented from NYXConnectorBase.

json_object * NYXLogicalSensorConnectorBase::toJSONObject ( )
virtual

Gets the sensor data as a json Object

Returns
sensor data as a json object if successful, NULL otherwise
Note
The json object ownership is transferred to the caller and will be responsible for freeing it using json_object_put(<object>);

Implements NYXConnectorBase.

Member Data Documentation

std::vector<NYXConnectorBase *> NYXLogicalSensorConnectorBase::m_SensorList
protected

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