3200作为AP模式,IP连接可以获取,断开连接的怎么获取
3200作为AP模式,IP连接可以获取,断开连接的怎么获取
我有设备连接上这个消息可以打出来;
UART_PRINT("[NETAPP EVENT] IP Leased to Client: IP=%d.%d.%d.%d , ",
然后断开就没有这个消息出来;
UART_PRINT("[NETAPP EVENT] IP Released for Client: IP=%d.%d.%d.%d , ",
下次连接还会打出连接消息;
UART_PRINT("[NETAPP EVENT] IP Leased to Client: IP=%d.%d.%d.%d , ",
void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *pNetAppEvent)
{
switch(pNetAppEvent->Event)
{
case SL_NETAPP_IPV4_IPACQUIRED_EVENT:
case SL_NETAPP_IPV6_IPACQUIRED_EVENT:
{
SET_STATUS_BIT(g_ulStatus, STATUS_BIT_IP_AQUIRED);
}
break;
case SL_NETAPP_IP_LEASED_EVENT:
{
SET_STATUS_BIT(g_ulStatus, STATUS_BIT_IP_LEASED);
g_ulStaIp = (pNetAppEvent)->EventData.ipLeased.ip_address;
UART_PRINT("[NETAPP EVENT] IP Leased to Client: IP=%d.%d.%d.%d , ",
SL_IPV4_BYTE(g_ulStaIp,3), SL_IPV4_BYTE(g_ulStaIp,2),
SL_IPV4_BYTE(g_ulStaIp,1), SL_IPV4_BYTE(g_ulStaIp,0));
}
break;
case SL_NETAPP_IP_RELEASED_EVENT:
{
CLR_STATUS_BIT(g_ulStatus, STATUS_BIT_IP_LEASED);
UART_PRINT("[NETAPP EVENT] IP Released for Client: IP=%d.%d.%d.%d , ",
SL_IPV4_BYTE(g_ulStaIp,3), SL_IPV4_BYTE(g_ulStaIp,2),
SL_IPV4_BYTE(g_ulStaIp,1), SL_IPV4_BYTE(g_ulStaIp,0));
}
break;
default:
{
UART_PRINT("[NETAPP EVENT] Unexpected event [0x%x] \n\r",
pNetAppEvent->Event);
}
break;
}
}
你好!谢谢你的回答,这段是程序里边有的 ,但是不起作用的!