obdii

0.0.1 • Public • Published

obdii

WORK IN PROGRESS

Based on https://github.com/sipimokus/node-obd2

WHY?

  • Leverage typescript better.
  • Extendability, allow more transportation layers.
  • Detach PID detection for separate library
  • Testability with can-utils

INSTALLATION

$ yarn add obdii

EXAMPLES

REACT NATIVE BLUETOOTH EXAMPLE

Bluetooth react native

import BluetoothSerial from 'react-native-bluetooth-serial-next';
import { Connection } from 'obdii/connection/react-native-bluetooth';
import { ELM327 } from 'obdii/transport/elm327';
import { OBD2 } from 'obdii';
 
// first pair then connect to device
const device = BluetoothSerial.device('obd2-dongle');
await device.connect();
 
const connection = new Connection(device);
const transport = new ELM327();
const obd = new OBD2({ connection, transport });
 
await obd.start();
await obd.listDTC();

Also bluetooth on linux/windows with nodejs:

import bluetooth from 'node-bluetooth';
import { BluetoothConnection } from 'obdii/connection/bluetooth';
 
const device = await bluetooth.connect('obd2-dongle', 'channel');
const connection = new Connection(device);

USB/SERIAL NODEJS EXAMPLE

USB or Serial Port dongles

import SerialPort from 'serialport';
import { Connection } from 'obdii/connection/serialport';
import { OBD2 } from 'obdii';
 
const port = new SerialPort('/dev/tty-usbserial1');
const connection = new Connection(port);
const obd = new OBD2({ connection });
 
await obd.start();
await obd.listDTC();

TCP/NET EXAMPLE

Wifi dongles

Should also work with import net from 'react-native-tcp'

import net from 'net';
import { Connection } from 'obdii/connection/net';
import { OBD2 } from 'obdii';
 
const client = net.createConnection({ host: '127.0.0.1', port: 27300 });
 
const connection = new Connection(client);
const obd = new OBD2({ connection });
 
await obd.start();
await obd.listDTC();

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.1
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.1
    2

Package Sidebar

Install

npm i obdii

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

199 kB

Total Files

100

Last publish

Collaborators

  • birkir