1 /* 2 * Copyright (c) 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_PROXIMITY_DRIVER_H 10 #define SENSOR_PROXIMITY_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 struct ProximityData { 18 uint8_t stateFlag; 19 }; 20 21 struct ProximityOpsCall { 22 int32_t (*Init)(struct SensorCfgData *data); 23 int32_t (*ReadData)(struct SensorCfgData *data); 24 }; 25 26 struct ProximityDrvData { 27 struct IDeviceIoService ioService; 28 struct HdfDeviceObject *device; 29 HdfWorkQueue proximityWorkQueue; 30 HdfWork proximityWork; 31 OsalTimer proximityTimer; 32 bool detectFlag; 33 bool enable; 34 int64_t interval; 35 struct SensorCfgData *proximityCfg; 36 struct ProximityOpsCall ops; 37 }; 38 39 struct SensorCfgData *ProximityCreateCfgData(const struct DeviceResourceNode *node); 40 int32_t ProximityRegisterChipOps(const struct ProximityOpsCall *ops); 41 void ProximityReleaseCfgData(struct SensorCfgData *proximityCfg); 42 43 #endif /* SENSOR_PROXIMITY_DRIVER_H */ 44