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 DEVICE_HOST_SERVICE_H 10 #define DEVICE_HOST_SERVICE_H 11 12 #include "devhost_service_if.h" 13 #include "hdf_service_observer.h" 14 #include "hdf_dlist.h" 15 #include "osal_sysevent.h" 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif /* __cplusplus */ 20 21 struct DevHostService { 22 struct IDevHostService super; 23 uint16_t hostId; 24 const char *hostName; 25 struct DListHead devices; 26 struct HdfServiceObserver observer; 27 struct HdfSysEventNotifyNode sysEventNotifyNode; 28 }; 29 30 void DevHostServiceConstruct(struct DevHostService *service); 31 void DevHostServiceDestruct(struct DevHostService *service); 32 int DevHostServiceAddDevice(struct IDevHostService *inst, const struct HdfDeviceInfo *deviceInfo); 33 int DevHostServiceDelDevice(struct IDevHostService *inst, devid_t devId); 34 struct IDevHostService *DevHostServiceNewInstance(uint16_t hostId, const char *hostName); 35 void DevHostServiceFreeInstance(struct IDevHostService *service); 36 struct HdfObject *DevHostServiceCreate(void); 37 void DevHostServiceRelease(struct HdfObject *object); 38 39 #ifdef __cplusplus 40 } 41 #endif /* __cplusplus */ 42 43 #endif /* DEVICE_HOST_SERVICE_H */ 44