Open zmanian opened 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
B.append
Actually, that is what recv is doing, reading everything until a inter byte timeout, which returns an empty string.
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