public abstract class

BaseVehicleDataSource

extends Object
implements VehicleDataSource
java.lang.Object
   ↳ com.openxc.sources.BaseVehicleDataSource
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

A common parent for all vehicle data sources. This class encapsulates funcationaliy common to most data sources. It accepts and stores a SourceCallback reference (required by the VehicleDataSource interface) and implements a handleMessage(VehicleMessage) method for subclass to call with each new message, regardless of its origin.

Summary

Public Constructors
BaseVehicleDataSource()
BaseVehicleDataSource(SourceCallback callback)
Construct a new instance and set the callback.
Public Methods
abstract boolean isConnected()
Return true if the data source is actively connected to its target, be it a USB endpoint, a Bluetooth channel, a trace file, etc.
void onPipelineActivated()
void onPipelineDeactivated()
void setCallback(SourceCallback callback)
Set the current source callback to the given value.
void stop()
Clear the callback so no further updates are sent.
Protected Methods
void connected()
void disconnected()
String getTag()
Return a string suitable as a tag for logging.
void handleMessage(VehicleMessage message)
Pass a new message to the callback, if set.
void waitForCallback()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.openxc.DataPipeline.Operator
From interface com.openxc.sources.VehicleDataSource

Public Constructors

public BaseVehicleDataSource ()

public BaseVehicleDataSource (SourceCallback callback)

Construct a new instance and set the callback.

Parameters
callback An object implementing the SourceCallback interface that should receive data from this source.

Public Methods

public abstract boolean isConnected ()

Return true if the data source is actively connected to its target, be it a USB endpoint, a Bluetooth channel, a trace file, etc. The source is capable of providing new vehicle data. Returns true if connected, false otherwise.

public void onPipelineActivated ()

public void onPipelineDeactivated ()

public void setCallback (SourceCallback callback)

Set the current source callback to the given value.

Parameters
callback a valid callback or null if you wish to stop the source from sending updates.

public void stop ()

Clear the callback so no further updates are sent. Subclasses should be sure to call super.stop() so they also stop sending updates when killed by a user.

Protected Methods

protected void connected ()

protected void disconnected ()

protected String getTag ()

Return a string suitable as a tag for logging.

protected void handleMessage (VehicleMessage message)

Pass a new message to the callback, if set.

Parameters
message the new message object.

protected void waitForCallback ()