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_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_slist.h" 15 #include "osal_mutex.h" 16 17 struct DevSvcManager { 18 struct IDevSvcManager super; 19 struct HdfSList services; 20 struct HdfServiceObserver observer; 21 struct OsalMutex mutex; 22 }; 23 24 struct HdfObject *DevSvcManagerCreate(void); 25 bool DevSvcManagerConstruct(struct DevSvcManager *inst); 26 void DevSvcManagerRelease(struct HdfObject *object); 27 struct IDevSvcManager *DevSvcManagerGetInstance(void); 28 int DevSvcManagerAddService(struct IDevSvcManager *manager, const char *svcName, struct HdfDeviceObject *service); 29 struct HdfObject *DevSvcManagerGetService(struct IDevSvcManager *manager, const char *svcName); 30 void DevSvcManagerRemoveService(struct IDevSvcManager *manager, const char *svcName); 31 32 int DevSvcManagerClntSubscribeService(const char *svcName, struct SubscriberCallback callback); 33 int DevSvcManagerClntUnsubscribeService(const char *svcName); 34 35 #endif /* DEVICE_SERVICE_MANAGER_H */ 36