edu.stanford.hci.r3.devices
Class Device

java.lang.Object
  extended by edu.stanford.hci.r3.devices.Device
Direct Known Subclasses:
AudioHeadsetDevice, HandheldDevice, LCDDevice, ProjectorDevice

public class Device
extends java.lang.Object

Applications can also include devices, which can supply input and receive output. Since devices may not be attached to the local machine where you are running the program, we need to assign a hostname to each device.

Devices work closely with the Actions API. Basically, devices are constructs that allow us to send events and actions to remote machines...

This software is distributed under the BSD License.


Constructor Summary
Device(java.lang.String theHostNameOrIPAddr, java.lang.String descriptiveName)
          Provide an IP address of a remote device that is listening for actions.
 
Method Summary
 void connect()
          Once we have connected, we can start sending this device commands....
 void disconnect()
           
static OpenFileAction doOpenFile(java.io.File file)
          Opens a file on the local device, using the default file editor.
static void doOpenURL(java.lang.String urlString)
          Opens a URL on the local machine.
static PlaySoundAction doPlaySound(java.io.File soundFile)
          Plays the sound file on the local device.
static void doSpeakText(java.lang.String textToSpeak)
           
 ActionChannel getActionChannel()
           
 AudioChannel getAudioChannel()
          The audio channel provides convenience functions to easily play audio or read text on this device.
 DisplayChannel getDisplayChannel()
          Access the display.
 java.lang.String getName()
           
 void invokeAction(R3Action action)
          Send actions directly to the REMOTE device that this Device object represents.
 boolean isAlive()
          Instead of pinging, we check if a device is "reachable" by making sure it has a host address.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Device

public Device(java.lang.String theHostNameOrIPAddr,
              java.lang.String descriptiveName)
Provide an IP address of a remote device that is listening for actions.

Method Detail

doPlaySound

public static PlaySoundAction doPlaySound(java.io.File soundFile)
Plays the sound file on the local device.

Parameters:
soundFile -
Returns:
the playSoundAction object, so you can stop the audio if you wish.

connect

public void connect()
Once we have connected, we can start sending this device commands....


disconnect

public void disconnect()

getActionChannel

public ActionChannel getActionChannel()
Returns:

getAudioChannel

public AudioChannel getAudioChannel()
The audio channel provides convenience functions to easily play audio or read text on this device. But, if you need to access the sender directly, you can always call the lower level invokeAction(...).

Returns:
a channel that allows us to send audio to this device...

getDisplayChannel

public DisplayChannel getDisplayChannel()
Access the display.

Returns:

getName

public java.lang.String getName()
Returns:

invokeAction

public void invokeAction(R3Action action)
Send actions directly to the REMOTE device that this Device object represents.

Parameters:
action -

isAlive

public boolean isAlive()
Instead of pinging, we check if a device is "reachable" by making sure it has a host address.

Returns:

doSpeakText

public static void doSpeakText(java.lang.String textToSpeak)
Parameters:
textToSpeak -

doOpenURL

public static void doOpenURL(java.lang.String urlString)
Opens a URL on the local machine.


doOpenFile

public static OpenFileAction doOpenFile(java.io.File file)
Opens a file on the local device, using the default file editor.

Parameters:
file -
Returns:

Copyright 2006 Stanford University