SunSPOT API V5.0


com.sun.spot.sensorboard.io
Class InvertingInputPin

java.lang.Object
  extended by com.sun.spot.sensorboard.io.InvertingInputPin
All Implemented Interfaces:
IInputPin, IInputPinListener

public class InvertingInputPin
extends Object
implements IInputPin, IInputPinListener

Class implementing single bit input with inversion of values read, i.e. low signal is returned as high and high signal is returned as low.

Author:
jn151271 11-Mar-2005

Constructor Summary
InvertingInputPin(IInputPin input)
          Constructor.
 
Method Summary
 void addIInputPinListener(IInputPinListener who)
          Adds the specified input pin listener to receive callbacks from this input pin.
 IInputPinListener[] getIInputPinListeners()
          Returns an array of all the input pin listeners registered on this input pin.
 PinDescriptor getIndex()
          Return the PinDescriptor associated with this input pin.
 boolean isHigh()
          Return true if the actual input bit is low.
 boolean isLow()
          Return true if the actual input bit is high.
 void pinSetHigh(IInputPin pin)
          Callback from associated InputPin to when switch released.
 void pinSetLow(IInputPin pin)
          Callback from associated InputPin to when switch pressed.
 void removeIInputPinListener(IInputPinListener who)
          Removes the specified input pin listener so that it no longer receives callbacks from this input pin.
 void waitForChange()
          Blocks until there is a change, either way, in the input, as defined for the interface IInputPin
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InvertingInputPin

public InvertingInputPin(IInputPin input)
Constructor. Stores the single-bit input to be used.

Parameters:
input - single-bit input to be used
Method Detail

getIndex

public PinDescriptor getIndex()
Return the PinDescriptor associated with this input pin.

Specified by:
getIndex in interface IInputPin
Returns:
the PinDescriptor associated with this input pin.

isLow

public boolean isLow()
Return true if the actual input bit is high.

Specified by:
isLow in interface IInputPin
Returns:
true if the input is high, false if the input is low, i.e. the exact opposite of the returned value as described for the interface SingleBitInput
See Also:
IInputPin.isLow()

isHigh

public boolean isHigh()
Return true if the actual input bit is low.

Specified by:
isHigh in interface IInputPin
Returns:
true if the input is low, false if the input is high, i.e. the exact opposite of the returned value as described for the interface SingleBitInput
See Also:
IInputPin.isHigh()

waitForChange

public void waitForChange()
Blocks until there is a change, either way, in the input, as defined for the interface IInputPin

Specified by:
waitForChange in interface IInputPin
See Also:
IInputPin.waitForChange()

addIInputPinListener

public void addIInputPinListener(IInputPinListener who)
Adds the specified input pin listener to receive callbacks from this input pin.

Specified by:
addIInputPinListener in interface IInputPin
Parameters:
who - the input pin listener to add.

removeIInputPinListener

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

Specified by:
removeIInputPinListener in interface IInputPin
Parameters:
who - the input pin listener to remove.

getIInputPinListeners

public IInputPinListener[] getIInputPinListeners()
Returns an array of all the input pin listeners registered on this input pin.

Specified by:
getIInputPinListeners in interface IInputPin
Returns:
all of this input pin's listeners or an empty array if no input pin listeners are currently registered.

pinSetLow

public void pinSetLow(IInputPin pin)
Callback from associated InputPin to when switch pressed. Spawns threads to notify any registered IInputPinListener.

Specified by:
pinSetLow in interface IInputPinListener

pinSetHigh

public void pinSetHigh(IInputPin pin)
Callback from associated InputPin to when switch released. Spawns threads to notify any registered IInputPinListener.

Specified by:
pinSetHigh in interface IInputPinListener
Parameters:
pin - the pin that has changed state to high.

SunSPOT API V5.0


Copyright � 2006-2008 Sun Microsystems, Inc. All Rights Reserved.