|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectamip.api.highlevel.Client
public class Client
This class provides access to AMIP itself and also Playlist and Player objects. You must init it before any other communication with AMIP using the init method.
Method Summary | |
---|---|
java.lang.String |
evaluate(java.lang.String variable)
Evaluates AMIP variable and returns the result of evaluation as string. |
void |
execute(java.lang.String command)
Executes AMIP API command. |
java.lang.String |
format(int preset)
Same as format(String spec) , but uses AMIP preset with the specified number and formats the result
according to this preset. |
java.lang.String |
format(java.lang.String spec)
Formats the string with AMIP variables or functions. |
Config |
getConfig()
|
int |
getDcount()
|
int |
getDsec()
|
java.lang.String |
getHost()
|
static Client |
getInstance()
Use this method to get the Client object. |
Player |
getPlayer()
Returns Player instance to control your player. |
Playlist |
getPlaylist()
Provides access to the Playlist object for operations with player's playlist. |
int |
getPort()
|
int |
getTimeout()
|
void |
init()
You may use this method if AMIP is installed on the same machine and is running on the default port (60333). |
void |
init(java.lang.String host,
int port)
Simpe init method, uses defaults for timeout (5000), dsec (5) and dcount (1) parameters. |
void |
init(java.lang.String host,
int port,
int timeout,
int dsec,
int dcount)
Initializes client. |
boolean |
isInitialized()
|
boolean |
pingServer()
Pings AMIP plugin, useful to know if it's running or not. |
void |
setDcount(int dcount)
|
void |
setDsec(int dsec)
|
void |
setHost(java.lang.String host)
|
void |
setPort(int port)
|
void |
setTimeout(int timeout)
|
void |
uninit()
Uninit client before your application is terminated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Client getInstance()
Client
object.
public void init(java.lang.String host, int port, int timeout, int dsec, int dcount) throws ClientInitializationFailedException
host
- specifies the IP address of the machine where AMIP plugin is installed and running, may be 127.0.0.1
in case AMIP is on the same machine.port
- AMIP plugin port, default is 60333.timeout
- timeout in milliseconds for all the operations, on localhost 1000-5000 is a good option, on slow and
unstable connections you may want to use higher values.dsec
- amount of seconds to block any connections for if previous dcount attempts failed.dcount
- threshold of failed operations, if reached, all further connections will be suspended for dsec
seconds. dsec and dcount arguments are to prevent lockups in case AMIP can't be reached.
ClientInitializationFailedException
- if client cannot be initialized with the specified parameters.public void init(java.lang.String host, int port) throws ClientInitializationFailedException
host
- AMIP host.port
- AMIP port.
ClientInitializationFailedException
public void init() throws ClientInitializationFailedException
ClientInitializationFailedException
public void uninit()
public java.lang.String evaluate(java.lang.String variable) throws GeneralClientException
variable
- AMIP API command/variable to evaluate, for example 'var_name' or 'cfg_enabled'.
GeneralClientException
public void execute(java.lang.String command) throws GeneralClientException
command
- API command, such as 'control pause'.
GeneralClientException
public java.lang.String format(java.lang.String spec) throws GeneralClientException
spec
- the string which may contain AMIP variables and functions, for example "$cf(%1 - %2)".
GeneralClientException
public java.lang.String format(int preset) throws GeneralClientException
format(String spec)
, but uses AMIP preset with the specified number and formats the result
according to this preset.
preset
- AMIP preset to format song info according to (can take value from 1 to 5).
GeneralClientException
public boolean pingServer()
public int getDcount()
public void setDcount(int dcount)
public int getDsec()
public void setDsec(int dsec)
public int getTimeout()
public void setTimeout(int timeout)
public int getPort()
public void setPort(int port)
public java.lang.String getHost()
public void setHost(java.lang.String host)
public boolean isInitialized()
public Playlist getPlaylist()
Playlist
object for operations with player's playlist.
public Player getPlayer()
Player
instance to control your player.
public Config getConfig()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |