From: Jinkun Jang Date: Fri, 15 Mar 2013 16:17:32 +0000 (+0900) Subject: merge with master X-Git-Tag: 2.1b_release~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d9e7ac70e35c7660b4dec893a03ce42e80c45ec3;p=platform%2Fframework%2Fnative%2Fuix.git merge with master --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 8806f25..64bc1a1 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,9 @@ SET (${this_target}_SOURCE_FILES src/FUixSensorTiltSensorData.cpp src/FUixSensorGyroSensorData.cpp src/FUixSensorLightSensorData.cpp + src/FUixSensorGravitySensorData.cpp + src/FUixSensorUserAccelerationSensorData.cpp + src/FUixSensorDeviceOrientationSensorData.cpp src/FUixSensorSensorManager.cpp src/FUixSensor_ISensorCore.cpp src/FUixSensor_SensorUtil.cpp diff --git a/inc/FUixSensor.h b/inc/FUixSensor.h index 307d037..7023ddf 100755 --- a/inc/FUixSensor.h +++ b/inc/FUixSensor.h @@ -32,6 +32,9 @@ #include #include #include +#include +#include +#include #include #include #include diff --git a/inc/FUixSensorAccelerationSensorData.h b/inc/FUixSensorAccelerationSensorData.h index f1a087c..da6b829 100644 --- a/inc/FUixSensorAccelerationSensorData.h +++ b/inc/FUixSensorAccelerationSensorData.h @@ -61,6 +61,47 @@ public: */ virtual ~AccelerationSensorData(void); + /** + * Copying of objects using this copy constructor is allowed. + * + * @since 2.1 + * + * @param[in] rhs An instance of %AccelerationSensorData + */ + AccelerationSensorData(const AccelerationSensorData& rhs); + + /** + * Compares the equality of values between two %AccelerationSensorData objects by overriding the Tizen::Base::Object::Equals() method. + * + * @since 2.1 + * + * @return @c true if all the fields in the objects are equal, @n + * else @c false + * @param[in] rhs The Tizen::Base::Object with which the comparison is done + * @remarks An instance of Tizen::Graphics::Bitmap is not taken into account in the comparisons. + */ + virtual bool Equals(const Tizen::Base::Object& rhs) const; + + /** + * Gets the hash value of the current instance by overriding the Tizen::Base::Object::GetHashCode() method. + * + * @since 2.1 + * + * @return The hash value of the current instance + */ + virtual int GetHashCode(void) const; + + /** + * Copying of objects using this copy assignment operator is allowed. + * + * @since 2.1 + * + * @return A reference to this instance + * @param[in] rhs An instance of %AccelerationSensorData + */ + AccelerationSensorData& operator =(const AccelerationSensorData& rhs); + + private: virtual result GetValue(SensorDataKey dataKey, long& value) const; virtual result GetValue(SensorDataKey dataKey, float& value) const; diff --git a/inc/FUixSensorDeviceOrientationSensorData.h b/inc/FUixSensorDeviceOrientationSensorData.h new file mode 100644 index 0000000..85181d3 --- /dev/null +++ b/inc/FUixSensorDeviceOrientationSensorData.h @@ -0,0 +1,137 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FUixSensorDeviceOrientationSensorData.h + * @brief This is the header file for the %DeviceOrientationSensorData class. + * + * This header file contains the declarations of the %DeviceOrientationSensorData class. + */ + +#ifndef _FUIX_SENSOR_DEVICE_ORIENTATION_SENSOR_DATA_H_ +#define _FUIX_SENSOR_DEVICE_ORIENTATION_SENSOR_DATA_H_ + +#include +#include + +namespace Tizen { namespace Uix { namespace Sensor +{ +/** + * @class DeviceOrientationSensorData + * @brief This class stores device-orientation sensor data, including a time stamp. + * + * @since 2.1 + * + * @remarks @b Header @b %file: @b \#include @b @n + * @b Library : @b osp-uix + * + * The %DeviceOrientationSensorData class stores device-orientation sensor data, including a time stamp. + * @n + * For more information on the class features, see Sensor Manager. + */ +class _OSP_EXPORT_ DeviceOrientationSensorData + : public Tizen::Uix::Sensor::SensorData +{ +public: + /** + * This is the default constructor for this class. + * + * @since 2.1 + */ + DeviceOrientationSensorData(void); + + /** + * This is the destructor for this class. + * + * @since 2.1 + */ + virtual ~DeviceOrientationSensorData(void); + + /** + * Copying of objects using this copy constructor is allowed. + * + * @since 2.1 + * + * @param[in] rhs An instance of %DeviceOrientationSensorData + */ + DeviceOrientationSensorData(const DeviceOrientationSensorData& rhs); + + /** + * Compares the equality of values between two %DeviceOrientationSensorData objects by overriding the Tizen::Base::Object::Equals() method. + * + * @since 2.1 + * + * @return @c true if all the fields in the objects are equal, @n + * else @c false + * @param[in] rhs The Tizen::Base::Object with which the comparison is done + * @remarks An instance of Tizen::Graphics::Bitmap is not taken into account in the comparisons. + */ + virtual bool Equals(const Tizen::Base::Object& rhs) const; + + /** + * Gets the hash value of the current instance by overriding the Tizen::Base::Object::GetHashCode() method. + * + * @since 2.1 + * + * @return The hash value of the current instance + */ + virtual int GetHashCode(void) const; + + /** + * Copying of objects using this copy assignment operator is allowed. + * + * @since 2.1 + * + * @return A reference to this instance + * @param[in] rhs An instance of %DeviceOrientationSensorData + */ + DeviceOrientationSensorData& operator =(const DeviceOrientationSensorData& rhs); + + + +private: + virtual result GetValue(SensorDataKey dataKey, long& value) const; + virtual result GetValue(SensorDataKey dataKey, float& value) const; + virtual result GetValue(SensorDataKey dataKey, bool& value) const; + +public: + /** + * The yaw value of the device-orientation sensor data + * + * @since 2.1 + */ + float yaw; + + /** + * The roll value of the device-orientation sensor data + * + * @since 2.1 + */ + float roll; + + /** + * The pitch value of the device-orientation sensor data + * + * @since 2.1 + */ + float pitch; + + +}; // DeviceOrientationSensorData +} } }// Tizen::Uix::Sensor + +#endif // _FUIX_SENSOR_DEVICE_ORIENTATION_SENSOR_DATA_H_ diff --git a/inc/FUixSensorGravitySensorData.h b/inc/FUixSensorGravitySensorData.h new file mode 100644 index 0000000..00a4f7c --- /dev/null +++ b/inc/FUixSensorGravitySensorData.h @@ -0,0 +1,135 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FUixSensorGravitySensorData.h + * @brief This is the header file for the %GravitySensorData class. + * + * This header file contains the declarations of the %GravitySensorData class. + */ + +#ifndef _FUIX_SENSOR_GRAVITY_SENSOR_DATA_H_ +#define _FUIX_SENSOR_GRAVITY_SENSOR_DATA_H_ + +#include +#include + +namespace Tizen { namespace Uix { namespace Sensor +{ +/** + * @class GravitySensorData + * @brief This class stores gravity sensor data, including a time stamp. + * + * @since 2.1 + * + * @remarks @b Header @b %file: @b \#include @b @n + * @b Library : @b osp-uix + * + * The %GravitySensorData class stores gravity sensor data, including a time stamp. + * @n + * For more information on the class features, see Sensor Manager. + */ +class _OSP_EXPORT_ GravitySensorData + : public Tizen::Uix::Sensor::SensorData +{ +public: + /** + * This is the default constructor for this class. + * + * @since 2.1 + */ + GravitySensorData(void); + + /** + * This is the destructor for this class. + * + * @since 2.1 + */ + virtual ~GravitySensorData(void); + + /** + * Copying of objects using this copy constructor is allowed. + * + * @since 2.1 + * + * @param[in] rhs An instance of %GravitySensorData + */ + GravitySensorData(const GravitySensorData& rhs); + + /** + * Compares the equality of values between two %GravitySensorData objects by overriding the Tizen::Base::Object::Equals() method. + * + * @since 2.1 + * + * @return @c true if all the fields in the objects are equal, @n + * else @c false + * @param[in] rhs The Tizen::Base::Object with which the comparison is done + * @remarks An instance of Tizen::Graphics::Bitmap is not taken into account in the comparisons. + */ + virtual bool Equals(const Tizen::Base::Object& rhs) const; + + /** + * Gets the hash value of the current instance by overriding the Tizen::Base::Object::GetHashCode() method. + * + * @since 2.1 + * + * @return The hash value of the current instance + */ + virtual int GetHashCode(void) const; + + /** + * Copying of objects using this copy assignment operator is allowed. + * + * @since 2.1 + * + * @return A reference to this instance + * @param[in] rhs An instance of %GravitySensorData + */ + GravitySensorData& operator =(const GravitySensorData& rhs); + + + +private: + virtual result GetValue(SensorDataKey dataKey, long& value) const; + virtual result GetValue(SensorDataKey dataKey, float& value) const; + virtual result GetValue(SensorDataKey dataKey, bool& value) const; + +public: + /** + * The x-axis value of the gravity sensor data + * + * @since 2.1 + */ + float x; + + /** + * The y-axis value of the gravity sensor data + * + * @since 2.1 + */ + float y; + + /** + * The z-axis value of the gravity sensor data + * + * @since 2.1 + */ + float z; +}; // GravitySensorData +} } } // Tizen::Uix::Sensor + +#endif // _FUIX_SENSOR_GRAVITY_SENSOR_DATA_H_ diff --git a/inc/FUixSensorGyroSensorData.h b/inc/FUixSensorGyroSensorData.h index 8aa2b6a..6ad5038 100644 --- a/inc/FUixSensorGyroSensorData.h +++ b/inc/FUixSensorGyroSensorData.h @@ -61,6 +61,48 @@ public: */ virtual ~GyroSensorData(void); + /** + * Copying of objects using this copy constructor is allowed. + * + * @since 2.1 + * + * @param[in] rhs An instance of %GyroSensorData + */ + GyroSensorData(const GyroSensorData& rhs); + + /** + * Compares the equality of values between two %GyroSensorData objects by overriding the Tizen::Base::Object::Equals() method. + * + * @since 2.1 + * + * @return @c true if all the fields in the objects are equal, @n + * else @c false + * @param[in] rhs The Tizen::Base::Object with which the comparison is done + * @remarks An instance of Tizen::Graphics::Bitmap is not taken into account in the comparisons. + */ + virtual bool Equals(const Tizen::Base::Object& rhs) const; + + /** + * Gets the hash value of the current instance by overriding the Tizen::Base::Object::GetHashCode() method. + * + * @since 2.1 + * + * @return The hash value of the current instance + */ + virtual int GetHashCode(void) const; + + /** + * Copying of objects using this copy assignment operator is allowed. + * + * @since 2.1 + * + * @return A reference to this instance + * @param[in] rhs An instance of %GyroSensorData + */ + GyroSensorData& operator =(const GyroSensorData& rhs); + + + private: virtual result GetValue(SensorDataKey dataKey, long& value) const; virtual result GetValue(SensorDataKey dataKey, float& value) const; diff --git a/inc/FUixSensorIMotionEventListener.h b/inc/FUixSensorIMotionEventListener.h index a69c931..fddad1b 100644 --- a/inc/FUixSensorIMotionEventListener.h +++ b/inc/FUixSensorIMotionEventListener.h @@ -74,7 +74,7 @@ public: * * @since 2.0 * - * @see Tizen::Uix::Sensor::MotionSnapType + * @see Tizen::Uix::Sensor::MotionType */ virtual void OnDoubleTapDetected(void) = 0; @@ -89,6 +89,17 @@ public: */ virtual void OnShakeDetected(MotionState motionState) = 0; + /** + * Called when the move-to-ear event is detected. @n + * When a move-to-ear event occurs, and if its type is registered by an application, then the event is triggered. + * + * @since 2.1 + * + * @see Tizen::Uix::Sensor::MotionType + */ + + virtual void OnMoveToEarDetected(void) {} + protected: // @@ -102,12 +113,6 @@ protected: // and consistency-related issues in the application. // virtual void IMotionEventListener_Reserved2(void) {} - - // - // This method is for internal use only. Using this method can cause behavioral, security-related, - // and consistency-related issues in the application. - // - virtual void IMotionEventListener_Reserved3(void) {} }; // IMotionEventListener } } } // Tizen::Uix::Sensor diff --git a/inc/FUixSensorLightSensorData.h b/inc/FUixSensorLightSensorData.h index a6fa297..2bd795d 100644 --- a/inc/FUixSensorLightSensorData.h +++ b/inc/FUixSensorLightSensorData.h @@ -61,6 +61,46 @@ public: */ virtual ~LightSensorData(void); + /** + * Copying of objects using this copy constructor is allowed. + * + * @since 2.1 + * + * @param[in] rhs An instance of %LightSensorData + */ + LightSensorData(const LightSensorData& rhs); + + /** + * Compares the equality of values between two %LightSensorData objects by overriding the Tizen::Base::Object::Equals() method. + * + * @since 2.1 + * + * @return @c true if all the fields in the objects are equal, @n + * else @c false + * @param[in] rhs The Tizen::Base::Object with which the comparison is done + * @remarks An instance of Tizen::Graphics::Bitmap is not taken into account in the comparisons. + */ + virtual bool Equals(const Tizen::Base::Object& rhs) const; + + /** + * Gets the hash value of the current instance by overriding the Tizen::Base::Object::GetHashCode() method. + * + * @since 2.1 + * + * @return The hash value of the current instance + */ + virtual int GetHashCode(void) const; + + /** + * Copying of objects using this copy assignment operator is allowed. + * + * @since 2.1 + * + * @return A reference to this instance + * @param[in] rhs An instance of %LightSensorData + */ + LightSensorData& operator =(const LightSensorData& rhs); + private: virtual result GetValue(SensorDataKey dataKey, long& value) const; virtual result GetValue(SensorDataKey dataKey, float& value) const; diff --git a/inc/FUixSensorMagneticSensorData.h b/inc/FUixSensorMagneticSensorData.h index 77f735c..ac9cd6a 100644 --- a/inc/FUixSensorMagneticSensorData.h +++ b/inc/FUixSensorMagneticSensorData.h @@ -61,6 +61,46 @@ public: */ virtual ~MagneticSensorData(void); + /** + * Copying of objects using this copy constructor is allowed. + * + * @since 2.1 + * + * @param[in] rhs An instance of %MagneticSensorData + */ + MagneticSensorData(const MagneticSensorData& rhs); + + /** + * Compares the equality of values between two %MagneticSensorData objects by overriding the Tizen::Base::Object::Equals() method. + * + * @since 2.1 + * + * @return @c true if all the fields in the objects are equal, @n + * else @c false + * @param[in] rhs The Tizen::Base::Object with which the comparison is done + * @remarks An instance of Tizen::Graphics::Bitmap is not taken into account in the comparisons. + */ + virtual bool Equals(const Tizen::Base::Object& rhs) const; + + /** + * Gets the hash value of the current instance by overriding the Tizen::Base::Object::GetHashCode() method. + * + * @since 2.1 + * + * @return The hash value of the current instance + */ + virtual int GetHashCode(void) const; + + /** + * Copying of objects using this copy assignment operator is allowed. + * + * @since 2.1 + * + * @return A reference to this instance + * @param[in] rhs An instance of %MagneticSensorData + */ + MagneticSensorData& operator =(const MagneticSensorData& rhs); + private: virtual result GetValue(SensorDataKey dataKey, long& value) const; virtual result GetValue(SensorDataKey dataKey, float& value) const; diff --git a/inc/FUixSensorMotion.h b/inc/FUixSensorMotion.h index ec8fbcf..43d436d 100644 --- a/inc/FUixSensorMotion.h +++ b/inc/FUixSensorMotion.h @@ -142,7 +142,7 @@ public: * Multiple motion types of type Tizen::Uix::Sensor::MotionType can be combined using the logical OR operator. * @exception E_SUCCESS The method is successful. * @exception E_INVALID_STATE This instance has not been constructed as yet. - * @exception E_INVALID_ARG A specified input parameter is invalid. @if OSPCOMPAT @b Since: @b 2.0 @endif + * @exception E_INVALID_ARG A specified input parameter is invalid. * @remarks The specific error code can be accessed using the GetLastResult() method. */ void SetEnabled(unsigned long type); diff --git a/inc/FUixSensorMotionCommon.h b/inc/FUixSensorMotionCommon.h index 75c5228..a73ef39 100644 --- a/inc/FUixSensorMotionCommon.h +++ b/inc/FUixSensorMotionCommon.h @@ -43,6 +43,7 @@ enum MotionType MOTION_TYPE_SNAP = 0x0001, /**< The motion type: Snap */ MOTION_TYPE_SHAKE = 0x0002, /**< The motion type: Shake */ MOTION_TYPE_DOUBLETAP = 0x0004, /**< The motion type: Tap */ + MOTION_TYPE_MOVE_TO_EAR = 0x0008, /**< The motion type: Move to ear @b Since: @b 2.1 */ MOTION_TYPE_ALL = 0xFFFF, /**< The motion type: All */ }; @@ -61,7 +62,7 @@ enum MotionState MOTION_STARTED, /**< The specified motion has just started */ MOTION_INPROGRESS, /**< The specified motion is happening */ MOTION_ENDED, /**< The specified motion has just ended */ - MOTION_CANCELLED, /**< Reserved */ + MOTION_CANCELLED, /**< The specified motion has just canceled */ }; /** diff --git a/inc/FUixSensorProximitySensorData.h b/inc/FUixSensorProximitySensorData.h index 18ad0ef..0307f64 100644 --- a/inc/FUixSensorProximitySensorData.h +++ b/inc/FUixSensorProximitySensorData.h @@ -71,6 +71,46 @@ public: */ bool IsObjectDetected(void) const; + /** + * Copying of objects using this copy constructor is allowed. + * + * @since 2.1 + * + * @param[in] rhs An instance of %ProximitySensorData + */ + ProximitySensorData(const ProximitySensorData& rhs); + + /** + * Compares the equality of values between two %ProximitySensorData objects by overriding the Tizen::Base::Object::Equals() method. + * + * @since 2.1 + * + * @return @c true if all the fields in the objects are equal, @n + * else @c false + * @param[in] rhs The Tizen::Base::Object with which the comparison is done + * @remarks An instance of Tizen::Graphics::Bitmap is not taken into account in the comparisons. + */ + virtual bool Equals(const Tizen::Base::Object& rhs) const; + + /** + * Gets the hash value of the current instance by overriding the Tizen::Base::Object::GetHashCode() method. + * + * @since 2.1 + * + * @return The hash value of the current instance + */ + virtual int GetHashCode(void) const; + + /** + * Copying of objects using this copy assignment operator is allowed. + * + * @since 2.1 + * + * @return A reference to this instance + * @param[in] rhs An instance of %ProximitySensorData + */ + ProximitySensorData& operator =(const ProximitySensorData& rhs); + private: virtual result GetValue(SensorDataKey dataKey, long& value) const; virtual result GetValue(SensorDataKey dataKey, float& value) const; diff --git a/inc/FUixSensorSensorManager.h b/inc/FUixSensorSensorManager.h index 6178266..d02853e 100644 --- a/inc/FUixSensorSensorManager.h +++ b/inc/FUixSensorSensorManager.h @@ -179,7 +179,7 @@ public: * @exception E_OUT_OF_MEMORY The memory is insufficient. * @exception E_INVALID_ARG An interval must be greater than the maximum interval or less than the minimum interval or the sensor type is invalid. * @exception E_OPERATION_FAILED The operation has failed to add a sensor listener. - * @exception E_USER_ALREADY_REGISTERED The specified listener is already registered for the specified sensor type. + * @exception E_USER_ALREADY_REGISTERED The specified @c listener is already registered for the specified sensor type. * @exception E_UNSUPPORTED_OPERATION The target device does not support the specific sensor. */ @@ -656,7 +656,7 @@ public: * @exception E_OPERATION_FAILED The operation has failed. * @exception E_UNSUPPORTED_OPERATION The target device does not support the specific sensor. * @remarks The wake up feature is automatically disabled by the system as soon as the calling application is terminated. - * @remarks This method cannot be tested on the Emulator. It always returns E_SUCCESS on the Emulator. + * @remarks This method cannot be tested on the Emulator. It always returns @c E_SUCCESS on the Emulator. */ result SetWakeupEnabled(SensorType sensorType, bool enable); @@ -693,7 +693,7 @@ public: * @exception E_OPERATION_FAILED The operation has failed. * @exception E_UNSUPPORTED_OPERATION The target device does not support the specific sensor. * @remarks The specific error code can be accessed using the GetLastResult() method. - * @remarks This method cannot be tested on the Emulator. It always returns true on the Emulator. + * @remarks This method cannot be tested on the Emulator. It always returns @c true on the Emulator. */ bool IsWakeupEnabled(SensorType sensorType) const; diff --git a/inc/FUixSensorSensorTypes.h b/inc/FUixSensorSensorTypes.h index 66a2494..388b779 100644 --- a/inc/FUixSensorSensorTypes.h +++ b/inc/FUixSensorSensorTypes.h @@ -43,6 +43,9 @@ enum SensorType SENSOR_TYPE_TILT, /**< The tilt sensor type */ SENSOR_TYPE_GYRO, /**< The gyro sensor type */ SENSOR_TYPE_LIGHT, /**< The light sensor type */ + SENSOR_TYPE_GRAVITY, /**< The gravity sensor type @b Since: @b 2.1 */ + SENSOR_TYPE_USER_ACCELERATION, /**< The user-acceleration sensor type @b Since: @b 2.1 */ + SENSOR_TYPE_DEVICE_ORIENTATION, /**< The device-orientation sensor type @b Since: @b 2.1 */ SENSOR_TYPE_MAX, // This enum value is for internal use only. // Using this enum value can cause behavioral, // security-related, and consistency-related diff --git a/inc/FUixSensorTiltSensorData.h b/inc/FUixSensorTiltSensorData.h index faa7389..24fab84 100644 --- a/inc/FUixSensorTiltSensorData.h +++ b/inc/FUixSensorTiltSensorData.h @@ -61,6 +61,48 @@ public: */ virtual ~TiltSensorData(void); + /** + * Copying of objects using this copy constructor is allowed. + * + * @since 2.1 + * + * @param[in] rhs An instance of %TiltSensorData + */ + TiltSensorData(const TiltSensorData& rhs); + + /** + * Compares the equality of values between two %TiltSensorData objects by overriding the Tizen::Base::Object::Equals() method. + * + * @since 2.1 + * + * @return @c true if all the fields in the objects are equal, @n + * else @c false + * @param[in] rhs The Tizen::Base::Object with which the comparison is done + * @remarks An instance of Tizen::Graphics::Bitmap is not taken into account in the comparisons. + */ + virtual bool Equals(const Tizen::Base::Object& rhs) const; + + /** + * Gets the hash value of the current instance by overriding the Tizen::Base::Object::GetHashCode() method. + * + * @since 2.1 + * + * @return The hash value of the current instance + */ + virtual int GetHashCode(void) const; + + /** + * Copying of objects using this copy assignment operator is allowed. + * + * @since 2.1 + * + * @return A reference to this instance + * @param[in] rhs An instance of %TiltSensorData + */ + TiltSensorData& operator =(const TiltSensorData& rhs); + + + private: virtual result GetValue(SensorDataKey dataKey, long& value) const; virtual result GetValue(SensorDataKey dataKey, float& value) const; diff --git a/inc/FUixSensorUserAccelerationSensorData.h b/inc/FUixSensorUserAccelerationSensorData.h new file mode 100644 index 0000000..b1b4d74 --- /dev/null +++ b/inc/FUixSensorUserAccelerationSensorData.h @@ -0,0 +1,133 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FUixSensorUserAccelerationSensorData.h + * @brief This is the header file for the %UserAccelerationSensorData class. + * + * This header file contains the declarations of the %UserAccelerationSensorData class. + */ + +#ifndef _FUIX_SENSOR_USER_ACCELERATION_SENSOR_DATA_H_ +#define _FUIX_SENSOR_USER_ACCELERATION_SENSOR_DATA_H_ + +#include +#include + +namespace Tizen { namespace Uix { namespace Sensor +{ +/** + * @class UserAccelerationSensorData + * @brief This class stores user-acceleration sensor data, including a time stamp. + * + * @since 2.1 + * + * @remarks @b Header @b %file: @b \#include @b @n + * @b Library : @b osp-uix + * + * The %UserAccelerationSensorData class stores user-acceleration sensor data, including a time stamp. + * @n + * For more information on the class features, see Sensor Manager. + */ +class _OSP_EXPORT_ UserAccelerationSensorData + : public Tizen::Uix::Sensor::SensorData +{ +public: + /** + * This is the default constructor for this class. + * + * @since 2.1 + */ + UserAccelerationSensorData(void); + + /** + * This is the destructor for this class. + * + * @since 2.1 + */ + virtual ~UserAccelerationSensorData(void); + + /** + * Copying of objects using this copy constructor is allowed. + * + * @since 2.1 + * + * @param[in] rhs An instance of %UserAccelerationSensorData + */ + UserAccelerationSensorData(const UserAccelerationSensorData& rhs); + + /** + * Compares the equality of values between two %UserAccelerationSensorData objects by overriding the Tizen::Base::Object::Equals() method. + * + * @since 2.1 + * + * @return @c true if all the fields in the objects are equal, @n + * else @c false + * @param[in] rhs The Tizen::Base::Object with which the comparison is done + * @remarks An instance of Tizen::Graphics::Bitmap is not taken into account in the comparisons. + */ + virtual bool Equals(const Tizen::Base::Object& rhs) const; + + /** + * Gets the hash value of the current instance by overriding the Tizen::Base::Object::GetHashCode() method. + * + * @since 2.1 + * + * @return The hash value of the current instance + */ + virtual int GetHashCode(void) const; + + /** + * Copying of objects using this copy assignment operator is allowed. + * + * @since 2.1 + * + * @return A reference to this instance + * @param[in] rhs An instance of %UserAccelerationSensorData + */ + UserAccelerationSensorData& operator =(const UserAccelerationSensorData& rhs); + +private: + virtual result GetValue(SensorDataKey dataKey, long& value) const; + virtual result GetValue(SensorDataKey dataKey, float& value) const; + virtual result GetValue(SensorDataKey dataKey, bool& value) const; + +public: + /** + * The x-axis value of the user-acceleration sensor data + * + * @since 2.1 + */ + float x; + + /** + * The y-axis value of the user-acceleration sensor data + * + * @since 2.1 + */ + float y; + + /** + * The z-axis value of the user-acceleration sensor data + * + * @since 2.1 + */ + float z; +}; // UserAccelerationSensorData +} } } // Tizen::Uix::Sensor + +#endif // _FUIX_SENSOR_USER_ACCELERATION_SENSOR_DATA_H_ diff --git a/packaging/osp-uix.spec b/packaging/osp-uix.spec index 79f928c..75f4ff4 100755 --- a/packaging/osp-uix.spec +++ b/packaging/osp-uix.spec @@ -3,7 +3,7 @@ Name: osp-uix Summary: osp uix library -Version: 1.2.0.0 +Version: 1.2.1.0 Release: 2 Group: System/Libraries License: TO_BE/FILLED_IN diff --git a/src/FUixSensorAccelerationSensorData.cpp b/src/FUixSensorAccelerationSensorData.cpp index b3f1e05..685f02a 100644 --- a/src/FUixSensorAccelerationSensorData.cpp +++ b/src/FUixSensorAccelerationSensorData.cpp @@ -25,10 +25,13 @@ // Includes #include #include - +#include +#include #include #include "FUixSensor_SensorUtil.h" +using namespace Tizen::Base; + namespace Tizen { namespace Uix { namespace Sensor { namespace @@ -49,6 +52,75 @@ AccelerationSensorData::~AccelerationSensorData(void) } +AccelerationSensorData::AccelerationSensorData(const AccelerationSensorData& rhs) + :x(rhs.x) + ,y(rhs.y) + ,z(rhs.z) +{ + +} + +AccelerationSensorData& +AccelerationSensorData::operator =(const AccelerationSensorData& rhs) +{ + // check for self-assignment + if (this != &rhs) + { + timestamp = rhs.timestamp; + x = rhs.x; + y = rhs.y; + z = rhs.z; + } + + return *this; +} + +int +AccelerationSensorData::GetHashCode(void) const +{ + int hash = 0; + + hash += LongLong::GetHashCode(this->timestamp); + hash += Float::GetHashCode(this->x); + hash += Float::GetHashCode(this->y); + hash += Float::GetHashCode(this->z); + + return hash; +} + +bool +AccelerationSensorData::Equals(const Object& rhs) const +{ + const AccelerationSensorData* pRhs = dynamic_cast (&rhs); + if (pRhs == null) + { + return false; + } + + if (this->timestamp != pRhs->timestamp) + { + return false; + } + + if (this->x != pRhs->x) + { + return false; + } + + if (this->y != pRhs->y) + { + return false; + } + + if (this->z != pRhs->z) + { + return false; + } + + + return true; +} + result AccelerationSensorData::GetValue(SensorDataKey dataKey, long& value) const { diff --git a/src/FUixSensorDeviceOrientationSensorData.cpp b/src/FUixSensorDeviceOrientationSensorData.cpp new file mode 100644 index 0000000..86c3b49 --- /dev/null +++ b/src/FUixSensorDeviceOrientationSensorData.cpp @@ -0,0 +1,143 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FUixSensorDeviceOrientationSensorData.cpp + * @brief This is the implementation file for the %DeviceOrientationSensorData class. + * + * This files contains implementation of the %TiltSensorData class. + */ + +// Includes +#include +#include +#include +#include + +#include +#include "FUixSensor_SensorUtil.h" + +using namespace Tizen::Base; + +namespace Tizen { namespace Uix { namespace Sensor +{ +namespace +{ +static const wchar_t W_MSG_INVALID_SENSOR_DATA_KEY[] = L"A data matching the specified key and data type cannot be found."; +} // Anonymous + +DeviceOrientationSensorData::DeviceOrientationSensorData(void) + : yaw(0.0F) + , roll(0.0F) + , pitch(0.0F) +{ + +} + +DeviceOrientationSensorData::~DeviceOrientationSensorData(void) +{ + +} + +DeviceOrientationSensorData::DeviceOrientationSensorData(const DeviceOrientationSensorData& rhs) + :yaw(rhs.yaw) + ,roll(rhs.roll) + ,pitch(rhs.pitch) +{ + +} + +DeviceOrientationSensorData& +DeviceOrientationSensorData::operator =(const DeviceOrientationSensorData& rhs) +{ + // check for self-assignment + if (this != &rhs) + { + timestamp = rhs.timestamp; + yaw = rhs.yaw; + roll = rhs.roll; + pitch = rhs.pitch; + } + + return *this; +} + +int +DeviceOrientationSensorData::GetHashCode(void) const +{ + int hash = 0; + + hash += LongLong::GetHashCode(this->timestamp); + hash += Float::GetHashCode(this->yaw); + hash += Float::GetHashCode(this->roll); + hash += Float::GetHashCode(this->pitch); + + return hash; +} + +bool +DeviceOrientationSensorData::Equals(const Object& rhs) const +{ + const DeviceOrientationSensorData* pRhs = dynamic_cast (&rhs); + if (pRhs == null) + { + return false; + } + + if (this->timestamp != pRhs->timestamp) + { + return false; + } + + if (this->roll != pRhs->roll) + { + return false; + } + + if (this->roll != pRhs->roll) + { + return false; + } + + if (this->pitch != pRhs->pitch) + { + return false; + } + return true; +} + +result +DeviceOrientationSensorData::GetValue(SensorDataKey dataKey, long& value) const +{ + SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY); + return E_INVALID_ARG; +} + +result +DeviceOrientationSensorData::GetValue(SensorDataKey dataKey, float& value) const +{ + SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY); + return E_INVALID_ARG; +} + +result +DeviceOrientationSensorData::GetValue(SensorDataKey dataKey, bool& value) const +{ + SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY); + return E_INVALID_ARG; +} +} } }// Tizen::Uix::Sensor diff --git a/src/FUixSensorGravitySensorData.cpp b/src/FUixSensorGravitySensorData.cpp new file mode 100644 index 0000000..9f8286e --- /dev/null +++ b/src/FUixSensorGravitySensorData.cpp @@ -0,0 +1,143 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FUixSensorGravitySensorData.cpp + * @brief This is the implementation file for the %GravitySensorData class. + * + * This files contains implementation of the %GravitySensorData class. + */ + +// Includes +#include +#include +#include +#include + +#include +#include "FUixSensor_SensorUtil.h" + +using namespace Tizen::Base; + +namespace Tizen { namespace Uix { namespace Sensor +{ +namespace +{ +static const wchar_t W_MSG_INVALID_SENSOR_DATA_KEY[] = L"A data matching the specified key and data type cannot be found."; +} // Anonymous + +GravitySensorData::GravitySensorData(void) + : x(0.0F) + , y(0.0F) + , z(0.0F) +{ + +} + +GravitySensorData::~GravitySensorData(void) +{ + +} + +GravitySensorData::GravitySensorData(const GravitySensorData& rhs) + :x(rhs.x) + ,y(rhs.y) + ,z(rhs.z) +{ + +} + +GravitySensorData& +GravitySensorData::operator =(const GravitySensorData& rhs) +{ + // check for self-assignment + if (this != &rhs) + { + timestamp = rhs.timestamp; + x = rhs.x; + y = rhs.y; + z = rhs.z; + } + + return *this; +} + +int +GravitySensorData::GetHashCode(void) const +{ + int hash = 0; + + hash += LongLong::GetHashCode(this->timestamp); + hash += Float::GetHashCode(this->x); + hash += Float::GetHashCode(this->y); + hash += Float::GetHashCode(this->z); + + return hash; +} + +bool +GravitySensorData::Equals(const Object& rhs) const +{ + const GravitySensorData* pRhs = dynamic_cast (&rhs); + if (pRhs == null) + { + return false; + } + + if (this->timestamp != pRhs->timestamp) + { + return false; + } + + if (this->x != pRhs->x) + { + return false; + } + + if (this->y != pRhs->y) + { + return false; + } + + if (this->z != pRhs->z) + { + return false; + } + return true; +} + +result +GravitySensorData::GetValue(SensorDataKey dataKey, long& value) const +{ + SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY); + return E_INVALID_ARG; +} + +result +GravitySensorData::GetValue(SensorDataKey dataKey, float& value) const +{ + SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY); + return E_INVALID_ARG; +} + +result +GravitySensorData::GetValue(SensorDataKey dataKey, bool& value) const +{ + SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY); + return E_INVALID_ARG; +} +} } } // Tizen::Uix::Sensor diff --git a/src/FUixSensorGyroSensorData.cpp b/src/FUixSensorGyroSensorData.cpp index 61246a4..75c46c0 100644 --- a/src/FUixSensorGyroSensorData.cpp +++ b/src/FUixSensorGyroSensorData.cpp @@ -25,9 +25,13 @@ // Includes #include #include +#include +#include #include +using namespace Tizen::Base; + namespace Tizen { namespace Uix { namespace Sensor { namespace @@ -48,6 +52,74 @@ GyroSensorData::~GyroSensorData(void) } +GyroSensorData::GyroSensorData(const GyroSensorData& rhs) + :x(rhs.x) + ,y(rhs.y) + ,z(rhs.z) +{ + +} + +GyroSensorData& +GyroSensorData::operator =(const GyroSensorData& rhs) +{ + // check for self-assignment + if (this != &rhs) + { + timestamp = rhs.timestamp; + x = rhs.x; + y = rhs.y; + z = rhs.z; + } + + return *this; +} + +int +GyroSensorData::GetHashCode(void) const +{ + int hash = 0; + + hash += LongLong::GetHashCode(this->timestamp); + hash += Float::GetHashCode(this->x); + hash += Float::GetHashCode(this->y); + hash += Float::GetHashCode(this->z); + + return hash; +} + +bool +GyroSensorData::Equals(const Object& rhs) const +{ + const GyroSensorData* pRhs = dynamic_cast (&rhs); + if (pRhs == null) + { + return false; + } + + if (this->timestamp != pRhs->timestamp) + { + return false; + } + + if (this->x != pRhs->x) + { + return false; + } + + if (this->y != pRhs->y) + { + return false; + } + + if (this->z != pRhs->z) + { + return false; + } + + return true; +} + result GyroSensorData::GetValue(SensorDataKey dataKey, long& value) const { diff --git a/src/FUixSensorLightSensorData.cpp b/src/FUixSensorLightSensorData.cpp index 906faa6..8ad4426 100644 --- a/src/FUixSensorLightSensorData.cpp +++ b/src/FUixSensorLightSensorData.cpp @@ -25,9 +25,13 @@ // Includes #include #include +#include +#include #include +using namespace Tizen::Base; + namespace Tizen { namespace Uix { namespace Sensor { namespace @@ -46,6 +50,57 @@ LightSensorData::~LightSensorData(void) } +LightSensorData::LightSensorData(const LightSensorData& rhs) + :level(rhs.level) +{ + +} + +LightSensorData& +LightSensorData::operator =(const LightSensorData& rhs) +{ + // check for self-assignment + if (this != &rhs) + { + timestamp = rhs.timestamp; + level = rhs.level; + } + + return *this; +} + +int +LightSensorData::GetHashCode(void) const +{ + int hash = 0; + + hash += LongLong::GetHashCode(this->timestamp); + hash += Float::GetHashCode(this->level); + + return hash; +} + +bool +LightSensorData::Equals(const Object& rhs) const +{ + const LightSensorData* pRhs = dynamic_cast (&rhs); + if (pRhs == null) + { + return false; + } + + if (this->timestamp != pRhs->timestamp) + { + return false; + } + + if (this->level != pRhs->level) + { + return false; + } + + return true; +} result LightSensorData::GetValue(SensorDataKey dataKey, long& value) const { diff --git a/src/FUixSensorMagneticSensorData.cpp b/src/FUixSensorMagneticSensorData.cpp index 229b01c..a7ca4ac 100644 --- a/src/FUixSensorMagneticSensorData.cpp +++ b/src/FUixSensorMagneticSensorData.cpp @@ -25,10 +25,13 @@ // Includes #include #include - +#include +#include #include #include "FUixSensor_SensorUtil.h" +using namespace Tizen::Base; + namespace Tizen { namespace Uix { namespace Sensor { namespace @@ -49,6 +52,74 @@ MagneticSensorData::~MagneticSensorData(void) } +MagneticSensorData::MagneticSensorData(const MagneticSensorData& rhs) + :x(rhs.x) + ,y(rhs.y) + ,z(rhs.z) +{ + +} + +MagneticSensorData& +MagneticSensorData::operator =(const MagneticSensorData& rhs) +{ + // check for self-assignment + if (this != &rhs) + { + timestamp = rhs.timestamp; + x = rhs.x; + y = rhs.y; + z = rhs.z; + } + + return *this; +} + +int +MagneticSensorData::GetHashCode(void) const +{ + int hash = 0; + + hash += LongLong::GetHashCode(this->timestamp); + hash += Float::GetHashCode(this->x); + hash += Float::GetHashCode(this->y); + hash += Float::GetHashCode(this->z); + + return hash; +} + +bool +MagneticSensorData::Equals(const Object& rhs) const +{ + const MagneticSensorData* pRhs = dynamic_cast (&rhs); + if (pRhs == null) + { + return false; + } + + if (this->timestamp != pRhs->timestamp) + { + return false; + } + + if (this->x != pRhs->x) + { + return false; + } + + if (this->y != pRhs->y) + { + return false; + } + + if (this->z != pRhs->z) + { + return false; + } + + + return true; +} result MagneticSensorData::GetValue(SensorDataKey dataKey, long& value) const { diff --git a/src/FUixSensorProximitySensorData.cpp b/src/FUixSensorProximitySensorData.cpp index 77ca4c5..d91d5cd 100644 --- a/src/FUixSensorProximitySensorData.cpp +++ b/src/FUixSensorProximitySensorData.cpp @@ -25,10 +25,14 @@ // Includes #include #include +#include +#include #include #include "FUixSensor_SensorUtil.h" +using namespace Tizen::Base; + namespace Tizen { namespace Uix { namespace Sensor { namespace @@ -47,6 +51,59 @@ ProximitySensorData::~ProximitySensorData(void) } + +ProximitySensorData::ProximitySensorData(const ProximitySensorData& rhs) + :distance(rhs.distance) +{ + +} + +ProximitySensorData& +ProximitySensorData::operator =(const ProximitySensorData& rhs) +{ + // check for self-assignment + if (this != &rhs) + { + timestamp = rhs.timestamp; + distance = rhs.distance; + } + + return *this; +} + +int +ProximitySensorData::GetHashCode(void) const +{ + int hash = 0; + + hash += LongLong::GetHashCode(this->timestamp); + hash += Float::GetHashCode(this->distance); + + return hash; +} + +bool +ProximitySensorData::Equals(const Object& rhs) const +{ + const ProximitySensorData* pRhs = dynamic_cast (&rhs); + if (pRhs == null) + { + return false; + } + + if (this->timestamp != pRhs->timestamp) + { + return false; + } + + if (this->distance != pRhs->distance) + { + return false; + } + + return true; +} + result ProximitySensorData::GetValue(SensorDataKey dataKey, long& value) const { diff --git a/src/FUixSensorSensorData.cpp b/src/FUixSensorSensorData.cpp index c40e70c..616844c 100644 --- a/src/FUixSensorSensorData.cpp +++ b/src/FUixSensorSensorData.cpp @@ -25,7 +25,6 @@ // Includes #include #include - #include namespace Tizen { namespace Uix { namespace Sensor diff --git a/src/FUixSensorTiltSensorData.cpp b/src/FUixSensorTiltSensorData.cpp index 59357f3..c99828d 100644 --- a/src/FUixSensorTiltSensorData.cpp +++ b/src/FUixSensorTiltSensorData.cpp @@ -25,10 +25,14 @@ // Includes #include #include +#include +#include #include #include "FUixSensor_SensorUtil.h" +using namespace Tizen::Base; + namespace Tizen { namespace Uix { namespace Sensor { namespace @@ -49,6 +53,75 @@ TiltSensorData::~TiltSensorData(void) } +TiltSensorData::TiltSensorData(const TiltSensorData& rhs) + :azimuth(rhs.azimuth) + ,roll(rhs.roll) + ,pitch(rhs.pitch) +{ + +} + +TiltSensorData& +TiltSensorData::operator =(const TiltSensorData& rhs) +{ + // check for self-assignment + if (this != &rhs) + { + timestamp = rhs.timestamp; + azimuth = rhs.azimuth; + roll = rhs.roll; + pitch = rhs.pitch; + } + + return *this; +} + +int +TiltSensorData::GetHashCode(void) const +{ + int hash = 0; + + hash += LongLong::GetHashCode(this->timestamp); + hash += Float::GetHashCode(this->azimuth); + hash += Float::GetHashCode(this->roll); + hash += Float::GetHashCode(this->pitch); + + return hash; +} + +bool +TiltSensorData::Equals(const Object& rhs) const +{ + const TiltSensorData* pRhs = dynamic_cast (&rhs); + if (pRhs == null) + { + return false; + } + + if (this->timestamp != pRhs->timestamp) + { + return false; + } + + if (this->azimuth != pRhs->azimuth) + { + return false; + } + + if (this->roll != pRhs->roll) + { + return false; + } + + if (this->pitch != pRhs->pitch) + { + return false; + } + + + return true; +} + result TiltSensorData::GetValue(SensorDataKey dataKey, long& value) const { diff --git a/src/FUixSensorUserAccelerationSensorData.cpp b/src/FUixSensorUserAccelerationSensorData.cpp new file mode 100644 index 0000000..8139a4c --- /dev/null +++ b/src/FUixSensorUserAccelerationSensorData.cpp @@ -0,0 +1,144 @@ +// +// Open Service Platform +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FUixSensorUserAccelerationSensorData.cpp + * @brief This is the implementation file for the %UserAccelerationSensorData class. + * + * This files contains implementation of the %GravitySensorData class. + */ + +// Includes +#include +#include +#include +#include + +#include +#include "FUixSensor_SensorUtil.h" + +using namespace Tizen::Base; + + +namespace Tizen { namespace Uix { namespace Sensor +{ +namespace +{ +static const wchar_t W_MSG_INVALID_SENSOR_DATA_KEY[] = L"A data matching the specified key and data type cannot be found."; +} // Anonymous + +UserAccelerationSensorData::UserAccelerationSensorData(void) + : x(0.0F) + , y(0.0F) + , z(0.0F) +{ + +} + +UserAccelerationSensorData::~UserAccelerationSensorData(void) +{ + +} + +UserAccelerationSensorData::UserAccelerationSensorData(const UserAccelerationSensorData& rhs) + :x(rhs.x) + ,y(rhs.y) + ,z(rhs.z) +{ + +} + +UserAccelerationSensorData& +UserAccelerationSensorData::operator =(const UserAccelerationSensorData& rhs) +{ + // check for self-assignment + if (this != &rhs) + { + timestamp = rhs.timestamp; + x = rhs.x; + y = rhs.y; + z = rhs.z; + } + + return *this; +} + +int +UserAccelerationSensorData::GetHashCode(void) const +{ + int hash = 0; + + hash += LongLong::GetHashCode(this->timestamp); + hash += Float::GetHashCode(this->x); + hash += Float::GetHashCode(this->y); + hash += Float::GetHashCode(this->z); + + return hash; +} + +bool +UserAccelerationSensorData::Equals(const Object& rhs) const +{ + const UserAccelerationSensorData* pRhs = dynamic_cast (&rhs); + if (pRhs == null) + { + return false; + } + + if (this->timestamp != pRhs->timestamp) + { + return false; + } + + if (this->x != pRhs->x) + { + return false; + } + + if (this->y != pRhs->y) + { + return false; + } + + if (this->z != pRhs->z) + { + return false; + } + return true; +} + +result +UserAccelerationSensorData::GetValue(SensorDataKey dataKey, long& value) const +{ + SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY); + return E_INVALID_ARG; +} + +result +UserAccelerationSensorData::GetValue(SensorDataKey dataKey, float& value) const +{ + SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY); + return E_INVALID_ARG; +} + +result +UserAccelerationSensorData::GetValue(SensorDataKey dataKey, bool& value) const +{ + SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY); + return E_INVALID_ARG; +} +} } } // Tizen::Uix::Sensor diff --git a/src/FUixSensor_ISensorCore.cpp b/src/FUixSensor_ISensorCore.cpp index b0f0c4b..7e887cd 100644 --- a/src/FUixSensor_ISensorCore.cpp +++ b/src/FUixSensor_ISensorCore.cpp @@ -50,6 +50,9 @@ static const long SENSOR_MIN_INTERVALS[] = { 20L, // SENSOR_TYPE_TILT 20L, // SENSOR_TYPE_GYRO 100L, // SENSOR_TYPE_LIGHT + 20L, // SENSOR_TYPE_GRAVITY + 20L, // SENSOR_TYPE_USER_ACCELERATION + 20L, // SENSOR_TYPE_DEVICE_ORIENTATION }; static const long SENSOR_MAX_INTERVALS[] = { 100L, // SENSOR_TYPE_ACCELERATION @@ -58,6 +61,9 @@ static const long SENSOR_MAX_INTERVALS[] = { 1000L, // SENSOR_TYPE_TILT 100L, // SENSOR_TYPE_GYRO 5000L, // SENSOR_TYPE_LIGHT + 100L, // SENSOR_TYPE_GRAVITY + 100L, // SENSOR_TYPE_USER_ACCELERATION + 100L, // SENSOR_TYPE_DEVICE_ORIENTATION }; static const float MIN_VALUE_TILT = 0.0F; static const float MAX_VALUE_TILT = 360.0F; @@ -87,6 +93,12 @@ ConvertToSensorTypeEFromSensorType(SensorType sensorType) return SENSOR_GYROSCOPE; case SENSOR_TYPE_LIGHT: return SENSOR_LIGHT; + case SENSOR_TYPE_GRAVITY: + return SENSOR_GRAVITY; + case SENSOR_TYPE_USER_ACCELERATION: + return SENSOR_LINEAR_ACCELERATION; + case SENSOR_TYPE_DEVICE_ORIENTATION: + return SENSOR_DEVICE_ORIENTATION; default: SysAssertf(false, "ConvertToSensorTypeEFromSensorType() > Invalid SensorType [sensorType:%d]", sensorType); SetLastResult(E_INVALID_ARG); @@ -122,6 +134,12 @@ GetSensorTypeEFromSensorCoreEventType(_SensorCoreEventType eventType) return SENSOR_GYROSCOPE; case _SENSOR_CORE_EVENT_TYPE_LIGHT_LEVEL_DATA: return SENSOR_LIGHT; + case _SENSOR_CORE_EVENT_TYPE_GRAVITY_DATA: + return SENSOR_GRAVITY; + case _SENSOR_CORE_EVENT_TYPE_USER_ACCELERATION_DATA: + return SENSOR_LINEAR_ACCELERATION; + case _SENSOR_CORE_EVENT_TYPE_DEVICE_ORIENTATION_DATA: + return SENSOR_DEVICE_ORIENTATION; default: SysAssertf(false, "GetSensorTypeEFromSensorCoreEventType() > Invalid _SensorCoreEventType [eventType:%d]", eventType); SetLastResult(E_INVALID_ARG); @@ -225,9 +243,9 @@ OnRotationRateDataEventReceived(unsigned long long timestamp, sensor_data_accura eventBuffer.isEventValid = IsAccuracyValid(accuracy); eventBuffer.eventType = _SENSOR_CORE_EVENT_TYPE_ROTATION_RATE_DATA; eventBuffer.eventTimestamp = CorrectTimestamp(timestamp); - eventBuffer.eventKind.rotationRateData.x = x * DEGREE_TO_RADIAN; - eventBuffer.eventKind.rotationRateData.y = y * DEGREE_TO_RADIAN; - eventBuffer.eventKind.rotationRateData.z = z * DEGREE_TO_RADIAN; + eventBuffer.eventKind.rotationRateData.x = x; + eventBuffer.eventKind.rotationRateData.y = y; + eventBuffer.eventKind.rotationRateData.z = z; receiver.OnSensorCoreEventReceived(eventBuffer); } @@ -246,7 +264,56 @@ OnLightLevelDataEventReceived(unsigned long long timestamp, float lux, void* pUs void OnAccelerationSensorWakeupEventReceived(void *pUserData) { - SysLog(NID_UIX, "Device wake up by Acceleration sensor."); + SysLog(NID_UIX, " OnAccelerationSensorWakeupEventReceived Device wake up by Acceleration sensor."); +} + +void +OnGravityDataEventReceived(unsigned long long timestamp, sensor_data_accuracy_e accuracy,float x, float y, float z, void* pUserData) +{ + _ISensorCoreEventReceiver& receiver= *static_cast<_ISensorCoreEventReceiver*>(pUserData); + _SensorCoreEvent& eventBuffer = receiver.GetSensorCoreEventBuffer(); + + SysLog(NID_UIX, "taehwan.son OnGravityDataEventReceived."); + eventBuffer.isEventValid = IsAccuracyValid(accuracy); + eventBuffer.eventType = _SENSOR_CORE_EVENT_TYPE_GRAVITY_DATA; + eventBuffer.eventTimestamp = CorrectTimestamp(timestamp); + eventBuffer.eventKind.gravityData.x = x; + eventBuffer.eventKind.gravityData.y = y; + eventBuffer.eventKind.gravityData.z = z; + receiver.OnSensorCoreEventReceived(eventBuffer); + +} + +void +OnUserAccelerationDataEventReceived(unsigned long long timestamp, sensor_data_accuracy_e accuracy,float x, float y, float z, void* pUserData) +{ + _ISensorCoreEventReceiver& receiver= *static_cast<_ISensorCoreEventReceiver*>(pUserData); + _SensorCoreEvent& eventBuffer = receiver.GetSensorCoreEventBuffer(); + + SysLog(NID_UIX, "OnUserAccelerationDataEventReceived."); + eventBuffer.isEventValid = IsAccuracyValid(accuracy); + eventBuffer.eventType = _SENSOR_CORE_EVENT_TYPE_USER_ACCELERATION_DATA; + eventBuffer.eventTimestamp = CorrectTimestamp(timestamp); + eventBuffer.eventKind.userAccelerationData.x = x * METER_PER_SECOND_SQUARE_TO_G; + eventBuffer.eventKind.userAccelerationData.y = y * METER_PER_SECOND_SQUARE_TO_G; + eventBuffer.eventKind.userAccelerationData.z = z * METER_PER_SECOND_SQUARE_TO_G; + receiver.OnSensorCoreEventReceived(eventBuffer); +} + +void +OnDeviceOrientationDataEventReceived(unsigned long long timestamp, sensor_data_accuracy_e accuracy,float yaw, float pitch, float roll, void* pUserData) +{ + _ISensorCoreEventReceiver& receiver= *static_cast<_ISensorCoreEventReceiver*>(pUserData); + _SensorCoreEvent& eventBuffer = receiver.GetSensorCoreEventBuffer(); + + SysLog(NID_UIX, "OnDeviceOrientationDataEventReceived."); + eventBuffer.isEventValid = IsAccuracyValid(accuracy); + eventBuffer.eventType = _SENSOR_CORE_EVENT_TYPE_DEVICE_ORIENTATION_DATA; + eventBuffer.eventTimestamp = CorrectTimestamp(timestamp); + eventBuffer.eventKind.deviceOrientationData.yaw = yaw; + eventBuffer.eventKind.deviceOrientationData.pitch = pitch; + eventBuffer.eventKind.deviceOrientationData.roll = roll; + receiver.OnSensorCoreEventReceived(eventBuffer); } // Internal management methods ----------------------------------------------------------------------------------------------- // @@ -344,6 +411,21 @@ PrepareSensorCoreEventSensing(sensor_h sensorHandle, _SensorCoreEventType eventT sensorResult = sensor_awake_set_cb(sensorHandle, SENSOR_ACCELEROMETER, OnAccelerationSensorWakeupEventReceived, pUserData); break; } + case _SENSOR_CORE_EVENT_TYPE_GRAVITY_DATA: + { + sensorResult = sensor_gravity_set_cb(sensorHandle, interval, OnGravityDataEventReceived, pUserData); + break; + } + case _SENSOR_CORE_EVENT_TYPE_USER_ACCELERATION_DATA: + { + sensorResult = sensor_linear_acceleration_set_cb(sensorHandle, interval, OnUserAccelerationDataEventReceived, pUserData); + break; + } + case _SENSOR_CORE_EVENT_TYPE_DEVICE_ORIENTATION_DATA: + { + sensorResult = sensor_device_orientation_set_cb(sensorHandle, interval, OnDeviceOrientationDataEventReceived, pUserData); + break; + } default: { // PARADOX @@ -420,6 +502,21 @@ UnprepareSensorCoreEventSensing(sensor_h sensorHandle, _SensorCoreEventType even sensorResult = sensor_awake_unset_cb(sensorHandle, SENSOR_ACCELEROMETER); break; } + case _SENSOR_CORE_EVENT_TYPE_GRAVITY_DATA: + { + sensorResult = sensor_gravity_unset_cb(sensorHandle); + break; + } + case _SENSOR_CORE_EVENT_TYPE_USER_ACCELERATION_DATA: + { + sensorResult = sensor_linear_acceleration_unset_cb(sensorHandle); + break; + } + case _SENSOR_CORE_EVENT_TYPE_DEVICE_ORIENTATION_DATA: + { + sensorResult = sensor_device_orientation_unset_cb(sensorHandle); + break; + } default: { // PARADOX @@ -452,129 +549,94 @@ UnprepareSensorCoreEventSensing(sensor_h sensorHandle, _SensorCoreEventType even } result +StartSensorType(sensor_h sensorHandle, sensor_type_e sensorTypeE) +{ + int sensorResult = sensor_start(sensorHandle, sensorTypeE); + if (!IsSuccess(sensorResult)) + { + // SENSOR_ERROR_IO_ERROR or SENSOR_ERROR_OPERATION_FAILED + if (_AppInfo::GetApiVersion() == Tizen::Base::_API_VERSION_2_0 && _AppInfo::IsOspCompat()) + { + SysAssertf(false, "StartSensorCoreEventSensing() > sensor_start() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, sensorTypeE, sensorResult); + SetLastResult(E_DEVICE_UNAVAILABLE); + return E_DEVICE_UNAVAILABLE; + } + else + { + SysAssertf(false, "StartSensorCoreEventSensing() > sensor_start() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, sensorTypeE, sensorResult); + SetLastResult(E_OPERATION_FAILED); + return E_OPERATION_FAILED; + } + } + + sensorResult = sensor_set_always_on(sensorHandle, sensorTypeE); + if (!IsSuccess(sensorResult)) + { + // SENSOR_ERROR_IO_ERROR + if (_AppInfo::GetApiVersion() == Tizen::Base::_API_VERSION_2_0 && _AppInfo::IsOspCompat()) + { + SysAssertf(false, "StartSensorCoreEventSensing() > sensor_set_always_on() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, sensorTypeE, sensorResult); + SetLastResult(E_DEVICE_UNAVAILABLE); + return E_DEVICE_UNAVAILABLE; + } + else + { + SysAssertf(false, "StartSensorCoreEventSensing() > sensor_set_always_on() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, sensorTypeE, sensorResult); + SetLastResult(E_OPERATION_FAILED); + return E_OPERATION_FAILED; + } + } + return E_SUCCESS; +} + +result StartSensorCoreEventSensing(sensor_h sensorHandle, _SensorCoreEventType eventType) { switch (eventType) { case _SENSOR_CORE_EVENT_TYPE_TILT_DATA: { - int sensorResult = sensor_start(sensorHandle, SENSOR_ACCELEROMETER); - if (!IsSuccess(sensorResult)) - { - // SENSOR_ERROR_IO_ERROR or SENSOR_ERROR_OPERATION_FAILED - if (_AppInfo::GetApiVersion() == Tizen::Base::_API_VERSION_2_0 && _AppInfo::IsOspCompat()) - { - SysAssertf(false, "StartSensorCoreEventSensing() > sensor_start() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, SENSOR_ACCELEROMETER, sensorResult); - SetLastResult(E_DEVICE_UNAVAILABLE); - return E_DEVICE_UNAVAILABLE; - } - else - { - SysAssertf(false, "StartSensorCoreEventSensing() > sensor_start() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, SENSOR_ACCELEROMETER, sensorResult); - SetLastResult(E_OPERATION_FAILED); - return E_OPERATION_FAILED; - } - } - - sensorResult = sensor_start(sensorHandle, SENSOR_ORIENTATION); - if (!IsSuccess(sensorResult)) - { - // SENSOR_ERROR_IO_ERROR or SENSOR_ERROR_OPERATION_FAILED - sensor_stop(sensorHandle, SENSOR_ACCELEROMETER); - - if(_AppInfo::GetApiVersion() == Tizen::Base::_API_VERSION_2_0 && _AppInfo::IsOspCompat()) - { - SysAssertf(false, "StartSensorCoreEventSensing() > sensor_start() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, SENSOR_ORIENTATION, sensorResult); - SetLastResult(E_DEVICE_UNAVAILABLE); - return E_DEVICE_UNAVAILABLE; - } - else - { - SysAssertf(false, "StartSensorCoreEventSensing() > sensor_start() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, SENSOR_ORIENTATION, sensorResult); - SetLastResult(E_OPERATION_FAILED); - return E_OPERATION_FAILED; - } - - } - sensorResult = sensor_set_always_on(sensorHandle, SENSOR_ACCELEROMETER); - if (!IsSuccess(sensorResult)) - { - // SENSOR_ERROR_IO_ERROR - if (_AppInfo::GetApiVersion() == Tizen::Base::_API_VERSION_2_0 && _AppInfo::IsOspCompat()) - { - SysAssertf(false, "StartSensorCoreEventSensing() > sensor_set_always_on() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, SENSOR_ACCELEROMETER, sensorResult); - SetLastResult(E_DEVICE_UNAVAILABLE); - return E_DEVICE_UNAVAILABLE; - } - else - { - SysAssertf(false, "StartSensorCoreEventSensing() > sensor_set_always_on() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, SENSOR_ACCELEROMETER, sensorResult); - SetLastResult(E_OPERATION_FAILED); - return E_OPERATION_FAILED; - } - } - sensorResult = sensor_set_always_on(sensorHandle, SENSOR_ORIENTATION); - if (!IsSuccess(sensorResult)) - { - // SENSOR_ERROR_IO_ERROR - if (_AppInfo::GetApiVersion() == Tizen::Base::_API_VERSION_2_0 && _AppInfo::IsOspCompat()) - { - SysAssertf(false, "StartSensorCoreEventSensing() > sensor_set_always_on() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, SENSOR_ORIENTATION, sensorResult); - SetLastResult(E_DEVICE_UNAVAILABLE); - return E_DEVICE_UNAVAILABLE; - } - else - { - SysAssertf(false, "StartSensorCoreEventSensing() > sensor_set_always_on() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, SENSOR_ORIENTATION, sensorResult); - SetLastResult(E_OPERATION_FAILED); - return E_OPERATION_FAILED; - } - - } + StartSensorType(sensorHandle,SENSOR_ACCELEROMETER); + StartSensorType(sensorHandle,SENSOR_ORIENTATION); + break; + } + case _SENSOR_CORE_EVENT_TYPE_GRAVITY_DATA: + { + SysLog(NID_UIX,"taehwan.son "); + StartSensorType(sensorHandle,SENSOR_GRAVITY); break; } default: { sensor_type_e sensorTypeE = GetSensorTypeEFromSensorCoreEventType(eventType); - - int sensorResult = sensor_start(sensorHandle, sensorTypeE); - if (!IsSuccess(sensorResult)) - { - // SENSOR_ERROR_IO_ERROR or SENSOR_ERROR_OPERATION_FAILED - if(_AppInfo::GetApiVersion() == Tizen::Base::_API_VERSION_2_0 && _AppInfo::IsOspCompat()) - { - SysAssertf(false, "StartSensorCoreEventSensing() > sensor_start() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, sensorTypeE, sensorResult); - SetLastResult(E_DEVICE_UNAVAILABLE); - return E_DEVICE_UNAVAILABLE; - } - else - { - SysAssertf(false, "StartSensorCoreEventSensing() > sensor_start() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, sensorTypeE, sensorResult); - SetLastResult(E_OPERATION_FAILED); - return E_OPERATION_FAILED; - } - } - sensorResult = sensor_set_always_on(sensorHandle, sensorTypeE); - if (!IsSuccess(sensorResult)) - { - // SENSOR_ERROR_IO_ERROR - if (_AppInfo::GetApiVersion() == Tizen::Base::_API_VERSION_2_0 && _AppInfo::IsOspCompat()) - { - SysAssertf(false, "StartSensorCoreEventSensing() > sensor_set_always_on() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, sensorTypeE, sensorResult); - SetLastResult(E_DEVICE_UNAVAILABLE); - return E_DEVICE_UNAVAILABLE; - } - else - { - SysAssertf(false, "StartSensorCoreEventSensing() > sensor_set_always_on() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, sensorTypeE, sensorResult); - SetLastResult(E_OPERATION_FAILED); - return E_OPERATION_FAILED; - } - } + StartSensorType(sensorHandle,sensorTypeE); break; } } + return E_SUCCESS; +} + +result +StopSensorType(sensor_h sensorHandle, sensor_type_e sensorTypeE) +{ + int sensorResult = sensor_stop(sensorHandle,sensorTypeE ); + if (!IsSuccess(sensorResult)) + { + if (_AppInfo::GetApiVersion() == Tizen::Base::_API_VERSION_2_0 && _AppInfo::IsOspCompat()) + { + // SENSOR_ERROR_IO_ERROR + SysAssertf(false, "StartSensorCoreEventSensing() > sensor_stop() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, sensorTypeE, sensorResult); + SetLastResult(E_DEVICE_UNAVAILABLE); + return E_DEVICE_UNAVAILABLE; + } + else + { + SysAssertf(false, "StartSensorCoreEventSensing() > sensor_stop() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, sensorTypeE, sensorResult); + SetLastResult(E_OPERATION_FAILED); + return E_OPERATION_FAILED; + } + } return E_SUCCESS; } @@ -585,66 +647,19 @@ StopSensorCoreEventSensing(sensor_h sensorHandle, _SensorCoreEventType eventType { case _SENSOR_CORE_EVENT_TYPE_TILT_DATA: { - int sensorResult = sensor_stop(sensorHandle, SENSOR_ORIENTATION); - if (!IsSuccess(sensorResult)) - { - // SENSOR_ERROR_IO_ERROR - if (_AppInfo::GetApiVersion() == Tizen::Base::_API_VERSION_2_0 && _AppInfo::IsOspCompat()) - { - SysAssertf(false, "StartSensorCoreEventSensing() > sensor_stop() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, SENSOR_ORIENTATION, sensorResult); - SetLastResult(E_DEVICE_UNAVAILABLE); - return E_DEVICE_UNAVAILABLE; - } - else - { - SysAssertf(false, "StartSensorCoreEventSensing() > sensor_stop() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, SENSOR_ACCELEROMETER, sensorResult); - SetLastResult(E_OPERATION_FAILED); - return E_OPERATION_FAILED; - } - - } - - sensorResult = sensor_stop(sensorHandle, SENSOR_ACCELEROMETER); - if (!IsSuccess(sensorResult)) - { - if (_AppInfo::GetApiVersion() == Tizen::Base::_API_VERSION_2_0 && _AppInfo::IsOspCompat()) - { - // SENSOR_ERROR_IO_ERROR - SysAssertf(false, "StartSensorCoreEventSensing() > sensor_stop() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, SENSOR_ACCELEROMETER, sensorResult); - SetLastResult(E_DEVICE_UNAVAILABLE); - return E_DEVICE_UNAVAILABLE; - } - else - { - SysAssertf(false, "StartSensorCoreEventSensing() > sensor_stop() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, SENSOR_ACCELEROMETER, sensorResult); - SetLastResult(E_OPERATION_FAILED); - return E_OPERATION_FAILED; - } - - } + StopSensorType(sensorHandle,SENSOR_ORIENTATION ); + StopSensorType(sensorHandle,SENSOR_ACCELEROMETER ); + break; + } + case _SENSOR_CORE_EVENT_TYPE_GRAVITY_DATA: + { + StopSensorType(sensorHandle,SENSOR_GRAVITY); break; } default: { sensor_type_e sensorTypeE = GetSensorTypeEFromSensorCoreEventType(eventType); - - int sensorResult = sensor_stop(sensorHandle, sensorTypeE); - if (!IsSuccess(sensorResult)) - { - if (_AppInfo::GetApiVersion() == Tizen::Base::_API_VERSION_2_0 && _AppInfo::IsOspCompat()) - { - SysAssertf(false, "StopSensorCoreEventSensing() > sensor_stop() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, sensorTypeE, sensorResult); - SetLastResult(E_DEVICE_UNAVAILABLE); - return E_DEVICE_UNAVAILABLE; - } - else - { - SysAssertf(false, "StopSensorCoreEventSensing() > sensor_stop() failed. [handle:%p, sensorTypeE:%d, result:%d]", sensorHandle, sensorTypeE, sensorResult); - SetLastResult(E_OPERATION_FAILED); - return E_OPERATION_FAILED; - } - // SENSOR_ERROR_IO_ERROR - } + StopSensorType(sensorHandle,sensorTypeE); break; } } @@ -693,6 +708,21 @@ ResetSensorCoreDataEventSensingInterval(sensor_h sensorHandle, _SensorCoreEventT sensorResult = sensor_light_set_interval(sensorHandle, interval); break; } + case _SENSOR_CORE_EVENT_TYPE_GRAVITY_DATA: + { + sensorResult = sensor_gravity_set_interval(sensorHandle, interval); + break; + } + case _SENSOR_CORE_EVENT_TYPE_USER_ACCELERATION_DATA: + { + sensorResult = sensor_gravity_set_interval(sensorHandle, interval); + break; + } + case _SENSOR_CORE_EVENT_TYPE_DEVICE_ORIENTATION_DATA: + { + sensorResult = sensor_gravity_set_interval(sensorHandle, interval); + break; + } default: { // PARADOX diff --git a/src/FUixSensor_MotionImpl.cpp b/src/FUixSensor_MotionImpl.cpp index aaa88e8..a185d78 100644 --- a/src/FUixSensor_MotionImpl.cpp +++ b/src/FUixSensor_MotionImpl.cpp @@ -96,6 +96,16 @@ _MotionImpl::__MotionEventReceiver(unsigned int eventType, sensor_event_data_t* } break; + + case MOTION_ENGINE_EVENT_DIRECT_CALL: + { + SysLog(NID_UIX, "Detected MOVE_TO_EAR event(%d)\n", eventData); + + if (eventData == MOTION_ENGINE_DIRECT_CALL_DETECTION) + pMotionEventListener->OnMoveToEarDetected(); + + } + break; } } } @@ -205,6 +215,27 @@ _MotionImpl::SetEnabled(unsigned long type) SysTryReturnVoidResult(NID_UIX, ret == 0, E_INVALID_STATE, "[E_INVALID_STATE] Failed to unregister motion double tap event."); } } + + if (type & MOTION_TYPE_MOVE_TO_EAR) + { + if (__motionType & MOTION_TYPE_MOVE_TO_EAR) + { + SysLog(NID_UIX, "MOTION_TYPE_MOVE_TO_EAR is already registered."); + } + else + { + ret = sf_register_event(__handle, MOTION_ENGINE_EVENT_DIRECT_CALL, null, __MotionEventReceiver, (void*) __pIMotionEventListener); + SysTryReturnVoidResult(NID_UIX, ret == 0, E_INVALID_STATE, "[E_INVALID_STATE] Failed to register motion direct call event."); + } + } + else + { + if (__motionType & MOTION_TYPE_MOVE_TO_EAR) + { + ret = sf_unregister_event(__handle, MOTION_ENGINE_EVENT_DIRECT_CALL); + SysTryReturnVoidResult(NID_UIX, ret == 0, E_INVALID_STATE, "[E_INVALID_STATE] Failed to unregister motion direct call event."); + } + } __motionType = type; SetLastResult(E_SUCCESS); @@ -222,6 +253,9 @@ _MotionImpl::IsSupported(MotionType type) const case MOTION_TYPE_SHAKE: // fall through case MOTION_TYPE_DOUBLETAP: + // fall through + case MOTION_TYPE_MOVE_TO_EAR: + isSupported = true; break; @@ -238,7 +272,7 @@ _MotionImpl::IsSupported(MotionType type) const bool _MotionImpl::IsMotionTypeValid(unsigned long type) { - if (type > MOTION_TYPE_NONE && type <= (MOTION_TYPE_SNAP | MOTION_TYPE_SHAKE | MOTION_TYPE_DOUBLETAP)) + if (type > MOTION_TYPE_NONE && type <= (MOTION_TYPE_SNAP | MOTION_TYPE_SHAKE | MOTION_TYPE_DOUBLETAP | MOTION_TYPE_MOVE_TO_EAR)) { return true; } diff --git a/src/FUixSensor_SensorCoreEventTypes.h b/src/FUixSensor_SensorCoreEventTypes.h index c9b60f4..6811189 100644 --- a/src/FUixSensor_SensorCoreEventTypes.h +++ b/src/FUixSensor_SensorCoreEventTypes.h @@ -38,6 +38,9 @@ enum _SensorCoreEventType _SENSOR_CORE_EVENT_TYPE_ROTATION_RATE_DATA, _SENSOR_CORE_EVENT_TYPE_LIGHT_LEVEL_DATA, _SENSOR_CORE_EVENT_TYPE_ACCELERATION_SENSOR_WAKEUP, + _SENSOR_CORE_EVENT_TYPE_GRAVITY_DATA, + _SENSOR_CORE_EVENT_TYPE_USER_ACCELERATION_DATA, + _SENSOR_CORE_EVENT_TYPE_DEVICE_ORIENTATION_DATA, _SENSOR_CORE_EVENT_TYPE_MAX, _SENSOR_CORE_EVENT_TYPE_NONE = -1, }; @@ -78,6 +81,14 @@ struct _SensorCoreEventTiltAxisOf3Dimension float azimuth; }; +struct _SensorCoreEventDeviceOrientationAxisOf3Dimension +{ + float yaw; + float roll; + float pitch; +}; + + struct _SensorCoreEventLevel { float level; @@ -92,6 +103,9 @@ union _SensorCoreEventKind _SensorCoreEventTiltAxisOf3Dimension tiltData; _SensorCoreEventAxisOf3Dimension rotationRateData; _SensorCoreEventLevel lightLevelData; + _SensorCoreEventAxisOf3Dimension gravityData; + _SensorCoreEventAxisOf3Dimension userAccelerationData; + _SensorCoreEventDeviceOrientationAxisOf3Dimension deviceOrientationData; }; struct _SensorCoreEvent diff --git a/src/FUixSensor_SensorEventDeliverer.cpp b/src/FUixSensor_SensorEventDeliverer.cpp index 09d6fe0..be5a6eb 100644 --- a/src/FUixSensor_SensorEventDeliverer.cpp +++ b/src/FUixSensor_SensorEventDeliverer.cpp @@ -32,6 +32,10 @@ #include #include #include +#include +#include +#include + #include #include "FUixSensor_SensorEventDeliverer.h" @@ -146,6 +150,12 @@ ConvertToSensorCoreDataEventTypeFromSensorType(SensorType sensorType) return _SENSOR_CORE_EVENT_TYPE_ROTATION_RATE_DATA; case SENSOR_TYPE_LIGHT: return _SENSOR_CORE_EVENT_TYPE_LIGHT_LEVEL_DATA; + case SENSOR_TYPE_GRAVITY: + return _SENSOR_CORE_EVENT_TYPE_GRAVITY_DATA; + case SENSOR_TYPE_USER_ACCELERATION: + return _SENSOR_CORE_EVENT_TYPE_USER_ACCELERATION_DATA; + case SENSOR_TYPE_DEVICE_ORIENTATION: + return _SENSOR_CORE_EVENT_TYPE_DEVICE_ORIENTATION_DATA; default: SysAssertf(false, "ConvertToSensorCoreEventTypeFromSensorType() > Invalid SensorType [sensorType:%d]", sensorType); return _SENSOR_CORE_EVENT_TYPE_NONE; @@ -226,6 +236,36 @@ IsSensorCoreEventChanged(_SensorCoreEventType eventType, _SensorCoreEvent& befor } break; } + case _SENSOR_CORE_EVENT_TYPE_GRAVITY_DATA: + { + if (IsEquals(before.eventKind.gravityData.x, after.eventKind.gravityData.x) && + IsEquals(before.eventKind.gravityData.y, after.eventKind.gravityData.y) && + IsEquals(before.eventKind.gravityData.z, after.eventKind.gravityData.z)) + { + return false; + } + break; + } + case _SENSOR_CORE_EVENT_TYPE_USER_ACCELERATION_DATA: + { + if (IsEquals(before.eventKind.userAccelerationData.x, after.eventKind.userAccelerationData.x) && + IsEquals(before.eventKind.userAccelerationData.y, after.eventKind.userAccelerationData.y) && + IsEquals(before.eventKind.userAccelerationData.z, after.eventKind.userAccelerationData.z)) + { + return false; + } + break; + } + case _SENSOR_CORE_EVENT_TYPE_DEVICE_ORIENTATION_DATA: + { + if (IsEquals(before.eventKind.deviceOrientationData.yaw, after.eventKind.deviceOrientationData.yaw) && + IsEquals(before.eventKind.deviceOrientationData.roll, after.eventKind.deviceOrientationData.roll) && + IsEquals(before.eventKind.deviceOrientationData.pitch, after.eventKind.deviceOrientationData.pitch)) + { + return false; + } + break; + } default: { SysAssertf(false, "IsSensorCoreEventChanged() > Invalid _SensorCoreEventType [eventType:%d]", eventType); @@ -344,6 +384,27 @@ _SensorEventDeliverer::OnSensorCoreEventReceived(_SensorCoreEvent& event) static_cast(sensorDataBuffer).level = event.eventKind.lightLevelData.level; break; } + case _SENSOR_CORE_EVENT_TYPE_GRAVITY_DATA: + { + static_cast(sensorDataBuffer).x = event.eventKind.gravityData.x; + static_cast(sensorDataBuffer).y = event.eventKind.gravityData.y; + static_cast(sensorDataBuffer).z = event.eventKind.gravityData.z; + break; + } + case _SENSOR_CORE_EVENT_TYPE_USER_ACCELERATION_DATA: + { + static_cast(sensorDataBuffer).x = event.eventKind.userAccelerationData.x; + static_cast(sensorDataBuffer).y = event.eventKind.userAccelerationData.y; + static_cast(sensorDataBuffer).z = event.eventKind.userAccelerationData.z; + break; + } + case _SENSOR_CORE_EVENT_TYPE_DEVICE_ORIENTATION_DATA: + { + static_cast(sensorDataBuffer).yaw = event.eventKind.deviceOrientationData.yaw; + static_cast(sensorDataBuffer).roll = event.eventKind.deviceOrientationData.roll; + static_cast(sensorDataBuffer).pitch = event.eventKind.deviceOrientationData.pitch; + break; + } default: { SysAssertf(false, "OnSensorCoreEventReceived() > Invalid _SensorCoreEventType [eventType:%d]", eventType); diff --git a/src/FUixSensor_SensorManagerImpl.cpp b/src/FUixSensor_SensorManagerImpl.cpp index efec9ce..c58008f 100644 --- a/src/FUixSensor_SensorManagerImpl.cpp +++ b/src/FUixSensor_SensorManagerImpl.cpp @@ -38,6 +38,9 @@ #include #include #include +#include +#include +#include #include #include @@ -72,6 +75,12 @@ CreateSensorDataDelivererN(SensorType sensorType) return new (std::nothrow) _SpecifiedSensorDataEventDelivererT(); case SENSOR_TYPE_LIGHT: return new (std::nothrow) _SpecifiedSensorDataEventDelivererT(); + case SENSOR_TYPE_GRAVITY: + return new (std::nothrow) _SpecifiedSensorDataEventDelivererT(); + case SENSOR_TYPE_USER_ACCELERATION: + return new (std::nothrow) _SpecifiedSensorDataEventDelivererT(); + case SENSOR_TYPE_DEVICE_ORIENTATION: + return new (std::nothrow) _SpecifiedSensorDataEventDelivererT(); default: SysAssertf(false, "CreateSensorDataDelivererN() > Invalid SensorType [sensorType:%d]", sensorType); return null;