Continuous loop reading data
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user