Modified for W5500 Ethernet initialize
Fork of GMMP_mbed by
Operation/Control/GMMP_Control.cpp
- Committer:
- lesmin
- Date:
- 2015-08-09
- Revision:
- 0:7e575e5f88ec
File content as of revision 0:7e575e5f88ec:
#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) ); }