Modified for W5500 Ethernet initialize Added the Ethernet interface re-initialize code Added the connection retry

Dependents:   ThingPlug_Ethernet_Example

Fork of GMMP_mbed by Eric Jung

Revision:
0:7e575e5f88ec
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Operation/Control/GMMP_Control.cpp	Sun Aug 09 14:11:35 2015 +0000
@@ -0,0 +1,45 @@
+#include "GMMP_Control.h"
+
+int GMMP_Control_Req(Control_Req*  pControl_Req)
+{
+	if(pControl_Req == NULL)
+	{
+		return SERVER_INFO_NOT_FOUND;
+	}
+
+	if(CheckSocket() != 0)
+	{
+		return SERVER_INFO_NOT_FOUND;
+	}
+
+	int nRet = ReadTCP( (char*)&pControl_Req->header  , sizeof(pControl_Req->header) );
+	if(nRet == GMMP_SUCCESS)
+	{
+		return nRet;
+	}
+
+	ConvertShort cvtshort;
+	cvtshort.sU8 = 0;
+	memcpy(cvtshort.usShort, pControl_Req->header.usMessageLength, sizeof(pControl_Req->header.usMessageLength) );
+
+	int nReadSize = ltobs(cvtshort.sU8) - sizeof(pControl_Req->header) ;
+
+	return ReadTCP( (char*)&pControl_Req->body, nReadSize);
+}
+
+int GMMP_Control_Rsp(Control_Rsp*  pControl_Rsp)
+{
+	if(pControl_Rsp == NULL)
+	{
+		return SERVER_INFO_NOT_FOUND;
+	}
+
+	if(CheckSocket() != 0)
+	{
+		return SERVER_INFO_NOT_FOUND;
+	}
+
+	return WriteTCP( (char*)pControl_Rsp, sizeof(Control_Rsp) );
+}
+
+