SunSPOT API V3.0


com.sun.spot.sensorboard.peripheral
Interface ISwitch

All Known Implementing Classes:
Switch

public interface ISwitch

Represents a simple pushbutton switch


Method Summary
 void addISwitchListener(ISwitchListener who)
          Adds the specified switch listener to receive callbacks from this switch.
 ISwitchListener[] getISwitchListeners()
          Returns an array of all the switch listeners registered on this switch.
 boolean isClosed()
          Return true if the switch IS pressed.
 boolean isOpen()
          Return true if the switch is NOT pressed
 void removeISwitchListener(ISwitchListener who)
          Removes the specified switch listener so that it no longer receives callbacks from this switch.
 void waitForChange()
          Block the current thread until the switch's state changes.
 

Method Detail

isOpen

boolean isOpen()
Return true if the switch is NOT pressed

Returns:
true if the switch is NOT pressed

isClosed

boolean isClosed()
Return true if the switch IS pressed.

Returns:
true if the switch IS pressed

waitForChange

void waitForChange()
Block the current thread until the switch's state changes. (This now uses interrupts and no longer polls.)


addISwitchListener

void addISwitchListener(ISwitchListener who)
Adds the specified switch listener to receive callbacks from this switch.

Parameters:
who - the switch listener to add.

removeISwitchListener

void removeISwitchListener(ISwitchListener who)
Removes the specified switch listener so that it no longer receives callbacks from this switch. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this switch.

Parameters:
who - the switch listener to remove.

getISwitchListeners

ISwitchListener[] getISwitchListeners()
Returns an array of all the switch listeners registered on this switch.

Returns:
all of this switch's SwitchListeners or an empty array if no switch listeners are currently registered.

SunSPOT API V3.0


Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.