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 16import { AsyncCallback, Callback } from './@ohos.base'; 17/** 18 * Provides extended methods to operate or manage Wi-Fi. 19 * 20 * <p>The APIs involved in this file are non-general APIs. 21 * These extended APIs are only used by some product types, such as routers. 22 * Common products should not use these APIs.</p> 23 * 24 * @namespace wifiManagerExt 25 * @since 9 26 */ 27declare namespace wifiManagerExt { 28 29 /** 30 * Enable Wi-Fi hotspot function. 31 * This method is asynchronous. After the Wi-Fi hotspot is enabled, Wi-Fi may be disabled. 32 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT 33 * @throws {BusinessError} 201 - Permission denied. 34 * @throws {BusinessError} 801 - Capability not supported. 35 * @throws {BusinessError} 2701000 - Operation failed. 36 * @syscap SystemCapability.Communication.WiFi.AP.Extension 37 * @since 9 38 * @deprecated since 10 39 */ 40 function enableHotspot(): void; 41 42 /** 43 * Disable Wi-Fi hotspot function. 44 * If Wi-Fi is enabled after the Wi-Fi hotspot is disabled, Wi-Fi may be re-enabled. 45 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT 46 * @throws {BusinessError} 201 - Permission denied. 47 * @throws {BusinessError} 801 - Capability not supported. 48 * @throws {BusinessError} 2701000 - Operation failed. 49 * @syscap SystemCapability.Communication.WiFi.AP.Extension 50 * @since 9 51 * @deprecated since 10 52 */ 53 function disableHotspot(): void; 54 55 /** 56 * Obtains the supported power Mode. 57 * @permission ohos.permission.GET_WIFI_INFO 58 * @returns { Promise<Array<PowerMode>> } Returns a list of application PowerMode. 59 * @throws {BusinessError} 201 - Permission denied. 60 * @throws {BusinessError} 801 - Capability not supported. 61 * @throws {BusinessError} 2701000 - Operation failed. 62 * @syscap SystemCapability.Communication.WiFi.AP.Extension 63 * @since 9 64 */ 65 function getSupportedPowerMode(): Promise<Array<PowerMode>>; 66 67 /** 68 * Obtains the supported power Mode. 69 * @permission ohos.permission.GET_WIFI_INFO 70 * @param { AsyncCallback<Array<PowerMode>> } callback - the callback of model. 71 * @throws {BusinessError} 201 - Permission denied. 72 * @throws {BusinessError} 801 - Capability not supported. 73 * @throws {BusinessError} 2701000 - Operation failed. 74 * @syscap SystemCapability.Communication.WiFi.AP.Extension 75 * @since 9 76 */ 77 function getSupportedPowerMode(callback: AsyncCallback<Array<PowerMode>>): void; 78 79 /** 80 * Obtains the current Wi-Fi power mode. 81 * @permission ohos.permission.GET_WIFI_INFO 82 * @returns { Promise<PowerMode> } 83 * @throws {BusinessError} 201 - Permission denied. 84 * @throws {BusinessError} 801 - Capability not supported. 85 * @throws {BusinessError} 2701000 - Operation failed. 86 * @syscap SystemCapability.Communication.WiFi.AP.Extension 87 * @since 9 88 */ 89 function getPowerMode(): Promise<PowerMode>; 90 91 /** 92 * Obtains the current Wi-Fi power mode. 93 * @permission ohos.permission.GET_WIFI_INFO 94 * @param { AsyncCallback<PowerMode> } callback - the callback of model 95 * @throws {BusinessError} 201 - Permission denied. 96 * @throws {BusinessError} 801 - Capability not supported. 97 * @throws {BusinessError} 2701000 - Operation failed. 98 * @syscap SystemCapability.Communication.WiFi.AP.Extension 99 * @since 9 100 */ 101 function getPowerMode(callback: AsyncCallback<PowerMode>): void; 102 103 /** 104 * Set the current Wi-Fi power mode. 105 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT 106 * @param { PowerMode } model --Wi-Fi power mode. 107 * @throws {BusinessError} 201 - Permission denied. 108 * @throws {BusinessError} 801 - Capability not supported. 109 * @throws {BusinessError} 2701000 - Operation failed. 110 * @syscap SystemCapability.Communication.WiFi.AP.Extension 111 * @since 9 112 * @deprecated since 10 113 */ 114 function setPowerMode(mode: PowerMode): void; 115 116 /** 117 * The power Mode enumeration. 118 * 119 * @enum { number } PowerMode 120 * @syscap SystemCapability.Communication.WiFi.AP.Extension 121 * @since 9 122 */ 123 export enum PowerMode { 124 /** 125 * Sleeping Mode. 126 * @syscap SystemCapability.Ability.AbilityRuntime.Core 127 * @since 9 128 */ 129 130 SLEEPING = 0, 131 132 /** 133 * General Mode. 134 * @syscap SystemCapability.Ability.AbilityRuntime.Core 135 * @since 9 136 * */ 137 GENERAL = 1, 138 139 /** 140 * Through wall Mode. 141 * @syscap SystemCapability.Ability.AbilityRuntime.Core 142 * @since 9 143 * */ 144 THROUGH_WALL = 2, 145 } 146} 147 148export default wifiManagerExt; 149