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 
getSensorType() const21 uint8_t PlatformSensor::getSensorType() const {
22   return mSensorInfo->sensorType;
23 }
24 
getMinInterval() const25 uint64_t PlatformSensor::getMinInterval() const {
26   return mSensorInfo->minInterval;
27 }
28 
reportsBiasEvents() const29 bool PlatformSensor::reportsBiasEvents() const {
30   return mSensorInfo->reportsBiasEvents == 1;
31 }
32 
supportsPassiveMode() const33 bool PlatformSensor::supportsPassiveMode() const {
34   return mSensorInfo->supportsPassiveMode == 1;
35 }
36 
getSensorName() const37 const char *PlatformSensor::getSensorName() const {
38   return mSensorInfo->sensorName;
39 }
40 
getSensorIndex() const41 uint8_t PlatformSensor::getSensorIndex() const {
42   return CHRE_SENSOR_INDEX_DEFAULT;
43 }
44 
getTargetGroupMask() const45 uint16_t PlatformSensor::getTargetGroupMask() const {
46   return kDefaultTargetGroupMask;
47 }
48 
PlatformSensor(PlatformSensor && other)49 PlatformSensor::PlatformSensor(PlatformSensor &&other) {
50   *this = std::move(other);
51 }
52 
operator =(PlatformSensor && other)53 PlatformSensor &PlatformSensor::operator=(PlatformSensor &&other) {
54   // Note: if this implementation is ever changed to depend on "this" containing
55   // initialized values, the move constructor implementation must be updated.
56   mSensorHandle = other.mSensorHandle;
57   mSensorInfo = other.mSensorInfo;
58   other.mSensorInfo = nullptr;
59 
60   return *this;
61 }
62 
63 }  // namespace chre
64