|
SunSPOT API V4.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.spot.sensorboard.peripheral.Switch
public class Switch
Class implementing simple switches, assuming a mapping of open=LOW, closed=HIGH. If the sense of the switch is reversed compose an InvertingInputPin onto the pin input.
| Constructor Summary | |
|---|---|
Switch(IInputPin input)
Constructor. |
|
| 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 |
pinSetHigh(IInputPin pin)
Callback from associated InputPin to when switch released. |
void |
pinSetLow(IInputPin pin)
Callback from associated InputPin to when switch 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. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Switch(IInputPin input)
input - the single-bit input to be used| Method Detail |
|---|
public boolean isOpen()
isOpen in interface ISwitchpublic boolean isClosed()
isClosed in interface ISwitchpublic void waitForChange()
waitForChange in interface ISwitchpublic void addISwitchListener(ISwitchListener who)
addISwitchListener in interface ISwitchwho - the switch listener to add.public void removeISwitchListener(ISwitchListener who)
removeISwitchListener in interface ISwitchwho - the switch listener to remove.public ISwitchListener[] getISwitchListeners()
getISwitchListeners in interface ISwitchpublic void pinSetLow(IInputPin pin)
pinSetLow in interface IInputPinListenerpublic void pinSetHigh(IInputPin pin)
pinSetHigh in interface IInputPinListenerpin - the pin that has changed state to high.
|
SunSPOT API V4.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||