org.qtunes.daap
Class DaapServer

java.lang.Object
  extended by org.qtunes.daap.DaapServer
All Implemented Interfaces:
Service

public class DaapServer
extends java.lang.Object
implements Service

This Service handles DAAP and DACP requests via a WebServer, and manages the announcement of this service via ZeroConf. It's used for streaming music to iTunes, or to allow a Player to be remotely controlled by the Remote app on an Apple iPhone. Only one DaapServer is required to service multiple simultaneous clients - one is required for sharing, and when playing the correct Player to control can be identified by the Remote that's in use.


Constructor Summary
DaapServer()
           
 
Method Summary
 void addRemote(java.lang.String name, Player player, java.lang.String pin)
          Add a new Remote pairing
 ServiceContext getContext()
          Return the ServiceContext that was passed into Service.startService(org.qtunes.core.ServiceContext)
 boolean isSharing()
          Return true if this DaapServer is sharing it's collection to iTunes, as set by setSharing(boolean)
 void removeRemote(java.lang.String name, Player player)
          Unpair a previously paired Remote
 java.util.Map<java.lang.String,java.lang.Object> reportState()
          Return a Map describing the state of this Service, for serialization back to any client that needs to know (eg webplayer) - so values should be serializable objects, eg Lists, Maps or simple objects.
 void setSharing(boolean sharing)
          Set whether this DaapServer is sharing it's collection to iTunes
 void startService(ServiceContext context)
          Start the Service
 void stopService(ServiceContext context)
          Stop the Service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DaapServer

public DaapServer()
Method Detail

isSharing

public boolean isSharing()
Return true if this DaapServer is sharing it's collection to iTunes, as set by setSharing(boolean)


setSharing

public void setSharing(boolean sharing)
Set whether this DaapServer is sharing it's collection to iTunes


startService

public void startService(ServiceContext context)
Description copied from interface: Service
Start the Service

Specified by:
startService in interface Service
Parameters:
context - the ServiceContext for this Service

stopService

public void stopService(ServiceContext context)
Description copied from interface: Service
Stop the Service

Specified by:
stopService in interface Service
Parameters:
context - the ServiceContext for this Service (same as was passed into start)

getContext

public ServiceContext getContext()
Description copied from interface: Service
Return the ServiceContext that was passed into Service.startService(org.qtunes.core.ServiceContext)

Specified by:
getContext in interface Service

reportState

public java.util.Map<java.lang.String,java.lang.Object> reportState()
Description copied from interface: Service
Return a Map describing the state of this Service, for serialization back to any client that needs to know (eg webplayer) - so values should be serializable objects, eg Lists, Maps or simple objects. If no useful state, return null.

Specified by:
reportState in interface Service

addRemote

public void addRemote(java.lang.String name,
                      Player player,
                      java.lang.String pin)
Add a new Remote pairing

Parameters:
name - the name of the Remote
player - the Player it's being paired with
pin - the 4-digit pin entered by the user to match that on the Remote

removeRemote

public void removeRemote(java.lang.String name,
                         Player player)
Unpair a previously paired Remote

Parameters:
name - the name of the Remote
player - the Player it was paired with