Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: G_functions/fPtr_func.cpp
- Revision:
- 4:5af740da0a59
- Parent:
- 1:c73566c6788a
diff -r b89198ac2efe -r 5af740da0a59 G_functions/fPtr_func.cpp
--- a/G_functions/fPtr_func.cpp Sun Feb 22 18:33:10 2015 +0000
+++ b/G_functions/fPtr_func.cpp Mon Feb 23 21:10:13 2015 +0000
@@ -524,14 +524,30 @@
#if (defined(sl_WlanEvtHdlr))
void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent)
{
-
+ unsigned char g_ucConnectionSSID[32+1]; //Connection SSID
+ unsigned char g_ucConnectionBSSID[6]; //Connection BSSID
+
if(pWlanEvent == NULL)
printf(" [WLAN EVENT] NULL Pointer Error \n\r");
switch(pWlanEvent->Event) {
case SL_WLAN_CONNECT_EVENT: {
_cc3100_->SET_STATUS_BIT(g_Status, STATUS_BIT_CONNECTION);
-
+
+ // 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);
+
+ printf("[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]);
/*
* Information about the connected AP (like name, MAC etc) will be
* available in 'slWlanConnectAsyncResponse_t' - Applications
@@ -554,10 +570,22 @@
/* If the user has initiated 'Disconnect' request, 'reason_code' is SL_USER_INITIATED_DISCONNECTION */
if(SL_USER_INITIATED_DISCONNECTION == pEventData->reason_code) {
- printf(" Device disconnected from the AP on application's request \n\r");
+ printf("[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 {
- printf(" Device disconnected from the AP on an ERROR..!! \n\r");
+ printf("[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;
@@ -573,7 +601,7 @@
break;
default: {
- printf(" [WLAN EVENT] Unexpected event \n\r");
+ printf("[WLAN EVENT] Unexpected event [0x%x]\n\r",pWlanEvent->Event);
}
break;
}
@@ -607,6 +635,16 @@
pEventData = &pNetAppEvent->EventData.ipAcquiredV4;
g_GatewayIP = pEventData->gateway;
+ printf("[NETAPP EVENT] IP Acquired: IP=%d.%d.%d.%d , ""Gateway=%d.%d.%d.%d\n\r",
+ _cc3100_->_netcfg.SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.ip,3),
+ _cc3100_->_netcfg.SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.ip,2),
+ _cc3100_->_netcfg.SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.ip,1),
+ _cc3100_->_netcfg.SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.ip,0),
+ _cc3100_->_netcfg.SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.gateway,3),
+ _cc3100_->_netcfg.SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.gateway,2),
+ _cc3100_->_netcfg.SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.gateway,1),
+ _cc3100_->_netcfg.SL_IPV4_BYTE(pNetAppEvent->EventData.ipAcquiredV4.gateway,0));
+
}
break;
@@ -618,7 +656,7 @@
break;
default: {
- printf(" [NETAPP EVENT] Unexpected event \n\r");
+ printf("[NETAPP EVENT] Unexpected event [0x%x] \n\r",pNetAppEvent->Event);
}
break;
}
@@ -657,13 +695,13 @@
printf(" [SOCK EVENT] Close socket operation, failed to transmit all queued packets\n\r");
break;
default:
- printf(" [SOCK EVENT] Unexpected event \n\r");
+ printf("[SOCK ERROR] - TX FAILED : socket %d , reason""(%d) \n\n", pSock->EventData.sd, pSock->EventData.status);
break;
}
break;
default:
- printf(" [SOCK EVENT] Unexpected event \n\r");
+ printf("[SOCK EVENT] - Unexpected Event [%x0x]\n\n",pSock->Event);
break;
}
}
@@ -706,7 +744,7 @@
* Most of the general errors are not FATAL are are to be handled
* appropriately by the application
*/
- printf(" [GENERAL EVENT] \n\r");
+ printf("[GENERAL EVENT] - ID=[%d] Sender=[%d]\n\n", pDevEvent->EventData.deviceEvent.status, pDevEvent->EventData.deviceEvent.sender);
}
#endif