jputcu / serialport

Cross platform haskell library for using the serial port
Other
43 stars 36 forks source link

Do we need a recieveAll function? #20

Open zmanian opened 10 years ago

zmanian commented 10 years ago

When I used your library I always end up with a function similar to this...

Should something like it be in the library? I typically work with text console type interfaces

recieveAll :: SerialPort -> IO B.ByteString recieveAll serialHandle = do resp <- recv serialHandle 128 case resp of "" -> return resp _ -> do x <- recieveAll serialHandle return $ resp B.append x

jputcu commented 10 years ago

Actually, that is what recv is doing, reading everything until a inter byte timeout, which returns an empty string.