2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUixSensor_SensorUtil.h
20 * @brief This is the header file for the %_SensorUtil class.
22 * This header file contains the constants and the declarations of the %_SensorUtil class.
25 #ifndef _FUIX_SENSOR_INTERNAL_SENSOR_UTIL_H_
26 #define _FUIX_SENSOR_INTERNAL_SENSOR_UTIL_H_
28 #include <FBaseUtilMath.h>
29 #include <FUixSensorSensorTypes.h>
31 namespace Tizen { namespace Uix { namespace Sensor
33 static const double GRAVITATIONAL_ACCELERATION = 9.80665f; // m/s^2
34 static const double PI = Tizen::Base::Utility::Math::GetPi(); // PI = 3.1415926535897932...
35 static const double MICROSECOND_TO_MILLISECOND = 0.001;
36 static const double METER_PER_SECOND_SQUARE_TO_G = 1.0 / GRAVITATIONAL_ACCELERATION;
37 static const double DEGREE_TO_RADIAN = (PI / 180.0);
38 static const double RADIAN_TO_DEGREE = (180.0 / PI);
39 static const int BIT_FOR_TIMESTAMP_CUTTING = 33;
41 template <typename Numeric> inline bool
42 IsEquals(Numeric a, Numeric b)
44 return !(a > b) && !(a < b);
50 static bool IsSensorTypeValid(SensorType sensorType);
51 static result CheckSensorTypeValidation(SensorType sensorType);
52 static result CheckIntervalValidation(SensorType sensorType, long interval);
53 static double Atan2(double y, double x);
54 static long CutTimestamp(long long timestamp);
55 static bool IsObjectDetected(float distance);
61 } } }// Tizen::Uix::Sensor
63 #endif // _FUIX_SENSOR_INTERNAL_SENSOR_UTIL_H_