1 /* 2 * Copyright (c) 2020-2022 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_SERVICE_MANAGER_H 10 #define DEVICE_SERVICE_MANAGER_H 11 12 #include "devsvc_manager_if.h" 13 #include "hdf_service_observer.h" 14 #include "hdf_dlist.h" 15 #include "osal_mutex.h" 16 17 struct DevSvcManager { 18 struct IDevSvcManager super; 19 struct DListHead services; 20 struct HdfServiceObserver observer; 21 struct DListHead svcstatListeners; 22 struct OsalMutex mutex; 23 }; 24 25 struct HdfObject *DevSvcManagerCreate(void); 26 bool DevSvcManagerConstruct(struct DevSvcManager *inst); 27 void DevSvcManagerRelease(struct IDevSvcManager *inst); 28 struct IDevSvcManager *DevSvcManagerGetInstance(void); 29 30 int DevSvcManagerStartService(void); 31 32 int DevSvcManagerAddService( 33 struct IDevSvcManager *inst, struct HdfDeviceObject *service, const struct HdfServiceInfo *servInfo); 34 struct HdfObject *DevSvcManagerGetService(struct IDevSvcManager *inst, const char *svcName); 35 void DevSvcManagerRemoveService( 36 struct IDevSvcManager *inst, const char *svcName, const struct HdfDeviceObject *devObj); 37 void DevSvcManagerListService(struct HdfSBuf *serviceNameSet, DeviceClass deviceClass); 38 int DevSvcManagerListServiceByInterfaceDesc( 39 struct IDevSvcManager *inst, const char *interfaceDesc, struct HdfSBuf *reply); 40 41 int DevSvcManagerClntSubscribeService(const char *svcName, struct SubscriberCallback callback); 42 int DevSvcManagerClntUnsubscribeService(const char *svcName); 43 44 #endif /* DEVICE_SERVICE_MANAGER_H */ 45