Class: OBDIIPID

OBDIIPID

Provides methods and properties for reading/writing PIDs.

Members


<readonly> ECU :object

Gets an object that can be used to simulate an ECU for this PID.

Type:
  • object
Since:
  • 0.5 (WAT 2.0)

<readonly> id :number

Gets the ID assigned to this PID. ID is usually the ECU address.

Type:
  • number
Since:
  • 0.1 (WAT 1.1)

index :int

Gets/sets the index to offset data value in CAN message

Type:
  • int
Since:
  • 0.5 (WAT 2.0)

<readonly> mode :number

Gets the number of the mode that this PID is a member of.

Type:
  • number
Since:
  • 0.1 (WAT 1.1)

<readonly> modeName :string

Gets the name of the mode that this PID is a member of.

Type:
  • string
Since:
  • 0.1 (WAT 1.1)

<readonly> pid :number

Gets the PID number assigned to this PID.

Type:
  • number
Since:
  • 0.1 (WAT 1.1)

readOnly :bool

Gets/sets if the PID is writable. By default all PIDs are read only. This property needs to be changed to false in order to write a PID.

Type:
  • bool
Since:
  • 0.4 (WAT 1.4)
Default Value:
  • true

route :int

Gets/sets obd bus route between CAN and K-Line (ISO-K) The default configuration is CAN

Type:
  • int
Since:
  • 0.4 (WAT 1.4)
See:
  • obd-II.OBDIIPID#Route

Route :object

Available routes for a PID.

Type:
  • object
Properties:
Name Type Description
CAN number

0

KLine number

1

Since:
  • 0.4 (WAT 1.4)
See:
  • obd-II.OBDIIPID#route

<readonly> running :bool

Returns true if the PID is currently being read or written.

Type:
  • bool
Since:
  • 0.1 (WAT 1.1)

Methods


checkSupport()

Begins checking if the PID is supported. The operation is asynchronous and emits the result using onSupported and either supported or unsupported. onSupported provides the same information as supported/unsupported, but in a single event instead of two.

Since:
  • 0.1 (WAT 1.1)
Returns:
Type
bool

get()

Begins getting the PID. The operation is asynchronous and emits the result using either onFailed or onComplete.

If the PID is not read only or the bus cannot start the request (e.g. no power), then the get will fail and false will be returned.

Since:
  • 0.3 (WAT 1.3)
Returns:
Type
bool

write()

Begins writing the PID. The operation is asynchronous and emits the result using either onFailed or onComplete.

If the PID is read only or the bus cannot start the request (e.g. no power), then the write will fail and false will be returned.

Parameters:
Type Description
number | string | Array.<number>

The value to write. The type depends on the kind of PID.

Since:
  • 0.3 (WAT 1.3)
Returns:
Type
bool

Events


onComplete

Indicates that the an operation (read/write) on the PID has succeeded and emits the value of the PID. The type of the value depends on the kind of PID.

Type: string | number | Array.<number>
Since:
  • 0.1 (WAT 1.1)
See:

onFailed

Indicates that the an operation (read/write) on the PID failed. Usually this means that the PID is not supported, or the bus is not connected/powered. properly.

Since:
  • 0.1 (WAT 1.1)
See:

onSupported

Indicates the result of a support check. Value is true if the PID is supported.

Type: bool
Since:
  • 0.1 (WAT 1.1)
See:

supported

Indicates that the PID has been identified as supported.

Since:
  • 0.1 (WAT 1.1)
See:

unsupported

Indicates that the PID has been identified as not supported.

Since:
  • 0.1 (WAT 1.1)
See: