public class SoundPlayingRobotMonitor extends java.lang.Object implements RobotStateMonitor
SoundPlayingRobotMonitor
is an implementation of RobotStateMonitor
that
plays sounds at certain event transitions within the Robot Controller application.Modifier and Type | Class and Description |
---|---|
protected static class |
SoundPlayingRobotMonitor.Sound |
Modifier and Type | Field and Description |
---|---|
protected Context |
context |
static boolean |
DEBUG |
protected java.lang.String |
errorMessage |
protected SoundPlayingRobotMonitor.Sound |
lastSoundPlayed |
protected NetworkStatus |
networkStatus |
protected PeerStatus |
peerStatus |
protected RobotState |
robotState |
protected RobotStatus |
robotStatus |
protected java.util.concurrent.atomic.AtomicInteger |
runningsInFlight |
static int |
soundConnect |
static int |
soundDisconnect |
static int |
soundError |
static int |
soundRunning |
static int |
soundWarning |
protected java.lang.String |
warningMessage |
Constructor and Description |
---|
SoundPlayingRobotMonitor() |
SoundPlayingRobotMonitor(Context context) |
Modifier and Type | Method and Description |
---|---|
protected void |
playConnect() |
protected void |
playDisconnect() |
protected void |
playError() |
protected void |
playRunning() |
protected void |
playSound(SoundPlayingRobotMonitor.Sound sound,
int resourceId) |
protected void |
playSound(SoundPlayingRobotMonitor.Sound sound,
int resourceId,
Consumer<java.lang.Integer> runWhenStarted,
java.lang.Runnable runWhenFinished) |
protected void |
playWarning() |
static void |
prefillSoundCache() |
void |
updateErrorMessage(java.lang.String errorMessage)
Informs the monitor that a critical error occurred in the robot, or clears
any error previously reported.
|
void |
updateNetworkStatus(NetworkStatus networkStatus,
java.lang.String extra)
Informs the monitor of the current status of the network connection.
|
void |
updatePeerStatus(PeerStatus peerStatus)
Informs the monitor of the current status of relationship to the peer application.
|
void |
updateRobotState(RobotState robotState)
Informs the monitor of the current state of the robot.
|
void |
updateRobotStatus(RobotStatus robotStatus)
Informs the monitor of the current status of the robot.
|
void |
updateWarningMessage(java.lang.String warningMessage)
Informs the monitor that a warning has occurred in the robot, or clears
any warning previously reported.
|
public static boolean DEBUG
protected Context context
protected RobotState robotState
protected RobotStatus robotStatus
protected NetworkStatus networkStatus
protected PeerStatus peerStatus
protected java.lang.String errorMessage
protected java.lang.String warningMessage
protected SoundPlayingRobotMonitor.Sound lastSoundPlayed
protected java.util.concurrent.atomic.AtomicInteger runningsInFlight
public static int soundConnect
public static int soundDisconnect
public static int soundRunning
public static int soundWarning
public static int soundError
public SoundPlayingRobotMonitor()
public SoundPlayingRobotMonitor(Context context)
public static void prefillSoundCache()
protected void playConnect()
protected void playDisconnect()
protected void playRunning()
protected void playWarning()
protected void playError()
public void updateRobotState(RobotState robotState)
RobotStateMonitor
updateRobotState
in interface RobotStateMonitor
robotState
- the current state of the robot.public void updateRobotStatus(RobotStatus robotStatus)
RobotStateMonitor
updateRobotStatus
in interface RobotStateMonitor
robotStatus
- the current status of the robotRobotStatus
public void updatePeerStatus(PeerStatus peerStatus)
RobotStateMonitor
updatePeerStatus
in interface RobotStateMonitor
peerStatus
- the relationship of this app to its peerPeerStatus
public void updateNetworkStatus(NetworkStatus networkStatus, java.lang.String extra)
RobotStateMonitor
updateNetworkStatus
in interface RobotStateMonitor
networkStatus
- the current status of the network connectionextra
- additional information useful in some statusespublic void updateErrorMessage(java.lang.String errorMessage)
RobotStateMonitor
updateErrorMessage
in interface RobotStateMonitor
errorMessage
- the error message being reported, or null if the error is being cleared.public void updateWarningMessage(java.lang.String warningMessage)
RobotStateMonitor
updateWarningMessage
in interface RobotStateMonitor
warningMessage
- the warning message being reported, or null if the warning is being cleared.protected void playSound(SoundPlayingRobotMonitor.Sound sound, int resourceId)
protected void playSound(SoundPlayingRobotMonitor.Sound sound, int resourceId, Consumer<java.lang.Integer> runWhenStarted, java.lang.Runnable runWhenFinished)