1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef SENSOR_DEVICE_IF_H 10 #define SENSOR_DEVICE_IF_H 11 12 #include "sensor_device_type.h" 13 14 struct SensorOps { 15 int32_t (*Enable)(void); 16 int32_t (*Disable)(void); 17 int32_t (*SetBatch)(int64_t samplingInterval, int64_t reportInterval); 18 int32_t (*SetMode)(int32_t mode); 19 int32_t (*SetOption)(uint32_t option); 20 int32_t (*ReadSensorData)(struct SensorReportEvent *events); 21 }; 22 23 struct SensorDeviceInfo { 24 struct SensorBasicInfo sensorInfo; 25 struct SensorOps ops; 26 }; 27 28 int32_t AddSensorDevice(const struct SensorDeviceInfo *deviceInfo); 29 int32_t DeleteSensorDevice(const struct SensorBasicInfo *sensorBaseInfo); 30 int32_t ReportSensorEvent(const struct SensorReportEvent *events); 31 32 #endif /* SENSOR_DEVICE_IF_H */ 33