*/
// EXTERNAL INCLUDES
+#ifdef CAPI_SYSTEM_SENSOR_SUPPORT
+#include <sensor/sensor.h>
+
+#define SENSOR_ENABLED
+#endif
+
#include <deque>
#include <dali/public-api/object/base-object.h>
-#include <timer.h>
// INTERNAL INCLUDES
-#include <tilt-sensor.h>
+#include <public-api/adaptor-framework/timer.h>
+#include <devel-api/adaptor-framework/tilt-sensor.h>
namespace Dali
{
static Dali::TiltSensor Get();
/**
- * @copydoc Dali::TiltSensor::Enable()
+ * @copydoc Dali::TiltSensor::Start()
*/
- bool Enable();
+ bool Start();
/**
- * @copydoc Dali::TiltSensor::Disable()
+ * @copydoc Dali::TiltSensor::Stop()
*/
- void Disable();
+ void Stop();
/**
- * @copydoc Dali::TiltSensor::IsEnabled()
+ * @copydoc Dali::TiltSensor::IsStarted()
*/
- bool IsEnabled() const;
+ bool IsStarted() const;
/**
* @copydoc Dali::TiltSensor::GetRoll()
*/
static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+ /**
+ * Update sensor data
+ * @note This is called by static sensor callback function
+ * @param[in] event sensor event data
+ */
+#ifdef SENSOR_ENABLED
+ void Update(sensor_event_s *event);
+#endif
+
private:
+ enum State
+ {
+ DISCONNECTED,
+ CONNECTED,
+ STARTED,
+ STOPPED
+ };
+
/**
* Private constructor; see also TiltSensor::New()
*/
virtual ~TiltSensor();
/**
- * Timer callback to update the tilt values
+ * Connect sensor device
+ */
+ bool Connect();
+ /**
+ * Disconnect sensor device
*/
- bool Update();
+ void Disconnect();
// Undefined
TiltSensor(const TiltSensor&);
TiltSensor& operator=(TiltSensor&);
private:
-
+ State mState;
float mFrequencyHertz;
- Dali::Timer mTimer;
- SlotDelegate< TiltSensor > mTimerSlot;
- int mSensorFrameworkHandle;
+#ifdef SENSOR_ENABLED
+ sensor_type_e mSensorType;
+ sensor_h mSensor;
+ sensor_listener_h mSensorListener;
+#else
+ int mSensorType;
+ int* mSensor;
+ int* mSensorListener;
+#endif
float mRoll;
float mPitch;
Radian mRotationThreshold;
- std::deque<float> mRollValues;
- std::deque<float> mPitchValues;
-
TiltedSignalType mTiltedSignal;
};