|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.nokia.mid.ui.DeviceControl
DeviceControl provides a collection of methods to control some of the special features available in mobile devices, e.g., vibration and screen (LCD) backlight.
This class is thread safe.
Method Summary | |
static void |
flashLights(long duration)
Deprecated. As of Nokia UI API 1.1 in devices with MIDP 2.0 or higher, replaced by javax.microedition.lcdui.Display.flashBacklight(int). |
static void |
setLights(int num,
int level)
Activates and deactivates the lights on the device. |
static void |
startVibra(int freq,
long duration)
Deprecated. As of Nokia UI API 1.1 in devices with MIDP 2.0 or higher, replaced by javax.microedition.lcdui.Display.vibrate(int). |
static void |
stopVibra()
Deprecated. As of Nokia UI API 1.1 in devices with MIDP 2.0 or higher, replaced by javax.microedition.lcdui.Display.vibrate(int) |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static void setLights(int num, int level)
Note: Since in some devices key presses may turn on some device lights, the light settings may be changed also by the system.
num
- is the number or id for light, 0 is used for display
backlight, other numbers are currently left unspecified.level
- the lighting level 0-100. 0 means "off" or some other
minimum lighting setting. For many devices, a value greater
than 0 means "light on".
java.lang.IllegalArgumentException
- if light num is not
supported or level is not between 0-100.public static void flashLights(long duration)
This is a generic method for implementing a specific light flashing effect. This could be used as feedback in games, etc. If the device is not capable of handling the effect, the method call silently returns. In most devices, there is at least a screen backlight and different LEDs that could be used for the effect. There might be a maximum limit for the length of time: the effect automatically stops after a maximum length of time has been reached. When the flashing lights effect ends, the implementation sets the lights back to the proper light state. For example, if setLights is called during the lighting for light num with which the flashing effect is created the lights will return to this this value after flashing effect ends. The light flashing effect can be stopped by calling the method again with duration value 0.
duration
- length of time in milliseconds that the effect
should be active
java.lang.IllegalArgumentException
- if duration < 0public static void startVibra(int freq, long duration)
The parameter duration is used to indicate the length of time of the vibration in milliseconds. The method will not block for vibration. There is a maximum limit in the implementation for the length of time. Duration values that exceed this limit result in a maximum vibration effect.
If the method is called during a previously called vibration that has been activated from this method, the previous vibration is stopped and the new one is activated using the new set of parameters.
IllegalStateException will be thrown if freq is not 0 and if the device does not allow vibration; for example, it is common that vibration is not allowed when the device is being recharged in a desk stand or there is an incoming call. IllegalStateException will be thrown if there is no vibration capability in the device.
Note that if the frequency is 0, and the device does not have
vibration, IllegalStateException is thrown. This means that the
method call DeviceControl.startVibra(0,0)
can be used to
detect whether vibration is supported (IllegalStateException not
thrown) or not (IllegalStateException thrown) without any vibration
occuring even if it is supported.
freq
- the frequency of the vibra device. Value 0 can be used
for detecting whether or not there is a vibration device. 100 means
the maximum frequency value of a specific system. 1 must always
result in a minimum non-zero vibration.duration
- the length of time in milliseconds the vibration is
active.
java.lang.IllegalStateException
- For freq values 1-100:
the use of vibration is not allowed or the system does not have
vibration support. For frequency value 0: the device does not have
vibration.
java.lang.IllegalArgumentException
- if duration or freq is
< 0, or freq is > 100.public static void stopVibra()
startVibra(int freq, long duration)
.
If vibration is not active, the method silently returns.
|
forum.nokia.com/java | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |