1 /* 2 * Copyright (c) 2023 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 #ifndef WIFI_DIRECT_RESOURCE_MANAGER_H 16 #define WIFI_DIRECT_RESOURCE_MANAGER_H 17 18 #include "common_list.h" 19 #include "softbus_adapter_thread.h" 20 #include "wifi_direct_types.h" 21 #include "data/interface_info.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 struct ResourceManagerListener { 28 void (*onInterfaceInfoChange)(struct InterfaceInfo *info); 29 }; 30 31 struct ResourceManager { 32 int32_t (*initWifiDirectInfo)(void); 33 struct InterfaceInfo* (*getInterfaceInfo)(const char *interface); 34 void (*notifyInterfaceInfoChange)(struct InterfaceInfo *info); 35 bool (*isInterfaceAvailable)(const char *interface); 36 void (*registerListener)(struct ResourceManagerListener *listener); 37 int32_t (*getAllInterfacesSimpleInfo)(struct InterfaceInfo **infoArray, int32_t *infoArraySize); 38 int32_t (*getAllInterfacesInfo)(struct InterfaceInfo **infoArray, int32_t *infoArraySize); 39 int32_t (*getAllInterfacesNameAndMac)(struct InterfaceInfo **infoArray, int32_t *infoArraySize); 40 void (*dump)(void); 41 42 SoftBusMutex mutex; 43 struct ListNode interfaces; 44 int32_t count; 45 struct ResourceManagerListener listener; 46 bool isInited; 47 }; 48 49 struct ResourceManager* GetResourceManager(void); 50 51 int32_t ResourceManagerInit(void); 52 53 #ifdef __cplusplus 54 } 55 #endif 56 #endif