ZHCU938C May 2018 – January 2021 CC3100 , CC3100MOD , CC3200 , CC3200MOD
sl_NetCfgSet – 管理以下网络功能的配置:
示例:
/* 禁用 Rx 聚合 */
_u8 RxAggrEnable = 0;
sl_NetCfgSet(SL_SET_HOST_RX_AGGR, 0, sizeof(RxAggrEnable), (_u8 *)&RxAggrEnable);
_NetCfgIpV4Args_t ipV4;
ipV4.ipV4 = (unsigned long) SL_IPV4_VAL(10,1,1,201); // unsigned long IP address
ipV4.ipV4Mask = (unsigned long) SL_IPV4_VAL(255,255,255,0); // unsigned long //Subnet mask for this AP/P2P
ipV4.ipV4Gateway = (unsigned long) SL_IPV4_VAL(10,1,1,1); // unsigned long //Default gateway address
ipV4.ipV4DnsServer = (unsigned long) SL_IPV4_VAL(8,16,32,64); // unsigned long DNS
//server address
sl_NetCfgSet(SL_IPV4_AP_P2P_GO_STATIC_ENABLE, 1,
sizeof(_NetCfgIpV4Args_t),(unsigned char *)&ipV4);
sl_Stop(0);
sl_Start(NULL,NULL,NULL);
sl_NetCfgGet – 读取网络配置。选项是:
从 WLAN 工作站或 P2P 客户端获取 IP 地址的示例:
unsigned char len = sizeof(_NetCfgIpV4Args_t);
unsigned char dhcpIsOn = 0;
_NetCfgIpV4Args_t ipV4 = {0};
sl_NetCfgGet(SL_IPV4_STA_P2P_CL_GET_INFO,&dhcpIsOn,&len,(unsigned char *)&ipV4);
printf("DHCP is %s IP %d.%d.%d.%d MASK %d.%d.%d.%d GW %d.%d.%d.%d DNS %d.%d.%d.%d\n",
(dhcpIsOn > 0) ? "ON":"OFF", SL_IPV4_BYTE(ipV4.ipV4,3), SL_IPV4_BYTE(ipV4.ipV4,2),
SL_IPV4_BYTE(ipV4.ipV4,1), SL_IPV4_BYTE(ipV4.ipV4,0), SL_IPV4_BYTE(ipV4.ipV4Mask,3),
SL_IPV4_BYTE(ipV4.ipV4Mask,2), SL_IPV4_BYTE(ipV4.ipV4Mask,1),
SL_IPV4_BYTE(ipV4.ipV4Mask,0), SL_IPV4_BYTE(ipV4.ipV4Gateway,3),
SL_IPV4_BYTE(ipV4.ipV4Gateway,2), SL_IPV4_BYTE(ipV4.ipV4Gateway,1),
SL_IPV4_BYTE(ipV4.ipV4Gateway,0), SL_IPV4_BYTE(ipV4.ipV4DnsServer,3),
SL_IPV4_BYTE(ipV4.ipV4DnsServer,2), SL_IPV4_BYTE(ipV4.ipV4DnsServer,1),
SL_IPV4_BYTE(ipV4.ipV4DnsServer,0));