public interface KartListener
Interface to implement if an object is interested in basic kart status changes. An object implementing this interface can be added using the Kart's method
Kart.addKartListener(KartListener)
. The object will get notified about changes of the most important parameters of the Kart.
Note that not all changes in the registers of the kart are reported by this listener interface. If an object needs more details about all the registers
of the Kart, it should implement the KartStatusRegisterListener
interface and subscribe himself using the method
Kart.addStatusRegisterListener(KartStatusRegisterListener)
.
Modifier and Type | Method and Description |
---|---|
void |
batteryVoltageChanged(Kart kart,
float level)
The battery level has changed.
|
void |
connectionStatusChanged(Kart kart,
boolean online)
The connection status to the Kart has changed.
|
void |
message(Kart kart,
java.lang.String message)
The kart has a message to display, most of the time this are cryptic messages just for developers, but they might be helpful to display during
development...
|
void |
sequenceCompleted(Kart kart)
A sequence that was started using
Kart.run(KartSequence) has been completed. |
void |
steeringPositionChanged(Kart kart,
int absolutePosition,
float normalizedPosition)
Called by the kart whenever the actual steering position has changed.
|
void |
steeringPositionReachedChanged(Kart kart,
boolean reached)
The steering system has changed its state.
|
void steeringPositionChanged(Kart kart, int absolutePosition, float normalizedPosition)
Called by the kart whenever the actual steering position has changed.
This method is part of the KartListener interface and all listeners get notified when the value of the actual steering position has changed.
kart
- The kart object.absolutePosition
- The actual position from 0 to max steps (depends kart model).normalizedPosition
- The actual position from -1 to 1.void steeringPositionReachedChanged(Kart kart, boolean reached)
The steering system has changed its state.
This method is called when either the steering position has just reached its end position (reached = true) or when the steering system has got a new target value and starts the move to this new position (reached = false).
kart
- The kart object.reached
- True if the steering target position has reached, false otherwise.void batteryVoltageChanged(Kart kart, float level)
The battery level has changed.
This method is called by the kart object whenever the battery level on the kart changes.
kart
- The kart object.level
- The battery level from 0 (empty) to 1 (full).void sequenceCompleted(Kart kart)
A sequence that was started using Kart.run(KartSequence)
has been completed.
IMPORTANT: This feature is experimental and might not be implemented on all Karts!
kart
- The kart object.void connectionStatusChanged(Kart kart, boolean online)
The connection status to the Kart has changed.
This method is called if the Bluetooth connection to the kart has been closed or is broken.
kart
- The kart object.online
- True if the kart is online, false otherwise.void message(Kart kart, java.lang.String message)
The kart has a message to display, most of the time this are cryptic messages just for developers, but they might be helpful to display during development...
kart
- The kart object.message
- The message.