1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "chre/platform/platform_sensor.h"
18 
19 namespace chre {
20 
21 uint8_t PlatformSensor::getSensorType() const {
22   return mSensorInfo->sensorType;
23 }
24 
25 uint64_t PlatformSensor::getMinInterval() const {
26   return mSensorInfo->minInterval;
27 }
28 
29 bool PlatformSensor::reportsBiasEvents() const {
30   return mSensorInfo->reportsBiasEvents == 1;
31 }
32 
33 bool PlatformSensor::supportsPassiveMode() const {
34   return mSensorInfo->supportsPassiveMode == 1;
35 }
36 
37 const char *PlatformSensor::getSensorName() const {
38   return mSensorInfo->sensorName;
39 }
40 
41 PlatformSensor::PlatformSensor(PlatformSensor &&other) {
42   *this = std::move(other);
43 }
44 
45 PlatformSensor &PlatformSensor::operator=(PlatformSensor &&other) {
46   // Note: if this implementation is ever changed to depend on "this" containing
47   // initialized values, the move constructor implementation must be updated.
48   mSensorHandle = other.mSensorHandle;
49   mSensorInfo = other.mSensorInfo;
50   other.mSensorInfo = nullptr;
51 
52   return *this;
53 }
54 
55 }  // namespace chre
56