Extending the X_NUCLEO_IDW01M1 to allow configuration of the board as an access point
Dependents: X_NUCLEO_IDW01M1_AP_Test
Fork of X_NUCLEO_IDW01M1 by
Diff: Spwf/wifi_module.c
- Revision:
- 11:67a8c3499caf
- Parent:
- 10:e97284ae55f1
- Child:
- 22:a1276b7d3b2d
--- a/Spwf/wifi_module.c Fri May 13 07:43:12 2016 +0000 +++ b/Spwf/wifi_module.c Sat May 14 07:28:29 2016 +0000 @@ -326,6 +326,7 @@ status_flag.enable_receive_data_chunk = WIFI_FALSE; status_flag.data_pending_sockD=WIFI_FALSE; status_flag.enable_sock_read = WIFI_FALSE; + status_flag.enable_sock_data = WIFI_FALSE; status_flag.enable_query = WIFI_FALSE; status_flag.Set_AT_Cmd_Response_False = WIFI_FALSE; status_flag.enable_fw_update_read = WIFI_FALSE; @@ -1329,30 +1330,20 @@ { if(status_flag.enable_sock_read && status_flag.Q_Contains_Message && !status_flag.message_pending) { - //printf((const char*)&process_buffer[0]); - status_flag.Q_Contains_Message = WIFI_FALSE; - message_size = SockON_Data_Length; - chunk_size = Fillptr; - memcpy(UserDataBuff, process_buffer, Fillptr); - memset(process_buffer,0x00,Fillptr); - SockON_Data_Length = SockON_Data_Length - Fillptr; - Fillptr = 0; - pop_queue_length = 0; - - /* data is D Q'ed in pop_buffer and we return from here(process_buffer()) without processing this data. Next time we enter in this procedure the data will be overe written in pop_buffer - To avoid this, rewinding is necessary. */ - if(pop_buffer_size) - { - __disable_irq(); - rewind_buffer_queue(&big_buff,pop_buffer_size); //in this the case of rewinding past the buffer->end can happen - __enable_irq(); - memset(ptr, 0x00, pop_buffer_size); - pop_buffer_size = 0; - } - - Stop_Dequeue(); - status_flag.Pending_SockON_Callback = WIFI_TRUE; //set this to callback to user with User Buffer pointer - return; + /* data is D Q'ed in pop_buffer and we return from here(process_buffer()) without processing this data. Next time we enter in this procedure the data will be overe written in pop_buffer + To avoid this, rewinding is necessary. */ + if(pop_buffer_size) + { + __disable_irq(); + rewind_buffer_queue(&big_buff,pop_buffer_size); //in this the case of rewinding past the buffer->end can happen + __enable_irq(); + memset(ptr, 0x00, pop_buffer_size); + } + //used for bypassing enable_receive_data_chunk part for the first time \r\n..\r\n is received in case of socket data + status_flag.enable_sock_data = WIFI_TRUE; + + status_flag.Q_Contains_Message = WIFI_FALSE; + pop_queue_length = Fillptr; } //if in data mode, reset on \r\n @@ -1386,10 +1377,10 @@ status_flag.enable_receive_wifi_scan_response = WIFI_TRUE; } - if(!status_flag.Pending_SockON_Callback && !status_flag.HTTP_Data_available && !status_flag.FILE_Data_available) + //if(!status_flag.Pending_SockON_Callback && !status_flag.HTTP_Data_available && !status_flag.FILE_Data_available) { //Check Process Buffer for any pending message - if(status_flag.enable_receive_data_chunk) + if(status_flag.enable_receive_data_chunk && !status_flag.enable_sock_data) { if(pop_buffer_size) { @@ -1458,6 +1449,9 @@ status_flag.sock_read_ongoing = WIFI_TRUE; sock_total_count = sock_total_count + pop_queue_length; + if(status_flag.enable_sock_data) + status_flag.enable_sock_data = WIFI_FALSE; + /* Check for "ERROR: Not enough data in buffer " */ pStr = (char *) strstr((const char *)&process_buffer,"ERROR: ");