CC3100作为STA模式,怎样可以得到CC3100的MAC地址
Terry Han:
参考simplelink的库函数
读取CC3xxx无线wifi本机的MAC地址函数如下sl_NetCfgGet(SL_MAC_ADDRESS_GET,NULL,&macAddressLen,(unsigned char *)macAddressVal);
karmond tse:
回复 Terry Han:
请问simplelink库函数的下载地址是?
karmond tse:
回复 Terry Han:
现在还有一个问题就是CC3100作为STA,怎样可以得到CC3100连接的无线路由的SSID
Terry Han:
回复 karmond tse:
SSID的获取是在CC3100的回调函数中的,如下:
//*****************************************************************************////! \brief The Function Handles WLAN Events//!//! \param[in] pWlanEvent – Pointer to WLAN Event Info//!//! \return None//!//*****************************************************************************void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent){ if(!pWlanEvent) { return; }
switch(pWlanEvent->Event) { case SL_WLAN_CONNECT_EVENT: { SET_STATUS_BIT(g_ulStatus, STATUS_BIT_CONNECTION);
// // Information about the connected AP (like name, MAC etc) will be // available in 'slWlanConnectAsyncResponse_t'-Applications // can use it if required // // slWlanConnectAsyncResponse_t *pEventData = NULL; // pEventData = &pWlanEvent->EventData.STAandP2PModeWlanConnected; //
// Copy new connection SSID and BSSID to global parameters memcpy(g_ucConnectionSSID,pWlanEvent->EventData. STAandP2PModeWlanConnected.ssid_name, pWlanEvent->EventData.STAandP2PModeWlanConnected.ssid_len); memcpy(g_ucConnectionBSSID, pWlanEvent->EventData.STAandP2PModeWlanConnected.bssid, SL_BSSID_LENGTH);
UART_PRINT("[WLAN EVENT] STA Connected to the AP: %s ," "BSSID: %x:%x:%x:%x:%x:%x\n\r", g_ucConnectionSSID,g_ucConnectionBSSID[0], g_ucConnectionBSSID[1],g_ucConnectionBSSID[2], g_ucConnectionBSSID[3],g_ucConnectionBSSID[4], g_ucConnectionBSSID[5]); } break;
case SL_WLAN_DISCONNECT_EVENT: { slWlanConnectAsyncResponse_t* pEventData = NULL;
CLR_STATUS_BIT(g_ulStatus, STATUS_BIT_CONNECTION); CLR_STATUS_BIT(g_ulStatus, STATUS_BIT_IP_AQUIRED);
pEventData = &pWlanEvent->EventData.STAandP2PModeDisconnected;
// If the user has initiated 'Disconnect' request, //'reason_code' is SL_USER_INITIATED_DISCONNECTION if(SL_USER_INITIATED_DISCONNECTION == pEventData->reason_code) { UART_PRINT("[WLAN EVENT]Device disconnected from the AP: %s," "BSSID: %x:%x:%x:%x:%x:%x on application's request \n\r", g_ucConnectionSSID,g_ucConnectionBSSID[0], g_ucConnectionBSSID[1],g_ucConnectionBSSID[2], g_ucConnectionBSSID[3],g_ucConnectionBSSID[4], g_ucConnectionBSSID[5]); } else { UART_PRINT("[WLAN ERROR]Device disconnected from the AP AP: %s," "BSSID: %x:%x:%x:%x:%x:%x on an ERROR..!! \n\r", g_ucConnectionSSID,g_ucConnectionBSSID[0], g_ucConnectionBSSID[1],g_ucConnectionBSSID[2], g_ucConnectionBSSID[3],g_ucConnectionBSSID[4], g_ucConnectionBSSID[5]); } memset(g_ucConnectionSSID,0,sizeof(g_ucConnectionSSID)); memset(g_ucConnectionBSSID,0,sizeof(g_ucConnectionBSSID)); } break;
default: { UART_PRINT("[WLAN EVENT] Unexpected event [0x%x]\n\r", pWlanEvent->Event); } break; }}
TI中文支持网


