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.
Dependents: SNIC-httpclient-example SNIC-ntpclient-example
Fork of SNICInterface by
Diff: YDwifi/YDwifiUartCommand.cpp
- Revision:
- 3:9f90024d7fb2
- Parent:
- 2:0ba43344c814
- Child:
- 7:e88ccbe0225f
--- a/YDwifi/YDwifiUartCommand.cpp Tue Mar 11 10:38:36 2014 +0000
+++ b/YDwifi/YDwifiUartCommand.cpp Thu Mar 13 01:34:56 2014 +0000
@@ -42,6 +42,11 @@
return mResponseBuf_p;
}
+void C_YDwifiUartCommand::setScanResultHandler( void (*handler_p)(tagSCAN_RESULT_T *scan_result) )
+{
+ mScanResultHandler_p = handler_p;
+}
+
int C_YDwifiUartCommand::wait()
{
@@ -76,3 +81,39 @@
return ret;
}
+void C_YDwifiUartCommand::scanResultIndicate( unsigned char *payload_p, int payload_len )
+{
+ if( (payload_p == NULL) || (mScanResultHandler_p == NULL) )
+ {
+ return;
+ }
+
+ tagSCAN_RESULT_T scan_result;
+ int ap_count = payload_p[2];
+ unsigned char *ap_info_p = &payload_p[3];
+ int ap_info_idx = 0;
+
+ printf("%d\r\n", ap_count);
+ for( int i = 0; i < ap_count; i++ )
+ {
+ scan_result.channel = ap_info_p[ap_info_idx];
+ ap_info_idx++;
+ scan_result.rssi = (signed)ap_info_p[ap_info_idx];
+ ap_info_idx++;
+ scan_result.security= ap_info_p[ap_info_idx];
+ ap_info_idx++;
+ memcpy( scan_result.bssid, &ap_info_p[ap_info_idx], BSSID_MAC_LENTH );
+ ap_info_idx += BSSID_MAC_LENTH;
+ scan_result.network_type= ap_info_p[ap_info_idx];
+ ap_info_idx++;
+ scan_result.max_rate= ap_info_p[ap_info_idx];
+ ap_info_idx++;
+ ap_info_idx++; // reserved
+ strcpy( scan_result.ssid, (char *)&ap_info_p[ap_info_idx] );
+ ap_info_idx += strlen( (char *)&ap_info_p[ap_info_idx] );
+ ap_info_idx++;
+
+ // Scanresult callback
+ mScanResultHandler_p( &scan_result );
+ }
+}
