• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/**
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 * @namespace wifiext
26 * @since 8
27 */
28declare namespace wifiext {
29  /**
30   * Enables a Wi-Fi hotspot.
31   *
32   * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
33   * @returns { boolean } Returns {@code true} if this method is called successfully; returns {@code false} otherwise.
34   * @syscap SystemCapability.Communication.WiFi.AP.Extension
35   * @since 8
36   * @deprecated since 9
37   * @useinstead ohos.wifiManagerExt/wifiManagerExt.enableHotspot
38   */
39  function enableHotspot(): boolean;
40
41  /**
42   * Disables a Wi-Fi hotspot.
43   * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
44   * @returns { boolean } Returns {@code true} if this method is called successfully; returns {@code false} otherwise.
45   * @syscap SystemCapability.Communication.WiFi.AP.Extension
46   * @since 8
47   * @deprecated since 9
48   * @useinstead ohos.wifiManagerExt/wifiManagerExt.disableHotspot
49   */
50  function disableHotspot(): boolean;
51
52  /**
53   * Obtains the supported power model.
54   * @permission ohos.permission.GET_WIFI_INFO
55   * @returns { Promise<Array<PowerModel>> } Returns the array of supported power model.
56   * @syscap SystemCapability.Communication.WiFi.AP.Extension
57   * @since 8
58   * @deprecated since 9
59   * @useinstead ohos.wifiManagerExt/wifiManagerExt.getSupportedPowerMode
60   */
61  function getSupportedPowerModel(): Promise<Array<PowerModel>>;
62
63  /**
64   * Obtains the supported power model.
65   * @permission ohos.permission.GET_WIFI_INFO
66   * @param { AsyncCallback<Array<PowerModel>> } callback - callback function, no return value.
67   * @syscap SystemCapability.Communication.WiFi.AP.Extension
68   * @since 8
69   * @deprecated since 9
70   * @useinstead ohos.wifiManagerExt/wifiManagerExt.getSupportedPowerMode
71   */
72  function getSupportedPowerModel(callback: AsyncCallback<Array<PowerModel>>): void;
73
74  /**
75   * Obtains the current Wi-Fi power mode.
76   * @permission ohos.permission.GET_WIFI_INFO
77   * @returns { Promise<PowerModel> } Returns the current Wi-Fi power mode. If a value less than zero is returned, it indicates a failure.
78   * @syscap SystemCapability.Communication.WiFi.AP.Extension
79   * @since 8
80   * @deprecated since 9
81   * @useinstead ohos.wifiManagerExt/wifiManagerExt.getPowerMode
82   */
83  function getPowerModel(): Promise<PowerModel>;
84
85  /**
86   * Obtains the current Wi-Fi power mode.
87   * @permission ohos.permission.GET_WIFI_INFO
88   * @param { AsyncCallback<PowerModel> } callback - callback function, no return value.
89   * @syscap SystemCapability.Communication.WiFi.AP.Extension
90   * @since 8
91   * @deprecated since 9
92   * @useinstead ohos.wifiManagerExt/wifiManagerExt.getPowerMode
93   */
94  function getPowerModel(callback: AsyncCallback<PowerModel>): void;
95
96  /**
97   * Set the current Wi-Fi power mode.
98   * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
99   * @param { PowerModel } model - model indicates model file description to be loaded.
100   * @returns { boolean } Returns {@code true} if the Wi-Fi is active; returns {@code false} otherwise.
101   * @syscap SystemCapability.Communication.WiFi.AP.Extension
102   * @since 8
103   * @deprecated since 9
104   * @useinstead ohos.wifiManagerExt/wifiManagerExt.setPowerMode
105   */
106  function setPowerModel(model: PowerModel): boolean;
107
108  /**
109   * The power model enumeration.
110   *
111   * @enum { number } PowerModel
112   * @syscap SystemCapability.Communication.WiFi.AP.Extension
113   * @since 8
114   * @deprecated since 9
115   * @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode
116   */
117  export enum PowerModel {
118    /**
119    * Sleeping model.
120    * @syscap SystemCapability.Communication.WiFi.AP.Extension
121    * @since 8
122    * @deprecated since 9
123    * @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode
124    */
125    SLEEPING = 0,
126
127    /**
128    * General model.
129    * @syscap SystemCapability.Communication.WiFi.AP.Extension
130    * @since 8
131    * @deprecated since 9
132    * @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode
133    */
134    GENERAL = 1,
135
136    /**
137    * Through wall model.
138    * @syscap SystemCapability.Communication.WiFi.AP.Extension
139    * @since 8
140    * @deprecated since 9
141    * @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode
142    */
143    THROUGH_WALL = 2,
144  }
145}
146
147export default wifiext;
148