public class Dispatcher
extends java.lang.Object
implements com.illposed.osc.OSCListener, TUIO.TuioListener
Constructor and Description |
---|
Dispatcher()
Constructs a new Dispatcher.
|
Dispatcher(float w,
float h)
Constructs a new Dispatcher with a box width and height that will be passed to Junctions.
|
Dispatcher(float w,
float h,
java.lang.String address,
int port)
Constructs a new Dispatcher with a box width and height and a target address and port that will be passed to Junctions.
|
Dispatcher(java.lang.String address,
int port)
Constructs a new Dispatcher with a target address and port that will be passed to Junctions.
|
Modifier and Type | Method and Description |
---|---|
void |
acceptMessage(java.util.Date time,
com.illposed.osc.OSCMessage message)
Accepts certain OSC messages.
|
void |
addContact(long id,
float x,
float y)
Adds a Contact to this Dispatcher for distributing to Junctions.
|
void |
addJunction(Junction j)
Adds a Junction to this Dispatcher.
|
void |
addMessage(java.lang.String ip,
int port,
java.lang.String message) |
void |
addTuioCursor(TUIO.TuioCursor tcur)
Called when a new TuioCursor is added to the session.
|
void |
addTuioObject(TUIO.TuioObject tobj)
Not currently implemented.
|
void |
clearContacts()
Removes all Contacts from all Junctions.
|
void |
clearEvents()
Clears all events from the event queue.
|
void |
clearRejectedMessages()
Removes all rejected NDEF messages.
|
Junction |
createJunction(float x,
float y,
float w,
float h)
Creates a new Junction with the specified parameters.
|
int |
getEventCount()
Gets the total number of events in the event queue.
|
Junction[] |
getJunctions()
Returns an array of the Junctions currently stored in this Dispatcher.
|
java.lang.String |
getListeningAddress()
Returns the current IP address used to listen for incoming OSC messages.
|
int |
getListeningPort()
Returns the current port number used to listen for incoming OSC messages.
|
java.lang.String |
getLocalAddress()
Returns the local IP address of the device running this Dispatcher.
|
long |
getPlaybackTime()
Returns the elapsed playback time in naonseconds.
|
long |
getRecordTime()
Returns the elapsed record time in nanoseconds.
|
java.lang.String[] |
getRejectedMessages()
Returns any rejected NDEF messages.
|
Relay[] |
getRelays()
Returns the NDEF message mapping Relays associated with this Dispatcher as an array.
|
boolean |
isLooping()
Returns true if the playback of this Dispatcher is looping.
|
boolean |
isPlaying()
Returns true if this Dispatcher is currently playing.
|
boolean |
isRecording()
Returns true if this Dispatcher is currently recording.
|
void |
loadEvents() |
void |
loadJunctions()
Loads data from an XML file into the event queue.
|
void |
loadRelays() |
void |
loopPlayback()
Loops the playback of events.
|
void |
orderJunction(int o,
Junction j)
Sets the order for a Junction in the list for this Dispatcher.
|
void |
readFile(java.io.InputStream input)
Reads XML data from the provided InputStream.
|
void |
refresh(TUIO.TuioTime ftime)
Called to mark the end of a received TUIO message bundle.
|
void |
removeContact(long id)
Removes a Contact from a Junction via this Dispatcher.
|
void |
removeJunction(Junction j)
Removes a Junction from this Dispatcher.
|
void |
removeMessage(java.lang.String ip,
int port,
java.lang.String message) |
void |
removeTuioCursor(TUIO.TuioCursor tcur)
Called when an existing TuioCursor is removed from the session.
|
void |
removeTuioObject(TUIO.TuioObject tobj)
Not currently implemented.
|
void |
replaceMessage(java.lang.String ip,
int port,
java.lang.String oldMessage,
java.lang.String newMessage) |
void |
requestConnection()
Sends an NDEF connection request to the IP address and port of the default target node.
|
void |
requestConnection(java.lang.String[] ip,
int port)
Sends an NDEF connection request to the specified IP addresses (nodes).
|
void |
requestConnection(java.lang.String ip,
int port)
Sends an NDEF connection request to the specified IP address and port.
|
void |
requestMessages()
Sends an NDEF message request to the IP address and port of the default target node.
|
void |
requestMessages(java.lang.String[] ip,
int port)
Sends and NDEF message request to the specified IP addresses (nodes).
|
void |
requestMessages(java.lang.String ip,
int port)
Sends an NDEF message request to the specified IP address and port.
|
void |
saveAll() |
void |
saveEvents() |
void |
saveJunctions()
Saves recorded interaction data to XML.
|
void |
saveRelays() |
void |
setTarget(java.lang.String address,
int port)
Sets the IP address and port of the target to the specified values.
|
void |
startListening(int port)
Listen for incoming OSC messages on the given port.
|
void |
startListening(java.lang.String address,
int port)
Listen for incoming OSC messages on the given socket.
|
void |
startLooping()
Starts the looping state.
|
void |
startPlayback()
Starts the playback of events.
|
void |
startRecording()
Starts recording events for selected Junctions.
|
void |
stopListening()
Stop listening for incoming OSC messages.
|
void |
stopLooping()
Stops the looping state.
|
void |
stopPlayback()
Stops playback of events.
|
void |
stopRecording()
Stops recording events.
|
void |
updateContact(long id,
float x,
float y)
Updates a Contact associated with a Junction via this Dispatcher.
|
void |
updateTuioCursor(TUIO.TuioCursor tcur)
Called when an existing TuioCursor is updated.
|
void |
updateTuioObject(TUIO.TuioObject tobj)
Not currently implemented.
|
void |
writeFile(java.io.OutputStream output)
Writes an XML file to the provided OutputStream
|
public Dispatcher()
public Dispatcher(float w, float h)
w
- the box widthh
- the box heightpublic Dispatcher(java.lang.String address, int port)
address
- the IP address of the targetport
- the port number of the targetpublic Dispatcher(float w, float h, java.lang.String address, int port)
w
- the box widthh
- the box heightaddress
- the IP address of the targetport
- the port number of the targetpublic void setTarget(java.lang.String address, int port)
address
- the IP addressport
- the port numberpublic Junction createJunction(float x, float y, float w, float h)
addJunction(Junction)
method.x
- the x coordinate of the center pointy
- the y coordinate of the center pointw
- the widthh
- the heightpublic void addJunction(Junction j)
createJunction(float, float, float, float)
method. A Junction can be added only once.j
- the new Junction to addpublic void removeJunction(Junction j)
j
- the Junction to removepublic void orderJunction(int o, Junction j)
o
- the value to set for the orderj
- the Junction to be orderedpublic Junction[] getJunctions()
public java.lang.String getLocalAddress()
public void startListening(int port)
getLocalAddress()
method.port
- the port numberpublic void startListening(java.lang.String address, int port)
address
- the IP addressport
- the port numberpublic void stopListening()
public java.lang.String getListeningAddress()
public int getListeningPort()
public void requestConnection()
public void requestConnection(java.lang.String[] ip, int port)
ip
- an array of IP addressesport
- the port numberpublic void requestConnection(java.lang.String ip, int port)
ip
- the IP addressport
- the port numberpublic void requestMessages()
public void requestMessages(java.lang.String[] ip, int port)
ip
- an array of IP addressesport
- the port numberpublic void requestMessages(java.lang.String ip, int port)
ip
- the target IP addressport
- the target portpublic void addMessage(java.lang.String ip, int port, java.lang.String message)
public void removeMessage(java.lang.String ip, int port, java.lang.String message)
public void replaceMessage(java.lang.String ip, int port, java.lang.String oldMessage, java.lang.String newMessage)
public void acceptMessage(java.util.Date time, com.illposed.osc.OSCMessage message)
acceptMessage
in interface com.illposed.osc.OSCListener
time
- the time associated with the messagemessage
- the OSC messagepublic Relay[] getRelays()
public java.lang.String[] getRejectedMessages()
public void clearRejectedMessages()
public void addTuioObject(TUIO.TuioObject tobj)
addTuioObject
in interface TUIO.TuioListener
tobj
- the TuioObject to addpublic void updateTuioObject(TUIO.TuioObject tobj)
updateTuioObject
in interface TUIO.TuioListener
tobj
- the TuioObject to updatepublic void removeTuioObject(TUIO.TuioObject tobj)
removeTuioObject
in interface TUIO.TuioListener
tobj
- the TuioObject to removepublic void addTuioCursor(TUIO.TuioCursor tcur)
addTuioCursor
in interface TUIO.TuioListener
tcur
- the TuioCursor to addpublic void addContact(long id, float x, float y)
id
- the identifier associated with the Contactx
- the x location of the Contacty
- the y location of the Contactpublic void updateTuioCursor(TUIO.TuioCursor tcur)
updateTuioCursor
in interface TUIO.TuioListener
tcur
- the TuioCursor to updatepublic void updateContact(long id, float x, float y)
id
- the identifier associated with the Contactx
- the x location of the Contacty
- the y location of the Contactpublic void removeTuioCursor(TUIO.TuioCursor tcur)
removeTuioCursor
in interface TUIO.TuioListener
tcur
- the TuioCursor to removepublic void removeContact(long id)
id
- the identifier associated with the Contactpublic void clearContacts()
public void refresh(TUIO.TuioTime ftime)
refresh
in interface TUIO.TuioListener
ftime
- the TuioTime for the current TUIO message bundlepublic void startRecording()
public void stopRecording()
public boolean isRecording()
public long getRecordTime()
public void startPlayback()
public void stopPlayback()
public boolean isPlaying()
public void loopPlayback()
public void startLooping()
public void stopLooping()
public boolean isLooping()
public long getPlaybackTime()
public int getEventCount()
public void clearEvents()
public void saveJunctions()
public void saveRelays()
public void saveEvents()
public void saveAll()
public void loadJunctions()
public void loadRelays()
public void loadEvents()
public void readFile(java.io.InputStream input)
input
- the stream to readpublic void writeFile(java.io.OutputStream output)
output
- the stream to write