Continuous loop reading data

This commit is contained in:
Aart van Halteren
2013-07-16 21:52:05 +02:00
parent 96071fb9b5
commit 632c59580b
2 changed files with 26 additions and 20 deletions

View File

@@ -12,23 +12,21 @@ class InSyncState < StatePattern::State
while (idx+sync_pattern_length < bytes.length && !new_frame_starts(bytes,idx,sync_pattern_length)) do
frame = frame + bytes[idx]
idx = idx +1
idx = idx +1
end
# did we reach the end of the frame?
if new_frame_starts(bytes,idx,sync_pattern_length)
p "------ FRAME -----"
frame_lines = frame.split("\n")
p frame_lines
p "##################"
p "------ FRAME -----"
# p frame_lines
# p "##################"
reading = handle_frame(frame_lines)
p reading
return bytes[idx+sync_pattern_length..-1]
else
return nil
return bytes
end
end
private