SunSPOT API V6.0


com.sun.spot.sensorboard.io
Class InvertingInputPin

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

public class InvertingInputPin
extends Resource
implements IInputPin, 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.
 void addIInputPinListener(IInputPinListener who)
           
 SensorEvent createSensorEvent()
          Create a SensorEvent of the appropriate type for this sensor.
 String getDescription()
          This method returns a readable description of the sensor.
 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.
 double getMaxSamplingRate()
          Return the maximum sampling rate per second for this sensor.
 boolean isHigh()
          Return true if the actual input bit is low.
 boolean isLow()
          Return true if the actual input bit is high.
 void pinSetHigh(InputPinEvent ev)
          Callback from associated InputPin to when switch released.
 void pinSetLow(InputPinEvent ev)
          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 removeIInputPinListener(IInputPinListener who)
           
 void saveEventState(SensorEvent evt)
          Save the current sensor state in the specified event.
 void waitForChange()
          Blocks until there is a change, either way, in the input, as defined for the interface IInputPin
 
Methods inherited from class com.sun.spot.resources.Resource
addTag, getTags, getTagValue, hasTag, removeTag
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.spot.resources.IResource
addTag, getTags, getTagValue, hasTag, removeTag
 

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.

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.

addIInputPinListener

public void addIInputPinListener(IInputPinListener who)

removeIInputPinListener

public void removeIInputPinListener(IInputPinListener who)

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(InputPinEvent ev)
Callback from associated InputPin to when switch pressed. Spawns threads to notify any registered IInputPinListener.

Specified by:
pinSetLow in interface IInputPinListener
Parameters:
ev - the SensorEvent describing this event

pinSetHigh

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

Specified by:
pinSetHigh in interface IInputPinListener
Parameters:
ev - the SensorEvent describing this event

getDescription

public String getDescription()
Description copied from interface: ITransducer
This method returns a readable description of the sensor. The description should tell the essentials of the sensor, including at least the sensor type (accelerometer, microphone, thermometer). The returned string MUST not be null or an empty string.

Specified by:
getDescription in interface ITransducer
Returns:
the description of the sensor

getMaxSamplingRate

public double getMaxSamplingRate()
Description copied from interface: ITransducer
Return the maximum sampling rate per second for this sensor.

Specified by:
getMaxSamplingRate in interface ITransducer
Returns:
the maximum sampling rate per second for this sensor or 0 if not applicable.

createSensorEvent

public SensorEvent createSensorEvent()
Description copied from interface: ITransducer
Create a SensorEvent of the appropriate type for this sensor.

Specified by:
createSensorEvent in interface ITransducer
Returns:
a SensorEvent of the appropriate type for this sensor.

saveEventState

public void saveEventState(SensorEvent evt)
Description copied from interface: ITransducer
Save the current sensor state in the specified event.

Specified by:
saveEventState in interface ITransducer
Parameters:
evt - the event to store the sensor state in

SunSPOT API V6.0


Copyright © 2006-2010 Oracle. All Rights Reserved.