1 /* 2 * Copyright (c) 2022 Chipsea Technologies (Shenzhen) Corp., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef MEDICAL_SENSOR_H 17 #define MEDICAL_SENSOR_H 18 19 #include <string> 20 #include <vector> 21 22 #include "parcel.h" 23 24 namespace OHOS { 25 namespace Sensors { 26 class MedicalSensor : public Parcelable { 27 public: 28 MedicalSensor(); 29 virtual ~MedicalSensor() = default; 30 uint32_t GetSensorId() const; 31 void SetSensorId(uint32_t sensorId); 32 std::string GetName() const; 33 void SetName(const std::string &name); 34 std::string GetVendor() const; 35 void SetVendor(const std::string &vendor); 36 uint32_t GetVersion() const; 37 void SetVersion(uint32_t version); 38 float GetMaxRange() const; 39 void SetMaxRange(float maxRange); 40 float GetResolution() const; 41 void SetResolution(float resolution); 42 uint32_t GetFlags() const; 43 void SetFlags(uint32_t flags); 44 int32_t GetFifoMaxEventCount() const; 45 void SetFifoMaxEventCount(int32_t fifoMaxEventCount); 46 int64_t GetMinSamplePeriodNs() const; 47 void SetMinSamplePeriodNs(int64_t minSamplePeriodNs); 48 int64_t GetMaxSamplePeriodNs() const; 49 void SetMaxSamplePeriodNs(int64_t maxSamplePeriodNs); 50 std::vector<uint32_t> GetReserved() const; 51 void SetReserved(const std::vector<uint32_t> &reserved); 52 bool ReadFromParcel(Parcel &parcel); 53 static std::unique_ptr<MedicalSensor> Unmarshalling(Parcel &parcel); 54 virtual bool Marshalling(Parcel &parcel) const override; 55 56 private: 57 uint32_t sensorId_; 58 std::string name_; 59 std::string vendor_; 60 uint32_t version_; 61 float maxRange_; 62 float resolution_; 63 uint32_t flags_; 64 int32_t fifoMaxEventCount_; 65 int64_t minSamplePeriodNs_; 66 int64_t maxSamplePeriodNs_; 67 std::vector<uint32_t> reserved_; 68 }; 69 } // namespace Sensors 70 } // namespace OHOS 71 #endif // MEDICAL_SENSOR_H