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/** 2461847f8eSopenharmony_ci * Provides extended methods to operate or manage Wi-Fi. 2561847f8eSopenharmony_ci * 2661847f8eSopenharmony_ci * <p>The APIs involved in this file are non-general APIs. 2761847f8eSopenharmony_ci * These extended APIs are only used by some product types, such as routers. 2861847f8eSopenharmony_ci * Common products should not use these APIs.</p> 2961847f8eSopenharmony_ci * 3061847f8eSopenharmony_ci * @namespace wifiext 3161847f8eSopenharmony_ci * @since 8 3261847f8eSopenharmony_ci */ 3361847f8eSopenharmony_cideclare namespace wifiext { 3461847f8eSopenharmony_ci /** 3561847f8eSopenharmony_ci * Enables a Wi-Fi hotspot. 3661847f8eSopenharmony_ci * 3761847f8eSopenharmony_ci * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT 3861847f8eSopenharmony_ci * @returns { boolean } Returns {@code true} if this method is called successfully; returns {@code false} otherwise. 3961847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 4061847f8eSopenharmony_ci * @since 8 4161847f8eSopenharmony_ci * @deprecated since 9 4261847f8eSopenharmony_ci * @useinstead ohos.wifiManagerExt/wifiManagerExt.enableHotspot 4361847f8eSopenharmony_ci */ 4461847f8eSopenharmony_ci function enableHotspot(): boolean; 4561847f8eSopenharmony_ci 4661847f8eSopenharmony_ci /** 4761847f8eSopenharmony_ci * Disables a Wi-Fi hotspot. 4861847f8eSopenharmony_ci * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT 4961847f8eSopenharmony_ci * @returns { boolean } Returns {@code true} if this method is called successfully; returns {@code false} otherwise. 5061847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 5161847f8eSopenharmony_ci * @since 8 5261847f8eSopenharmony_ci * @deprecated since 9 5361847f8eSopenharmony_ci * @useinstead ohos.wifiManagerExt/wifiManagerExt.disableHotspot 5461847f8eSopenharmony_ci */ 5561847f8eSopenharmony_ci function disableHotspot(): boolean; 5661847f8eSopenharmony_ci 5761847f8eSopenharmony_ci /** 5861847f8eSopenharmony_ci * Obtains the supported power model. 5961847f8eSopenharmony_ci * @permission ohos.permission.GET_WIFI_INFO 6061847f8eSopenharmony_ci * @returns { Promise<Array<PowerModel>> } Returns the array of supported power model. 6161847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 6261847f8eSopenharmony_ci * @since 8 6361847f8eSopenharmony_ci * @deprecated since 9 6461847f8eSopenharmony_ci * @useinstead ohos.wifiManagerExt/wifiManagerExt.getSupportedPowerMode 6561847f8eSopenharmony_ci */ 6661847f8eSopenharmony_ci function getSupportedPowerModel(): Promise<Array<PowerModel>>; 6761847f8eSopenharmony_ci 6861847f8eSopenharmony_ci /** 6961847f8eSopenharmony_ci * Obtains the supported power model. 7061847f8eSopenharmony_ci * @permission ohos.permission.GET_WIFI_INFO 7161847f8eSopenharmony_ci * @param { AsyncCallback<Array<PowerModel>> } callback - callback function, no return value. 7261847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 7361847f8eSopenharmony_ci * @since 8 7461847f8eSopenharmony_ci * @deprecated since 9 7561847f8eSopenharmony_ci * @useinstead ohos.wifiManagerExt/wifiManagerExt.getSupportedPowerMode 7661847f8eSopenharmony_ci */ 7761847f8eSopenharmony_ci function getSupportedPowerModel(callback: AsyncCallback<Array<PowerModel>>): void; 7861847f8eSopenharmony_ci 7961847f8eSopenharmony_ci /** 8061847f8eSopenharmony_ci * Obtains the current Wi-Fi power mode. 8161847f8eSopenharmony_ci * @permission ohos.permission.GET_WIFI_INFO 8261847f8eSopenharmony_ci * @returns { Promise<PowerModel> } Returns the current Wi-Fi power mode. If a value less than zero is returned, it indicates a failure. 8361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 8461847f8eSopenharmony_ci * @since 8 8561847f8eSopenharmony_ci * @deprecated since 9 8661847f8eSopenharmony_ci * @useinstead ohos.wifiManagerExt/wifiManagerExt.getPowerMode 8761847f8eSopenharmony_ci */ 8861847f8eSopenharmony_ci function getPowerModel(): Promise<PowerModel>; 8961847f8eSopenharmony_ci 9061847f8eSopenharmony_ci /** 9161847f8eSopenharmony_ci * Obtains the current Wi-Fi power mode. 9261847f8eSopenharmony_ci * @permission ohos.permission.GET_WIFI_INFO 9361847f8eSopenharmony_ci * @param { AsyncCallback<PowerModel> } callback - callback function, no return value. 9461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 9561847f8eSopenharmony_ci * @since 8 9661847f8eSopenharmony_ci * @deprecated since 9 9761847f8eSopenharmony_ci * @useinstead ohos.wifiManagerExt/wifiManagerExt.getPowerMode 9861847f8eSopenharmony_ci */ 9961847f8eSopenharmony_ci function getPowerModel(callback: AsyncCallback<PowerModel>): void; 10061847f8eSopenharmony_ci 10161847f8eSopenharmony_ci /** 10261847f8eSopenharmony_ci * Set the current Wi-Fi power mode. 10361847f8eSopenharmony_ci * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT 10461847f8eSopenharmony_ci * @param { PowerModel } model - model indicates model file description to be loaded. 10561847f8eSopenharmony_ci * @returns { boolean } Returns {@code true} if the Wi-Fi is active; returns {@code false} otherwise. 10661847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 10761847f8eSopenharmony_ci * @since 8 10861847f8eSopenharmony_ci * @deprecated since 9 10961847f8eSopenharmony_ci * @useinstead ohos.wifiManagerExt/wifiManagerExt.setPowerMode 11061847f8eSopenharmony_ci */ 11161847f8eSopenharmony_ci function setPowerModel(model: PowerModel): boolean; 11261847f8eSopenharmony_ci 11361847f8eSopenharmony_ci /** 11461847f8eSopenharmony_ci * The power model enumeration. 11561847f8eSopenharmony_ci * 11661847f8eSopenharmony_ci * @enum { number } PowerModel 11761847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 11861847f8eSopenharmony_ci * @since 8 11961847f8eSopenharmony_ci * @deprecated since 9 12061847f8eSopenharmony_ci * @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode 12161847f8eSopenharmony_ci */ 12261847f8eSopenharmony_ci export enum PowerModel { 12361847f8eSopenharmony_ci /** 12461847f8eSopenharmony_ci * Sleeping model. 12561847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 12661847f8eSopenharmony_ci * @since 8 12761847f8eSopenharmony_ci * @deprecated since 9 12861847f8eSopenharmony_ci * @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode 12961847f8eSopenharmony_ci */ 13061847f8eSopenharmony_ci SLEEPING = 0, 13161847f8eSopenharmony_ci 13261847f8eSopenharmony_ci /** 13361847f8eSopenharmony_ci * General model. 13461847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 13561847f8eSopenharmony_ci * @since 8 13661847f8eSopenharmony_ci * @deprecated since 9 13761847f8eSopenharmony_ci * @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode 13861847f8eSopenharmony_ci */ 13961847f8eSopenharmony_ci GENERAL = 1, 14061847f8eSopenharmony_ci 14161847f8eSopenharmony_ci /** 14261847f8eSopenharmony_ci * Through wall model. 14361847f8eSopenharmony_ci * @syscap SystemCapability.Communication.WiFi.AP.Extension 14461847f8eSopenharmony_ci * @since 8 14561847f8eSopenharmony_ci * @deprecated since 9 14661847f8eSopenharmony_ci * @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode 14761847f8eSopenharmony_ci */ 14861847f8eSopenharmony_ci THROUGH_WALL = 2, 14961847f8eSopenharmony_ci } 15061847f8eSopenharmony_ci} 15161847f8eSopenharmony_ci 15261847f8eSopenharmony_ciexport default wifiext; 153