1 /* 2 * Copyright (C) 2024 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 OHOS_WIFI_SCAN_CONFIG_H 16 #define OHOS_WIFI_SCAN_CONFIG_H 17 18 #include <mutex> 19 #include "wifi_scan_control_msg.h" 20 21 namespace OHOS { 22 namespace Wifi { 23 class WifiScanConfig { 24 public: 25 WifiScanConfig(); 26 ~WifiScanConfig(); 27 28 void GetScanDeviceInfo(WifiScanDeviceInfo &scanDeviceInfo); 29 30 void SaveScanDeviceInfo(WifiScanDeviceInfo &scanDeviceInfo); 31 32 void SetAppRunningState(ScanMode appRunMode); 33 34 ScanMode GetAppRunningState(); 35 36 void SetScanType(ScanType scanType); 37 38 ScanType GetScanType(); 39 40 void SetScanInitiatorUid(int initiatorUid); 41 42 int GetScanInitiatorUid(); 43 44 WifiScanDeviceInfo GetScanDeviceInfo(); 45 46 void SetStaScene(const int &scene); 47 48 void SetStaSceneForbidCount(int count); 49 50 int GetStaSceneForbidCount(); 51 52 void SetScanControlInfo(const ScanControlInfo &info, int instId = 0); 53 54 int GetScanControlInfo(ScanControlInfo &info, int instId = 0); 55 56 void SetPackageInfo(std::map<std::string, std::vector<PackageInfo>> &filterMap); 57 58 void SetMovingFreezeScaned(bool scanned); 59 60 bool GetMovingFreezeScaned(); 61 62 void SetAbnormalApps(const std::vector<std::string> &abnormalAppList); 63 64 void SetAppPackageName(const std::string &appPackageName); 65 66 std::string GetAppPackageName(); 67 68 void SetStaCurrentTime(time_t time); 69 70 time_t GetStaCurrentTime(); 71 72 int SaveScanInfoList(const std::vector<WifiScanInfo> &results); 73 74 int ClearScanInfoList(); 75 76 int GetScanInfoList(std::vector<WifiScanInfo> &results); 77 78 void GetScanInfoListInner(std::vector<WifiScanInfo> &results); 79 80 void RecordWifiCategory(const std::string bssid, WifiCategory category); 81 82 WifiCategory GetWifiCategoryRecord(const std::string bssid); 83 84 void CleanWifiCategoryRecord(); 85 86 void RemoveWifiCategoryRecord(const std::string bssid); 87 88 void RecordHilinkAbility(const std::string &bssid, int isSupportHilink); 89 90 int GetHilinkAbility(const std::string &bssid); 91 92 private: 93 void InitScanControlForbidList(); 94 void InitScanControlIntervalList(); 95 96 std::mutex mScanDeviceInfoMutex; 97 WifiScanDeviceInfo mScanDeviceInfo; 98 std::mutex mScanMutex; 99 std::map<std::string, WifiCategory> mWifiCategoryRecord; 100 std::vector<WifiScanInfo> mWifiScanInfoList; 101 std::map<std::string, int> hilinkAbilityRecord; 102 }; 103 } // namespace Wifi 104 } // namespace OHOS 105 #endif 106