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.
Fork of NySNICInterface by
Diff: YDwifi/YDwifi.cpp
- Revision:
- 3:9f90024d7fb2
- Parent:
- 2:0ba43344c814
- Child:
- 5:ef3befe3edad
--- a/YDwifi/YDwifi.cpp Tue Mar 11 10:38:36 2014 +0000
+++ b/YDwifi/YDwifi.cpp Thu Mar 13 01:34:56 2014 +0000
@@ -14,6 +14,7 @@
bool is_receive;
}tagUART_RECVBUF_T;
tagUART_RECVBUF_T gUART_RCVBUF;
+unsigned char gUART_TEMP_BUF[UART_RECVBUF_SIZE];
C_YDwifi *C_YDwifi::mInstance_p;
@@ -92,38 +93,49 @@
// Check received data is EOM.
if( recvdata == UART_CMD_EOM )
{
+/*
printf("[recv]\r\n");
for( i = 0; i < gUART_RCVBUF.size; i++ )
{
printf("%02x ", gUART_RCVBUF.buf[i]);
}
printf("\r\n");
-
- // Get buffer for payload data
- unsigned char *payload_buf_p = instance_p->mUartCommand.getResponseBuf();
+*/
unsigned char command_id;
+ // Get payload from received data from UART.
+ int payload_len = C_YD_UartMsg::getResponsePayload( gUART_RCVBUF.size, gUART_RCVBUF.buf
+ , &command_id, gUART_TEMP_BUF );
+/*
+ printf("[payload]\r\n");
+ for( i = 0; i < payload_len; i++ )
+ {
+ printf("%02x ", gUART_TEMP_BUF[i]);
+ }
+ printf("\r\n");
+*/
+ // Check scan results indication
+ if( (command_id == UART_CMD_ID_WIFI) || (gUART_TEMP_BUF[0] == UART_CMD_SID_WIFI_SCAN_RESULT_IND) )
+ {
+ // Scan result indicate
+ instance_p->mUartCommand.scanResultIndicate( gUART_TEMP_BUF, payload_len );
+ }
- if( payload_buf_p != NULL )
+ // Checks in the command which is waiting.
+ if( instance_p->mUartCommand.isWaitingCommand(command_id, gUART_TEMP_BUF) )
{
- // Get payload from received data from UART.
- int payload_len = C_YD_UartMsg::getResponsePayload( gUART_RCVBUF.size, gUART_RCVBUF.buf
- , &command_id, payload_buf_p );
- printf("[payload]\r\n");
- for( i = 0; i < payload_len; i++ )
+ // Get buffer for payload data
+ unsigned char *payload_buf_p = instance_p->mUartCommand.getResponseBuf();
+ if( payload_buf_p != NULL )
{
- printf("%02x ", payload_buf_p[i]);
+ memcpy( payload_buf_p, gUART_TEMP_BUF, payload_len );
+ instance_p->mUartCommand.setResponseBuf( NULL );
}
- printf("\r\n");
-
- // Checks in the command which is waiting.
- if( instance_p->mUartCommand.isWaitingCommand(command_id, payload_buf_p) )
- {
- // Set status
- instance_p->mUartCommand.setCommandStatus( payload_buf_p[2] );
- // Set signal for command response wait.
- instance_p->mUartCommand.signal();
- }
+ // Set status
+ instance_p->mUartCommand.setCommandStatus( gUART_TEMP_BUF[2] );
+ // Set signal for command response wait.
+ instance_p->mUartCommand.signal();
}
+
gUART_RCVBUF.size = 0;
gUART_RCVBUF.is_receive = false;
}
