reline / obd-api

OBD-II API migrated to Kotlin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

obd-api

OBD-II API

Important resources

Before opening an issue or using this library, please take a look at the following resources:

Example

After pairing and establishing Bluetooth connection to your ELM327 device..

..
// retrieve Bluetooth socket
socket = .. // specific to the platform you're using

// execute commands
try {
  EchoOffCommand().run(socket.inputStream, socket.outputStream)
  LineFeedOffCommand().run(socket.inputStream, socket.outputStream)
  TimeoutCommand(125).run(socket.inputStream, socket.outputStream)
  SelectProtocolCommand(ObdProtocols.AUTO).run(socket.inputStream, socket.outputStream)
  AmbientAirTemperatureCommand().run(socket.inputStream, socket.outputStream)
} catch (e: Exception) {
  // handle errors
}

Troubleshooting

As @dembol noted:

Have you checked your ELM327 adapter with Torque or Scanmaster to see if it works with your car? Maybe the problem is with your device?

Popular OBD diagnostic tools reset state and disable echo, spaces etc before protocol selection. Download some ELM327 terminal for android and try following commands in order:

ATD
ATZ
AT E0
AT L0
AT S0
AT H0
AT SP 0

About

OBD-II API migrated to Kotlin

License:Apache License 2.0


Languages

Language:Kotlin 51.9%Language:Java 48.1%