|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.bff.javampd.monitor.MPDEventMonitor
org.bff.javampd.monitor.MPDStandAloneMonitor
public class MPDStandAloneMonitor
MPDStandAloneMonitor monitors a MPD connection by querying the status and
statistics of the MPD server at given delay intervals. As statistics change
appropriate events are fired indicating these changes. If more detailed
events are desired attach listeners to the different controllers of a
connection or use the MPDEventRelayer class.
| Nested Class Summary | |
|---|---|
static class |
MPDStandAloneMonitor.PlayerStatus
The status of the player. |
| Constructor Summary | |
|---|---|
MPDStandAloneMonitor(MPD mpd)
Creates a new instance of MPDStandAloneMonitor using the default delay of 1 second. |
|
MPDStandAloneMonitor(MPD mpd,
int delay)
Creates a new instance of MPDStandAloneMonitor using the given delay interval for queries. |
|
| Method Summary | |
|---|---|
void |
addMPDErrorListener(MPDErrorListener el)
Adds a MPDErrorListener to this object to receive
MPDErrorEvents. |
void |
addPlayerChangeListener(PlayerBasicChangeListener pcl)
Adds a PlayerBasicChangeListener to this object to receive
PlayerChangeEvents. |
void |
addPlaylistChangeListener(PlaylistBasicChangeListener pcl)
Adds a PlaylistBasicChangeListener to this object to receive
PlaylistChangeEvents. |
void |
addVolumeChangeListener(VolumeChangeListener vcl)
Adds a VolumeChangeListener to this object to receive
VolumeChangeEvents. |
protected void |
fireMPDErrorEvent(java.lang.String msg)
Sends the appropriate MPDErrorListener to all registered
MPDErrorListeners. |
protected void |
firePlayerChangeEvent(int id)
Sends the appropriate PlayerBasicChangeEvent to all registered
PlayerBasicChangeListeners. |
protected void |
firePlaylistChangeEvent(int id)
Sends the appropriate PlaylistChangeEvent to all registered
PlaylistChangeListener. |
protected void |
fireVolumeChangeEvent(int volume)
Sends the appropriate VolumeChangeEvent to all registered
VolumeChangeListener. |
MPDStandAloneMonitor.PlayerStatus |
getStatus()
Returns the current status of the player. |
boolean |
isStopped()
Returns true if the monitor is stopped, false if the monitor is still running. |
void |
removeMPDErrorListener(MPDErrorListener el)
Removes a MPDErrorListener from this object. |
void |
removePlayerChangeListener(PlayerBasicChangeListener pcl)
Removes a PlayerBasicChangeListener from this object. |
void |
removePlaylistStatusChangedListener(PlaylistBasicChangeListener pcl)
Removes a PlaylistBasicChangeListener from this object. |
void |
removeVolumeChangedListener(VolumeChangeListener vcl)
Removes a VolumeChangeListener from this object. |
void |
run()
Implements the Runnable run method to monitor the MPD connection. |
void |
start()
Starts the monitor by creating and starting a thread using this instance as the Runnable interface. |
void |
stop()
Stops the thread. |
| Methods inherited from class org.bff.javampd.monitor.MPDEventMonitor |
|---|
addConnectionChangeListener, addTrackPositionChangeListener, checkConnection, checkTrackPosition, fireConnectionChangeEvent, fireTrackPositionChangeEvent, removeConnectionChangeListener, removeTrackPositionChangeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MPDStandAloneMonitor(MPD mpd)
mpd - a connection to a MPD server
public MPDStandAloneMonitor(MPD mpd,
int delay)
mpd - a connection to a MPD serverdelay - the delay interval| Method Detail |
|---|
public void addPlayerChangeListener(PlayerBasicChangeListener pcl)
PlayerBasicChangeListener to this object to receive
PlayerChangeEvents.
pcl - the PlayerBasicChangeListener to addpublic void removePlayerChangeListener(PlayerBasicChangeListener pcl)
PlayerBasicChangeListener from this object.
pcl - the PlayerBasicChangeListener to removeprotected void firePlayerChangeEvent(int id)
PlayerBasicChangeEvent to all registered
PlayerBasicChangeListeners.
id - the event id to sendpublic void addVolumeChangeListener(VolumeChangeListener vcl)
VolumeChangeListener to this object to receive
VolumeChangeEvents.
vcl - the VolumeChangeListener to addpublic void removeVolumeChangedListener(VolumeChangeListener vcl)
VolumeChangeListener from this object.
vcl - the VolumeChangeListener to removeprotected void fireVolumeChangeEvent(int volume)
VolumeChangeEvent to all registered
VolumeChangeListener.
volume - the new volumepublic void addPlaylistChangeListener(PlaylistBasicChangeListener pcl)
PlaylistBasicChangeListener to this object to receive
PlaylistChangeEvents.
pcl - the PlaylistChangeListener to addpublic void removePlaylistStatusChangedListener(PlaylistBasicChangeListener pcl)
PlaylistBasicChangeListener from this object.
pcl - the PlaylistBasicChangeListener to removeprotected void firePlaylistChangeEvent(int id)
PlaylistChangeEvent to all registered
PlaylistChangeListener.
id - the event id to sendpublic void addMPDErrorListener(MPDErrorListener el)
MPDErrorListener to this object to receive
MPDErrorEvents.
el - the MPDErrorListener to addpublic void removeMPDErrorListener(MPDErrorListener el)
MPDErrorListener from this object.
el - the MPDErrorListener to removeprotected void fireMPDErrorEvent(java.lang.String msg)
MPDErrorListener to all registered
MPDErrorListeners.
msg - the event messagepublic void run()
run in interface java.lang.Runnablepublic void start()
public void stop()
public boolean isStopped()
public MPDStandAloneMonitor.PlayerStatus getStatus()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||