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 OHOS_IENHANCE_SERVICE_H 16 #define OHOS_IENHANCE_SERVICE_H 17 18 #include "wifi_errcode.h" 19 #include "wifi_scan_control_msg.h" 20 #include "wifi_msg.h" 21 22 namespace OHOS { 23 namespace Wifi { 24 using P2pEnhanceCallback = std::function<void(const std::string &, int32_t)>; 25 class IEnhanceService { 26 public: 27 virtual ~IEnhanceService() = default; 28 /** 29 * @Description Enhance service initialization function. 30 * 31 * @return success: WIFI_OPT_SUCCESS, failed: WIFI_OPT_FAILED 32 */ 33 virtual ErrCode Init() = 0; 34 /** 35 * @Description Stopping the Enhance Service. 36 * 37 * @return success: WIFI_OPT_SUCCESS, failed: WIFI_OPT_FAILED 38 */ 39 virtual ErrCode UnInit() = 0; 40 /** 41 * @Description check Scan is allowed. 42 * 43 * @return true: allowed, false: not allowed 44 */ 45 virtual bool AllowScanBySchedStrategy() = 0; 46 /** 47 * @Description Set EnhanceService Param. 48 * 49 * @return success: WIFI_OPT_SUCCESS, failed: WIFI_OPT_FAILED 50 */ 51 virtual ErrCode SetEnhanceParam(int64_t availableTime) = 0; 52 53 /** 54 * @Description Install Paket Filter Program 55 * 56 * @param ipAddr - ip address 57 * @param netMaskLen - net mask length 58 * @param macAddr - mac address 59 * @param macLen - mac address length 60 * @param screenState - screen state 61 * @return success: WIFI_OPT_SUCCESS, failed: WIFI_OPT_FAILED 62 */ 63 virtual ErrCode InstallFilterProgram( 64 unsigned int ipAddr, int netMaskLen, const unsigned char *macAddr, int macLen, int screenState) = 0; 65 66 /** 67 * @Description Get wifi category 68 * 69 * @param infoElems - info elems 70 * @param chipsetCategory - chipset category 71 * @param chipsetFeatrureCapability - chipset featrure capability 72 * @return 1: DEFAULT, 2: WIFI6, 3: WIFI6_PLUS, 4: WIFI7, 5: WIFI7_PLUS 73 */ 74 virtual WifiCategory GetWifiCategory( 75 std::vector<WifiInfoElem> infoElems, int chipsetCategory, int chipsetFeatrureCapability) = 0; 76 77 /** 78 * @Description set low tx power 79 * 80 * @param wifiLowPowerParam - wifi low power param 81 * @return ErrCode - operation result 82 */ 83 virtual ErrCode SetLowTxPower(const WifiLowPowerParam wifiLowPowerParam) = 0; 84 85 /** 86 * @Description Check Chba conncted 87 * 88 * @return true: conncted, false: not conncted 89 */ 90 virtual bool CheckChbaConncted() = 0; 91 92 /** 93 * @Description Is external scan allowed. 94 * 95 * @param scanDeviceInfo - scan device info 96 * @return true: allowed, false: not allowed 97 */ 98 virtual bool IsScanAllowed(WifiScanDeviceInfo &scanDeviceInfo) = 0; 99 100 /** 101 * @Description Is customer network. 102 * 103 * @param scanDeviceInfo - scan device info 104 * @return true: allowed, false: not allowed 105 */ 106 virtual bool IsHwItCustNetwork(WifiDeviceConfig &config) = 0; 107 108 /** 109 * @Description selfcure for multi dhcp server. 110 * 111 * @param cmd - add、get size、clear 112 * @param ipInfo - ip information 113 * @param retSize - get dhcp offer size 114 * @return ErrCode - operation result 115 */ 116 virtual ErrCode DealDhcpOfferResult(const OperationCmd &cmd, const IpInfo &ipInfo, uint32_t &retSize) = 0; 117 118 /** 119 * @Description selfcure for multi dhcp server. 120 * 121 * @param isChanged - is gateway changed situation 122 * @return ErrCode - operation result 123 */ 124 virtual ErrCode IsGatewayChanged(bool &isChanged) = 0; 125 126 /** 127 * @Description selfcure for multi dhcp server. 128 * 129 * @param isMultiDhcpServer - true、false 130 * @param startSelfcure - true、false 131 * @param ipInfo - get ipinfo 132 * @return ErrCode - operation result 133 */ 134 virtual ErrCode GetStaticIpConfig(const bool &isMultiDhcpServer, const bool &startSelfcure, IpInfo &ipInfo) = 0; 135 136 /** 137 * @Description Is Wide Bandwidth Supported. 138 * 139 * @return true: support, false: not support 140 */ 141 virtual bool IsWideBandwidthSupported() = 0; 142 143 /** 144 * @Description Check if custom network 145 * 146 * @return true or false 147 */ 148 virtual bool IsCustomNetwork(WifiDeviceConfig &config) = 0; 149 /** 150 * @Description Register P2pEnhance state Callback 151 * 152 * @param p2pEnhanceCallback - callback 153 * @return ErrCode - operation result 154 */ 155 virtual ErrCode RegisterP2pEnhanceCallback(P2pEnhanceCallback callback) = 0; 156 157 /** 158 * @Description unRegister P2pEnhance state Callback 159 * 160 * @return ErrCode - operation result 161 */ 162 virtual ErrCode UnRegisterP2pEnhanceCallback() = 0; 163 164 /** 165 * @Description Check Enhance Vap Available 166 * 167 * @return true: available, false: not available 168 */ 169 virtual bool CheckEnhanceVapAvailable() = 0; 170 171 /** 172 * @Description get the self wifi configuration information 173 * 174 * @param cfgType - configuration type 175 * @param cfgData - the queried data of wifi configuration 176 * @param getDatValidLen - the valid data length in the array `cfgData` 177 * @return ErrCode - operation result 178 */ 179 virtual ErrCode Hid2dGetSelfWifiCfgInfo(SelfCfgType cfgType, char cfgData[CFG_DATA_MAX_BYTES], 180 int* getDatValidLen) = 0; 181 182 /** 183 * @Description set the peer wifi configuration information 184 * 185 * @param cfgType - configuration type 186 * @param cfgData - the wifi configuration data to be set 187 * @param setDataValidLen - the valid data length in the array `cfgData` 188 * @return ErrCode - operation result 189 */ 190 virtual ErrCode Hid2dSetPeerWifiCfgInfo(PeerCfgType cfgType, char cfgData[CFG_DATA_MAX_BYTES], 191 int setDataValidLen) = 0; 192 }; 193 } // namespace Wifi 194 } // namespace OHOS 195 #endif