ZHCU938C May 2018 – January 2021 CC3100 , CC3100MOD , CC3200 , CC3200MOD
主机具有一个 API,使用 sl_WlanSet(),允许添加和删除信息元素。执行命令后,将向主机发送基本响应事件。
示例:
sl_protocol_WlanSetInfoElement_t infoele;
infoele.index = Index; // Index of the info element. range: 0 - MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED
infoele.role = Role; // INFO_ELEMENT_AP_ROLE (0) or INFO_ELEMENT_P2P_GO_ROLE (1)
infoele.ie.id = Id; // Info element ID. if INFO_ELEMENT_DEFAULT_ID (0) is set, ID will be set to 221.
// Organization unique ID.If all 3 bytes are zero - it will be replaced with 08,00,28.
infoele.ie.oui[0] = Oui0; // Organization unique ID first Byte
infoele.ie.oui[1] = Oui1; // Organization unique ID second Byte
infoele.ie.oui[2] = Oui2; // Organization unique ID third Byte
infoele.ie.length = Len; // Length of the info element. must be smaller than 253 bytes
memset(infoele.ie.data, 0, INFO_ELEMENT_MAX_SIZE);
if ( Len <= INFO_ELEMENT_MAX_SIZE )
{
memcpy(infoele.ie.data, IE, Len); // Info element. length of the info element is [0-252]
sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT,sizeof(sl_protocol_WlanSetInfoElement_t),(_u8* ) &infoele);
}
sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT,sizeof(sl_protocol_WlanSetInfoElement_t),(_u8* ) &infoele);
参数 | 字节数 | 说明 |
---|---|---|
Index | 1 | 条目的索引 |
Role | 1 | AP – 0,P2P GO = 1 |
Index | 1 | IE 的索引 |
Role | 1 | 0 – AP,1 – P2P GO |
ID | 1 | IE 编号(null = 特定于供应商 [221]) |
OUI | 3 | 特定供应商 IE 中的组织 ID (null = MAC_ADDR_OUI) |
IE Length | 2 | IE 有效载荷长度。0 表示删除此 IE。值在 [0-252] 范围内。所有配置的信息元素的总长度不应大于 (INFO_ELEMENT_MAX_TOTAL_LENGTH) |
IE | IE 长度 (0-252) | 信息元素的有效载荷 |
该命令使用以下结构。
typedef struct {
UINT8 index;
UINT8 role; //bit0: AP = 0, GO = 1
sl_protocol_InfoElement_t ie;
} sl_protocol_WlanSetInfoElement_t;
其中 sl_protocol_InfoElement_t 定义如下:
typedef struct {
UINT8 id;
UINT8 oui[3];
UINT16 length;
UINT8 data[252];
} sl_protocol_InfoElement_t;
主机最多可以配置 4 个 IE。
#define MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED 4
信息元素大小上限为 252 字节
#define INFO_ELEMENT_MAX_SIZE 252
AP 模式下所有信息元素的总长度为 300 字节(例如 - 4 个信息元素,每个元素 75 字节)
#define INFO_ELEMENT_MAX_TOTAL_LENGTH_AP 300
P2P GO 模式下所有信息元素的总长度为 160 字节
#define INFO_ELEMENT_MAX_TOTAL_LENGTH_AP 160
此限制包括 ID(1 字节)+ 长度 (1) + OUI (3)。
Role 定义如下:
#define INFO_ELEMENT_AP_ROLE 0
#define INFO_ELEMENT_P2P_GO_ROLE 1