Bulldog icon indicating copy to clipboard operation
Bulldog copied to clipboard

I2CBusConnection needs an available() method

Open pdibona opened this issue 11 years ago • 1 comments

Currently, the I2CBusConnection allows reading and writing data. But I see no way to check if data is available before invoking the readByte() method.

I tried using the connection.getInputStream().available() method, but that always throws an IOException about an invalid seek.

If the slave device doesn't respond almost instantly, the readByte() method throws a timeout IOException.

(Otherwise -- you have a great library here! Thanks!)

pdibona avatar Nov 22 '14 02:11 pdibona

Hi,

you're right about that. I'll see if something like this is possible.

Kind regards, Datenheld aka Bulldog

2014-11-22 3:49 GMT+01:00 pdibona [email protected]:

Currently, the I2CBusConnection allows reading and writing data. But I see no way to check if data is available before invoking the readByte() method.

I tried using the connection.getInputStream().available() method, but that always throws an IOException about an invalid seek.

If the slave device doesn't respond almost instantly, the readByte() method throws a timeout IOException.

(Otherwise -- you have a great library here! Thanks!)

— Reply to this email directly or view it on GitHub https://github.com/Datenheld/Bulldog/issues/15.

Datenheld avatar Nov 23 '14 15:11 Datenheld