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 './basic'; 17 18/** 19 * Provides extended methods to operate or manage Wi-Fi. 20 * 21 * <p>The APIs involved in this file are non-general APIs. 22 * These extended APIs are only used by some product types, such as routers. 23 * Common products should not use these APIs.</p> 24 * 25 * @since 9 26 * @import import wifiManagerExt from '@ohos.wifiManagerExt'; 27 */ 28declare namespace wifiManagerExt { 29 /** 30 * Enable a Wi-Fi hotspot. 31 * 32 * @since 9 33 * @throws {BusinessError} 201 - Permission denied. 34 * @throws {BusinessError} 801 - Capability not supported. 35 * @throws {BusinessError} 2701000 - Operation failed. 36 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT 37 * @syscap SystemCapability.Communication.WiFi.AP.Extension 38 */ 39 function enableHotspot(): void; 40 41 /** 42 * Disable a Wi-Fi hotspot. 43 * 44 * @since 9 45 * @throws {BusinessError} 201 - Permission denied. 46 * @throws {BusinessError} 801 - Capability not supported. 47 * @throws {BusinessError} 2701000 - Operation failed. 48 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT 49 * @syscap SystemCapability.Communication.WiFi.AP.Extension 50 */ 51 function disableHotspot(): void; 52 53 /** 54 * Obtain the supported power Mode. 55 * 56 * @returns Returns the array of supported power Mode. 57 * 58 * @since 9 59 * @throws {BusinessError} 201 - Permission denied. 60 * @throws {BusinessError} 801 - Capability not supported. 61 * @throws {BusinessError} 2701000 - Operation failed. 62 * @permission ohos.permission.GET_WIFI_INFO 63 * @syscap SystemCapability.Communication.WiFi.AP.Extension 64 */ 65 function getSupportedPowerMode(): Promise<Array<PowerMode>>; 66 function getSupportedPowerMode(callback: AsyncCallback<Array<PowerMode>>): void; 67 68 /** 69 * Obtain the current Wi-Fi power mode. 70 * 71 * @returns Returns the current Wi-Fi power mode. If a value less than zero is returned, it indicates a failure. 72 * 73 * @since 9 74 * @throws {BusinessError} 201 - Permission denied. 75 * @throws {BusinessError} 801 - Capability not supported. 76 * @throws {BusinessError} 2701000 - Operation failed. 77 * @permission ohos.permission.GET_WIFI_INFO 78 * @syscap SystemCapability.Communication.WiFi.AP.Extension 79 */ 80 function getPowerMode (): Promise<PowerMode>; 81 function getPowerMode (callback: AsyncCallback<PowerMode>): void; 82 83 /** 84 * Set the current Wi-Fi power mode. 85 * 86 * @since 9 87 * @throws {BusinessError} 201 - Permission denied. 88 * @throws {BusinessError} 801 - Capability not supported. 89 * @throws {BusinessError} 2701000 - Operation failed. 90 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT 91 * @syscap SystemCapability.Communication.WiFi.AP.Extension 92 */ 93 function setPowerMode(mode: PowerMode) : void 94 95 /** 96 * The power Mode enumeration. 97 * 98 * @since 9 99 * @syscap SystemCapability.Communication.WiFi.AP.Extension 100 */ 101 export enum PowerMode { 102 /** Sleeping Mode. */ 103 SLEEPING = 0, 104 105 /** General Mode. */ 106 GENERAL = 1, 107 108 /** Through wall Mode. */ 109 THROUGH_WALL = 2, 110 } 111} 112 113export default wifiManagerExt; 114