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/** 17 * @file 18 * @kit ConnectivityKit 19 */ 20 21import { AsyncCallback, Callback } from './@ohos.base'; 22 23/** 24 * Provides extended methods to operate or manage Wi-Fi. 25 * 26 * <p>The APIs involved in this file are non-general APIs. 27 * These extended APIs are only used by some product types, such as routers. 28 * Common products should not use these APIs.</p> 29 * 30 * @namespace wifiext 31 * @since 8 32 */ 33declare namespace wifiext { 34 /** 35 * Enables a Wi-Fi hotspot. 36 * 37 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT 38 * @returns { boolean } Returns {@code true} if this method is called successfully; returns {@code false} otherwise. 39 * @syscap SystemCapability.Communication.WiFi.AP.Extension 40 * @since 8 41 * @deprecated since 9 42 * @useinstead ohos.wifiManagerExt/wifiManagerExt.enableHotspot 43 */ 44 function enableHotspot(): boolean; 45 46 /** 47 * Disables a Wi-Fi hotspot. 48 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT 49 * @returns { boolean } Returns {@code true} if this method is called successfully; returns {@code false} otherwise. 50 * @syscap SystemCapability.Communication.WiFi.AP.Extension 51 * @since 8 52 * @deprecated since 9 53 * @useinstead ohos.wifiManagerExt/wifiManagerExt.disableHotspot 54 */ 55 function disableHotspot(): boolean; 56 57 /** 58 * Obtains the supported power model. 59 * @permission ohos.permission.GET_WIFI_INFO 60 * @returns { Promise<Array<PowerModel>> } Returns the array of supported power model. 61 * @syscap SystemCapability.Communication.WiFi.AP.Extension 62 * @since 8 63 * @deprecated since 9 64 * @useinstead ohos.wifiManagerExt/wifiManagerExt.getSupportedPowerMode 65 */ 66 function getSupportedPowerModel(): Promise<Array<PowerModel>>; 67 68 /** 69 * Obtains the supported power model. 70 * @permission ohos.permission.GET_WIFI_INFO 71 * @param { AsyncCallback<Array<PowerModel>> } callback - callback function, no return value. 72 * @syscap SystemCapability.Communication.WiFi.AP.Extension 73 * @since 8 74 * @deprecated since 9 75 * @useinstead ohos.wifiManagerExt/wifiManagerExt.getSupportedPowerMode 76 */ 77 function getSupportedPowerModel(callback: AsyncCallback<Array<PowerModel>>): void; 78 79 /** 80 * Obtains the current Wi-Fi power mode. 81 * @permission ohos.permission.GET_WIFI_INFO 82 * @returns { Promise<PowerModel> } Returns the current Wi-Fi power mode. If a value less than zero is returned, it indicates a failure. 83 * @syscap SystemCapability.Communication.WiFi.AP.Extension 84 * @since 8 85 * @deprecated since 9 86 * @useinstead ohos.wifiManagerExt/wifiManagerExt.getPowerMode 87 */ 88 function getPowerModel(): Promise<PowerModel>; 89 90 /** 91 * Obtains the current Wi-Fi power mode. 92 * @permission ohos.permission.GET_WIFI_INFO 93 * @param { AsyncCallback<PowerModel> } callback - callback function, no return value. 94 * @syscap SystemCapability.Communication.WiFi.AP.Extension 95 * @since 8 96 * @deprecated since 9 97 * @useinstead ohos.wifiManagerExt/wifiManagerExt.getPowerMode 98 */ 99 function getPowerModel(callback: AsyncCallback<PowerModel>): void; 100 101 /** 102 * Set the current Wi-Fi power mode. 103 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT 104 * @param { PowerModel } model - model indicates model file description to be loaded. 105 * @returns { boolean } Returns {@code true} if the Wi-Fi is active; returns {@code false} otherwise. 106 * @syscap SystemCapability.Communication.WiFi.AP.Extension 107 * @since 8 108 * @deprecated since 9 109 * @useinstead ohos.wifiManagerExt/wifiManagerExt.setPowerMode 110 */ 111 function setPowerModel(model: PowerModel): boolean; 112 113 /** 114 * The power model enumeration. 115 * 116 * @enum { number } PowerModel 117 * @syscap SystemCapability.Communication.WiFi.AP.Extension 118 * @since 8 119 * @deprecated since 9 120 * @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode 121 */ 122 export enum PowerModel { 123 /** 124 * Sleeping model. 125 * @syscap SystemCapability.Communication.WiFi.AP.Extension 126 * @since 8 127 * @deprecated since 9 128 * @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode 129 */ 130 SLEEPING = 0, 131 132 /** 133 * General model. 134 * @syscap SystemCapability.Communication.WiFi.AP.Extension 135 * @since 8 136 * @deprecated since 9 137 * @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode 138 */ 139 GENERAL = 1, 140 141 /** 142 * Through wall model. 143 * @syscap SystemCapability.Communication.WiFi.AP.Extension 144 * @since 8 145 * @deprecated since 9 146 * @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode 147 */ 148 THROUGH_WALL = 2, 149 } 150} 151 152export default wifiext; 153