1/*
2 * Copyright (c) 2024 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 * @addtogroup CHIP
18 * @{
19 *
20 * @brief Provides APIs for the upper-layer WLAN service.
21 *
22 * You can use the APIs to manager the wifi chip, init and release the wifi chip, create and remove iface, register callback
23 * get the name and type of the iface, get the support frequencies and set the mode of chip.
24 *
25 * @since 5.0
26 * @version 1.0
27 */
28
29/**
30 * @file IChipIface.idl
31 *
32 * @brief Provides APIs to obtaon the message of iface, include type, name and support frequencies.
33 *
34 * @since 5.0
35 * @version 1.0
36 */
37
38/**
39 * @brief Defines the package path of the chip module interface.
40 *
41 * @since 5.0
42 * @version 1.0
43 */
44
45package ohos.hdi.wlan.chip.v1_0;
46
47import ohos.hdi.wlan.chip.v1_0.ChipTypes;
48import ohos.hdi.wlan.chip.v1_0.IChipIfaceCallback;
49
50interface IChipIface {
51    /**
52     * @brief Obtains the type of the iface.
53     *
54     * @param type Indicates the type of the interface service object.
55     *
56     * @return Returns <b>0</b> if the operation is successful.
57     * @return Returns a negative value if the operation fails.
58     *
59     * @since 5.0
60     * @version 1.0
61     */
62    GetIfaceType([out] enum IfaceType type);
63
64    /**
65     * @brief Obtains the name of the iface.
66     *
67     * @param name Indicates the name of the interface service object.
68     *
69     * @return Returns <b>0</b> if the operation is successful.
70     * @return Returns a negative value if the operation fails.
71     *
72     * @since 5.0
73     * @version 1.0
74     */
75    GetIfaceName([out] String name);
76
77    /**
78     * @brief get iface featureset from wifi driver.
79     *
80     * @param capabilities Indicates the iface featureset.
81     *
82     * @return Returns <b>0</b> if the operation is successful.
83     * @return Returns a negative value if the operation fails.
84     *
85     * @since 5.0
86     * @version 1.0
87     */
88    GetIfaceCap([out] unsigned int capabilities);
89
90    /**
91     * @brief Obtains the frequencies supported by the corresponding band.
92     *
93     * @param band Indicates the wifi band.
94     * @param frequencies Indicates the supported frequencies.
95     *
96     * @return Returns <b>0</b> if the operation is successful.
97     * @return Returns a negative value if the operation fails.
98     *
99     * @since 5.0
100     * @version 1.0
101     */
102    GetSupportFreqs([in] int band, [out] unsigned int[] frequencies);
103
104    /**
105     * @brief Set mac to driver, change iface mac.
106     *
107     * @param mac Indicates the mac.
108     *
109     * @return Returns <b>0</b> if the operation is successful.
110     * @return Returns a negative value if the operation fails.
111     *
112     * @since 5.0
113     * @version 1.0
114     */
115    SetMacAddress([in] String mac);
116
117    /**
118     * @brief Set countrycode to driver, change iface countrycode.
119     *
120     * @param code Indicates the countrycode.
121     *
122     * @return Returns <b>0</b> if the operation is successful.
123     * @return Returns a negative value if the operation fails.
124     *
125     * @since 5.0
126     * @version 1.0
127     */
128    SetCountryCode([in] String code);
129
130    /**
131     * @brief Get iface current powermode.
132     *
133     * @param powerMode Indicates the current powermode.
134     *
135     * @return Returns <b>0</b> if the operation is successful.
136     * @return Returns a negative value if the operation fails.
137     *
138     * @since 5.0
139     * @version 1.0
140     */
141    GetPowerMode([out] int powerMode);
142
143    /**
144     * @brief Set powermode to driver, change iface powermode.
145     *
146     * @param powerMode Indicates the set powermode.
147     *
148     * @return Returns <b>0</b> if the operation is successful.
149     * @return Returns a negative value if the operation fails.
150     *
151     * @since 5.0
152     * @version 1.0
153     */
154    SetPowerMode([in] int powerMode);
155
156    /**
157     * @brief Register callback to iface.
158     *
159     * @param chipIfaceCallback Indicates the listener callback.
160     *
161     * @return Returns <b>0</b> if the operation is successful.
162     * @return Returns a negative value if the operation fails.
163     *
164     * @since 5.0
165     * @version 1.0
166     */
167    RegisterChipIfaceCallBack([in] IChipIfaceCallback chipIfaceCallback);
168
169    /**
170     * @brief Unregister callback to iface.
171     *
172     * @param chipIfaceCallback Indicates the listener callback.
173     *
174     * @return Returns <b>0</b> if the operation is successful.
175     * @return Returns a negative value if the operation fails.
176     *
177     * @since 5.0
178     * @version 1.0
179     */
180    UnRegisterChipIfaceCallBack([in] IChipIfaceCallback chipIfaceCallback);
181
182    /**
183     * @brief Start iface scan.
184     *
185     * @param scanParam Indicates the scan param.
186     *
187     * @return Returns <b>0</b> if the operation is successful.
188     * @return Returns a negative value if the operation fails.
189     *
190     * @since 5.0
191     * @version 1.0
192     */
193    StartScan([in] struct ScanParams scanParam);
194
195    /**
196     * @brief Get iface scan results.
197     *
198     * @param scanResultsInfo Indicates the scan result.
199     *
200     * @return Returns <b>0</b> if the operation is successful.
201     * @return Returns a negative value if the operation fails.
202     *
203     * @since 5.0
204     * @version 1.0
205     */
206    GetScanInfos([out] struct ScanResultsInfo[] scanResultsInfo);
207
208    /**
209     * @brief Start iface pno scan.
210     *
211     * @param pnoParams Indicates the pno scan param.
212     *
213     * @return Returns <b>0</b> if the operation is successful.
214     * @return Returns a negative value if the operation fails.
215     *
216     * @since 5.0
217     * @version 1.0
218     */
219    StartPnoScan([in] struct PnoScanParams pnoParams);
220
221    /**
222     * @brief Stop iface pno scan.
223     *
224     * @return Returns <b>0</b> if the operation is successful.
225     * @return Returns a negative value if the operation fails.
226     *
227     * @since 5.0
228     * @version 1.0
229     */
230    StopPnoScan();
231
232    /**
233     * @brief Get wifi signal info from driver.
234     *
235     * @param signalPollResult Indicates the signal info.
236     *
237     * @return Returns <b>0</b> if the operation is successful.
238     * @return Returns a negative value if the operation fails.
239     *
240     * @since 5.0
241     * @version 1.0
242     */
243    GetSignalPollInfo([out] struct SignalPollResult signalPollresult);
244
245    /**
246     * @brief Enable power mode for iface.
247     *
248     * @param mode Indicates the power mode.
249     *
250     * @return Returns <b>0</b> if the operation is successful.
251     * @return Returns a negative value if the operation fails.
252     *
253     * @since 5.0
254     * @version 1.0
255     */
256    EnablePowerMode([in] int mode);
257
258    /**
259     * @brief Set dpi rules.
260     *
261     * @param uid Indicates the current uid.
262     * @param protocol Indicates the rule.
263     * @param enable Indicates the mode.
264     *
265     * @return Returns <b>0</b> if the operation is successful.
266     * @return Returns a negative value if the operation fails.
267     *
268     * @since 5.0
269     * @version 1.0
270     */
271    SetDpiMarkRule([in] int uid, [in] int protocol, [in] int enable);
272
273    /**
274     * @brief Set tx power,This interface is preferentially used to communicate with the Wi-Fi service.
275     *
276     * @param power Indicates the power value.
277     *
278     * @return Returns <b>0</b> if the operation is successful.
279     * @return Returns a negative value if the operation fails.
280     *
281     * @since 5.0
282     * @version 1.0
283     */
284    SetTxPower([in] int power);
285
286     /**
287     * @brief Set interface up or down, This interface is preferentially used to communicate with the Wi-Fi service.
288     *
289     * @param state Indicates the iface state.
290     *
291     * @return Returns <b>0</b> if the operation is successful.
292     * @return Returns a negative value if the operation fails.
293     *
294     * @since 5.0
295     * @version 1.0
296     */
297    SetIfaceState([in] boolean state);
298};
299/** @} */