com.motorola.funlight
Class FunLight

java.lang.Object
  |
  +--com.motorola.funlight.FunLight

public class FunLight
extends java.lang.Object

FunLight class allows developers to access to additional lighting features that consist of varying colors, light intensity, and areas of light control. This API will enhance J2ME applications, such as game and karaoke applications.
A few examples:
1) when in driving game application, the developer would turn the Fun Lights on at varying light intensities and colors to warn of an impending crash,
2) a karaoke or jukebox application would have access to turn the Fun Lights on and off to the beat of the music,
3) an alarm clock or stopwatch application could use the Fun Lights in conjunction with a timer feature.

Fun Lights product:

MIDlet's developer can get information about current Fun Lights feature in run-time by invoking the java.lang.System.getProperty(String key) method with "funlights.product" key.

Product

Returned value

E380

"E380"

V600

"V600"

E390

"E390"

other

null

Region

Region is an area of phone (display, keypad etc.) that can light or change its color.


Field Summary
static int BLACK
          Constant for turning a region's light off.
static int BLANK
          Constant for Blank region.
static int BLUE
          Constant for blue color.
static int CYAN
          Constant for cyan color.
static int GREEN
          Constant for green color.
static int IGNORED
          Constant for indication that operation for region has been ignored.
static int MAGENTA
          Constant for magenta color.
static int OFF
          Constant for turning a region's light off.
static int ON
          Constant for turning a region's light on.
static int QUEUED
          Constant for indication that operation for region has been queued.
static int RED
          Constant for red color.
static int SUCCESS
          Constant for indication that operation for region has been successfully completed.
static int WHITE
          Constant for white color.
static int YELLOW
          Constant for yellow color.
 
Method Summary
static int getControl()
          Tries to occupy control for all existing regions.
static Region getRegion(int ID)
          Gets Fun Lights region by ID.
static Region[] getRegions()
          Gets the array of regions that exist on the current device.
static int[] getRegionsIDs()
          Gets the array of IDs of regions that exist on the current device.
static void releaseControl()
          Releases control for all existing regions.
static int setColor(byte red, byte green, byte blue)
          Sets the color for all of existing regions.
static int setColor(int color)
          Sets the color for all existing regions.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLACK

public static final int BLACK
Constant for turning a region's light off.
Value 0x00000000 is assigned to BLACK.

BLANK

public static final int BLANK
Constant for Blank region.

Note. Blank region is not "real" region on device. This is dummy region. All Blank region's method calls will be ignored, e.g. no null pointer exceptions occurs.
Value 0 is assigned to BLANK.

BLUE

public static final int BLUE
Constant for blue color.
Value 0x000000FF is assigned to BLUE.

CYAN

public static final int CYAN
Constant for cyan color.
Value 0x0000FFFF is assigned to CYAN.

GREEN

public static final int GREEN
Constant for green color.
Value 0x0000FF00 is assigned to GREEN.

MAGENTA

public static final int MAGENTA
Constant for magenta color.
Value 0x00FF00FF is assigned to MAGENTA.

OFF

public static final int OFF
Constant for turning a region's light off.
Value 0x00000000 is assigned to OFF.

ON

public static final int ON
Constant for turning a region's light on.
Value 0x00FFFFFF is assigned to ON.

RED

public static final int RED
Constant for red color.
Value 0x00FF0000 is assigned to RED.

WHITE

public static final int WHITE
Constant for white color.
Value 0x00FFFFFF is assigned to WHITE.

YELLOW

public static final int YELLOW
Constant for yellow color.
Value 0x00FFFF00 is assigned to YELLOW.

QUEUED

public static final int QUEUED
Constant for indication that operation for region has been queued.
Value 1 is assigned to QUEUED

SUCCESS

public static final int SUCCESS
Constant for indication that operation for region has been successfully completed.
Value 0 is assigned to SUCCESS

IGNORED

public static final int IGNORED
Constant for indication that operation for region has been ignored.
Value 2 is assigned to IGNORED
Method Detail

getControl

public static int getControl()
Tries to occupy control for all existing regions. This method calls getControl() method for all existing regions.

Note. If current device does not support any regions then QUEUED will be returned
Returns:
SUCCESS - if control for all regions has been obtained successfully.
IGNORED - if control at least for one region has been ignored.
QUEUED - if control at least for one region has been queued and no one has been ignored.

getRegion

public static Region getRegion(int ID)
Gets Fun Lights region by ID. If region with required ID does not exist in current device then Blank region will be returned.

Note. All methods calls for Blank region will be ignored.
Parameters:
ID - ID of Fun Light Region.
Returns:
Region with required ID.

getRegionsIDs

public static int[] getRegionsIDs()
Gets the array of IDs of regions that exist on the current device.

Note. If current device does not support any regions then null will be returned.
Returns:
Array IDs of existing regions.

getRegions

public static Region[] getRegions()
Gets the array of regions that exist on the current device.

Note. If current device does not support any regions then null will be returned.
Returns:
Array of existing regions.

releaseControl

public static void releaseControl()
Releases control for all existing regions. This method calls releaseControl() method for all existing regions.

Note. If current device does not support any regions then this method will do nothing.

setColor

public static int setColor(int color)
Sets the color for all existing regions. This method calls setColor(int color) method for all existing regions.

Note. If current device does not support any regions then QUEUED will be returned.
Parameters:
color - color in RGB format (0x00RRGGBB).
Returns:
SUCCESS - if color for all regions has been set.
IGNORED - if color setting for at least one region has been ignored.
QUEUED - if color setting for at least one region has been queued and no one has been ignored.

setColor

public static int setColor(byte red,
                           byte green,
                           byte blue)
Sets the color for all of existing regions. This method calls setColor(byte red, byte green, byte blue) method for all existing regions.

Note. If current device does not support any regions then QUEUED will be returned.
Parameters:
red - Red component of color.
green - Green component of color.
blue - Blue component of color.
Returns:
SUCCESS - if color for all regions has been set.
IGNORED - if color setting for at least one region has been ignored.
QUEUED - if color setting for at least one region has been queued and no one has been ignored.