ThingPlug Test
Dependents: WizFi310_ThingPlug_Test WizFi310_ThingPlug_Test_P
Fork of WizFi310Interface by
Revision 9:90902218e268, committed 2017-10-19
- Comitter:
- cliff1
- Date:
- Thu Oct 19 04:34:44 2017 +0000
- Parent:
- 8:08588dd2a66f
- Child:
- 10:ea405bb59143
- Commit message:
- 171019
Changed in this revision
| WizFi310/WizFi310_sock.cpp | Show annotated file Show diff for this revision Revisions of this file |
| WizFi310Interface.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/WizFi310/WizFi310_sock.cpp Mon Aug 28 05:19:48 2017 +0000
+++ b/WizFi310/WizFi310_sock.cpp Thu Oct 19 04:34:44 2017 +0000
@@ -167,10 +167,12 @@
int WizFi310::recv (int cid, char *buf, int len)
{
int i;
-
+
if (!isConnected(cid)) return -1;
if (_con[cid].buf == NULL ) return 0;
+
+ memset(buf, 0x00, sizeof(buf));
while (!_con[cid].received && _state.mode != MODE_COMMAND);
_con[cid].received = false;
--- a/WizFi310Interface.cpp Mon Aug 28 05:19:48 2017 +0000
+++ b/WizFi310Interface.cpp Thu Oct 19 04:34:44 2017 +0000
@@ -108,24 +108,42 @@
int WizFi310Interface::recvTP(const char *commandName, int executeStatus, int executeResult)
{
- int cid = 0;
+ int cnt, cid = 0, ret = 0;
char buffer[1024] = "";
-
+
if(_wizfi310.recv(cid, buffer, sizeof(buffer)))
{
//printf("%s\r\n", buffer);
-
+
if(_wizfi310.cmdSKTPRESULT(commandName, executeStatus, executeResult))
{
_wizfi310.initCon(cid, true);
return -1;
}
+
+ for(cnt = 0; cnt < sizeof(buffer); cnt++)
+ {
+ if( buffer[cnt] == '8' )
+ {
+ if( buffer[cnt + 1] == '0' )
+ {
+ WIZ_INFO("1!!/r/n/r/n");
+ ret = 1;
+ }
+
+ else if( buffer[cnt + 1] == '1' )
+ {
+ WIZ_INFO("2!!/r/n/r/n");
+ ret = 2;
+ }
+ }
+ }
WIZ_INFO("Complete/r/n/r/n");
_wizfi310.initCon(cid, true);
- return 0;
+ return ret;
}
WIZ_INFO("Incorrect Request\r\n");
