1 /*
2  * Copyright (C) 2021-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 #ifndef OHOS_IDL_IWIFI_CHIP_H
17 #define OHOS_IDL_IWIFI_CHIP_H
18 
19 #include <stdbool.h>
20 #include <stdint.h>
21 #include "i_wifi_chip_event_callback.h"
22 #include "i_wifi_struct.h"
23 #include "wifi_error_no.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #define EVENTS_IFACE_ADD_DEL_NUM 2
30 #define EVENTS_NUM_4 4
31 
32 /**
33  * @Description Sets the chip event callback function.
34  *
35  * @param callback - Callback function pointer structure.
36  */
37 void SetWifiChipEventCallback(IWifiChipEventCallback callback);
38 
39 /**
40  * @Description Obtains the callback structure of the chip event.
41  *
42  * @return IWifiChipEventCallback*
43  */
44 IWifiChipEventCallback *GetWifiChipEventCallback(void);
45 
46 /**
47  * @Description Obtains the chip ID.
48  *
49  * @param id
50  * @return WifiErrorNo
51  */
52 WifiErrorNo GetChipId(int32_t *id);
53 
54 /**
55  * @Description Creating a Device Interface in STA/AP/P2P/NAN Mode.
56  *
57  * @param type
58  * @param iface
59  * @return WifiErrorNo
60  */
61 WifiErrorNo CreateIface(int32_t type, IWifiIface *iface);
62 
63 /**
64  * @Description Obtains the network device interface object based on
65  *              the device interface name.
66  *
67  * @param ifname
68  * @param iface
69  * @return WifiErrorNo
70  */
71 WifiErrorNo GetIface(const char *ifname, IWifiIface *iface);
72 
73 /**
74  * @Description Obtains the interface type. Obtains the device interface name.
75  *
76  * @param type
77  * @param ifaces
78  * @param size - ifaces array size.
79  * @return WifiErrorNo
80  */
81 WifiErrorNo GetIfaceNames(int32_t type, char *ifaces, int32_t size);
82 
83 /**
84  * @Description Delete a network device interface object by device interface name.
85  *
86  * @param ifname
87  * @return WifiErrorNo
88  */
89 WifiErrorNo RemoveIface(const char *ifname);
90 
91 /**
92  * @Description Obtains chip capabilities.
93  *
94  * @param capabilities
95  * @return WifiErrorNo
96  */
97 WifiErrorNo GetCapabilities(uint32_t *capabilities);
98 
99 /**
100  * @Description Obtains the joint mode supported by the chip, for example,
101  *              sta+sta/sta+p2p/sta+ap/sta+nan/ap+nan.
102  *
103  * @param modes
104  * @param size
105  * @return WifiErrorNo
106  */
107 WifiErrorNo GetSupportedComboModes(int32_t *modes, int32_t *size);
108 
109 /**
110  * @Description Configure the current joint mode of the chip.
111  *
112  * @param mode
113  * @return WifiErrorNo
114  */
115 WifiErrorNo ConfigComboModes(int32_t mode);
116 
117 /**
118  * @Description Gets the current federation mode.
119  *
120  * @param id
121  * @return WifiErrorNo
122  */
123 WifiErrorNo GetComboModes(int32_t *id);
124 
125 /**
126  * @Description Registering a Wi-Fi Chip Event.
127  *
128  * @param callback - Callback function pointer structure.
129  * @return WifiErrorNo
130  */
131 WifiErrorNo RegisterEventCallback(IWifiChipEventCallback callback);
132 
133 /**
134  * @Description Requesting the debugging information of the firmware chip.
135  *
136  * @param bytes - Debug info size.
137  * @param size - Size of the memory to which bytes points.
138  * @return WifiErrorNo
139  */
140 WifiErrorNo RequestFirmwareDebugDump(unsigned char *bytes, int32_t *size);
141 
142 /**
143  * @Description is support DBDC
144  *
145  * @param isSupport - is support or not
146  * @return WifiErrorNo
147  */
148 WifiErrorNo IsChipSupportDbdc(bool *isSupport);
149 
150 /**
151  * @Description is support CSA
152  *
153  * @param isSupport - is support or not
154  * @return WifiErrorNo
155  */
156 WifiErrorNo IsChipSupportCsa(bool *isSupport);
157 
158 /**
159  * @Description is support radar detection
160  *
161  * @param isSupport - is support or not
162  * @return WifiErrorNo
163  */
164 WifiErrorNo IsChipSupportRadarDetect(bool *isSupport);
165 
166 /**
167  * @Description is support DFS channel
168  *
169  * @param isSupport - is support or not
170  * @return WifiErrorNo
171  */
172 WifiErrorNo IsChipSupportDfsChannel(bool *isSupport);
173 
174 /**
175  * @Description is support indoor channel
176  *
177  * @param isSupport - is support or not
178  * @return WifiErrorNo
179  */
180 WifiErrorNo IsChipSupportIndoorChannel(bool *isSupport);
181 #ifdef __cplusplus
182 }
183 #endif
184 #endif
185