Skip to content

adadache/obd-parser-serial-connection

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

obd-parser-serial-connection

Circle CI

Connection module for use with odb-parser.

Install

npm install obd-parser-serial-connection

Usage

The typical usage scenario is described in the obd-parser module docs, but if you want to use this module to get a plain OBD connection you can use the example code below as a start.

var getConnector = require('obd-parser-serial-connection');

// Returns a function that will allow us to connect to the serial port
var connect = getConnector({
  serialPath: '/dev/tty.usbserial',
  serialOpts: {
    baudrate: 38400
  }
});

connect(configureFunction)
  .then(function () {
    console.log('connected to serial port!')
  })
  .catch(function (err) {
    console.error('oh noes');
  });


function configureFunction (connection) {
  return new Promise(function (resolve, reject) {
    // Set up the obd connection etc.
    conn.write('ATZ');
    conn.write('ATE0');
  });
}

CHANGELOG

  • 0.1.2 - Ensure errors result in Promise rejection. Use debug instead of fhlog.

  • 0.1.1 - Patch for serialport 2.1.X changes in autoconnect

  • 0.1.0 - Initial release

About

A wrapper around a serialport connection for use by obd-parser

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%