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.
Dependents: ThingPlug_WiFi_Example_2 ThingPlug_Ethernet_Example ThingPlug_Ethernet_Example_temp_V2
Fork of GMMP_2 by
Operation/Control/GMMP_Control.cpp@10:84a748b7d1f6, 2015-08-14 (annotated)
- Committer:
- lesmin
- Date:
- Fri Aug 14 09:11:32 2015 +0000
- Revision:
- 10:84a748b7d1f6
- Parent:
- 0:7e575e5f88ec
added TCP retry codes by WIZnet
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| lesmin | 0:7e575e5f88ec | 1 | #include "GMMP_Control.h" |
| lesmin | 0:7e575e5f88ec | 2 | |
| lesmin | 0:7e575e5f88ec | 3 | int GMMP_Control_Req(Control_Req* pControl_Req) |
| lesmin | 0:7e575e5f88ec | 4 | { |
| lesmin | 0:7e575e5f88ec | 5 | if(pControl_Req == NULL) |
| lesmin | 0:7e575e5f88ec | 6 | { |
| lesmin | 0:7e575e5f88ec | 7 | return SERVER_INFO_NOT_FOUND; |
| lesmin | 0:7e575e5f88ec | 8 | } |
| lesmin | 0:7e575e5f88ec | 9 | |
| lesmin | 0:7e575e5f88ec | 10 | if(CheckSocket() != 0) |
| lesmin | 0:7e575e5f88ec | 11 | { |
| lesmin | 0:7e575e5f88ec | 12 | return SERVER_INFO_NOT_FOUND; |
| lesmin | 0:7e575e5f88ec | 13 | } |
| lesmin | 0:7e575e5f88ec | 14 | |
| lesmin | 0:7e575e5f88ec | 15 | int nRet = ReadTCP( (char*)&pControl_Req->header , sizeof(pControl_Req->header) ); |
| lesmin | 0:7e575e5f88ec | 16 | if(nRet == GMMP_SUCCESS) |
| lesmin | 0:7e575e5f88ec | 17 | { |
| lesmin | 0:7e575e5f88ec | 18 | return nRet; |
| lesmin | 0:7e575e5f88ec | 19 | } |
| lesmin | 0:7e575e5f88ec | 20 | |
| lesmin | 0:7e575e5f88ec | 21 | ConvertShort cvtshort; |
| lesmin | 0:7e575e5f88ec | 22 | cvtshort.sU8 = 0; |
| lesmin | 0:7e575e5f88ec | 23 | memcpy(cvtshort.usShort, pControl_Req->header.usMessageLength, sizeof(pControl_Req->header.usMessageLength) ); |
| lesmin | 0:7e575e5f88ec | 24 | |
| lesmin | 0:7e575e5f88ec | 25 | int nReadSize = ltobs(cvtshort.sU8) - sizeof(pControl_Req->header) ; |
| lesmin | 0:7e575e5f88ec | 26 | |
| lesmin | 0:7e575e5f88ec | 27 | return ReadTCP( (char*)&pControl_Req->body, nReadSize); |
| lesmin | 0:7e575e5f88ec | 28 | } |
| lesmin | 0:7e575e5f88ec | 29 | |
| lesmin | 0:7e575e5f88ec | 30 | int GMMP_Control_Rsp(Control_Rsp* pControl_Rsp) |
| lesmin | 0:7e575e5f88ec | 31 | { |
| lesmin | 0:7e575e5f88ec | 32 | if(pControl_Rsp == NULL) |
| lesmin | 0:7e575e5f88ec | 33 | { |
| lesmin | 0:7e575e5f88ec | 34 | return SERVER_INFO_NOT_FOUND; |
| lesmin | 0:7e575e5f88ec | 35 | } |
| lesmin | 0:7e575e5f88ec | 36 | |
| lesmin | 0:7e575e5f88ec | 37 | if(CheckSocket() != 0) |
| lesmin | 0:7e575e5f88ec | 38 | { |
| lesmin | 0:7e575e5f88ec | 39 | return SERVER_INFO_NOT_FOUND; |
| lesmin | 0:7e575e5f88ec | 40 | } |
| lesmin | 0:7e575e5f88ec | 41 | |
| lesmin | 0:7e575e5f88ec | 42 | return WriteTCP( (char*)pControl_Rsp, sizeof(Control_Rsp) ); |
| lesmin | 0:7e575e5f88ec | 43 | } |
| lesmin | 0:7e575e5f88ec | 44 | |
| lesmin | 0:7e575e5f88ec | 45 |
