Thanks for the explanation. I did not post it on the feedback, only here. Is auto lock an option already? When I hit settings there are no options other than restore or something like that. Am I missing this or is it yet to come?Hey, not sure if you were the one who submitted similar feedback via the site. This is a multi-faceted problem.
First, Auto-Lock - Easy fix, and already in the code base. This will let the app prevent the screen from sleeping while in the foreground.
Second is how strict iOS is with performing work in the background. You're not allowed to continuously stream data in the background. You can occasionally grab junks and perform work on that data, but not a stream. So in this use case, in order to use the app at all, it has to be in the foreground. For the MVP I made the choice to close the sockets whenever the app is put into the background. Trying to keep the connection alive poses a couple other issues. But I fully plan to circle back around to this.
Third and least possible to address is iOS's odd behavior with disconnected wireless devices. Part of this particular problem is the OBDLink itself, part of it is the system. I have a lot of background with Bluetooth, Bluetooth LE and WiFi on iOS. And have seen this many times in all protocols. Funny part is BLE is usually the easiest to deal with.
So here's the scenario I think you saw. You were connected and streaming from the device. Backgrounded the app or slept the phone. Reopened the app and it's not streaming anymore and the connection list is blank. You go to Settings, Bluetooth and Settings says you're still connected. If this is what you're referring to, it's an issue with either the way I am disconnecting from the device using available system calls or more likely yet another oddity with iOS. Problem is when I make the system call to close the socket connection, this actually puts the connected device into a limbo state were it's not connected but the system thinks it is. Only way to solve this is cycle power on the OBD or disconnect/reconnect from iOS Settings. I'm hoping addressing issue 2 will help alleviate this from being as prevalent. But you'll still see it in cases where the OBD module sleeps.