Wisors / OBD2Connect

This is a simple implementation of a socket connection to OBD2 adapter.
MIT License
24 stars 7 forks source link

iOS 9/10 Compatibility #1

Closed Kalvin126 closed 7 years ago

Kalvin126 commented 7 years ago

Hey Wisor,

Awesome start on OBD2Connect. Are you able to get this working on iOS9/10 devices? My own OBD project no longer works. Trying your demo project, it request times out as well. It connects fine, but requests time out.

I previous had an iPhone 5 running iOS 8 that had ELM transmissions working properly, but I no longer have said device.

Wisors commented 7 years ago

Hi Kalvin126,

I tried it on iPhone 7 iOS 10 and it works. I have two Wi-Fi adapters (ELM327 v1.5 and STN1170) and it is compatible with both of them. You should try to increase timeout interval, because by default it sets to 0.1 sec: let connection = OBDConnection(requestTimeout: 2) // Timeout in seconds

Kalvin126 commented 7 years ago

I tried 1 second, but it timed out as well. I'll increasing it further. Would you be open to contributions?

Wisors commented 7 years ago

Yeap, you are welcome to contribute. Try to check your adapter with any free OBD app from AppStore (for example https://itunes.apple.com/app/obd-car-doctor/id652142348). Is it work?

Also, It would be great to check is there any data received from adapter in one of the methods of OBDConnection class: private func handleReceived(data: Data)

Kalvin126 commented 7 years ago

Alright awesome. I actually just confirmed my obd wifi adapter is dead. Time to get another one :p

Kalvin126 commented 7 years ago

Might I ask what specific ELM327 adapter you are using? I have a Veepeak mini ELM327 v1.5 adapter. I tried it with obd car doctor and it work just fine actually. I guess I need to further debug.

Wisors commented 7 years ago

I have the cheapest Noname adapter you can buy on aliexpress, but it actually works fine for me. I should notice, that my framework has responsibility to transfer data between adapter and a phone. So, inside demo project I sent only ATZ command to reset the adapter to default settings. Usually, ATSP0 command follows next. And as I mentioned earlier func handleReceived(data: Data) would be the best place to start to debug the adapter response. Good luck!

Kalvin126 commented 7 years ago

Ok so, I put a breakpoint in handleReceived(data:. Ocaissionally I would get a response of ?\r\r> when sending ATZ command. The response seems like garbage though... This is through my iPad Air 2 with iOS 10.2, iPhone 6s 10.2.1, MacOS Sim 9.3/10.2

Wisors commented 7 years ago

Sorry for a late response. All commands must follow with a close line character \r and the response with ? character means that your adapter doesn't understand provided command.

Kalvin126 commented 7 years ago

No problems. I am just trying to get to the bottom of this. Apps like OBD Car Doctor from the app store work. Its able to send AT Z then the AT SP 0 commands.

Wisors commented 7 years ago

It's incorrect to compare this framework to app from app store. OBD2Connect just a "data-tube". It connects your API above it and OBD2 adapter only, all commands syntax and response handling are up to you.

Kalvin126 commented 7 years ago

Right, I understand that. I am just saying that they are able to send the same ATZ command and get a valid response back. Will be closing this issue indefinately.