WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
ANY API

结构体

struct  ext_wifi_any_peer_info
 
struct  ext_wifi_any_device
 
struct  ext_wifi_any_callback
 

宏定义

#define WIFI_ANY_MAX_USER_DATA   250
 
#define WIFI_ANY_KEY_LEN   16
 
#define WIFI_ANY_MAC_LEN   6
 
#define WIFI_ANY_MAX_SSID_LEN   (32 + 1)
 

类型定义

typedef void(* hi_wifi_any_scan_result_cb) (ext_wifi_any_device *devices[], unsigned char num)
 Callback function invoked when ANY scan is finished.CNcomment:ANY扫描完成回调函数CNend
 
typedef void(* uapi_wifi_any_recv_cb) (unsigned char *mac, unsigned char *data, unsigned short len, unsigned char seqnum)
 Callback function for ANY RX.CNcomment:ANY驱动接收回调函数CNend
 
typedef void(* uapi_wifi_any_send_complete_cb) (unsigned char *mac, unsigned char status, unsigned char seqnum)
 Callback function for ANY TX.CNcomment:ANY驱动发送回调函数CNend
 

函数

int uapi_wifi_any_init (const char *ifname)
 Use this funtion to initialize ANY feature.CNcomment:ANY功能初始化函数CNend
 
int uapi_wifi_any_deinit (void)
 Use this funtion to de-initialize ANY feature.CNcomment:ANY功能去初始化函数CNend
 
void uapi_wifi_any_set_callback (uapi_wifi_any_send_complete_cb send_cb, uapi_wifi_any_recv_cb recv_cb)
 Register callback functions for ANY TX and RX.CNcomment:注册ANY驱动发送回调函数和接收回调函数CNend
 
int uapi_wifi_any_send (const unsigned char *mac, unsigned char mac_len, unsigned char *data, unsigned short data_len, unsigned char seq)
 Send ANY frame to specific mac address.CNcomment:向指定MAC地址的设备发送ANY数据。CNend
 
int uapi_wifi_any_add_peer (const ext_wifi_any_peer_info *peer_info)
 Add information of ANY peer device.CNcomment:添加ANY对端设备信息。CNend
 
int uapi_wifi_any_del_peer (const unsigned char *mac, unsigned char len)
 Delete specific peer device.CNcomment:删除指定MAC地址的对端设备信息。CNend
 
int uapi_wifi_any_fetch_peer (unsigned char index, ext_wifi_any_peer_info *peer)
 Get ANY peer device's information by index.CNcomment:获取指定索引的对端设备信息。CNend
 
int uapi_wifi_any_discover_peer (hi_wifi_any_scan_result_cb p_fn_cb)
 Start ANY scan and register callback to handle scan results.
CNcomment:发起ANY扫描并注册回调函数处理扫描完成之后的结果。CNend
 

详细描述

宏定义说明

◆ WIFI_ANY_KEY_LEN

#define WIFI_ANY_KEY_LEN   16

Length of key in octets used in ANY communication.CNcomment:ANY加密通信的密钥长度,固定为16字节。CNend

◆ WIFI_ANY_MAC_LEN

#define WIFI_ANY_MAC_LEN   6

Length of MAC address.CNcomment:MAC地址长度定义CNend

◆ WIFI_ANY_MAX_SSID_LEN

#define WIFI_ANY_MAX_SSID_LEN   (32 + 1)

Max length of wlan ssid(for driver).CNcomment:wifi驱动SSID最大长度,+1为\0预留空间CNend

◆ WIFI_ANY_MAX_USER_DATA

#define WIFI_ANY_MAX_USER_DATA   250

Max length of data for a single ANY transmit.CNcomment:单次ANY发送允许的最大数据长度。CNend

类型定义说明

◆ hi_wifi_any_scan_result_cb

typedef void(* hi_wifi_any_scan_result_cb) (ext_wifi_any_device *devices[], unsigned char num)

Callback function invoked when ANY scan is finished.CNcomment:ANY扫描完成回调函数CNend

Description:
When registered,the driver uses this callback to deliver ANY devices found after an ANY scan.
CNcomment:注册该回调函数之后,驱动每次完成ANY扫描调用该接口反馈结果给上层.CNend
注意
1. This function is called in driver context,should not be blocked or do long time waiting.
CNcomment:1. 该回调函数运行于驱动线程,不能阻塞或长时间等待.CNend
  1. The memories of <devices> are requested and freed by the driver automatically.
    CNcomment:2. <devices>由驱动申请内存,也由驱动释放,回调中不应释放.CNend
参数
devices[IN] Type ext_wifi_any_device *, array of poniter of ANY devices found.CNcomment:发现的ANY设备信息, 该参数为指针类型的数组。CNend
num[IN] Type #unsigned char, the number of ANY devices found, maximum is 32.CNcomment:发现的设备数量, 最大不超过32.CNend
返回值
#voidno return value.CNcomment:无返回值.CNend
Dependency:
参见
uapi_wifi_any_discover_peer

◆ uapi_wifi_any_recv_cb

typedef void(* uapi_wifi_any_recv_cb) (unsigned char *mac, unsigned char *data, unsigned short len, unsigned char seqnum)

Callback function for ANY RX.CNcomment:ANY驱动接收回调函数CNend

Description:
When registered,the driver uses this callback to deliver data received.
CNcomment:注册该回调函数之后,驱动收到ANY报文则调用该回调函数传递给上层应用.CNend
注意
1. This function is called in driver context,should not be blocked or do long time waiting.
CNcomment:1. 该回调函数运行于驱动线程,不能阻塞或长时间等待.CNend
  1. The memories of <mac> and <data> are requested and freed by the driver.
    CNcomment:2. <mac>和<data>由驱动申请内存,也由驱动释放,回调中不应释放.CNend
参数
mac[IN] Type #unsigned char *, MAC address with 6 octets length.CNcomment:6字节长度MAC地址.CNend
data[IN] Type #unsigned char *, the address of data received.CNcomment:接收到数据的缓存地址.CNend
len[IN] Type #unsigned short, the length in octet of data received.CNcomment:接收的数据长度, 最大为250字节.CNend
seqnum[IN] Type #unsigned char, the sequence number of the ANY frame, range [0-255]. CNcomment:接收到的ANY帧的序列号,范围0-255.CNend
返回值
#voidno return value.CNcomment:无返回值.CNend
Dependency:
参见
uapi_wifi_any_set_callback

◆ uapi_wifi_any_send_complete_cb

typedef void(* uapi_wifi_any_send_complete_cb) (unsigned char *mac, unsigned char status, unsigned char seqnum)

Callback function for ANY TX.CNcomment:ANY驱动发送回调函数CNend

Description:
When registered,the driver uses this callback to notify whether an ACK has received.
CNcomment:注册该回调函数之后,驱动将发送结果(是否收到ACK)反馈给上层应用.CNend
注意
1. This function is called in driver context,should not be blocked or do long time waiting.
CNcomment:1. 该回调函数运行于驱动线程,不能阻塞或长时间等待.CNend
  1. The memories of <mac> are requested and freed by the driver.
    CNcomment:2. <mac>由驱动申请内存,也由驱动释放,回调中不应释放.CNend
参数
mac[IN] Type #unsigned char *, MAC address with 6 octets length.CNcomment:6字节长度MAC地址.CNend
status[IN] Type #unsigned char, the result of a single transmit,return 1 if transmitted successfully. CNcomment:单次发送的结果, 值为1代表发送成功,其他值代表发送失败.CNend
seqnum[IN] Type #unsigned char, the sequence number of the ANY frame, range [0-255]. CNcomment:接收到的ANY帧的序列号,范围0-255.CNend
返回值
#voidno return value.CNcomment:无返回值.CNend
Dependency:
参见
uapi_wifi_any_set_callback

函数说明

◆ uapi_wifi_any_add_peer()

int uapi_wifi_any_add_peer ( const ext_wifi_any_peer_info peer_info)

Add information of ANY peer device.CNcomment:添加ANY对端设备信息。CNend

Description:
Add information of ANY peer device(mac address, channel and key).
the number of peer devices must not exceed 16, among which the encrypted must not exceed 6.
CNcomment:添加对端设备的MAC地址,所在信道信息和用于加密通信的密钥。
对端设备总数最多16个,其中加密通信的对端个数最多6个。CNend
注意
1. The driver just stores the channels of peer devices.
It will not switch to a channel automatically which differs with the current channel.
CNcomment:1. 驱动仅保存对端设备的信道号,通信过程不会自动切到对应信道.CNend
  1. The memories of <peer_info> are requested and freed by user APP.
    CNcomment:2. <peer_info>内存由用户管理,驱动接口中不会释放.CNend
参数
peer_info[IN] Type ext_wifi_any_peer_info *, information of peer device. CNcomment:对端设备的信息.CNend
返回值
#EXT_OKExcute successfully
#OtherError code
Dependency:
参见
NULL

◆ uapi_wifi_any_deinit()

int uapi_wifi_any_deinit ( void  )

Use this funtion to de-initialize ANY feature.CNcomment:ANY功能去初始化函数CNend

Description:
Use this funtion to de-initialize ANY feature.CNcomment:ANY功能去初始化函数CNend
注意
NULL
参数
NULL
返回值
#EXT_OKExcute successfully
#OtherError code
Dependency:
  • hi_any_api.h: ANY API
参见
NULL

◆ uapi_wifi_any_del_peer()

int uapi_wifi_any_del_peer ( const unsigned char *  mac,
unsigned char  len 
)

Delete specific peer device.CNcomment:删除指定MAC地址的对端设备信息。CNend

Description:
Delete peer device specified by MAC address, the <len> should be constant 6.
CNcomment:删除指定MAC地址的对端设备信息,MAC地址长度需固定填6字节。CNend
注意
The memories of <mac> are requested and freed by user APP.
CNcomment:<mac>内存由用户申请和管理,执行完成后驱动不会释放.CNend
参数
mac[IN] Type #const unsigned char *, peer device's MAC address. CNcomment:待删除的对端设备的MAC地址.CNend
len[IN] Type #unsigned char, length of MAC address which shall be constant 6. CNcomment:对端设备的MAC地址长度,固定填6字节.CNend
返回值
#EXT_OKExcute successfully
#OtherError code
Dependency:
参见
NULL

◆ uapi_wifi_any_discover_peer()

int uapi_wifi_any_discover_peer ( hi_wifi_any_scan_result_cb  p_fn_cb)

Start ANY scan and register callback to handle scan results.
CNcomment:发起ANY扫描并注册回调函数处理扫描完成之后的结果。CNend

Description:
Start ANY scan and register callback to handle scan results.
The limit to the number of peers discoverd is 32 for a single scan.
CNcomment:发起ANY扫描并注册回调函数处理扫描完成之后的结果,单次扫描最多返回32个对端设备信息。CNend
注意
NULL
参数
p_fn_cb[IN] Type hi_wifi_any_scan_result_cb, callback function to handle scan results. CNcomment:由用户实现的回调函数, 扫描完成之后驱动调用该回调处理扫描结果.CNend
返回值
#EXT_OKExcute successfully
#OtherError code
Dependency:
参见
hi_wifi_any_scan_result_cb

◆ uapi_wifi_any_fetch_peer()

int uapi_wifi_any_fetch_peer ( unsigned char  index,
ext_wifi_any_peer_info peer 
)

Get ANY peer device's information by index.CNcomment:获取指定索引的对端设备信息。CNend

Description:
Get ANY peer device's information by index.Index starts from 0 and should not exceed 15.
CNcomment:获取指定索引的对端设备信息。其中传入的index从0开始指定查询第几个对端,最大不能超过15。CNend
注意
The memories of <peer> are requested and freed by user APP.
CNcomment:<peer>内存由用户申请和管理,由驱动填充查询到的信息.CNend
参数
index[IN] Type #unsigned char, peer device's index, start from 0. CNcomment:待查询的对端设备的索引,从0开始.CNend
peer[OUT] Type ext_wifi_any_peer_info *, peer device's information. CNcomment:查询到的对端设备的信息.CNend
返回值
#EXT_OKExcute successfully
#OtherError code
Dependency:
参见
NULL

◆ uapi_wifi_any_init()

int uapi_wifi_any_init ( const char *  ifname)

Use this funtion to initialize ANY feature.CNcomment:ANY功能初始化函数CNend

Description:
Use this funtion to initialize ANY feature.CNcomment:ANY功能初始化函数CNend
注意
A device shall be intialized only once, do de-initialzing first before perform a new initialization.
CNcomment:一个设备只允许一次初始化,重新初始化之前需要先调用去ANY初始化.CNend
参数
seqnum[IN] Type #const char *, the interface name used to TX/RX ANY frames, eg.wlan0/ap0/mesh0. CNcomment:用于收发ANY报文的接口名称,常用值为"wlan0","ap0"或"mesh0".CNend
返回值
#EXT_OKExcute successfully
#OtherError code
Dependency:
  • hi_any_api.h: ANY API
参见
NULL

◆ uapi_wifi_any_send()

int uapi_wifi_any_send ( const unsigned char *  mac,
unsigned char  mac_len,
unsigned char *  data,
unsigned short  data_len,
unsigned char  seq 
)

Send ANY frame to specific mac address.CNcomment:向指定MAC地址的设备发送ANY数据。CNend

Description:
Frame TX interface of ANY, specify frame's sequece number by seq.
the mac_len shall be constant 6 and data_len for a frame should not exceed 250 octets.
CNcomment:ANY报文发送接口,可以通过seq指定该报文的发送序列号。
其中MAC地址长度固定填6字节,待发送的数据长度data_len不能超过250字节 CNend
注意
The memories of <mac> and <data> are requested and freed by user APP.
CNcomment:<mac>和<data>内存由用户申请和管理,执行完成后驱动不会释放.CNend
参数
mac[IN] Type #const unsigned char *, destination MAC address, it may be unicast or broadcast. CNcomment:6字节长度目的MAC地址, 可为单播或者广播地址, 不支持组播地址.CNend
mac_len[IN] Type #unsigned char, length of MAC address which shall be 6 in octet. CNcomment:MAC地址长度, 需为6字节.CNend
data[IN] Type #unsigned char *, the address of data.CNcomment:待发送数据的缓存地址.CNend
len[IN] Type #unsigned short, the length in octet of data, maximum is 250. CNcomment:待发送的数据长度, 最大为250字节.CNend
seqnum[IN] Type #unsigned char, the sequence number of the ANY frame, range [0-255]. CNcomment:待发送的ANY帧的序列号,范围0-255.CNend
返回值
#EXT_OKExcute successfully
#OtherError code
Dependency:
参见
uapi_wifi_any_send_complete_cb

◆ uapi_wifi_any_set_callback()

void uapi_wifi_any_set_callback ( uapi_wifi_any_send_complete_cb  send_cb,
uapi_wifi_any_recv_cb  recv_cb 
)

Register callback functions for ANY TX and RX.CNcomment:注册ANY驱动发送回调函数和接收回调函数CNend

Description:
Register callback functions for ANY TX and RX.CNcomment:注册ANY驱动发送回调函数和接收回调函数CNend
注意
APP shall implement the TX/RX callbacks and register them to driver through this function.
CNcomment:需要用户自己实现该回调函数功能并通过上述接口注册给驱动.CNend
参数
send_cb[IN] Type uapi_wifi_any_send_complete_cb, callback function for ANY TX. CNcomment:ANY驱动发送回调函数.CNend
recv_cb[IN] Type uapi_wifi_any_recv_cb, callback function for ANY RX. CNcomment:ANY驱动接收回调函数.CNend
返回值
#voidno return value.CNcomment:无返回值.CNend
Dependency:
参见
uapi_wifi_any_send_complete_cb | uapi_wifi_any_recv_cb