ThingPlug Test

Dependents:   WizFi310_ThingPlug_Test WizFi310_ThingPlug_Test_P

Fork of WizFi310Interface by WIZnet

Revision:
8:08588dd2a66f
Parent:
7:b7019399eb1e
Child:
9:90902218e268
--- a/WizFi310Interface.cpp	Fri Aug 25 00:55:43 2017 +0000
+++ b/WizFi310Interface.cpp	Mon Aug 28 05:19:48 2017 +0000
@@ -72,7 +72,14 @@
     return _wizfi310.getMACAddress();
 }
 
-int WizFi310Interface::conTP(const char *clientId, const char *credentialId, const char *serviceId, const char *devId, const char *containerNm)
+int WizFi310Interface::conTP(
+    const char *clientId, 
+    const char *credentialId, 
+    const char *serviceId, 
+    const char *devId, 
+    const char *containerNm,
+    const char *commandName
+    )
 {
     //if ( _wizfi310.joinTP(clientId, credentialId, serviceId, devId, containerNm) == -1 ) return NSAPI_ERROR_NO_SOCKET;
     
@@ -85,6 +92,9 @@
     if(_wizfi310.cmdSKTPCONTAINER("1", containerNm))    return -1;
     WIZ_INFO("Created Container\r\n");
     
+    if(_wizfi310.cmdSKTPCMD("1", commandName))    return -1;
+    WIZ_INFO("Created CommandName\r\n");
+    
     return 0;
 }
 
@@ -96,6 +106,34 @@
     return 0;
 }
 
+int WizFi310Interface::recvTP(const char *commandName, int executeStatus, int executeResult)
+{
+    int cid = 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;
+        }
+        
+        WIZ_INFO("Complete/r/n/r/n");
+        _wizfi310.initCon(cid, true);
+        
+        return 0;
+    }
+    
+    WIZ_INFO("Incorrect Request\r\n");
+    _wizfi310.initCon(cid, true);
+    
+    return -1;
+}
+
 int WizFi310Interface::disConTP()
 {   
     if(_wizfi310.cmdSKTPCON("0"))    return -1;