1 #ifndef DALI_SENSOR_TIZEN_TILT_SENSOR_IMPL_TIZEN_H
2 #define DALI_SENSOR_TIZEN_TILT_SENSOR_IMPL_TIZEN_H
5 * Copyright (c) 2021 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 #ifdef CAPI_SYSTEM_SENSOR_SUPPORT
23 #include <sensor/sensor.h>
24 #define SENSOR_ENABLED
27 #include <dali/internal/sensor/common/tilt-sensor-impl.h>
28 #include <dali/public-api/object/base-object.h>
32 #include <dali/devel-api/adaptor-framework/tilt-sensor.h>
33 #include <dali/public-api/adaptor-framework/timer.h>
42 * TiltSensorTizen provides pitch & roll values when the device is tilted.
44 class TiltSensorTizen : public Dali::Internal::Adaptor::TiltSensor
47 typedef Dali::TiltSensor::TiltedSignalType TiltedSignalType;
51 * @return New instance of TiltSensorTizen
53 static TiltSensorTizen* New();
56 * @copydoc Dali::TiltSensor::Start()
58 bool Start() override;
61 * @copydoc Dali::TiltSensor::Stop()
66 * @copydoc Dali::TiltSensor::IsStarted()
68 bool IsStarted() const override;
71 * @copydoc Dali::TiltSensor::GetRoll()
73 float GetRoll() const override;
76 * @copydoc Dali::TiltSensor::GetPitch()
78 float GetPitch() const override;
81 * @copydoc Dali::TiltSensor::GetRotation()
83 Quaternion GetRotation() const override;
86 * @copydoc Dali::TiltSensor::TiltedSignal()
88 TiltedSignalType& TiltedSignal() override;
91 * @copydoc Dali::TiltSensor::SetUpdateFrequency()
93 void SetUpdateFrequency(float frequencyHertz) override;
96 * @copydoc Dali::TiltSensor::GetUpdateFrequency()
98 float GetUpdateFrequency() const override;
101 * @copydoc Dali::TiltSensor::SetRotationThreshold()
103 void SetRotationThreshold(Radian rotationThreshold) override;
106 * @copydoc Dali::TiltSensor::GetRotationThreshold()
108 Radian GetRotationThreshold() const override;
111 * Connects a callback function with the object's signals.
112 * @param[in] object The object providing the signal.
113 * @param[in] tracker Used to disconnect the signal.
114 * @param[in] signalName The signal to connect to.
115 * @param[in] functor A newly allocated FunctorDelegate.
116 * @return True if the signal was connected.
117 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
119 static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
123 * @note This is called by static sensor callback function
124 * @param[in] event sensor event data
126 #ifdef SENSOR_ENABLED
127 void Update(sensor_event_s* event);
140 * Private constructor; see also TiltSensor::New()
147 virtual ~TiltSensorTizen();
150 * Connect sensor device
154 * Disconnect sensor device
159 TiltSensorTizen(const TiltSensor&);
162 TiltSensorTizen& operator=(TiltSensor&);
166 float mFrequencyHertz;
168 #ifdef SENSOR_ENABLED
169 sensor_type_e mSensorType;
171 sensor_listener_h mSensorListener;
175 int* mSensorListener;
180 Quaternion mRotation;
182 Radian mRotationThreshold;
184 TiltedSignalType mTiltedSignal;
187 } // namespace Adaptor
189 } // namespace Internal
193 #endif // DALI_SENSOR_TIZEN_TILT_SENSOR_IMPL_TIZEN_H