AndrOBD icon indicating copy to clipboard operation
AndrOBD copied to clipboard

Propagating an error up and reset a connection?

Open schnapi opened this issue 8 years ago • 3 comments

What would happen if we throw an exception here and propagate this error up to mainActivity. Can we do that? I would like to call mCommService.connectionLost() after that. Is that recommended?

https://github.com/fr3ts0n/AndrOBD/blob/eceacfc63ecb96781c75f6a39d52e0e1693ee0be/library/src/main/java/com/fr3ts0n/prot/StreamHandler.java#L103

Thanks!

schnapi avatar Apr 10 '18 06:04 schnapi

Hi @schnapi ,

Yes, I can see the advantage of it. I also see that the USB-Handler does exactly behave like you suggested, but BT and WiFi do not.

There are quite lot of callers to this method, so in order to propagate the exception I will have to check each caller to handle the exception.

Please give me some time for analysis ...

Thanks

fr3ts0n avatar Apr 10 '18 19:04 fr3ts0n

Currently doesn't look too well ... I tried to do these changes but received several un-intended effects during my real-live tests (like stopped communication w/o any disconnect detection ...). I'll have to find a better way to clean up this implementation ...

If you have a good idea, pls suggest with a pull request ...

fr3ts0n avatar Apr 18 '18 18:04 fr3ts0n

So far I haven't notice any un-intended effects from my side. Maybe you have problems with OBD adapter. I had some cheap OBD adapter which caused me a lot of problems. If I have any problems I will try to find another solution...

schnapi avatar Apr 26 '18 21:04 schnapi