net.mp3elf.elfServer
Class elfXMLRPCProxy

java.lang.Object
  |
  +--net.mp3elf.elfServer.elfXMLRPCProxy

public class elfXMLRPCProxy
extends java.lang.Object

This class provides the functions that are available to XMLRPC clients. The argument and return types of these functions are mapped to XML-RPC types as documented by the helma xml-rpc library. The functions in this class are prefixed by the appropriate elf MAC address. The elf MAC Address can be obtained from ServerXMLRPCProxy.enumerateElfs() Note that the constructor is documented here by JavaDoc. You do not need to call the constructor from your XMLRPC Client

See Also:
xmlrpc.org, helma.org xmlrpc

Constructor Summary
elfXMLRPCProxy(net.mp3elf.elfServer.elfTINI tini)
          Creates new elfXMLRPCProxy
 
Method Summary
 boolean addElfListener(java.lang.String URL, java.lang.String listenerFunction)
          Register a callback XMLRPC function to receive elf change notifications.
 void disableControls()
          Disable the mp3elf control panel.
 void enableControls()
          Re-enable the mp3elf front panel controls.
Note: Other clients may have called disableControls(), so controls may still be disabled after calling this function.
 java.lang.String getAlbumName()
          Get the album name for the currently playing track.
 java.lang.String getArtistName()
          Get the artist name for the currently playing track.
 boolean getConnectedStatus()
          This function indicates whether the elf hardware is currently connected to this server process
 int getCurrentPlaylistIndex()
          Get the index of the currently playing track within the current playlist
 int getPlayingStatus()
          Obtain the current playing status of this elf
 java.util.Vector getPlaylistEntries()
          Get the file names for the current playlist
 java.lang.String getPlaylistName()
          Retrieve the name of the current playlist
 java.util.Hashtable getStatusTable()
          Obtains a Hashtable containing several pieces of information about the elf.
 java.lang.String getTrackName()
          Get the name of the currently playing track.
 int pause()
          Pause playback.
 int play()
          Start playback.
 int playlistAddItem(java.lang.String item)
          Add this file to the end of the current playlist
 void removeElfListener(java.lang.String URL, java.lang.String listenerFunction)
          Deregister a callback that was registered with addElfListener(String URL, String listenerFunction)
 int selectPlaylist(java.lang.String playlistID)
          Select a new playlist for this elf
 int skipBack()
          Skip back one track in the current playlist
 int skipFwd()
          Skip forward one track in the current playlist
 int stop()
          Stop playback.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

elfXMLRPCProxy

public elfXMLRPCProxy(net.mp3elf.elfServer.elfTINI tini)
Creates new elfXMLRPCProxy
Parameters:
tini - The elfTINI that this class proxies for.
Method Detail

getStatusTable

public java.util.Hashtable getStatusTable()
Obtains a Hashtable containing several pieces of information about the elf. This call should be used to reduce the number of XMLRPC calls made by a client program
Returns:
A Hashtable containing the following:
NameTypeDescription
playingStatusIntegerSee getPlayingStatus()
playlistNameStringSee getPlaylistName()
trackNameStringSee getTrackName()
artistNameStringSee getArtistName()
albumNameStringSee getAlbumName()

stop

public int stop()
Stop playback. If playback is already stopped, this command is ignored.
Returns:
The current playing status. See getPlayingStatus()

play

public int play()
Start playback. If already playing, this command is ignored.
Returns:
The current playing status. See getPlayingStatus()

pause

public int pause()
Pause playback. If the elf is not currently playing, this command is ignored
Returns:
The current playing status. See getPlayingStatus()

skipFwd

public int skipFwd()
Skip forward one track in the current playlist
Returns:
The current playing status. See getPlayingStatus()

skipBack

public int skipBack()
Skip back one track in the current playlist
Returns:
The current playing status. See getPlayingStatus()

getPlaylistName

public java.lang.String getPlaylistName()
Retrieve the name of the current playlist
Returns:
The name of the current playlist. This is the symbolic name assigned to the playlist through the config file, not the filename of the playlist file

getTrackName

public java.lang.String getTrackName()
Get the name of the currently playing track.
Returns:
The name of the currently playing track. This data comes from the MP3 idv3 tag. If there is no idv3 data then this name will be empty

getArtistName

public java.lang.String getArtistName()
Get the artist name for the currently playing track.
Returns:
The artist name for the currently playing track. This data comes from the MP3 idv3 tag. If there is no idv3 data then this name will be empty

getPlaylistEntries

public java.util.Vector getPlaylistEntries()
Get the file names for the current playlist
Returns:
A vector of strings. Each element of the vector contains the filename of an mp3 file in this playlist

getAlbumName

public java.lang.String getAlbumName()
Get the album name for the currently playing track.
Returns:
The album name for the currently playing track. This data comes from the MP3 idv3 tag. If there is no idv3 data then this name will be empty

selectPlaylist

public int selectPlaylist(java.lang.String playlistID)
Select a new playlist for this elf
Parameters:
playlistID - The playlist ID to select
Returns:
0 = success
-1 = playlist ID not found

playlistAddItem

public int playlistAddItem(java.lang.String item)
Add this file to the end of the current playlist
Parameters:
item - The file name to add to the current playlist. This file path must be accessible to the elfServer
Returns:
The new size of the playlist or -1 if addition failed

getPlayingStatus

public int getPlayingStatus()
Obtain the current playing status of this elf
Returns:
0=Stopped
1=Paused
2=Playing

getConnectedStatus

public boolean getConnectedStatus()
This function indicates whether the elf hardware is currently connected to this server process
Returns:
true = the network sockets are connected to the elf

getCurrentPlaylistIndex

public int getCurrentPlaylistIndex()
Get the index of the currently playing track within the current playlist
Returns:
An integer that can be used with getPlaylistEntries() to obtain the filename of the currently playing track

addElfListener

public boolean addElfListener(java.lang.String URL,
                              java.lang.String listenerFunction)
Register a callback XMLRPC function to receive elf change notifications. The registered function must receive an integer. Any return is ignored. The integer that is sent to the function indicates one of the following events occurred:
ValueEvent
0End of Track
1Start of Track
2Paused
3Playing
4Stopped
5Skip Forward
6Skip Backward
7End of Playlist
8New Playlist
9Elf has connected
10Elf has disconnected
Parameters:
URL - The URL (Host, port and path) of the server providing the XMLRPC function
listenerFunction - The name of the function to be called on the specified server
Returns:
True indicates that the callback was successfully registered.
Since:
1.60?

removeElfListener

public void removeElfListener(java.lang.String URL,
                              java.lang.String listenerFunction)
Deregister a callback that was registered with addElfListener(String URL, String listenerFunction)
Parameters:
URL - The URL that was provided to registerListener
listenerFunction - The function that was provided to addElfListener
Since:
1.60?

disableControls

public void disableControls()
Disable the mp3elf control panel. Calling this function will prevent the elfServer from acting upon front panel key inputs
Since:
1.60?

enableControls

public void enableControls()
Re-enable the mp3elf front panel controls.
Note: Other clients may have called disableControls(), so controls may still be disabled after calling this function.
Since:
1.60?