• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2 * @file soc_wifi_p2p_api.h
3 *
4 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16 * Description: header file for wifi p2p api.CNcomment:描述:WiFi p2p api接口头文件。CNend
17 *
18 * Create: 2020-7-8
19 */
20 
21 /**
22  * @defgroup soc_wifi_p2p WiFi Basic Settings
23  * @ingroup soc_wifi
24  */
25 
26 #ifndef EXT_WIFI_P2P_API_H
27 #define EXT_WIFI_P2P_API_H
28 
29 #ifdef __cplusplus
30 #if __cplusplus
31 extern "C" {
32 #endif
33 #endif
34 
35 /**
36  * @ingroup soc_wifi_p2p
37  *
38  * max wps dev name length.CNcomment:WPS dev name最大长度CNend
39  */
40 #define WPS_DEV_NAME_MAX_LEN            32
41 
42 /**
43  * @ingroup soc_wifi_p2p
44  *
45  * max wps serial number length.CNcomment:WPS serial number最大长度CNend
46  */
47 #define WPS_SERIAL_NUMBER_MAX_LEN       32
48 
49 /**
50  * @ingroup soc_wifi_p2p
51  *
52  * max wps manufacturer length.CNcomment:WPS manufacturer最大长度CNend
53  */
54 #define WPS_MANUFACTURER_MAX_LEN        64
55 
56 /**
57  * @ingroup soc_wifi_p2p
58  *
59  * max wps model name length.CNcomment:WPS model name最大长度CNend
60  */
61 #define WPS_MODEL_NAME_MAX_LEN          32
62 
63 /**
64  * @ingroup soc_wifi_p2p
65  *
66  * max wps model number length.CNcomment:WPS model number最大长度CNend
67  */
68 #define WPS_MODEL_NUMBER_MAX_LEN        32
69 
70 /**
71  * @ingroup soc_wifi_p2p
72  *
73  * max wps mode length.CNcomment:WPS mode最大长度CNend
74  */
75 #define WPS_MODE_MAX_LEN                15
76 
77 /**
78  * @ingroup soc_wifi_p2p
79  *
80  * max wps state length.CNcomment:WPS state最大长度CNend
81  */
82 #define WPS_STATE_MAX_LEN               19
83 
84 /**
85  * @ingroup soc_wifi_p2p
86  *
87  * max wps ip length.CNcomment:WPS IP最大长度CNend
88  */
89 #define WPS_IP_MAX_LEN                  15
90 
91 /**
92  * @ingroup soc_wifi_p2p
93  *
94  * max wps ip length.CNcomment:WPS IP最大长度CNend
95  */
96 #define WPS_PINCODE_MAX_LEN              9
97 
98 /**
99  * @ingroup soc_wifi_p2p
100  *
101  * p2p invalid value.CNcomment:P2P无效参数CNend
102  */
103 #define P2P_INVALID_VAL                 (-1)
104 
105 /**
106  * @ingroup soc_wifi_basic
107  *
108  * Length of MAC address.CNcomment:MAC地址长度定义.CNend
109  */
110 #define P2P_MAC_LEN        6
111 
112 /**
113  * @ingroup soc_wifi_basic
114  *
115  * Max length of SSID.CNcomment:SSID最大长度定义.CNend
116  */
117 #define P2P_MAX_SSID_LEN  32
118 
119 /**
120  * @ingroup soc_wifi_basic
121  *
122  * Max num of p2p client.CNcomment:p2p默认支持client的最大数量.CNend
123  */
124 #define WIFI_DEFAULT_P2P_MAX_NUM_CLIENT     4
125 
126 /**
127  * @ingroup soc_wifi_basic
128  *
129  * length of device type.CNcomment:device type的长度.CNend
130  */
131 #define WPS_DEV_TYPE_LEN 8
132 
133 /**
134  * @ingroup soc_wifi_basic
135  *
136  * length of methond config.CNcomment:关联方法的长度.CNend
137  */
138 #define MAX_METHOND_CONFIG_LEN 44
139 
140 /**
141  * @ingroup soc_wifi_basic
142  *
143  * Max length of PSK.CNcomment:PSK长度.CNend
144  */
145 #define PSK_LEN 32
146 
147 /**
148  * @ingroup soc_wifi_basic
149  *
150  * Total address length of the maximum number of clients.CNcomment:最大数client的地址总长度.CNend
151  */
152 #define MAX_CLINET_SAVE_ADDR_LEN 48
153 
154 /**
155  * @ingroup soc_wifi_basic
156  *
157  * Len of Prefix name.CNcomment:网络前缀名称长度.CNend
158  */
159 #define PREFIX_NAME_LEN 32
160 
161 /**
162  * @ingroup soc_wifi_basic
163  *
164  * Max num of persistent group.CNcomment:永久网络最大数量.CNend
165  */
166 #define P2P_MAX_PERSISTENT_CNT 10
167 
168 /**
169  * @ingroup hi_wifi_basic
170  *
171  * p2p max scan number of ap.CNcomment:p2p扫描结果的最多数目.CNend
172  */
173 #define P2P_SCAN_DEVICE_LIMIT               32
174 
175 /**
176  * @ingroup soc_wifi_p2p
177  *
178  * the peer connect flag.CNcomment:p2p对端连接标志
179  */
180 typedef enum {
181     EXT_WIFI_P2P_PEER_CONNECT_AUTO,        /**< automatically accept connections. CNcomment: 自动接受连接.CNend */
182     EXT_WIFI_P2P_PEER_CONNECT_MANUAL,      /**< manually accept connections. CNcomment: 手动接受连接.CNend */
183     EXT_WIFI_P2P_PEER_CONNECT_BUTT
184 } ext_wifi_p2p_peer_connect_choose;
185 
186 /**
187  * @ingroup soc_wifi_p2p
188  *
189  * p2p mode.CNcomment:p2p模式。
190  */
191 typedef enum {
192     EXT_WIFI_P2P_MODE_GC,                 /**< gc mode. CNcomment: gc 模式.CNend */
193     EXT_WIFI_P2P_MODE_GO,                 /**< go mode. CNcomment: go 模式.CNend */
194     EXT_WIFI_P2P_DEVICE_ONLY,             /**< group in process. CNcomment: 正在创建组.CNend */
195     EXT_WIFI_P2P_MODE_BUTT
196 } ext_wifi_p2p_mode;
197 
198 /**
199  * @ingroup soc_wifi_p2p
200  *
201  * p2p Connection state.CNcomment:p2p连接状态。
202  */
203 typedef enum {
204     EXT_WIFI_P2P_DISCONNECTED,           /**< disconnect. CNcomment: 断开连接状态.CNend */
205     EXT_WIFI_P2P_CONNECTED,              /**< connected. CNcomment: 连接完成.CNend */
206     EXT_WIFI_P2P_CONNECTING,             /**< connecting. CNcomment: 正在连接.CNend */
207     EXT_WIFI_P2P_CONN_STATUS_BUTT
208 }ext_wifi_p2p_state;
209 
210 /**
211  * @ingroup soc_wifi_p2p
212  *
213  * Struct of p2p's peer info.CNcomment:p2p对端结果CNend
214  *
215  */
216 typedef struct {
217     unsigned char device_addr[P2P_MAC_LEN];     /**< device addr. CNcomment: device地址.CNend */
218     char device_name[WPS_DEV_NAME_MAX_LEN + 1]; /**< device name. CNcomment: device名称.CNend */
219     unsigned short config_methods;              /**< config methods. CNcomment: 配置方式.CNend */
220     unsigned char group_capab;                  /**< group capbility. CNcomment: 组能力.CNend */
221     int persistent_id;                          /**< persistent id corresponding to MAC address.
222                                                      CNcomment: mac地址对应的永久网络id.CNend */
223 } ext_wifi_p2p_peer_info;
224 
225 /**
226  * @ingroup soc_wifi_p2p
227  *
228  * Struct of p2p's config that can be updated.CNcomment:p2p 可以更新的配置CNend
229  *
230  */
231 typedef struct {
232     char device_name[WPS_DEV_NAME_MAX_LEN + 1];        /**< device name. CNcomment: 设备名称.CNend */
233     char manufacturer[WPS_MANUFACTURER_MAX_LEN + 1];   /**< manufacturer. CNcomment: 设备厂商名称.CNend */
234     char serial_number[WPS_SERIAL_NUMBER_MAX_LEN + 1]; /**< serial number. CNcomment: 设备序列号.CNend */
235     char model_name[WPS_MODEL_NAME_MAX_LEN + 1];       /**< model name. CNcomment: 设备型号.CNend */
236     char model_number[WPS_MODEL_NUMBER_MAX_LEN + 1];   /**< model number. CNcomment: 设备编号.CNend */
237     int  go_intent;                                    /**< go intent. CNcomment: GO协商倾向值.CNend */
238     int  oper_channel;                                 /**< operating channel. CNcomment: 工作信道.CNend */
239     int  listen_channel;                               /**< listen channel. CNcomment: 监听信道.CNend */
240     int  wps_method;                                   /**< wps method. CNcomment: wps的连接方式.CNend */
241 } ext_wifi_p2p_user_conf;
242 
243 /**
244  * @ingroup soc_wifi_p2p
245  *
246  * Struct of p2p's connect status.CNcomment:p2p 连接状态CNend
247  *
248  */
249 typedef struct {
250     char ssid[P2P_MAX_SSID_LEN + 1];  /**< group ssid. CNcomment: 组名称.CNend */
251     unsigned char bssid[P2P_MAC_LEN]; /**< group bssid. CNcomment: 组地址.CNend */
252     int op_freq;                      /**< oprational freq. CNcomment: 工作信道.CNend */
253     ext_wifi_p2p_mode mode;           /**< mode. CNcomment: 模式.CNend */
254     ext_wifi_p2p_state p2p_state;     /**< p2p state. CNcomment:状态.CNend */
255 } ext_wifi_p2p_status_info;
256 
257 /**
258  * @ingroup soc_wifi_p2p
259  *
260  * Struct of p2p's DHCP config.CNcomment:p2p DHCP可设置的网络CNend
261  *
262  */
263 typedef struct {
264     char wpa_p2p_dhcps_ip[WPS_IP_MAX_LEN + 1];
265     char wpa_p2p_dhcps_netmask[WPS_IP_MAX_LEN + 1];
266     char wpa_p2p_dhcps_gateway[WPS_IP_MAX_LEN + 1];
267 } ext_wifi_p2p_dhcps_ifconfig;
268 
269 /**
270  * @ingroup soc_wifi_p2p
271  *
272  * mac address of go's client.CNcomment:与p2p相连的client mac地址.CNend
273  *
274  */
275 typedef struct {
276     unsigned char mac[P2P_MAC_LEN];             /**< MAC address.CNcomment:与go相连的client mac地址.CNend */
277     unsigned char dev_addr[P2P_MAC_LEN];        /**< MAC address.CNcomment:与go相连的client dev地址.CNend */
278     char device_name[WPS_DEV_NAME_MAX_LEN + 1]; /**< device name. CNcomment: 设备名称.CNend */
279 } ext_wifi_p2p_client_info;
280 
281 /**
282  * @ingroup soc_wifi_p2p
283  *
284  * wifi mode.CNcomment:wifi模式。
285  */
286 enum wifi_mode {
287     /**< infrastructure mode, associate with an AP. CNcomment:基础结构模式,可以关联ap.CNend */
288     WIFI_MODE_INFRA = 0,
289     /**< IBSS peer-to-peer. CNcomment: IBSS模式,点对点.CNend */
290     WIFI_MODE_IBSS = 1,
291     /**< access point. CNcomment: 接入点.CNend */
292     WIFI_MODE_AP = 2,
293     /**< P2P Group Owner. CNcomment: p2p组拥有者.CNend */
294     WIFI_MODE_P2P_GO = 3,
295     /**< P2P Group Formation. CNcomment: p2p组形成.CNend */
296     WIFI_MODE_P2P_GROUP_FORMATION = 4,
297     /**< mesh. CNcomment: mesh.CNend */
298     WIFI_MODE_MESH = 5,
299 };
300 
301 /**
302  * @ingroup soc_wifi_p2p
303  *
304  * Struct of p2p's connect.CNcomment:p2p 连接入参结构体CNend
305  *
306  */
307 typedef struct {
308     unsigned char peer_addr[P2P_MAC_LEN];   /**< peer device addr. CNcomment: 对端的device地址.CNend */
309     char pin[WPS_PINCODE_MAX_LEN];          /**< Pin Code of WPS.CNcomment:WPS的Pin码.CNend */
310     int  join_group;                        /**< Join an existing groupo or not . CNcomment: 是否加入已存在的组 */
311     int  persistent;                        /**< persistent or not. CNcomment: 是否期望永久网络.CNend */
312     int  go_intent;                         /**< go intent. CNcomment: 组网成为go的意愿值.CNend */
313     int  wps_method;                        /**< wps_method. CNcomment: 连接的WPS方式.CNend */
314 } ext_wifi_p2p_connect;
315 
316 /**
317  * @ingroup soc_wifi_p2p
318  *
319  *  Struct of p2p's persistent ssid.CNcomment:p2p永久网络ssid结构体。
320  */
321 typedef struct {
322     /**< ssid of persistent group. CNcomment: 永久网络名称.CNend */
323     unsigned char ssid[EXT_WIFI_MAX_SSID_LEN + 1];
324     /**< len of ssid. CNcomment: 永久网络名称长度.CNend */
325     unsigned int ssid_len;
326     /**< bssid is set or not. CNcomment: bssid是否设置.CNend */
327     unsigned int bssid_set;
328     /**< bssid of persistent group. CNcomment:永久网络bssid.CNend */
329     unsigned char bssid[EXT_WIFI_MAC_LEN];
330     /**< mode. CNcomment:工作模式.CNend */
331     enum wifi_mode mode;
332     /**< device addr. CNcomment:go的device addr.CNend */
333     unsigned char go_p2p_dev_addr[EXT_WIFI_MAC_LEN];
334     /**< psk. CNcomment:psk数据.CNend */
335     unsigned char psk[PSK_LEN];
336     /**< psk is set or not. CNcomment:psk是否设置.CNend */
337     int psk_set;
338     /**< disabled is set or not. CNcomment:wpa p2p设置的标志.CNend */
339     int disabled;
340     /**< list of client.CNcomment:关联的client表.CNend */
341     unsigned char p2p_client_list[MAX_CLINET_SAVE_ADDR_LEN];
342     /**< num of client.CNcomment:关联的client数量.CNend */
343     unsigned int num_p2p_clients;
344     /**< persistent or not.CNcomment:是否是永久网络.CNend */
345     int p2p_persistent_group;
346     /**< wps enable or not.CNcomment:wps是否开启.CNend */
347     int wps_disabled;
348 } p2p_persistent_ssid;
349 
350 /**
351  * @ingroup soc_wifi_p2p
352  *
353  *  Struct of p2p's persistent config .CNcomment:p2p永久网络配置结构体。
354  */
355 typedef struct {
356     char device_name[WPS_DEV_NAME_MAX_LEN + 1];        /**< device name.CNcomment:device 名称.CNend */
357     char manufacturer[WPS_MANUFACTURER_MAX_LEN + 1];   /**< manufacturer. CNcomment: 设备厂商名称.CNend */
358     char serial_number[WPS_SERIAL_NUMBER_MAX_LEN + 1]; /**< serial number. CNcomment: 设备序列号.CNend */
359     char model_name[WPS_MODEL_NAME_MAX_LEN + 1];       /**< model name. CNcomment: 设备型号.CNend */
360     char model_number[WPS_MODEL_NUMBER_MAX_LEN + 1];   /**< model number. CNcomment: 设备编号.CNend */
361 } p2p_persistent_config;
362 
363 /**
364  * @ingroup soc_wifi_p2p
365  *
366  *  Struct of p2p's persistent .CNcomment:p2p永久网络结构体。
367  */
368 typedef struct {
369     p2p_persistent_config conf;                        /**< config of persistent.CNcomment:永久网络配置.CNend */
370     p2p_persistent_ssid ssid[P2P_MAX_PERSISTENT_CNT];         /**< ssid config of persistent.CNcomment:ssid配置.CNend */
371 } p2p_user_persistent;
372 
373 /**
374  * @ingroup soc_wifi_p2p
375  *
376  *  Struct of p2p's persistent group.CNcomment:p2p永久网络组结构体。
377  */
378 typedef struct {
379     int network_id;                                        /**< network id.CNcomment:网络id.CNend */
380     unsigned char network_name[EXT_WIFI_MAX_SSID_LEN + 1]; /**< network name.CNcomment:网络名称.CNend */
381     unsigned char  go_bssid[EXT_WIFI_MAC_LEN];             /**< go bssid.CNcomment:go的bssid.CNend */
382     char  reserved;
383 } ext_p2p_persistent_group;
384 
385 /**
386 * @ingroup  soc_wifi_p2p
387 * @brief  Start Start wifi p2p.CNcomment:开启P2P.CNend
388 *
389 * @par Description:
390 *           Start wifi p2p.CNcomment:开启P2P.CNend
391 *
392 * @attention  1. Multiple interfaces of the same type are not supported.CNcomment:1. 不支持使用多个同类型接口.CNend\n
393 *             2. Dual interface coexistence support: STA + P2P.
394 *                CNcomment:2. 双接口共存支持:STA + P2P.CNend\n
395 *             3. The memories of <ifname> and <len> should be requested by the caller,
396 *                the input value of len must be the same as the length of ifname
397 *                (The minimum length is 5 bytes and the recommended length is 17 bytes).\n
398 *                CNcomment:3. <ifname>和<len>由调用者申请内存,用户写入len的值必须与ifname长度一致。
399 *                (最小长度是5字节,建议长度为17Bytes).CNend\n
400 *             4. This is a blocking function.CNcomment:4.此函数为阻塞函数.CNend
401 * @param  ifname          [IN/OUT]     Type #char *, device name.CNcomment:接口名.CNend
402 * @param  len             [IN/OUT]     Type #int *, length of device name.CNcomment:接口名长度.CNend
403 *
404 * @retval #EXT_WIFI_OK        Execute successfully.
405 * @retval #EXT_WIFI_FAIL      Execute failed.
406 * @par Dependency:
407 *            @li soc_wifi_api.h: WiFi API
408 * @see  NULL
409 * @since
410 */
411 int uapi_wifi_p2p_start(char *ifname, int *len);
412 
413 /**
414 * @ingroup  soc_wifi_p2p
415 * @brief  Close wifi p2p.CNcomment:关闭P2P.CNend
416 *
417 * @par Description:
418 *           Close wifi p2p.CNcomment:关闭P2P.CNend
419 *
420 * @attention  1. This is a blocking function.CNcomment:1.此函数为阻塞函数.CNend
421 * @param  NULL
422 *
423 * @retval #EXT_WIFI_OK        Execute successfully.
424 * @retval #EXT_WIFI_FAIL      Execute failed.
425 * @par Dependency:
426 *            @li soc_wifi_api.h: WiFi API
427 * @see  NULL
428 * @since
429 */
430 int uapi_wifi_p2p_stop(void);
431 
432 /**
433 * @ingroup  soc_wifi_p2p
434 * @brief    Start p2p scan.CNcomment:开始p2p查找 。CNend
435 *
436 * @par Description:
437 *           Start p2p scan.CNcomment:开始p2p查找 。CNend
438 *
439 * @attention  sec: The value range is a positive integer starting from 5 to 120.
440                    CNcomment:取值范围为从5到120的正整数。CNend \n
441 * @param  sec          [IN]     Type  int, scan time(unit s).CNcomment:查找时间。CNend
442 *
443 * @retval #EXT_WIFI_OK        Execute successfully.
444 * @retval #EXT_WIFI_FAIL      Execute failed.
445 * @par Dependency:
446 *            @li soc_wifi_api.h: WiFi API
447 * @see  NULL
448 * @since
449 */
450 int uapi_wifi_p2p_find(int sec);
451 
452 /**
453 * @ingroup  soc_wifi_p2p
454 * @brief    Start p2p listen.CNcomment:开始p2p监听。CNend
455 *
456 * @par Description:
457 *           Start p2p listen.CNcomment:开始p2p监听。CNend
458 *
459 * @attention   1.period should be less than interval.CNcomment:1.period应该小于interval。CNend \n;
460 *              2.Both period and interval should be positive numbers,max num is 65535.
461 *                CNcomment:2.period和interval都为正数,最大值为65535。CNend \n;
462 *              3.When the period and interval are both 0, the listen stops.
463 *                CNcomment:3.当period和interval都为0的时候,监听停止。CNend \n;
464 *
465 * @param  period          [IN]     Type  int, listen time once(int ms).
466 *                                          CNcomment:每次监听时间。CNend
467 *         interval        [IN]     Type  int, listen time interval once (int ms).
468 *                                          CNcomment:每次间隔时间时间。CNend
469 * @retval #EXT_WIFI_OK        Execute successfully.
470 * @retval #EXT_WIFI_FAIL      Execute failed.
471 * @par Dependency:
472 *            @li soc_wifi_api.h: WiFi API
473 * @see  NULL
474 * @since
475 */
476 int uapi_wifi_p2p_listen(int period, int interval);
477 
478 /**
479 * @ingroup  soc_wifi_p2p
480 * @brief    Stop p2p find.CNcomment:停止p2p查找。CNend
481 *
482 * @par Description:
483 *           Stop p2p find.CNcomment:停止p2p查找。CNend
484 *
485 * @attention  NULL
486 * @param  NULL
487 *
488 * @retval #EXT_WIFI_OK        Execute successfully.
489 * @retval #EXT_WIFI_FAIL      Execute failed.
490 * @par Dependency:
491 *            @li soc_wifi_api.h: WiFi API
492 * @see  NULL
493 * @since
494 */
495 int uapi_wifi_p2p_stop_find(void);
496 
497 /**
498 * @ingroup  soc_wifi_p2p
499 * @brief    Set p2p log level.CNcomment:设置P2P的日志级别。CNend
500 *
501 * @par Description:
502 *           Set p2p log level.CNcomment:设置P2P的日志级别。CNend
503 *
504 * @attention  NULL
505 * @param  log_level
506 *
507 * @retval #EXT_WIFI_OK        Execute successfully.
508 * @retval #EXT_WIFI_FAIL      Execute failed.
509 * @par Dependency:
510 *            @li soc_wifi_api.h: WiFi API
511 * @see  NULL
512 * @since
513 */
514 int uapi_wifi_p2p_log_level(char *log_level);
515 
516 /**
517 * @ingroup  soc_wifi_p2p
518 * @brief    Connect to specific p2p device.CNcomment:连接指定的p2p设备。CNend
519 *
520 * @par Description:
521 *           Connect to specific p2p device.CNcomment:连接指定的p2p设备。CNend
522 *
523 * @attention   Address length must be 6 bytes.CNcomment:地址长度必须为6字节。CNend \n;
524 *
525 * @param  con    [IN]        Type  #ext_wifi_p2p_connect,associated parameter structure.CNcomment:p2p连接入参结构体。CNend
526 *
527 * @retval #EXT_WIFI_OK        Execute successfully.
528 * @retval #EXT_WIFI_FAIL      Execute failed.
529 * @par Dependency:
530 *            @li soc_wifi_api.h: WiFi API
531 * @see  NULL
532 * @since
533 */
534 int uapi_wifi_p2p_connect(ext_wifi_p2p_connect con);
535 
536 /**
537 * @ingroup  soc_wifi_p2p
538 * @brief    reject to specific p2p device.CNcomment:拒绝指定的p2p设备。CNend
539 *
540 * @par Description:
541 *           reject to specific p2p device.CNcomment:拒绝指定的p2p设备。CNend
542 *
543 * @attention  Address length must be 6 bytes.CNcomment:地址长度必须为6字节。CNend \n;
544 * @param  peer_addr    [IN]        Type  #const unsigned char *, peer device address.CNcomment:对端device地址。CNend
545 *         addr_len     [IN]        Type  #unsigned char , len of peer device address .CNcomment:对端device地址长度。CNend
546 * @retval #EXT_WIFI_OK        Execute successfully.
547 * @retval #EXT_WIFI_FAIL      Execute failed.
548 * @par Dependency:
549 *            @li soc_wifi_api.h: WiFi API
550 * @see  NULL
551 * @since
552 */
553 int uapi_wifi_p2p_reject(const unsigned char *peer_addr, unsigned char addr_len);
554 
555 /**
556 * @ingroup  soc_wifi_p2p
557 * @brief    1.Enabling a fixed p2p device network.CNcomment:启用永久网络。CNend
558 *           2.Invite other devices to join the group.CNcomment:邀请其他设备加入网络。CNend
559 *
560 * @par Description:
561 *          1.Enabling a persistent p2p network.CNcomment:启用永久网络。CNend
562 *          2.Invite other devices to join the group.CNcomment:邀请其他设备加入网络。CNend
563 *
564 * @attention Address length must be 6 bytes.CNcomment:地址长度必须为6字节。CNend \n;
565 * @param  persistent_id   [IN]        Type #int  connect network for persistent save value.
566 *                                                CNcomment:永久网络id,邀请其他网络的时候为-1。CNend
567 *         peer_addr       [IN]        Type #const unsigned char * peer mac address.CNcomment:对端device地址。CNend
568 *         addr_len        [IN]        Type #unsigned char len of peer mac address.
569 *                                                         CNcomment:对端device地址长度。CNend
570 *
571 * @retval #EXT_WIFI_OK        Execute successfully.
572 * @retval #EXT_WIFI_FAIL      Execute failed.
573 * @par Dependency:
574 *            @li soc_wifi_api.h: WiFi API
575 * @see  NULL
576 * @since
577 */
578 int uapi_wifi_p2p_invite(int persistent_id, const unsigned char *peer_addr, unsigned char addr_len);
579 
580 /**
581 * @ingroup  soc_wifi_p2p
582 * @brief  show information of peer.CNcomment:显示对端信息.CNend
583 *
584 * @par Description:
585 *           show information of peer.CNcomment:显示对端信息.CNend
586 * @attention  1. The memories of <p2pList> and <peer_num> memories are requested by the caller. \n
587 *             The <p2pList> size up to : OAL_SIZEOF(ext_wifi_p2p_peer_info p2pList) * 32. \n
588 *             CNcomment:1. <p2pList>和<peer_num>由调用者申请内存,
589 *             <p2pList>size最大为:OAL_SIZEOF(ext_wifi_p2p_peer_info p2pList) * 32.CNend \n
590 *             2. peer_num: parameters can be passed in to specify the number of find results.The maximum is 32. \n
591 *             CNcomment:2. peer_num: 可以传入参数,指定获取扫描到的结果数量,最大为32。CNend \n
592 *             3. peer_num should be same with number of ext_wifi_ap_info structures applied,
593 *                Otherwise, it will cause memory overflow. \n
594 *             CNcomment:3. peer_num和申请的ext_wifi_p2p_peer_info结构体数量一致,否则可能造成内存溢出。CNend \n
595 * @param  p2pList           [IN/OUT]    Type #ext_wifi_p2p_peer_info * p2p find result.CNcomment:p2p发现的结果.CNend
596 * @param  peer_num          [IN/OUT]    Type #unsigned int *, number of scan result.CNcomment:p2p发现的网络数目.CNend
597 *
598 * @retval #EXT_WIFI_OK        Execute successfully.
599 * @retval #EXT_WIFI_FAIL      Execute failed.
600 * @par Dependency:
601 *            @li soc_wifi_api.h: WiFi API
602 * @see  NULL
603 * @since
604 */
605 int uapi_wifi_p2p_peers(ext_wifi_p2p_peer_info *p2pList, unsigned int *peer_num);
606 
607 /**
608 * @ingroup  soc_wifi_p2p
609 * @brief    Show connect status of p2p.CNcomment:显示p2p的连接状态信息。CNend
610 *
611 * @par Description:
612 *           Show connect status of p2p.CNcomment:显示p2p的连接状态信息。CNend
613 *
614 * @attention  NULL
615 * @param   status      [OUT]       Type  #ext_wifi_p2p_status_info *, device information.
616 *
617 * @retval #EXT_WIFI_OK        Execute successfully.
618 * @retval #EXT_WIFI_FAIL      Execute failed.
619 * @par Dependency:
620 *            @li soc_wifi_api.h: WiFi API
621 * @see  NULL
622 * @since
623 */
624 int uapi_wifi_p2p_status(ext_wifi_p2p_status_info *status);
625 
626 /**
627 * @ingroup  soc_wifi_p2p
628 * @brief  Get all client's information of p2p go.CNcomment:p2p go获取已连接的client的信息.CNend
629 *
630 * @par Description:
631 *           Get all client's information of p2p go .CNcomment:p2p go获取已连接的client的信息.CNend
632 *
633 * @attention  1.client_list: malloc by user.CNcomment:1.连接client参数。由用户动态申请。CNend \n
634 *             2.client_list: max size is ext_wifi_p2p_client_info * 4.
635 *               CNcomment:2.client_list 足够的结构体大小,最大为ext_wifi_p2p_client_info * 4。CNend \n
636 *             3.client_num:parameters can be passed in to specify the number of connected client.The maximum is 4.
637 *               CNcomment:3.可以传入参数,指定获取已接入的client个数,最大为4。CNend \n
638 *             4.client_num should be the same with number of ext_wifi_p2p_client_info struct applied, Otherwise,
639 *               it will cause memory overflow.\n
640 *               CNcomment:4.client_num和申请的ext_wifi_p2p_client_info结构体数量一致,否则可能造成内存溢出。CNend \n
641 *             5.Only the client that are successfully associated are displayed.
642 *               CNcomment:5.只显示关联成功的client。CNend
643 * @param  client_list        [IN/OUT]  Type  #ext_wifi_p2p_client_info *, client information.CNcomment:client信息.CNend
644 * @param  client_num         [IN/OUT]  Type  #unsigned int *, client number.CNcomment:client个数.CNend
645 *
646 * @retval #EXT_WIFI_OK        Execute successfully.
647 * @retval #EXT_WIFI_FAIL      Execute failed.
648 * @par Dependency:
649 *            @li soc_wifi_api.h: WiFi API
650 * @see  NULL
651 * @since
652 */
653 int uapi_wifi_p2p_get_connected_client(ext_wifi_p2p_client_info *client_list, unsigned int *client_num);
654 
655 /**
656 * @ingroup  soc_wifi_p2p
657 * @brief  go deauth user by peer device address.CNcomment:go指定断开连接的client网络.CNend
658 *
659 * @par Description:
660 *          go deauth user by peer device address.CNcomment:go指定断开连接的client网络.CNend
661 *
662 * @attention  NULL
663 * @param  peer_dev_addr    [IN]     Type  #const unsigned char *, gc mac address.CNcomment:MAC地址.CNend
664 *         addr_len         [IN]     Type  #unsigned char, len of gc mac address.CNcomment:MAC地址.CNend
665 *
666 * @retval #EXT_WIFI_OK        Execute successfully.
667 * @retval #EXT_WIFI_FAIL      Execute failed.
668 * @par Dependency:
669 *            @li soc_p2p_api.h: WiFi API
670 * @see  NULL
671 * @since
672 */
673 int uapi_wifi_p2p_remove_client(const unsigned char *peer_dev_addr, unsigned char addr_len);
674 
675 /**
676 * @ingroup  soc_wifi_p2p
677 * @brief    Cancel an ongoing P2P group formation and joining-a-group related operation.
678             CNcomment:取消正在进行的P2P群组组建和入群相关操作。CNend
679 *
680 * @par Description:
681 *           Cancel an ongoing P2P group formation and joining-a-group related operation.
682             CNcomment:取消正在进行的P2P群组组建和入群相关操作。CNend
683 *
684 * @attention  NULL
685 *
686 * @retval #EXT_WIFI_OK        Execute successfully.
687 * @retval #EXT_WIFI_FAIL      Execute failed.
688 * @par Dependency:
689 *            @li soc_wifi_api.h: WiFi API
690 * @see  NULL
691 * @since
692 */
693 int uapi_wifi_p2p_cancel(void);
694 
695 /**
696 * @ingroup  soc_wifi_p2p
697 * @brief    disconncet for p2p network.CNcomment:断开p2p连接。CNend
698 *
699 * @par Description:
700 *           disconncet for p2p network.CNcomment:断开p2p连接。CNend
701 *
702 * @attention  NULL
703 *
704 * @retval #EXT_WIFI_OK        Execute successfully.
705 * @retval #EXT_WIFI_FAIL      Execute failed.
706 * @par Dependency:
707 *            @li soc_wifi_api.h: WiFi API
708 * @see  NULL
709 * @since
710 */
711 int uapi_wifi_p2p_remove_group(void);
712 
713 /**
714 * @ingroup  soc_wifi_p2p
715 * @brief    Update p2p configuration.CNcomment:p2p可修改的参数。CNend
716 *
717 * @par Description:
718 *           Update p2p configuration.CNcomment:p2p可修改的参数。CNend
719 *
720 * @attention  NULL
721 * @param   updateConfig      [IN]       Type  #ext_wifi_p2p_user_conf, configuration need update.
722 *
723 * @retval #EXT_WIFI_OK        Execute successfully.
724 * @retval #EXT_WIFI_FAIL      Execute failed.
725 * @par Dependency:
726 *            @li soc_wifi_api.h: WiFi API
727 * @see  NULL
728 * @since
729 */
730 int uapi_wifi_p2p_user_config(ext_wifi_p2p_user_conf updateConfig);
731 
732 /**
733 * @ingroup  soc_wifi_p2p
734 * @brief    Get p2p configuration.CNcomment:获取p2p的参数。CNend
735 *
736 * @par Description:
737 *           Get p2p configuration.CNcomment:获取p2p的参数。CNend
738 *
739 * @attention  NULL
740 * @param   updateConfig      [OUT]       Type  #ext_wifi_p2p_user_conf.
741 *
742 * @retval #EXT_WIFI_OK        Execute successfully.
743 * @retval #EXT_WIFI_FAIL      Execute failed.
744 * @par Dependency:
745 *            @li soc_wifi_api.h: WiFi API
746 * @see  NULL
747 * @since
748 */
749 int uapi_wifi_p2p_get_user_config(ext_wifi_p2p_user_conf *GetConfig);
750 
751 /**
752 * @ingroup  soc_wifi_p2p
753 * @brief    user accept p2p .CNcomment:p2p是否接受连接。CNend
754 *
755 * @par Description:
756 *           user accept p2p.
757 *
758 * @attention  NULL
759 * @param   con        [IN]        Type  #ext_wifi_p2p_connect, associated parameter structure.
760 *                                       CNcomment:连接入参结构体。CNend
761 *         assoc       [IN]        Type  #int assoc, accept or reject.CNcomment:p2p是否接受连接。CNend
762 *
763 * @retval #EXT_WIFI_OK        Execute successfully.
764 * @retval #EXT_WIFI_FAIL      Execute failed.
765 * @li soc_wifi_api.h: WiFi API
766 * @see  NULL
767 * @since
768 */
769 int uapi_wifi_p2p_user_accept(ext_wifi_p2p_connect con, int assoc);
770 
771 /**
772 * @ingroup  soc_wifi_p2p
773 * @brief  Set the status that P2P automatically accepts connections or manually receives connections.
774 *         CNcomment:设置p2p是自动接收连接还是手动接收连接.CNend
775 *
776 * @par Description:
777 *           Set the status that P2P automatically accepts connections or manually receives connections.
778 *           CNcomment:设置p2p是自动接收连接还是手动接收连接.CNend
779 *
780 * @attention  NULL
781 * @param  flag [IN]  Type  #ext_wifi_p2p_peer_connect_choose CNcomment:设置p2p是自动连接还是手动连接的标志.CNend
782 *
783 * @retval #EXT_WIFI_OK        Execute successfully.
784 * @retval #EXT_WIFI_FAIL      Execute failed.
785 * @par Dependency:
786 *            @li soc_wifi_p2p_api.h: WiFi API
787 * @see  NULL
788 * @since
789 */
790 int uapi_wifi_set_peer_connect_choose(ext_wifi_p2p_peer_connect_choose flag);
791 
792 /**
793 * @ingroup	soc_wifi_p2p
794 * @brief  Get the status that P2P automatically accepts connections or manually receives connections.
795 *         CNcomment:返回目前p2p是自动接收连接还是手动接收连接.CNend
796 *
797 * @par Description:
798 *           Get the status that P2P automatically accepts connections or manually receives connections.
799 *           CNcomment:返回目前p2p是自动接收连接还是手动接收连接.CNend
800 *
801 * @attention  NULL
802 * @param      NULL
803 *
804 * @retval #EXT_WIFI_P2P_PEER_CONNECT_AUTO or EXT_WIFI_P2P_PEER_CONNECT_MANUAL.
805 * @par Dependency:
806 *			 @li soc_wifi_api.h: WiFi API
807 * @see	NULL
808 * @since
809 */
810 ext_wifi_p2p_peer_connect_choose uapi_wifi_get_peer_connect_choose(void);
811 
812 /**
813 * @ingroup  soc_wifi_p2p
814 * @brief    Get the configuration information of P2P persistent network.CNcomment:获取p2p永久网络配置信息。CNend
815 *
816 * @par Description:NULL
817 *
818 * @attention  1.The persisetnt network information obtained is used to save it in NV and cannot be modified.
819 *               Otherwise, it may cause a memory error.
820 *               CNcomment:1.获取的永久网络信息,用于保存在nv中,不能修改,否则或造成内存错误.CNend
821 *             2.It need to obtain the permanent network configuration before p2pstop,
822 *               otherwise the persistent data will be cleared to 0
823 *               CNcomment:2.需要在p2pstop之前获取数据,否则永久网络数据会被清除。CNend
824 *
825 * @param   conf      [IN]       Type  #p2p_user_persistent *, configuration need be got.
826 *
827 * @retval #EXT_WIFI_OK        Execute successfully.
828 * @retval #EXT_WIFI_FAIL      Execute failed.
829 
830 * @par Dependency:
831 *            @li soc_wifi_api.h: WiFi API
832 * @see  NULL
833 * @since
834 */
835 int uapi_wifi_p2p_get_persistent_conf(p2p_user_persistent *conf);
836 
837 /**
838 * @ingroup  soc_wifi_p2p
839 * @brief    Get the configuration information of P2P persistent network.CNcomment:设置p2p永久网络配置信息。CNend
840 *
841 * @par Description:NULL
842 *
843 * @attention  The set permanent network information should be consistent with the obtained information,
844 *             otherwise it will cause memory error
845 *             CNcomment:设置的永久网络信息,要和获取的一致,否则或造成内存错误.CNend
846 *
847 * @param   conf      [IN]       Type  #p2p_user_persistent, configuration need be set.
848 *
849 * @retval #EXT_WIFI_OK        Execute successfully.
850 * @retval #EXT_WIFI_FAIL      Execute failed.
851 * @par Dependency:
852 *            @li soc_wifi_api.h: WiFi API
853 * @see  NULL
854 * @since
855 */
856 int uapi_wifi_p2p_set_persistent_conf(p2p_user_persistent conf);
857 
858 /**
859 * @ingroup  soc_wifi_p2p
860 * @brief    Get the nformation of P2P persistent network.CNcomment:获取永久网络信息给用户。CNend
861 *
862 * @par Description:NULL
863 *
864 * @attention  NULL
865 * @param   info      [IN/OUT]       Type  #ext_p2p_persistent_group *, infomation of persistent group.
866 *          info_num  [IN/OUT]       Type  #int *, number of persistent group.
867 * @retval #EXT_WIFI_OK        Execute successfully.
868 * @retval #EXT_WIFI_FAIL      Execute failed.
869 * @par Dependency:
870 *            @li soc_wifi_api.h: WiFi API
871 * @see  NULL
872 * @since
873 */
874 int uapi_wifi_p2p_get_persistent_info(ext_p2p_persistent_group *info, int *info_num);
875 
876 /**
877 * @ingroup  soc_wifi_p2p
878 * @brief    Get the configuration information of P2P persistent network.CNcomment: 删除永久网络信息。CNend
879 *
880 * @par Description:
881 *           network id.
882 *
883 * @attention  NULL
884 * @param   id      [IN]       Type  #int, network id.
885 *
886 * @retval #EXT_WIFI_OK        Execute successfully.
887 * @retval #EXT_WIFI_FAIL      Execute failed.
888 * @par Dependency:
889 *            @li soc_wifi_api.h: WiFi API
890 * @see  NULL
891 * @since
892 */
893 int uapi_wifi_p2p_del_persistent_info(int id);
894 
895 /**
896 * @ingroup  soc_wifi_p2p
897 * @brief    Starting WPS PBC.CNcomment: 启动wps pbc。CNend
898 *
899 * @par Description:NULL.
900 *
901 * @attention It can only be used when the device is go.CNcomment: 只有go的时候可以使用。CNend
902 * @param   NULL
903 *
904 * @retval #EXT_WIFI_OK        Execute successfully.
905 * @retval #EXT_WIFI_FAIL      Execute failed.
906 * @par Dependency:
907 *            @li soc_wifi_api.h: WiFi API
908 * @see  NULL
909 * @since
910 */
911 int uapi_wifi_p2p_wps_pbc(void);
912 #ifdef __cplusplus
913 #if __cplusplus
914     }
915 #endif
916 #endif
917 
918 #endif /* end of soc_wifi_p2p_api.h */
919 
920