com.buglabs.bug.sysfs
Class LEDDevice

java.lang.Object
  extended by com.buglabs.bug.sysfs.SysfsNode
      extended by com.buglabs.bug.sysfs.LEDDevice

public class LEDDevice
extends SysfsNode

A class to control a single-color or multi-color LED.


Field Summary
static int COLOR_MONO
          Constant for single color LED
static int TYPE_MONO_COLOR
          LED is single color.
static int TYPE_TRI_COLOR
          LED is tri color
 
Fields inherited from class com.buglabs.bug.sysfs.SysfsNode
root
 
Constructor Summary
LEDDevice(java.io.File root, java.lang.String name)
          Constructor for tri-color LED
LEDDevice(java.io.File root, java.lang.String name, java.lang.String color)
          Constructor for mono LED.
 
Method Summary
 int getBrightness(int color)
           
 int getColorCount()
           
 java.lang.String getLEDTrigger(int color)
           
 java.lang.String[] getLEDTriggers(int color)
          Get the Trigger types this LED supports.
 java.lang.String getName()
           
 int getType()
           
 void setBrightness(int color, int brightness)
          Set the brightness for the specified LED.
 void setTrigger(int color, java.lang.String trigger)
          Set a trigger on a LED.
 
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
 

Field Detail

TYPE_MONO_COLOR

public static final int TYPE_MONO_COLOR
LED is single color.

See Also:
Constant Field Values

TYPE_TRI_COLOR

public static final int TYPE_TRI_COLOR
LED is tri color

See Also:
Constant Field Values

COLOR_MONO

public static final int COLOR_MONO
Constant for single color LED

See Also:
Constant Field Values
Constructor Detail

LEDDevice

public LEDDevice(java.io.File root,
                 java.lang.String name,
                 java.lang.String color)
Constructor for mono LED.

Parameters:
root -
name -
color -

LEDDevice

public LEDDevice(java.io.File root,
                 java.lang.String name)
Constructor for tri-color LED

Parameters:
root -
name -
Method Detail

getName

public java.lang.String getName()
Returns:
name of LED.

getType

public int getType()
Returns:
type of LED

setBrightness

public void setBrightness(int color,
                          int brightness)
                   throws java.io.IOException
Set the brightness for the specified LED.

Parameters:
color -
brightness -
Throws:
java.io.IOException

getBrightness

public int getBrightness(int color)
Parameters:
color -
Returns:
the current brightness of the specified LED.

setTrigger

public void setTrigger(int color,
                       java.lang.String trigger)
                throws java.io.IOException
Set a trigger on a LED.

Parameters:
color -
trigger -
Throws:
java.io.IOException

getLEDTrigger

public java.lang.String getLEDTrigger(int color)
                               throws java.io.IOException
Parameters:
color -
Returns:
The LED trigger that is currently set. "none" means no trigger is active.
Throws:
java.io.IOException

getLEDTriggers

public java.lang.String[] getLEDTriggers(int color)
                                  throws java.io.IOException
Get the Trigger types this LED supports. These trigger types can be set using setLEDTrigger.

Parameters:
color -
Returns:
Throws:
java.io.IOException

getColorCount

public int getColorCount()
Returns:
The number of colors this LED supports. Zero based.