Skip to main content

OBD-II / ELM327 Vehicle State

Fabrika AI reads the vehicle's current state from an ELM327-compatible adapter and attaches the snapshot to the next vision or acoustic scan. The snapshot is stored with the scan, shown in the report, included in the PDF, and included in support diagnostics.

Supported connections​

LinkImplementationNotes
Bluetooth LEflutter_blue_plus (local Android platform fork)Scans all BLE advertisements; prefers known OBD names; selects write/notify characteristics including FFE0/FFE1, FFF0/FFF1/FFF2, and 18F0/2AF0.
Bluetooth classic SPPNative Android BluetoothSocket + event channel in MainActivity.ktLists paired devices; connect over the standard SPP UUID. Pair the adapter in Android settings first.
USB OTGNative Android USB host bridge over usb-serial-for-android 3.9.0Drivers: CDC ACM, FTDI, CP210x, CH34x, PL2303. Requests USB permission on first connect.

The app requests Android 12+ BLUETOOTH_SCAN / BLUETOOTH_CONNECT; older Android uses legacy Bluetooth and location permissions. USB host support is optional in the manifest.

Diagnostic commands​

Elm327Client initializes with ATZ, echo/linefeed/header off, protocol auto (ATSP0), adaptive timing, and a longer timeout. It then reads:

  • VIN with 09 02 (ISO-TP multi-frame aware)
  • Live PIDs: load, coolant, fuel trims, RPM, speed, timing, intake/ambient/oil temperature, MAF, throttle/pedal, fuel level, run time, distances, battery/control voltage, fuel rate, torque and more
  • Stored, pending, and permanent DTCs (03, 07, 0A)
  • MIL/readiness (01 01)
  • Adapter ID, protocol, and ATRV battery voltage

Responses are parsed from both spaced and compact hex, with 0: / 1: ISO-TP prefixes. Commands are serialized to avoid overlapping ELM requests. NO DATA, SEARCHING..., ?, and unsupported PIDs are ignored per request.

Attach to the model and reports​

  • ScanRecord.obd stores an ObdSnapshot; SQLite schema version 2 adds scans.obd_json.
  • AppState.saveVisionScan and saveAcousticScan automatically use a fresh snapshot (under 45 minutes old) from ObdSession.
  • The snapshot appears in the report detail screen, the generated PDF, and support-diagnostic bundles.
  • OBD data is evidence/context, not an independent autonomous diagnosis. The existing precision gates still apply.

Safety and limitations​

  • Do not clear DTCs without recording them first; clearing resets readiness monitors.
  • Adapter clone firmware varies. Unsupported PIDs and multi-frame quirks are handled defensively, but a physical adapter matrix test is still required.
  • OBD-II coverage is broad for 2001+ cars in Egypt, but older/protocol-specific vehicles may be partial. The UI explains this rather than promising universal coverage.
  • Keep the cable away from hot engine parts and never drive while operating the phone.
  • OBD access is local; no vehicle data is uploaded unless the user submits a support bundle or shares a report.