1bae4d13cSopenharmony_ci/* 2bae4d13cSopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd. 3bae4d13cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4bae4d13cSopenharmony_ci * you may not use this file except in compliance with the License. 5bae4d13cSopenharmony_ci * You may obtain a copy of the License at 6bae4d13cSopenharmony_ci * 7bae4d13cSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8bae4d13cSopenharmony_ci * 9bae4d13cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10bae4d13cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11bae4d13cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12bae4d13cSopenharmony_ci * See the License for the specific language governing permissions and 13bae4d13cSopenharmony_ci * limitations under the License. 14bae4d13cSopenharmony_ci */ 15bae4d13cSopenharmony_ci 16bae4d13cSopenharmony_ci#ifndef SENSOR_H 17bae4d13cSopenharmony_ci#define SENSOR_H 18bae4d13cSopenharmony_ci 19bae4d13cSopenharmony_ci#include <string> 20bae4d13cSopenharmony_ci#include <vector> 21bae4d13cSopenharmony_ci 22bae4d13cSopenharmony_ci#include "parcel.h" 23bae4d13cSopenharmony_ci 24bae4d13cSopenharmony_cinamespace OHOS { 25bae4d13cSopenharmony_cinamespace Sensors { 26bae4d13cSopenharmony_ciclass Sensor : public Parcelable { 27bae4d13cSopenharmony_cipublic: 28bae4d13cSopenharmony_ci Sensor(); 29bae4d13cSopenharmony_ci virtual ~Sensor() = default; 30bae4d13cSopenharmony_ci int32_t GetSensorId() const; 31bae4d13cSopenharmony_ci void SetSensorId(int32_t sensorId); 32bae4d13cSopenharmony_ci int32_t GetSensorTypeId() const; 33bae4d13cSopenharmony_ci void SetSensorTypeId(int32_t sensorTypeId); 34bae4d13cSopenharmony_ci std::string GetSensorName() const; 35bae4d13cSopenharmony_ci void SetSensorName(const std::string &sensorName); 36bae4d13cSopenharmony_ci std::string GetVendorName() const; 37bae4d13cSopenharmony_ci void SetVendorName(const std::string &vendorName); 38bae4d13cSopenharmony_ci std::string GetHardwareVersion() const; 39bae4d13cSopenharmony_ci void SetHardwareVersion(const std::string &hardwareVersion); 40bae4d13cSopenharmony_ci std::string GetFirmwareVersion() const; 41bae4d13cSopenharmony_ci void SetFirmwareVersion(const std::string &firmwareVersion); 42bae4d13cSopenharmony_ci float GetMaxRange() const; 43bae4d13cSopenharmony_ci void SetMaxRange(float maxRange); 44bae4d13cSopenharmony_ci float GetResolution() const; 45bae4d13cSopenharmony_ci void SetResolution(float resolution); 46bae4d13cSopenharmony_ci float GetPower() const; 47bae4d13cSopenharmony_ci void SetPower(float power); 48bae4d13cSopenharmony_ci uint32_t GetFlags() const; 49bae4d13cSopenharmony_ci void SetFlags(uint32_t flags); 50bae4d13cSopenharmony_ci int32_t GetFifoMaxEventCount() const; 51bae4d13cSopenharmony_ci void SetFifoMaxEventCount(int32_t fifoMaxEventCount); 52bae4d13cSopenharmony_ci int64_t GetMinSamplePeriodNs() const; 53bae4d13cSopenharmony_ci void SetMinSamplePeriodNs(int64_t minSamplePeriodNs); 54bae4d13cSopenharmony_ci int64_t GetMaxSamplePeriodNs() const; 55bae4d13cSopenharmony_ci void SetMaxSamplePeriodNs(int64_t maxSamplePeriodNs); 56bae4d13cSopenharmony_ci bool ReadFromParcel(Parcel &parcel); 57bae4d13cSopenharmony_ci static std::unique_ptr<Sensor> Unmarshalling(Parcel &parcel); 58bae4d13cSopenharmony_ci virtual bool Marshalling(Parcel &parcel) const override; 59bae4d13cSopenharmony_ci 60bae4d13cSopenharmony_ciprivate: 61bae4d13cSopenharmony_ci int32_t sensorId_; 62bae4d13cSopenharmony_ci int32_t sensorTypeId_; 63bae4d13cSopenharmony_ci std::string sensorName_; 64bae4d13cSopenharmony_ci std::string vendorName_; 65bae4d13cSopenharmony_ci std::string firmwareVersion_; 66bae4d13cSopenharmony_ci std::string hardwareVersion_; 67bae4d13cSopenharmony_ci float maxRange_; 68bae4d13cSopenharmony_ci float resolution_; 69bae4d13cSopenharmony_ci float power_; 70bae4d13cSopenharmony_ci uint32_t flags_; 71bae4d13cSopenharmony_ci int32_t fifoMaxEventCount_; 72bae4d13cSopenharmony_ci int64_t minSamplePeriodNs_; 73bae4d13cSopenharmony_ci int64_t maxSamplePeriodNs_; 74bae4d13cSopenharmony_ci}; 75bae4d13cSopenharmony_ci} // namespace Sensors 76bae4d13cSopenharmony_ci} // namespace OHOS 77bae4d13cSopenharmony_ci#endif // SENSOR_H 78