1 /* 2 * Copyright (c) 2023 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_HUMIDITY_DRIVER_H 10 #define SENSOR_HUMIDITY_DRIVER_H 11 12 #include "hdf_workqueue.h" 13 #include "osal_timer.h" 14 #include "sensor_config_parser.h" 15 #include "sensor_platform_if.h" 16 17 #define HUMIDITY_DEFAULT_SAMPLING_1000_MS 1000000000 18 19 struct HumidityData { 20 int32_t humidity; 21 }; 22 23 struct HumidityOpsCall { 24 int32_t (*Init)(struct SensorCfgData *data); 25 int32_t (*ReadData)(struct SensorCfgData *data); 26 }; 27 28 struct HumidityDrvData { 29 struct IDeviceIoService ioService; 30 struct HdfDeviceObject *device; 31 HdfWorkQueue humidityWorkQueue; 32 HdfWork humidityWork; 33 OsalTimer humidityTimer; 34 bool detectFlag; 35 bool enable; 36 int64_t interval; 37 struct SensorCfgData *humidityCfg; 38 struct HumidityOpsCall ops; 39 }; 40 41 int32_t HumidityRegisterChipOps(const struct HumidityOpsCall *ops); 42 struct SensorCfgData *HumidityCreateCfgData(const struct DeviceResourceNode *node); 43 void HumidityReleaseCfgData(struct SensorCfgData *humidityCfg); 44 45 #endif /* SENSOR_HUMIDITY_DRIVER_H */ 46