• 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 './basic';
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 * @since 8
26 * @import import wifiext from '@ohos.wifiext';
27 */
28declare namespace wifiext {
29    /**
30     * Enables a Wi-Fi hotspot.
31     *
32     * @returns Returns {@code true} if this method is called successfully; returns {@code false} otherwise.
33     * @since 8
34     * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
35     * @syscap SystemCapability.Communication.WiFi.AP.Extension
36     * @deprecated since 9
37     * @useinstead ohos.wifiManagerExt/wifiManagerExt.enableHotspot
38     */
39     function enableHotspot(): boolean;
40
41     /**
42      * Disables a Wi-Fi hotspot.
43      *
44      * @returns Returns {@code true} if this method is called successfully; returns {@code false} otherwise.
45      * @since 8
46      * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
47      * @syscap SystemCapability.Communication.WiFi.AP.Extension
48      * @deprecated since 9
49      * @useinstead ohos.wifiManagerExt/wifiManagerExt.disableHotspot
50      */
51     function disableHotspot(): boolean;
52
53    /**
54     * Obtains the supported power model.
55     *
56     * @returns Returns the array of supported power model.
57     *
58     * @since 8
59     * @permission ohos.permission.GET_WIFI_INFO
60     * @syscap SystemCapability.Communication.WiFi.AP.Extension
61     * @deprecated since 9
62     * @useinstead ohos.wifiManagerExt/wifiManagerExt.getSupportedPowerMode
63     */
64     function getSupportedPowerModel(): Promise<Array<PowerModel>>;
65     function getSupportedPowerModel(callback: AsyncCallback<Array<PowerModel>>): void;
66
67    /**
68     * Obtains the current Wi-Fi power mode.
69     *
70     * @returns Returns the current Wi-Fi power mode. If a value less than zero is returned, it indicates a failure.
71     *
72     * @since 8
73     * @permission ohos.permission.GET_WIFI_INFO
74     * @syscap SystemCapability.Communication.WiFi.AP.Extension
75     * @deprecated since 9
76     * @useinstead ohos.wifiManagerExt/wifiManagerExt.getPowerMode
77     */
78    function getPowerModel (): Promise<PowerModel>;
79    function getPowerModel (callback: AsyncCallback<PowerModel>): void;
80
81    /**
82     * Set the current Wi-Fi power mode.
83     *
84     * @returns Returns {@code true} if the Wi-Fi is active; returns {@code false} otherwise.
85     *
86     * @since 8
87     * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT
88     * @syscap SystemCapability.Communication.WiFi.AP.Extension
89     * @deprecated since 9
90     * @useinstead ohos.wifiManagerExt/wifiManagerExt.setPowerMode
91     */
92    function setPowerModel(model: PowerModel) : boolean
93
94    /**
95     * The power model enumeration.
96     *
97     * @since 8
98     * @syscap SystemCapability.Communication.WiFi.AP.Extension
99     * @deprecated since 9
100     * @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode
101     */
102     export enum PowerModel {
103        /** Sleeping model. */
104        SLEEPING = 0,
105
106        /** General model. */
107        GENERAL = 1,
108
109        /** Through wall model. */
110        THROUGH_WALL = 2,
111    }
112}
113
114export default wifiext;
115