This module is contains the Vehicle class, which is the main entry point for using the Python library to access vehicle data programatically. Most users will want to interact with an instance of Vehicle, and won’t need to deal with other parts of the library directly (besides measurement types).
The Vehicle class is the main entry point for the OpenXC Python library. A Vehicle represents a connection to at least one vehicle data source and zero or 1 vehicle controllers, which can accept commands to send back to the vehicle. A Vehicle instance can have more than one data source (e.g. if the computer using this library has a secondary GPS data source).
Most applications will either request synchronous vehicle data measurements using the
getmethod or or with a callback function passed to
More advanced applications that want access to all raw vehicle data may want to register a
DataSinkwith a Vehicle.
Construct a new Vehicle instance, optionally providing an vehicle interface from
openxc.interfaceto user for I/O.
Add a vehicle data sink to the instance.
sinkshould be a sub-class of
DataSinkor at least have a
The sink will be started if it is startable. (i.e. it has a
Add a vehicle data source to the instance.
The Vehicle instance will be set as the callback of the source, and the source will be started if it is startable. (i.e. it has a
Return the latest measurement for the given class or None if nothing has been received from the vehicle.
Register the callback function to be called whenever a new measurement of the given class is received from the vehicle data sources.
If the callback is already registered for measurements of the given type, this method will have no effect.
Stop notifying the given callback of new values of the measurement type.
If the callback was not previously registered as a listener, this method will have no effect.