From e732cd1a429dca70f653882f5d4d08b6656b444b Mon Sep 17 00:00:00 2001 From: follower Date: Sat, 8 Dec 2007 03:05:21 +0000 Subject: [PATCH] Add routine to read and match bytes received. (Essentially strcmp replacement without requiring a large receive buffer.) Note that failed matches drop any bytes matched successfully. git-svn-id: svn+ssh://oldsvn/home/mlalondesvn/svn/cral@79 3ee9b42a-b53c-0410-a25e-f0b6218d5d5b --- .../wiz810mj/src/demo/WizDemo3/WizDemo3.pde | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/branches/follower/wiz810mj/src/demo/WizDemo3/WizDemo3.pde b/branches/follower/wiz810mj/src/demo/WizDemo3/WizDemo3.pde index a293858..747d97d 100644 --- a/branches/follower/wiz810mj/src/demo/WizDemo3/WizDemo3.pde +++ b/branches/follower/wiz810mj/src/demo/WizDemo3/WizDemo3.pde @@ -200,6 +200,23 @@ uint8_t readByte() { } +int readMatch(char *stringToMatch) { + + while (getSn_RX_RSR(testSocket) < strlen(stringToMatch)) { + // block + // TODO: Return error or wait or "too short"? + } + + for (int currCharIdx = 0; currCharIdx < strlen(stringToMatch); currCharIdx++) { + if (readByte() != stringToMatch[currCharIdx]) { + return 0; + } + } + + return 1; +} + + void loop() { Serial.println("Test W5100 socket...");