1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef DDK_DEVICE_MANAGER_H
17 #include <stdint.h>
18 
19 #include "hdf_usb_pnp_manage.h"
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 #define USB_PNP_NOTIFY_SERVICE_NAME "hdf_usb_pnp_notify_service"
24 typedef int32_t (*DdkDevMgrHandleDev)(const struct UsbPnpNotifyMatchInfoTable *device, void *priv);
25 typedef int32_t (*DdkDevMgrHandleGadget)(void *priv);
26 /*
27  * Init methed must be called before all other metheds
28  * Success return 0, otherwise return non-zero
29  */
30 int32_t DdkDevMgrInit(const char *gadgetStatePath);
31 const struct UsbPnpNotifyMatchInfoTable *DdkDevMgrCreateDevice(const char *deviceDir);
32 int32_t DdkDevMgrRemoveDevice(int32_t busNum, int32_t devNum, struct UsbPnpNotifyMatchInfoTable *info);
33 int32_t DdkDevMgrForEachDeviceSafe(DdkDevMgrHandleDev handle, void *priv);
34 int32_t DdkDevMgrGetGadgetLinkStatusSafe(DdkDevMgrHandleGadget handle, void *priv);
35 bool DdkDevMgrGetGadgetLinkStatus();
36 #ifdef __cplusplus
37 }
38 #endif
39 #define DDK_DEVICE_MANAGER_H
40 #endif // DDK_DEVICE_MANAGER_H
41