• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., 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 OHOS_HDI_SENSOR_V1_1_ISENSORINTERFACE_VDI_H
17 #define OHOS_HDI_SENSOR_V1_1_ISENSORINTERFACE_VDI_H
18 
19 #include "hdf_load_vdi.h"
20 #include "isensor_callback_vdi.h"
21 
22 namespace OHOS {
23 namespace HDI {
24 namespace Sensor {
25 namespace V1_1 {
26 
27 #define HDI_SENSOR_VDI_LIBNAME "libhdi_sensor_impl.z.so"
28 
29 struct HdfSensorInformationVdi {
30     std::string sensorName;
31     std::string vendorName;
32     std::string firmwareVersion;
33     std::string hardwareVersion;
34     int32_t sensorTypeId;
35     int32_t sensorId;
36     float maxRange;
37     float accuracy;
38     float power;
39     int64_t minDelay;
40     int64_t maxDelay;
41 };
42 
43 class ISensorInterfaceVdi {
44 public:
45     virtual ~ISensorInterfaceVdi() = default;
46     virtual int32_t Init() = 0;
47     virtual int32_t GetAllSensorInfo(std::vector<HdfSensorInformationVdi>& info) = 0;
48     virtual int32_t Enable(int32_t sensorId) = 0;
49     virtual int32_t Disable(int32_t sensorId) = 0;
50     virtual int32_t SetBatch(int32_t sensorId, int64_t samplingInterval, int64_t reportInterval) = 0;
51     virtual int32_t SetMode(int32_t sensorId, int32_t mode) = 0;
52     virtual int32_t SetOption(int32_t sensorId, uint32_t option) = 0;
53     virtual int32_t Register(int32_t groupId, const sptr<ISensorCallbackVdi>& callbackObj) = 0;
54     virtual int32_t Unregister(int32_t groupId, const sptr<ISensorCallbackVdi>& callbackObj) = 0;
55 };
56 
57 struct WrapperSensorVdi {
58     struct HdfVdiBase base;
59     ISensorInterfaceVdi *sensorModule;
60 };
61 } // V1_1
62 } // Sensor
63 } // HDI
64 } // OHOS
65 
66 #endif // OHOS_HDI_SENSOR_V1_1_ISENSORINTERFACE_VDI_H
67