161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit ConnectivityKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport { AsyncCallback, Callback } from './@ohos.base'; 2261847f8eSopenharmony_ci/** 2361847f8eSopenharmony_ci * Provides extended methods to operate or manage Wi-Fi. 2461847f8eSopenharmony_ci * 2561847f8eSopenharmony_ci * <p>The APIs involved in this file are non-general APIs. 2661847f8eSopenharmony_ci * These extended APIs are only used by some product types, such as routers. 2761847f8eSopenharmony_ci * Common products should not use these APIs.</p> 2861847f8eSopenharmony_ci * 2961847f8eSopenharmony_ci * @namespace wifiManagerExt 3061847f8eSopenharmony_ci * @since 9 3161847f8eSopenharmony_ci */ 3261847f8eSopenharmony_cideclare namespace wifiManagerExt { 3361847f8eSopenharmony_ci 3461847f8eSopenharmony_ci /** 3561847f8eSopenharmony_ci * Enable Wi-Fi hotspot function. 3661847f8eSopenharmony_ci * This method is asynchronous. After the Wi-Fi hotspot is enabled, Wi-Fi may be disabled. 3761847f8eSopenharmony_ci * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT 3861847f8eSopenharmony_ci * @throws {BusinessError} 201 - Permission denied. 3961847f8eSopenharmony_ci * @throws {BusinessError} 801 - Capability not supported. 4061847f8eSopenharmony_ci * @throws {BusinessError} 2701000 - Operation failed. 4161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 4261847f8eSopenharmony_ci * @since 9 4361847f8eSopenharmony_ci * @deprecated since 10 4461847f8eSopenharmony_ci */ 4561847f8eSopenharmony_ci function enableHotspot(): void; 4661847f8eSopenharmony_ci 4761847f8eSopenharmony_ci /** 4861847f8eSopenharmony_ci * Disable Wi-Fi hotspot function. 4961847f8eSopenharmony_ci * If Wi-Fi is enabled after the Wi-Fi hotspot is disabled, Wi-Fi may be re-enabled. 5061847f8eSopenharmony_ci * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT 5161847f8eSopenharmony_ci * @throws {BusinessError} 201 - Permission denied. 5261847f8eSopenharmony_ci * @throws {BusinessError} 801 - Capability not supported. 5361847f8eSopenharmony_ci * @throws {BusinessError} 2701000 - Operation failed. 5461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 5561847f8eSopenharmony_ci * @since 9 5661847f8eSopenharmony_ci * @deprecated since 10 5761847f8eSopenharmony_ci */ 5861847f8eSopenharmony_ci function disableHotspot(): void; 5961847f8eSopenharmony_ci 6061847f8eSopenharmony_ci /** 6161847f8eSopenharmony_ci * Obtains the supported power Mode. 6261847f8eSopenharmony_ci * @permission ohos.permission.GET_WIFI_INFO 6361847f8eSopenharmony_ci * @returns { Promise<Array<PowerMode>> } Returns a list of application PowerMode. 6461847f8eSopenharmony_ci * @throws {BusinessError} 201 - Permission denied. 6561847f8eSopenharmony_ci * @throws {BusinessError} 801 - Capability not supported. 6661847f8eSopenharmony_ci * @throws {BusinessError} 2701000 - Operation failed. 6761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 6861847f8eSopenharmony_ci * @since 9 6961847f8eSopenharmony_ci */ 7061847f8eSopenharmony_ci function getSupportedPowerMode(): Promise<Array<PowerMode>>; 7161847f8eSopenharmony_ci 7261847f8eSopenharmony_ci /** 7361847f8eSopenharmony_ci * Obtains the supported power Mode. 7461847f8eSopenharmony_ci * @permission ohos.permission.GET_WIFI_INFO 7561847f8eSopenharmony_ci * @param { AsyncCallback<Array<PowerMode>> } callback - the callback of model. 7661847f8eSopenharmony_ci * @throws {BusinessError} 201 - Permission denied. 7761847f8eSopenharmony_ci * @throws {BusinessError} 801 - Capability not supported. 7861847f8eSopenharmony_ci * @throws {BusinessError} 2701000 - Operation failed. 7961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 8061847f8eSopenharmony_ci * @since 9 8161847f8eSopenharmony_ci */ 8261847f8eSopenharmony_ci function getSupportedPowerMode(callback: AsyncCallback<Array<PowerMode>>): void; 8361847f8eSopenharmony_ci 8461847f8eSopenharmony_ci /** 8561847f8eSopenharmony_ci * Obtains the current Wi-Fi power mode. 8661847f8eSopenharmony_ci * @permission ohos.permission.GET_WIFI_INFO 8761847f8eSopenharmony_ci * @returns { Promise<PowerMode> } 8861847f8eSopenharmony_ci * @throws {BusinessError} 201 - Permission denied. 8961847f8eSopenharmony_ci * @throws {BusinessError} 801 - Capability not supported. 9061847f8eSopenharmony_ci * @throws {BusinessError} 2701000 - Operation failed. 9161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 9261847f8eSopenharmony_ci * @since 9 9361847f8eSopenharmony_ci */ 9461847f8eSopenharmony_ci function getPowerMode(): Promise<PowerMode>; 9561847f8eSopenharmony_ci 9661847f8eSopenharmony_ci /** 9761847f8eSopenharmony_ci * Obtains the current Wi-Fi power mode. 9861847f8eSopenharmony_ci * @permission ohos.permission.GET_WIFI_INFO 9961847f8eSopenharmony_ci * @param { AsyncCallback<PowerMode> } callback - the callback of model 10061847f8eSopenharmony_ci * @throws {BusinessError} 201 - Permission denied. 10161847f8eSopenharmony_ci * @throws {BusinessError} 801 - Capability not supported. 10261847f8eSopenharmony_ci * @throws {BusinessError} 2701000 - Operation failed. 10361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 10461847f8eSopenharmony_ci * @since 9 10561847f8eSopenharmony_ci */ 10661847f8eSopenharmony_ci function getPowerMode(callback: AsyncCallback<PowerMode>): void; 10761847f8eSopenharmony_ci 10861847f8eSopenharmony_ci /** 10961847f8eSopenharmony_ci * Set the current Wi-Fi power mode. 11061847f8eSopenharmony_ci * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT 11161847f8eSopenharmony_ci * @param { PowerMode } model --Wi-Fi power mode. 11261847f8eSopenharmony_ci * @throws {BusinessError} 201 - Permission denied. 11361847f8eSopenharmony_ci * @throws {BusinessError} 801 - Capability not supported. 11461847f8eSopenharmony_ci * @throws {BusinessError} 2701000 - Operation failed. 11561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 11661847f8eSopenharmony_ci * @since 9 11761847f8eSopenharmony_ci * @deprecated since 10 11861847f8eSopenharmony_ci */ 11961847f8eSopenharmony_ci function setPowerMode(mode: PowerMode): void; 12061847f8eSopenharmony_ci 12161847f8eSopenharmony_ci /** 12261847f8eSopenharmony_ci * The power Mode enumeration. 12361847f8eSopenharmony_ci * 12461847f8eSopenharmony_ci * @enum { number } PowerMode 12561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 12661847f8eSopenharmony_ci * @since 9 12761847f8eSopenharmony_ci */ 12861847f8eSopenharmony_ci export enum PowerMode { 12961847f8eSopenharmony_ci /** 13061847f8eSopenharmony_ci * Sleeping Mode. 13161847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 13261847f8eSopenharmony_ci * @since 9 13361847f8eSopenharmony_ci */ 13461847f8eSopenharmony_ci 13561847f8eSopenharmony_ci SLEEPING = 0, 13661847f8eSopenharmony_ci 13761847f8eSopenharmony_ci /** 13861847f8eSopenharmony_ci * General Mode. 13961847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 14061847f8eSopenharmony_ci * @since 9 14161847f8eSopenharmony_ci * */ 14261847f8eSopenharmony_ci GENERAL = 1, 14361847f8eSopenharmony_ci 14461847f8eSopenharmony_ci /** 14561847f8eSopenharmony_ci * Through wall Mode. 14661847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.Core 14761847f8eSopenharmony_ci * @since 9 14861847f8eSopenharmony_ci * */ 14961847f8eSopenharmony_ci THROUGH_WALL = 2, 15061847f8eSopenharmony_ci } 15161847f8eSopenharmony_ci} 15261847f8eSopenharmony_ci 15361847f8eSopenharmony_ciexport default wifiManagerExt; 154