David Fletcher / Mbed 2 deprecated cc3100_Test_websock_Camera_CM4F

Dependencies:   mbed

Revision:
18:3f1b52616d00
Parent:
12:7d75ba5deed1
--- a/http/server/WebSockHandler.cpp	Mon Aug 31 15:20:36 2015 +0000
+++ b/http/server/WebSockHandler.cpp	Thu Sep 03 20:10:39 2015 +0000
@@ -290,7 +290,6 @@
  */
 int WSCore_DataSend(UINT16 uConnection, struct HttpBlob PayLoad, UINT8 Opcode)
 {
-	Uart_Write((uint8_t*)"WSCore_DataSend\n\r");
 	UINT16 usTotalLength;
 	UINT8 usNextBlock;
 	UINT16 usPayloadLen;	// The heap cannot support beyond 65kb
@@ -304,7 +303,7 @@
 		usTotalLength = PayLoad.uLength;
 
 	do{
-
+        wait_ms(10);
 		///Is this the final packet?
 		if(usTotalLength < FRAGMENT_LENGTH)
 		{
@@ -316,7 +315,7 @@
 
 		/// Add this byte to the sendpacket
 		HttpResponse_AddCharToResponseHeaders(usNextBlock);
-
+        
 		///Reset byte
 		usNextBlock = 0x0;
 		///Mask bit is always set to 0 from server to client
@@ -331,7 +330,7 @@
 
 		/// Add this byte to the sendpacket
 		HttpResponse_AddCharToResponseHeaders(usNextBlock);
-
+    
 		/// If payload length is more than 125 bytes, we need 16 bits to represent it.
 		if(usPayloadLen == (126))
 		{
@@ -351,12 +350,14 @@
 		}
 
 		HttpResponse_AddStringToResponseHeaders(pucPayLoadData,(usPayloadLen));
-
-		if(!WS_SendPacket(uConnection))
+        wait_ms(2);
+		if(!WS_SendPacket(uConnection)){
+		    Uart_Write((uint8_t*)"WS_SendPacket error \n\r");
 			return 0;
-
+        }
 		if(Opcode == WS_CLOSE)
 		{
+			Uart_Write((uint8_t*)"WS_Close \n\r");
 			sl_WebSocketCloseEvtHdlr();
 			wait(1);
 			(HttpCore_CloseConnection(uConnection));
@@ -364,7 +365,6 @@
 		}
 
 		usTotalLength -= (usPayloadLen);
-
 		// Reset to continuation frame if packet is larger than max fragment size
 		Opcode = WS_CONTINUATION;