From 2e4f5189dfa5f22a658848ab53a3c1bc76603536 Mon Sep 17 00:00:00 2001 From: follower Date: Sat, 8 Dec 2007 03:27:20 +0000 Subject: [PATCH] Add some comments to 'readMatch'. git-svn-id: svn+ssh://oldsvn/home/mlalondesvn/svn/cral@81 3ee9b42a-b53c-0410-a25e-f0b6218d5d5b --- .../wiz810mj/src/demo/WizDemo3/WizDemo3.pde | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/branches/follower/wiz810mj/src/demo/WizDemo3/WizDemo3.pde b/branches/follower/wiz810mj/src/demo/WizDemo3/WizDemo3.pde index 7637177..fd1a2f0 100644 --- a/branches/follower/wiz810mj/src/demo/WizDemo3/WizDemo3.pde +++ b/branches/follower/wiz810mj/src/demo/WizDemo3/WizDemo3.pde @@ -201,12 +201,27 @@ uint8_t readByte() { int readMatch(char *stringToMatch) { + /* + + Routine to read and match bytes received. + + (Essentially strcmp replacement without requiring a large receive buffer.) + + NOTE: Failed matches drop all bytes read so far. (i.e. you can't check for + a bunch of possible matches from the same starting position). + TODO: Fix this. + + Note: This blocks if there isn't enough data in the rx buffer. + + */ while (getSn_RX_RSR(testSocket) < strlen(stringToMatch)) { // block // TODO: Return error or wait or "too short"? } + // TODO: Do fancy string-matching techniques to avoid reading the whole string + // on non-matches. :-) for (int currCharIdx = 0; currCharIdx < strlen(stringToMatch); currCharIdx++) { if (readByte() != stringToMatch[currCharIdx]) { return 0;