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_MANAGER_H 10 #define SENSOR_DEVICE_MANAGER_H 11 12 #include "hdf_base.h" 13 #include "hdf_device_desc.h" 14 #include "hdf_workqueue.h" 15 #include "osal_mutex.h" 16 #include "sensor_device_type.h" 17 #include "sensor_device_if.h" 18 19 #define HDF_SENSOR_EVENT_QUEUE_NAME "hdf_sensor_event_queue" 20 21 enum SensorCmd { 22 SENSOR_CMD_GET_INFO_LIST = 0, 23 SENSOR_CMD_OPS = 1, 24 SENSOR_CMD_END, 25 }; 26 enum SensorOpsCmd { 27 SENSOR_OPS_CMD_ENABLE = 0, 28 SENSOR_OPS_CMD_DISABLE = 1, 29 SENSOR_OPS_CMD_SET_BATCH = 2, 30 SENSOR_OPS_CMD_SET_MODE = 3, 31 SENSOR_OPS_CMD_SET_OPTION = 4, 32 SENSOR_OPS_CMD_BUTT, 33 }; 34 35 struct SensorDevInfoNode { 36 struct SensorDeviceInfo devInfo; 37 struct DListHead node; 38 }; 39 40 typedef int32_t (*SensorCmdHandle)(struct SensorDeviceInfo *info, struct HdfSBuf *data, struct HdfSBuf *reply); 41 42 struct SensorCmdHandleList { 43 enum SensorOpsCmd cmd; 44 SensorCmdHandle func; 45 }; 46 47 struct SensorDevMgrData { 48 struct IDeviceIoService ioService; 49 struct HdfDeviceObject *device; 50 struct DListHead sensorDevInfoHead; 51 struct OsalMutex mutex; 52 struct OsalMutex eventMutex; 53 }; 54 55 #endif /* SENSOR_DEVICE_MANAGER_H */ 56