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

#include <NyxSensorConnector.h>

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

Public Member Functions

 NYXRotationSensorConnector (NYXConnectorObserver *aObserver, bool bCanPostEvent=true)
 
float pitch () const
 
float roll () const
 
float yaw () const
 
float quaternionW () const
 
float quaternionX () const
 
float quaternionY () const
 
float quaternionZ () const
 
const float * rotationMatrix () const
 
virtual json_object * toJSONObject ()
 
virtual QEventgetQSensorData ()
 
- Public Member Functions inherited from NYXConnectorBase
virtual ~NYXConnectorBase ()
 
virtual bool on ()
 
virtual bool off ()
 
virtual bool setRate (SensorReportRate aRate)
 
virtual void setOrientationAngle (int aAngle)
 
virtual std::string toJSONString ()
 
virtual nyx_device_handle_t getHandle ()
 
Sensor type ()
 
virtual void scheduleDeletion ()
 

Protected Slots

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

Protected Member Functions

virtual void postProcessSensorData ()
 
- Protected Member Functions inherited from NYXConnectorBase
 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 ()
 

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)
 
- 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
 

Detailed Description

NYX Rotation sensor connector class

Constructor & Destructor Documentation

NYXRotationSensorConnector::NYXRotationSensorConnector ( NYXConnectorObserver aObserver,
bool  bCanPostEvent = true 
)

Parameterized constructor

Parameters
[in]aObserver- NYX sensor observer
[in]bCanPostEvent- Control whether to post event or not

Rotation Sensor Connector

Member Function Documentation

QEvent * NYXRotationSensorConnector::getQSensorData ( )
virtual

Gets the sensor data in Qt (QEvent) format

Returns
QEvent if successful, NULL otherwise
Note
the ownership of heap data (QEvent *) is transferred to caller and is responsible for deleting that data

Implements NYXConnectorBase.

float NYXRotationSensorConnector::pitch ( ) const
inline

Euler angle of rotation (in degrees) amount of pitch in degrees

void NYXRotationSensorConnector::postProcessSensorData ( )
protectedvirtual

Implement this method, if a sensor requires post processing of the sensor data before sending it for App consumption

Reimplemented from NYXConnectorBase.

float NYXRotationSensorConnector::quaternionW ( ) const
inline

Quaternion vector of rotation

float NYXRotationSensorConnector::quaternionX ( ) const
inline
float NYXRotationSensorConnector::quaternionY ( ) const
inline
float NYXRotationSensorConnector::quaternionZ ( ) const
inline
void NYXRotationSensorConnector::readSensorData ( int  aSocket)
protectedvirtualslot

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

Parameters
[in]aSocket- Socket identifier
float NYXRotationSensorConnector::roll ( ) const
inline

Euler angle of rotation (in degrees) amount of roll in degrees

const float* NYXRotationSensorConnector::rotationMatrix ( ) const
inline

Rotation Matrix [3 x 3]

json_object * NYXRotationSensorConnector::toJSONObject ( )
virtual

Gets the sensor data as a json Object

JSON Format: Json Object { "rotationMatrix" : [0,1,2,3,4,5,6,7,8,9], "quaternionVector" : { "w" : float, "x" : float, "y" : float, "z" : float }, "eulerAngle" : { "roll" : float, "pitch" : float, "yaw" : float } }

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.

float NYXRotationSensorConnector::yaw ( ) const
inline

Euler angle of rotation (in degrees) amount of yaw in degrees


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