2022-02-16 06:40:49 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2023-12-11 09:08:03 +00:00
|
|
|
/**
|
|
|
|
* @file
|
2024-01-08 07:25:39 +00:00
|
|
|
* @kit ConnectivityKit
|
2023-12-11 09:08:03 +00:00
|
|
|
*/
|
|
|
|
|
2023-04-04 02:17:06 +00:00
|
|
|
import { AsyncCallback, Callback } from './@ohos.base';
|
2022-02-16 06:40:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Provides extended methods to operate or manage Wi-Fi.
|
|
|
|
*
|
|
|
|
* <p>The APIs involved in this file are non-general APIs.
|
|
|
|
* These extended APIs are only used by some product types, such as routers.
|
|
|
|
* Common products should not use these APIs.</p>
|
|
|
|
*
|
2023-08-30 07:30:22 +00:00
|
|
|
* @namespace wifiext
|
2022-02-16 06:40:49 +00:00
|
|
|
* @since 8
|
|
|
|
*/
|
|
|
|
declare namespace wifiext {
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
|
|
|
* Enables a Wi-Fi hotspot.
|
|
|
|
*
|
2023-09-05 07:55:44 +00:00
|
|
|
* @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
|
2023-08-31 07:16:37 +00:00
|
|
|
* @returns { boolean } Returns {@code true} if this method is called successfully; returns {@code false} otherwise.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Extension
|
2023-08-30 07:30:22 +00:00
|
|
|
* @since 8
|
2023-04-21 09:47:24 +00:00
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.wifiManagerExt/wifiManagerExt.enableHotspot
|
|
|
|
*/
|
|
|
|
function enableHotspot(): boolean;
|
2022-02-16 06:40:49 +00:00
|
|
|
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
|
|
|
* Disables a Wi-Fi hotspot.
|
2023-09-05 07:55:44 +00:00
|
|
|
* @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
|
2023-08-31 07:16:37 +00:00
|
|
|
* @returns { boolean } Returns {@code true} if this method is called successfully; returns {@code false} otherwise.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Extension
|
2023-08-31 07:16:37 +00:00
|
|
|
* @since 8
|
2023-04-21 09:47:24 +00:00
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.wifiManagerExt/wifiManagerExt.disableHotspot
|
|
|
|
*/
|
|
|
|
function disableHotspot(): boolean;
|
2022-02-16 06:40:49 +00:00
|
|
|
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
|
|
|
* Obtains the supported power model.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-08-31 07:16:37 +00:00
|
|
|
* @returns { Promise<Array<PowerModel>> } Returns the array of supported power model.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Extension
|
2023-08-30 07:30:22 +00:00
|
|
|
* @since 8
|
2023-04-21 09:47:24 +00:00
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.wifiManagerExt/wifiManagerExt.getSupportedPowerMode
|
|
|
|
*/
|
|
|
|
function getSupportedPowerModel(): Promise<Array<PowerModel>>;
|
2023-08-30 07:30:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtains the supported power model.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-08-31 08:59:27 +00:00
|
|
|
* @param { AsyncCallback<Array<PowerModel>> } callback - callback function, no return value.
|
2023-08-30 07:30:22 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Extension
|
2023-08-31 07:16:37 +00:00
|
|
|
* @since 8
|
2023-08-30 07:30:22 +00:00
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.wifiManagerExt/wifiManagerExt.getSupportedPowerMode
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function getSupportedPowerModel(callback: AsyncCallback<Array<PowerModel>>): void;
|
2022-02-16 06:40:49 +00:00
|
|
|
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
|
|
|
* Obtains the current Wi-Fi power mode.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-08-31 12:11:34 +00:00
|
|
|
* @returns { Promise<PowerModel> } Returns the current Wi-Fi power mode. If a value less than zero is returned, it indicates a failure.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Extension
|
2023-08-30 07:30:22 +00:00
|
|
|
* @since 8
|
2023-04-21 09:47:24 +00:00
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.wifiManagerExt/wifiManagerExt.getPowerMode
|
|
|
|
*/
|
|
|
|
function getPowerModel(): Promise<PowerModel>;
|
2023-08-30 07:30:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtains the current Wi-Fi power mode.
|
|
|
|
* @permission ohos.permission.GET_WIFI_INFO
|
2023-08-31 12:11:34 +00:00
|
|
|
* @param { AsyncCallback<PowerModel> } callback - callback function, no return value.
|
2023-08-30 07:30:22 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Extension
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.wifiManagerExt/wifiManagerExt.getPowerMode
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function getPowerModel(callback: AsyncCallback<PowerModel>): void;
|
2022-02-16 06:40:49 +00:00
|
|
|
|
2023-09-01 10:00:10 +00:00
|
|
|
/**
|
2023-04-21 09:47:24 +00:00
|
|
|
* Set the current Wi-Fi power mode.
|
2023-09-05 07:55:44 +00:00
|
|
|
* @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
|
2023-08-31 08:59:27 +00:00
|
|
|
* @param { PowerModel } model - model indicates model file description to be loaded.
|
2023-08-31 06:10:55 +00:00
|
|
|
* @returns { boolean } Returns {@code true} if the Wi-Fi is active; returns {@code false} otherwise.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Extension
|
2023-08-30 07:30:22 +00:00
|
|
|
* @since 8
|
2023-04-21 09:47:24 +00:00
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.wifiManagerExt/wifiManagerExt.setPowerMode
|
|
|
|
*/
|
2023-08-30 07:30:22 +00:00
|
|
|
function setPowerModel(model: PowerModel): boolean;
|
2022-02-16 06:40:49 +00:00
|
|
|
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
|
|
|
* The power model enumeration.
|
|
|
|
*
|
2023-08-30 07:30:22 +00:00
|
|
|
* @enum { number } PowerModel
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Extension
|
2023-08-30 07:30:22 +00:00
|
|
|
* @since 8
|
2023-04-21 09:47:24 +00:00
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode
|
|
|
|
*/
|
|
|
|
export enum PowerModel {
|
2023-08-30 07:30:22 +00:00
|
|
|
/**
|
|
|
|
* Sleeping model.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Extension
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
SLEEPING = 0,
|
2022-02-16 06:40:49 +00:00
|
|
|
|
2023-08-30 07:30:22 +00:00
|
|
|
/**
|
|
|
|
* General model.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Extension
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
GENERAL = 1,
|
2022-02-16 06:40:49 +00:00
|
|
|
|
2023-08-30 07:30:22 +00:00
|
|
|
/**
|
|
|
|
* Through wall model.
|
|
|
|
* @syscap SystemCapability.Communication.WiFi.AP.Extension
|
|
|
|
* @since 8
|
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
THROUGH_WALL = 2,
|
|
|
|
}
|
2022-02-16 06:40:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default wifiext;
|