edu.berkeley.guir.ptk.apps.busmobile
Class BusLEDOutput

java.lang.Object
  extended byedu.berkeley.guir.ptk.PTK
      extended byedu.berkeley.guir.ptk.output.Output
          extended byedu.berkeley.guir.ptk.output.PhidgetInterfaceKitOutput
              extended byedu.berkeley.guir.ptk.apps.busmobile.BusLEDOutput
All Implemented Interfaces:
Phidgets._IPhidgetManagerEvents, Animatable, java.util.EventListener, java.lang.Runnable

public class BusLEDOutput
extends PhidgetInterfaceKitOutput
implements Animatable

Example Output that extends the PhidgetIntefaceKitOutput library element. Also, is Animatable.

Author:
tmatthew

Field Summary
static int NUM_STEPS
           
 
Fields inherited from class edu.berkeley.guir.ptk.output.PhidgetInterfaceKitOutput
kit, KIT, manager, my_serial_num
 
Fields inherited from class edu.berkeley.guir.ptk.output.Output
animatable, d_queue, data_ids_I_want, history, ITEMS_LENGTH, metadata_I_want, num_ids, num_metadata, output_cycle_time, transition
 
Fields inherited from class edu.berkeley.guir.ptk.PTK
debug, MAX_DEBUG, MED_DEBUG, MIN_DEBUG, NO_DEBUG
 
Fields inherited from interface Phidgets._IPhidgetManagerEvents
event_package, id_1, id_2, id_3
 
Constructor Summary
BusLEDOutput(int serial, Metadata metadata_I_want)
           
 
Method Summary
 Event alternateStep(Event prev_event, Event new_event, int step)
          Returns an event that represents the "alternate" or "opposite" of what is displayed by the other transition methods in order to create a "flashing" effect.
 Event changeblindTransStep(Event prev_event, Event new_event, int step_num)
          Returns an event that is somewhere between the start and end points of a change blind transition, depending on the display_step and the number of steps involved in the transition.
protected  void displayEvent(Event e)
          This code needs to actually display the event (e.g.
 Event endTransition(Event prev_event, Event new_event, int step)
          Returns an event representative of the end state of a transition.
 void initialize()
          Called when the interface kit with serial number SERVO is attached.
 Event interruptTransStep(Event prev_event, Event new_event, int step_num)
          Returns an event that is somewhere between the start and end points of a interrupt transition, depending on the display_step and the number of steps involved in the transition.
 Event makeawareTransStep(Event prev_event, Event new_event, int step_num)
          Returns an event that is somewhere between the start and end points of a make aware transition, depending on the display_step and the number of steps involved in the transition.
 Event startTransition(Event prev_event, Event new_event, int step)
          Returns an event representative of the beginning of a transition.
protected  int translateTime2Lights(double time)
           
 
Methods inherited from class edu.berkeley.guir.ptk.output.PhidgetInterfaceKitOutput
initManager, OnAttach, OnDetach, OnError
 
Methods inherited from class edu.berkeley.guir.ptk.output.Output
addDataID, addMetadataIWant, checkAction, doIWant, getAllMetadata, getDataIDs, getFirstMetadata, getHistory, handleEvent, interDisplayEvent, isAnimatable, printMetadataIWant, run, setChangeblindTransitionSteps, setDataIDsIWant, setInterruptTransitionSteps, setMakeawareTransitionSteps, setTimeBetweenDisplayEvents, setTransition, setUnsetNotification
 
Methods inherited from class edu.berkeley.guir.ptk.PTK
getMAX, getMED, getMIN, getNO, printDebug, printDebug, printError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUM_STEPS

public static final int NUM_STEPS
See Also:
Constant Field Values
Constructor Detail

BusLEDOutput

public BusLEDOutput(int serial,
                    Metadata metadata_I_want)
Method Detail

initialize

public void initialize()
Called when the interface kit with serial number SERVO is attached.

Specified by:
initialize in class PhidgetInterfaceKitOutput

displayEvent

protected void displayEvent(Event e)
Description copied from class: Output
This code needs to actually display the event (e.g. print the text, show the image, etc). This function should return as fast as possible.

Specified by:
displayEvent in class Output
Parameters:
e - This event to be displayed

translateTime2Lights

protected int translateTime2Lights(double time)

startTransition

public Event startTransition(Event prev_event,
                             Event new_event,
                             int step)
Description copied from interface: Animatable
Returns an event representative of the beginning of a transition.

Specified by:
startTransition in interface Animatable
Parameters:
prev_event - the previous event sent to this Output (null if the new event is the first).
new_event - the new event to be displayed on the Output.
step - a number indicating the display order of the event returned if the Transition is creating a set of events.
Returns:
Event

endTransition

public Event endTransition(Event prev_event,
                           Event new_event,
                           int step)
Description copied from interface: Animatable
Returns an event representative of the end state of a transition. This typically involves the new event data.

Specified by:
endTransition in interface Animatable
Parameters:
prev_event - the previous event sent to this Output (null if the new event is the first).
new_event - the new event to be displayed on the Output.
step - a number indicating the display order of the event returned if the Transition is creating a set of events.
Returns:
Event

changeblindTransStep

public Event changeblindTransStep(Event prev_event,
                                  Event new_event,
                                  int step_num)
Description copied from interface: Animatable
Returns an event that is somewhere between the start and end points of a change blind transition, depending on the display_step and the number of steps involved in the transition. Only need to implement if the application uses change blind transitions.

Specified by:
changeblindTransStep in interface Animatable
Parameters:
prev_event - the previous event sent to this Output (null if the new event is the first).
new_event - the new event to be displayed on the Output.
step_num - a number indicating the display order of the event returned if the Transition is creating a set of events.
Returns:
Event

makeawareTransStep

public Event makeawareTransStep(Event prev_event,
                                Event new_event,
                                int step_num)
Description copied from interface: Animatable
Returns an event that is somewhere between the start and end points of a make aware transition, depending on the display_step and the number of steps involved in the transition. Only need to implement if the application uses make aware transitions.

Specified by:
makeawareTransStep in interface Animatable
Parameters:
prev_event - the previous event sent to this Output (null if the new event is the first).
new_event - the new event to be displayed on the Output.
step_num - a number indicating the display order of the event returned if the Transition is creating a set of events.
Returns:
Event

interruptTransStep

public Event interruptTransStep(Event prev_event,
                                Event new_event,
                                int step_num)
Description copied from interface: Animatable
Returns an event that is somewhere between the start and end points of a interrupt transition, depending on the display_step and the number of steps involved in the transition. Only need to implement if the application uses interrupt transitions.

Specified by:
interruptTransStep in interface Animatable
Parameters:
prev_event - the previous event sent to this Output (null if the new event is the first).
new_event - the new event to be displayed on the Output.
step_num - a number indicating the display order of the event returned if the Transition is creating a set of events.
Returns:
Event

alternateStep

public Event alternateStep(Event prev_event,
                           Event new_event,
                           int step)
Description copied from interface: Animatable
Returns an event that represents the "alternate" or "opposite" of what is displayed by the other transition methods in order to create a "flashing" effect. For example, if a text is displayed on a ticker, the alternateStep might be to delete all the text. For an interrupt transition, the effect would be text flashing between the the new event text (returned by endTransition) and no text (returned by alternateStep).

Specified by:
alternateStep in interface Animatable
Parameters:
prev_event - the previous event sent to this Output (null if the new event is the first).
new_event - the new event to be displayed on the Output.
step - a number indicating the display order of the event returned if the Transition is creating a set of events.
Returns:
Event