|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jraf.jlibibuddy.IBuddy
public class IBuddy
Main entry point to i-Buddy commanding. Note: currently, one and only one i-Buddy can be manipulated with this library. Therefore, this class should be used as a singleton, even if this not enforced by the code.
| Nested Class Summary | |
|---|---|
static class |
IBuddy.Color
Different colors for the head (all possible combinations of the blue, green and red LEDs). |
static class |
IBuddy.Rotate
Different rotation states. |
static class |
IBuddy.Wings
Different wing positions. |
| Method Summary | |
|---|---|
static IBuddy |
getIBuddy()
Gets the i-Buddy. |
void |
sendAllOff()
Turns everything off. |
void |
sendHeadBlue(boolean headBlue)
Turns the head blue LED on or off. |
void |
sendHeadColor(boolean headBlue,
boolean headGreen,
boolean headRed)
Turns the head LEDs on or off. |
void |
sendHeadColor(IBuddy.Color color)
Sets a color on the head by turning the LEDs on or off. |
void |
sendHeadGreen(boolean headGreen)
Turns the head green LED on or off. |
void |
sendHeadRed(boolean headRed)
Turns the head red LED on or off. |
void |
sendHeart(boolean heart)
Turns the heart LED on or off. |
void |
sendRotate(boolean rotateRight,
boolean rotateLeft)
Turns the "rotate right" and "rotate left" states on or off. |
void |
sendRotate(IBuddy.Rotate rotate)
Sets the rotate state. |
void |
sendRotateLeft(boolean rotateLeft)
Turns the "rotate left" state on or off. |
void |
sendRotateRight(boolean rotateRight)
Turns the "rotate right" state on or off. |
void |
sendState(boolean heart,
boolean headBlue,
boolean headGreen,
boolean headRed,
boolean wingsDown,
boolean wingsUp,
boolean rotateRight,
boolean rotateLeft)
General purpose send state method. |
void |
sendWings(boolean wingsDown,
boolean wingsUp)
Turns the "wings up" and "wings down" states on or off. |
void |
sendWings(IBuddy.Wings wings)
Sets the wings state. |
void |
sendWingsDown(boolean wingsDown)
Turns the "wings down" state on or off. |
void |
sendWingsUp(boolean wingsUp)
Turns the "wings up" state on or off. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static IBuddy getIBuddy()
public void sendState(boolean heart,
boolean headBlue,
boolean headGreen,
boolean headRed,
boolean wingsDown,
boolean wingsUp,
boolean rotateRight,
boolean rotateLeft)
throws IBuddyException
heart - true to turn the heart LED on, false to turn it off.headBlue - true to turn the head blue LED on, false to turn it off.headGreen - true to turn the head green LED on, false to turn it off.headRed - true to turn the head red LED on, false to turn it off.wingsDown - true to turn the "wings down" state on, false to turn it off.wingsUp - true to turn the "wings up" state on, false to turn it off.rotateRight - true to turn the "rotate right" state on, false to turn it off.rotateLeft - true to turn the "rotate left" state on, false to turn it off.
IBuddyException - in case of problem while sending the usb command.
java.lang.IllegalArgumentException - if wingsUp and wingsDown are both true, or if rotateRight and rotateLeft are both true.
public void sendAllOff()
throws IBuddyException
IBuddyException - in case of problem while sending the usb command.
public void sendHeart(boolean heart)
throws IBuddyException
heart - whether to turn the heart LED on (true) or off (false).
IBuddyException - in case of problem while sending the usb command.
public void sendHeadBlue(boolean headBlue)
throws IBuddyException
headBlue - whether to turn the head blue LED on (true) or off (false).
IBuddyException - in case of problem while sending the usb command.
public void sendHeadGreen(boolean headGreen)
throws IBuddyException
headGreen - whether to turn the head green LED on (true) or off (false).
IBuddyException - in case of problem while sending the usb command.
public void sendHeadRed(boolean headRed)
throws IBuddyException
headRed - whether to turn the head red LED on (true) or off (false).
IBuddyException - in case of problem while sending the usb command.
public void sendHeadColor(boolean headBlue,
boolean headGreen,
boolean headRed)
throws IBuddyException
headBlue - whether to turn the head blue LED on (true) or off (false).headGreen - whether to turn the head green LED on (true) or off (false).headRed - whether to turn the head red LED on (true) or off (false).
IBuddyException - in case of problem while sending the usb command.
public void sendHeadColor(IBuddy.Color color)
throws IBuddyException
color - the color to set on the head.
IBuddyException - in case of problem while sending the usb command.
public void sendWingsDown(boolean wingsDown)
throws IBuddyException
wingsDown - whether to turn the "wings down" on (true) or off (false).
IBuddyException - in case of problem while sending the usb command.
public void sendWingsUp(boolean wingsUp)
throws IBuddyException
wingsUp - whether to turn the "wings up" on (true) or off (false).
IBuddyException - in case of problem while sending the usb command.
public void sendWings(boolean wingsDown,
boolean wingsUp)
throws IBuddyException
wingsUp - whether to turn the "wings up" on (true) or off (false).wingsDown - whether to turn the "wings down" on (true) or off (false).
java.lang.IllegalArgumentException - if wingsUp and wingsDown are both true.
IBuddyException - in case of problem while sending the usb command.
public void sendWings(IBuddy.Wings wings)
throws IBuddyException
wings - the wings state.
IBuddyException - in case of problem while sending the usb command.
public void sendRotateRight(boolean rotateRight)
throws IBuddyException
rotateRight - whether to turn the "rotate right" on (true) or off (false).
IBuddyException - in case of problem while sending the usb command.
public void sendRotateLeft(boolean rotateLeft)
throws IBuddyException
rotateLeft - whether to turn the "rotate left" on (true) or off (false).
IBuddyException - in case of problem while sending the usb command.
public void sendRotate(boolean rotateRight,
boolean rotateLeft)
throws IBuddyException
rotateRight - whether to turn the "rotate right" on (true) or off (false).rotateLeft - whether to turn the "rotate left" on (true) or off (false).
java.lang.IllegalArgumentException - if rotateRight and rotateLeft are both true.
IBuddyException - in case of problem while sending the usb command.
public void sendRotate(IBuddy.Rotate rotate)
throws IBuddyException
rotate - the rotate state.
IBuddyException - in case of problem while sending the usb command.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||