public class Obd2Streams
extends java.lang.Object
Constructor and Description |
---|
Obd2Streams() |
Modifier and Type | Method and Description |
---|---|
static double |
getDouble(com.google.gson.JsonElement json,
java.lang.String key)
Utility method to simplify accessing a number as a double.
|
static com.google.gson.JsonObject |
getObject(com.google.gson.JsonObject json,
java.lang.String key)
Utility method to simplify accessing a JSON object.
|
static TStream<com.google.gson.JsonObject> |
increasingTemps(SerialDevice device)
Get a stream of temperature readings which
are increasing over the last minute.
|
static TStream<com.google.gson.JsonObject> |
tach(SerialDevice device)
Get a stream containing vehicle speed (km/h)
and engine revs (rpm).
|
public static TStream<com.google.gson.JsonObject> increasingTemps(SerialDevice device)
pid
. Filter so that only
those with a rate of increase greater than
or equal to 1 degree C/minute is present on the returned stream.
Temperatures included are
AIR_INTAKE_TEMP
and
ENGINE_COOLANT_TEMP
.device
- Serial device the ELM327 is connected to.public static TStream<com.google.gson.JsonObject> tach(SerialDevice device)
Speed
and engine revs
are polled every 200ms and returned as a stream
containing JSON objects with keys speed
and rpm
.
The two readings may not be exactly consistent with
each other as there are fetched sequentially from
the ELM327.device
- Serial device the ELM327 is connected to.public static com.google.gson.JsonObject getObject(com.google.gson.JsonObject json, java.lang.String key)
json
- JSON object containing the object to be got.key
- Key of the object to be got.key
from json
.public static double getDouble(com.google.gson.JsonElement json, java.lang.String key)
json
- JSON object containing the number to be got.key
- Key of the number to be got.key
from json
.Copyright © 2016 The Apache Software Foundation. All Rights Reserved - bbe71fa-20161201-1641