1 /* 2 * Copyright (C) 2021 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 OHOS_WIFI_SCAN_CONTROL_MSG_H 17 #define OHOS_WIFI_SCAN_CONTROL_MSG_H 18 19 #include "wifi_hid2d_msg.h" 20 #include "wifi_scan_msg.h" 21 #include "wifi_p2p_msg.h" 22 #include "define.h" 23 24 namespace OHOS { 25 namespace Wifi { 26 struct Hid2dInfo { 27 Hid2dUpperScene softBusScene; 28 Hid2dUpperScene castScene; 29 Hid2dUpperScene shareScene; 30 Hid2dUpperScene mouseCrossScene; 31 Hid2dUpperScene miraCastScene; 32 P2pConnectedState p2pConnectState; 33 int p2pEnhanceState; 34 int64_t hid2dSceneLastSetTime; 35 Hid2dInfoHid2dInfo36 Hid2dInfo() 37 { 38 p2pConnectState = P2pConnectedState::P2P_DISCONNECTED; 39 p2pEnhanceState = 0; 40 hid2dSceneLastSetTime = 0; 41 } 42 }; 43 44 struct WifiScanDeviceInfo { 45 int appId; 46 int idelState; 47 int thermalLevel; 48 int screenState; 49 int staScene; 50 int staSceneForbidCount; 51 int freezeState; 52 int noChargerState; 53 int gnssFixState; 54 std::string packageName; 55 int initiatorUid; 56 time_t staCurrentTime; 57 bool isAbsFreezeScaned; 58 bool externScan; 59 bool isSystemApp; 60 ScanMode scanMode; 61 ScanType scanType; 62 Hid2dInfo hid2dInfo; 63 ScanControlInfo scanControlInfo; 64 std::vector<PackageInfo> scan_thermal_trust_list; 65 std::vector<PackageInfo> scan_frequency_trust_list; 66 std::vector<PackageInfo> scan_screen_off_trust_list; 67 std::vector<PackageInfo> scan_gps_block_list; 68 std::vector<PackageInfo> scan_hid2d_list; 69 std::vector<std::string> abnormalAppList; 70 WifiScanDeviceInfoWifiScanDeviceInfo71 WifiScanDeviceInfo() 72 { 73 appId = 0; 74 idelState = MODE_STATE_CLOSE; 75 thermalLevel = 1; 76 screenState = MODE_STATE_DEFAULT; 77 staScene = SCAN_SCENE_MAX; 78 freezeState = MODE_STATE_CLOSE; 79 noChargerState = MODE_STATE_CLOSE; 80 scanMode = ScanMode::SCAN_MODE_MAX; 81 scanType = ScanType::SCAN_DEFAULT; 82 isAbsFreezeScaned = false; 83 staSceneForbidCount = 0; 84 externScan = false; 85 isSystemApp = false; 86 staCurrentTime = 0; 87 gnssFixState = 0; 88 packageName = ""; 89 initiatorUid = -1; 90 } 91 GetScanInitiatorNameWifiScanDeviceInfo92 std::string GetScanInitiatorName() 93 { 94 std::string scanInitiatorName = ""; 95 if (packageName.empty()) { 96 scanInitiatorName = std::to_string(initiatorUid); 97 } else { 98 scanInitiatorName = packageName; 99 } 100 return scanInitiatorName; 101 } 102 }; 103 104 enum class ScanLimitType { 105 INVALID = -1, 106 INTERVAL, 107 SCAN_DISABLE, 108 WIFI_DISABLE, 109 HID2D_SOFTBUS, 110 HID2D_CAST, 111 HID2D_MIRACAST, 112 HID2D_SHARE, 113 HID2D_CROSS, 114 THERMAL, 115 SCREEN_OFF, 116 SCHED_STRATEGY, 117 DURING_STA, 118 CUSTOM_SCENE, 119 GNSS_FIX, 120 MOVING_FREEZE, 121 ABNORMAL_APP, 122 CANNOT_SWITCH_AP, 123 STA_STATE, 124 ACTION_LISTEN, 125 HID2D_CLONE, 126 GAME_SCENE 127 }; 128 } // namespace Wifi 129 } // namespace OHOS 130 #endif