1 #ifndef DALI_SENSOR_COMMON_TILT_SENSOR_IMPL_H
2 #define DALI_SENSOR_COMMON_TILT_SENSOR_IMPL_H
5 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/object/base-object.h>
25 #include <dali/public-api/adaptor-framework/timer.h>
26 #include <dali/devel-api/adaptor-framework/tilt-sensor.h>
39 * TiltSensor provides pitch & roll values when the device is tilted.
41 class TiltSensor : public Dali::BaseObject
53 ~TiltSensor() override;
55 typedef Dali::TiltSensor::TiltedSignalType TiltedSignalType;
58 * @copydoc Dali::TiltSensor::Start()
63 * @copydoc Dali::TiltSensor::Stop()
68 * @copydoc Dali::TiltSensor::IsStarted()
70 virtual bool IsStarted() const;
73 * @copydoc Dali::TiltSensor::GetRoll()
75 virtual float GetRoll() const;
78 * @copydoc Dali::TiltSensor::GetPitch()
80 virtual float GetPitch() const;
83 * @copydoc Dali::TiltSensor::GetRotation()
85 virtual Quaternion GetRotation() const;
88 * @copydoc Dali::TiltSensor::TiltedSignal()
90 virtual TiltedSignalType& TiltedSignal();
93 * @copydoc Dali::TiltSensor::SetUpdateFrequency()
95 virtual void SetUpdateFrequency( float frequencyHertz );
98 * @copydoc Dali::TiltSensor::GetUpdateFrequency()
100 virtual float GetUpdateFrequency() const;
103 * @copydoc Dali::TiltSensor::SetRotationThreshold()
105 virtual void SetRotationThreshold(Radian rotationThreshold);
108 * @copydoc Dali::TiltSensor::GetRotationThreshold()
110 virtual Radian GetRotationThreshold() const;
113 * Connects a callback function with the object's signals.
114 * @param[in] object The object providing the signal.
115 * @param[in] tracker Used to disconnect the signal.
116 * @param[in] signalName The signal to connect to.
117 * @param[in] functor A newly allocated FunctorDelegate.
118 * @return True if the signal was connected.
119 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
121 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
124 } // namespace Adaptor
126 } // namespace Internal
128 inline Internal::Adaptor::TiltSensor& GetImplementation(Dali::TiltSensor& sensor)
130 DALI_ASSERT_ALWAYS( sensor && "TiltSensor handle is empty" );
132 BaseObject& handle = sensor.GetBaseObject();
134 return static_cast<Internal::Adaptor::TiltSensor&>(handle);
137 inline const Internal::Adaptor::TiltSensor& GetImplementation(const Dali::TiltSensor& sensor)
139 DALI_ASSERT_ALWAYS( sensor && "TiltSensor handle is empty" );
141 const BaseObject& handle = sensor.GetBaseObject();
143 return static_cast<const Internal::Adaptor::TiltSensor&>(handle);
148 #endif // DALI_SENSOR_COMMON_TILT_SENSOR_IMPL_H