UNPKG

rxjs-obd

Version:

RxJS Implementation for OBD (On Board Diagnostics) of vehicles via ELM 327 connections.

42 lines (41 loc) 1.48 kB
import { Subscriber } from 'rxjs'; import { OuterSubscriber } from '../internal/OuterSubscriber'; import { OBDEvent } from './OBDEvent'; export declare abstract class OBDOuterSubscriber extends OuterSubscriber<OBDEvent, OBDEvent> { protected constructor(destination: Subscriber<OBDEvent>); /** * Return an integer that represent the frequency of execution of this command. * 0 - Just once. * 1 - Every pulse * n - id % n === 0. */ abstract pulse(): number; /** * Return the string representation of the OBD Read command. * For example use '010C\r' for Engine RPM. * @returns the string representation of the OBD Read command */ abstract command(): string; /** * Return the name of the OBD Field on OBD Data object. * For example use 'rpm' for Engine RPM. * @returns the name of the OBD Field on OBD Data object. */ abstract field(): string | string[]; /** * Parse the OBD response. * @param bytes the response read from OBD. * @returns the parsed response. */ abstract parse(bytes: string[]): number | string | (number | string)[]; /** * Send the command to OBD Reader and try to read the response. * @param event The OBD reader event loop. */ protected _next(event: OBDEvent): void; /** * Read one return from OBD, parse and update event. * @param event the OBD reader event loop. */ read(event: OBDEvent): void; }