From 9e4345bf77b5173b041694817afef2c4dd4c7999 Mon Sep 17 00:00:00 2001 From: Clovis Durand Date: Fri, 13 Dec 2019 00:05:58 +0100 Subject: [PATCH] [#14] Updated main.cpp to use testAccept Signed-off-by: Clovis Durand --- software/src/main.cpp | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/software/src/main.cpp b/software/src/main.cpp index 9c06c70..9e5655e 100644 --- a/software/src/main.cpp +++ b/software/src/main.cpp @@ -96,20 +96,33 @@ void loop(void) { Serial.print("[DEBUG] New client, IP : "); Serial.println(lClient.localIP()); - std::string lCurrentLine; + std::string lCurrentLine = ""; int lResult = 0; - /* Loop while the client is connected */ - while(lClient.connected()) { - /* Process request */ - lResult = acceptRequest(&lClient); - if(0 != lResult) { - Serial.println("[ERROR] Failed to process remote request w/ acceptRequest !"); - } else { - Serial.println("[DEBUG] Processed acceptRequest successfully !"); - } + // /* Loop while the client is connected */ + // while(lClient.connected()) { + // /* Process request */ + // lResult = acceptRequest(&lClient); + // if(0 != lResult) { + // Serial.println("[ERROR] Failed to process remote request w/ acceptRequest !"); + // } else { + // Serial.println("[DEBUG] Processed acceptRequest successfully !"); + // } + // } + + lResult = testAccept(&lClient, &lCurrentLine, &sRequest); + if(0 != lResult) { + Serial.println("[ERROR] Failed to process remote request w/ testAccept !"); + } else { + Serial.println("[DEBUG] Processed testAccept successfully !"); } + /* Close the client when operation is done */ + sRequest = ""; + lClient.stop(); + Serial.println("Client disconnected."); + Serial.println(); + /* Clear the request string */ sRequest = "";