• 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
16/**
17 * @file
18 * @kit ConnectivityKit
19 */
20
21import { AsyncCallback, Callback } from './@ohos.base';
22/**
23 * Provides extended methods to operate or manage Wi-Fi.
24 *
25 * <p>The APIs involved in this file are non-general APIs.
26 * These extended APIs are only used by some product types, such as routers.
27 * Common products should not use these APIs.</p>
28 *
29 * @namespace wifiManagerExt
30 * @since 9
31 */
32declare namespace wifiManagerExt {
33
34  /**
35   * Enable Wi-Fi hotspot function.
36   * This method is asynchronous. After the Wi-Fi hotspot is enabled, Wi-Fi may be disabled.
37   * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
38   * @throws {BusinessError} 201 - Permission denied.
39   * @throws {BusinessError} 801 - Capability not supported.
40   * @throws {BusinessError} 2701000 - Operation failed.
41   * @syscap SystemCapability.Communication.WiFi.AP.Extension
42   * @since 9
43   * @deprecated since 10
44   */
45  function enableHotspot(): void;
46
47  /**
48   * Disable Wi-Fi hotspot function.
49   * If Wi-Fi is enabled after the Wi-Fi hotspot is disabled, Wi-Fi may be re-enabled.
50   * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
51   * @throws {BusinessError} 201 - Permission denied.
52   * @throws {BusinessError} 801 - Capability not supported.
53   * @throws {BusinessError} 2701000 - Operation failed.
54   * @syscap SystemCapability.Communication.WiFi.AP.Extension
55   * @since 9
56   * @deprecated since 10
57   */
58  function disableHotspot(): void;
59
60  /**
61   * Obtains the supported power Mode.
62   * @permission ohos.permission.GET_WIFI_INFO
63   * @returns { Promise<Array<PowerMode>> } Returns a list of application PowerMode.
64   * @throws {BusinessError} 201 - Permission denied.
65   * @throws {BusinessError} 801 - Capability not supported.
66   * @throws {BusinessError} 2701000 - Operation failed.
67   * @syscap SystemCapability.Communication.WiFi.AP.Extension
68   * @since 9
69   */
70  function getSupportedPowerMode(): Promise<Array<PowerMode>>;
71
72  /**
73   * Obtains the supported power Mode.
74   * @permission ohos.permission.GET_WIFI_INFO
75   * @param { AsyncCallback<Array<PowerMode>> } callback - the callback of model.
76   * @throws {BusinessError} 201 - Permission denied.
77   * @throws {BusinessError} 801 - Capability not supported.
78   * @throws {BusinessError} 2701000 - Operation failed.
79   * @syscap SystemCapability.Communication.WiFi.AP.Extension
80   * @since 9
81   */
82  function getSupportedPowerMode(callback: AsyncCallback<Array<PowerMode>>): void;
83
84  /**
85   * Obtains the current Wi-Fi power mode.
86   * @permission ohos.permission.GET_WIFI_INFO
87   * @returns { Promise<PowerMode> }
88   * @throws {BusinessError} 201 - Permission denied.
89   * @throws {BusinessError} 801 - Capability not supported.
90   * @throws {BusinessError} 2701000 - Operation failed.
91   * @syscap SystemCapability.Communication.WiFi.AP.Extension
92   * @since 9
93   */
94  function getPowerMode(): Promise<PowerMode>;
95
96  /**
97   * Obtains the current Wi-Fi power mode.
98   * @permission ohos.permission.GET_WIFI_INFO
99   * @param { AsyncCallback<PowerMode> } callback - the callback of model
100   * @throws {BusinessError} 201 - Permission denied.
101   * @throws {BusinessError} 801 - Capability not supported.
102   * @throws {BusinessError} 2701000 - Operation failed.
103   * @syscap SystemCapability.Communication.WiFi.AP.Extension
104   * @since 9
105   */
106  function getPowerMode(callback: AsyncCallback<PowerMode>): void;
107
108  /**
109   * Set the current Wi-Fi power mode.
110   * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
111   * @param { PowerMode } model --Wi-Fi power mode.
112   * @throws {BusinessError} 201 - Permission denied.
113   * @throws {BusinessError} 801 - Capability not supported.
114   * @throws {BusinessError} 2701000 - Operation failed.
115   * @syscap SystemCapability.Communication.WiFi.AP.Extension
116   * @since 9
117   * @deprecated since 10
118   */
119  function setPowerMode(mode: PowerMode): void;
120
121  /**
122   * The power Mode enumeration.
123   *
124   * @enum { number } PowerMode
125   * @syscap SystemCapability.Communication.WiFi.AP.Extension
126   * @since 9
127   */
128  export enum PowerMode {
129    /**
130     * Sleeping Mode.
131     * @syscap SystemCapability.Ability.AbilityRuntime.Core
132     * @since 9
133    */
134
135    SLEEPING = 0,
136
137    /**
138     * General Mode.
139     * @syscap SystemCapability.Ability.AbilityRuntime.Core
140     * @since 9
141     * */
142    GENERAL = 1,
143
144    /**
145     * Through wall Mode.
146     * @syscap SystemCapability.Ability.AbilityRuntime.Core
147     * @since 9
148     * */
149    THROUGH_WALL = 2,
150  }
151}
152
153export default wifiManagerExt;
154