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 HDF_SERVICE_OBSERVER_H 10 #define HDF_SERVICE_OBSERVER_H 11 12 #include "hdf_device.h" 13 #include "hdf_device_desc.h" 14 #include "hdf_slist.h" 15 #include "osal_mutex.h" 16 17 struct HdfServiceObserver { 18 struct HdfSList services; 19 struct OsalMutex observerMutex; 20 }; 21 22 bool HdfServiceObserverConstruct(struct HdfServiceObserver *observer); 23 void HdfServiceObserverDestruct(struct HdfServiceObserver *observer); 24 int HdfServiceObserverPublishService(struct HdfServiceObserver *observer, 25 const char *svcName, devid_t deviceId, uint16_t policy, struct HdfObject *service); 26 int HdfServiceObserverSubscribeService(struct HdfServiceObserver *observer, 27 const char *svcName, devid_t deviceId, struct SubscriberCallback callback); 28 void HdfServiceObserverRemoveRecord(struct HdfServiceObserver *observer, const char *svcName); 29 30 #endif /* HDF_SERVICE_OBSERVER_H */ 31