com.buglabs.bug.base
Class BUGBaseControl

java.lang.Object
  extended by com.buglabs.bug.sysfs.SysfsNode
      extended by com.buglabs.bug.base.BUGBaseControl
All Implemented Interfaces:
IBUG20BaseControl

public class BUGBaseControl
extends SysfsNode
implements IBUG20BaseControl

Impl of IBUG20BaseControl that uses sysfs file API to control BUGbase LEDs.


Field Summary
 
Fields inherited from class com.buglabs.bug.sysfs.SysfsNode
root
 
Fields inherited from interface com.buglabs.bug.base.pub.IBUG20BaseControl
COLOR_BLUE, COLOR_GREEN, COLOR_RED, LED_BATTERY, LED_BLUETOOTH, LED_POWER, LED_WLAN
 
Constructor Summary
BUGBaseControl()
           
 
Method Summary
 int getLEDBrightness(int led, int color)
           
 java.util.List getLEDDevices()
           
 java.lang.String getLEDTrigger(int led, int color)
           
 java.lang.String[] getLEDTriggers(int led, int color)
           
 void setLEDBrightness(int led, int brightness)
          Set brightness level for PWM-controlled LED.
 void setLEDColor(int led, int color, boolean on)
          Turn on or off a specific color on a multi color LED.
 void setLEDTrigger(int led, int color, java.lang.String trigger)
          Set the trigger for a given LED and Color
 
Methods inherited from class com.buglabs.bug.sysfs.SysfsNode
getFirstLineofFile, pad, parseHexInt, parseInt, parseMultiInt, println
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BUGBaseControl

public BUGBaseControl()
               throws java.io.FileNotFoundException
Throws:
java.io.FileNotFoundException
Method Detail

setLEDBrightness

public void setLEDBrightness(int led,
                             int brightness)
                      throws java.io.IOException
Description copied from interface: IBUG20BaseControl
Set brightness level for PWM-controlled LED.

Specified by:
setLEDBrightness in interface IBUG20BaseControl
Parameters:
led - IBUGBaseControl.LED_*
brightness - 0 - 255
Throws:
java.io.IOException - is thrown if invalid LED value is passed.

setLEDColor

public void setLEDColor(int led,
                        int color,
                        boolean on)
                 throws java.io.IOException
Description copied from interface: IBUG20BaseControl
Turn on or off a specific color on a multi color LED.

Specified by:
setLEDColor in interface IBUG20BaseControl
Parameters:
led - IBUGBaseControl.LED_*
color - IBUGBaseControl.COLOR_*
on - TRUE if LED is to be on, false otherwise.
Throws:
java.io.IOException - is thrown if invalid LED or color value is passed

getLEDBrightness

public int getLEDBrightness(int led,
                            int color)
                     throws java.io.IOException
Specified by:
getLEDBrightness in interface IBUG20BaseControl
Throws:
java.io.IOException

setLEDTrigger

public void setLEDTrigger(int led,
                          int color,
                          java.lang.String trigger)
                   throws java.io.IOException
Description copied from interface: IBUG20BaseControl
Set the trigger for a given LED and Color

Specified by:
setLEDTrigger in interface IBUG20BaseControl
Throws:
java.io.IOException

getLEDTrigger

public java.lang.String getLEDTrigger(int led,
                                      int color)
                               throws java.io.IOException
Specified by:
getLEDTrigger in interface IBUG20BaseControl
Returns:
The trigger a given light is currently set to.
Throws:
java.io.IOException

getLEDTriggers

public java.lang.String[] getLEDTriggers(int led,
                                         int color)
                                  throws java.io.IOException
Specified by:
getLEDTriggers in interface IBUG20BaseControl
Returns:
A list of string names of triggers that can be set for LEDs.
Throws:
java.io.IOException

getLEDDevices

public java.util.List getLEDDevices()
Specified by:
getLEDDevices in interface IBUG20BaseControl
Returns:
A list of LEDDevices controllable on BUG 2.0 base.