public abstract class BaseVehicleDataSource extends java.lang.Object implements VehicleDataSource
VehicleDataSource
interface) and implements a
handleMessage(VehicleMessage)
method for subclass to call
with each new message, regardless of its origin.Constructor and Description |
---|
BaseVehicleDataSource() |
BaseVehicleDataSource(SourceCallback callback)
Construct a new instance and set the callback.
|
Modifier and Type | Method and Description |
---|---|
protected void |
connected() |
protected void |
disconnected() |
SourceCallback |
getCallback() |
protected java.lang.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.
|
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 void |
waitForCallback() |
public BaseVehicleDataSource()
public BaseVehicleDataSource(SourceCallback callback)
callback
- An object implementing the
SourceCallback interface that should receive data from this
source.public void setCallback(SourceCallback callback)
setCallback
in interface VehicleDataSource
callback
- a valid callback or null if you wish to stop the source
from sending updates.protected void disconnected()
protected void connected()
public abstract boolean isConnected()
VehicleDataSource
isConnected
in interface VehicleDataSource
public void stop()
stop
in interface VehicleDataSource
protected void handleMessage(VehicleMessage message)
message
- the new message object.protected void waitForCallback()
public void onPipelineActivated()
onPipelineActivated
in interface DataPipeline.Operator
public void onPipelineDeactivated()
onPipelineDeactivated
in interface DataPipeline.Operator
public SourceCallback getCallback()
protected java.lang.String getTag()