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 FUixSensorUserAccelerationSensorData.cpp
20 * @brief This is the implementation file for the %UserAccelerationSensorData class.
22 * This files contains implementation of the %GravitySensorData class.
26 #include <FBaseErrors.h>
27 #include <FBaseSysLog.h>
28 #include <FBaseFloat.h>
29 #include <FBaseLongLong.h>
31 #include <FUixSensorUserAccelerationSensorData.h>
32 #include "FUixSensor_SensorUtil.h"
34 using namespace Tizen::Base;
37 namespace Tizen { namespace Uix { namespace Sensor
41 static const wchar_t W_MSG_INVALID_SENSOR_DATA_KEY[] = L"A data matching the specified key and data type cannot be found.";
44 UserAccelerationSensorData::UserAccelerationSensorData(void)
52 UserAccelerationSensorData::~UserAccelerationSensorData(void)
57 UserAccelerationSensorData::UserAccelerationSensorData(const UserAccelerationSensorData& rhs)
65 UserAccelerationSensorData&
66 UserAccelerationSensorData::operator =(const UserAccelerationSensorData& rhs)
68 // check for self-assignment
71 timestamp = rhs.timestamp;
81 UserAccelerationSensorData::GetHashCode(void) const
85 hash += LongLong::GetHashCode(this->timestamp);
86 hash += Float::GetHashCode(this->x);
87 hash += Float::GetHashCode(this->y);
88 hash += Float::GetHashCode(this->z);
94 UserAccelerationSensorData::Equals(const Object& rhs) const
96 const UserAccelerationSensorData* pRhs = dynamic_cast <const UserAccelerationSensorData*>(&rhs);
102 if (this->timestamp != pRhs->timestamp)
107 if (this->x != pRhs->x)
112 if (this->y != pRhs->y)
117 if (this->z != pRhs->z)
125 UserAccelerationSensorData::GetValue(SensorDataKey dataKey, long& value) const
127 SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY);
128 return E_INVALID_ARG;
132 UserAccelerationSensorData::GetValue(SensorDataKey dataKey, float& value) const
134 SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY);
135 return E_INVALID_ARG;
139 UserAccelerationSensorData::GetValue(SensorDataKey dataKey, bool& value) const
141 SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY);
142 return E_INVALID_ARG;
144 } } } // Tizen::Uix::Sensor