• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_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(struct IDevSvcManager *manager, const char *svcName,
33                             uint16_t devClass, struct HdfDeviceObject *service, const char *servInfo);
34 struct HdfObject *DevSvcManagerGetService(struct IDevSvcManager *manager, const char *svcName);
35 void DevSvcManagerRemoveService(struct IDevSvcManager *manager, const char *svcName);
36 void DevSvcManagerListService(struct HdfSBuf *serviecNameSet, DeviceClass deviceClass);
37 
38 int DevSvcManagerClntSubscribeService(const char *svcName, struct SubscriberCallback callback);
39 int DevSvcManagerClntUnsubscribeService(const char *svcName);
40 
41 #endif /* DEVICE_SERVICE_MANAGER_H */
42