bluegammon
Class Device

java.lang.Object
  extended bybluegammon.Device

public final class Device
extends java.lang.Object

The Device represents the device the MIDlet is running on.

Author:
Peter Andersson

Field Summary
static int KEYCODE_BACK
          Canvas keycode for back button
static int KEYCODE_LEFT_SOFT
          Canvas keycode for left softbutton
static int KEYCODE_RIGHT_SOFT
          Canvas keycode for right softbutton
 
Method Summary
static boolean canBluetooth()
          Returns whether this device implements bluetooth-apis or not.
static boolean canVibrate()
          Returns whether this device can vibrate via J2ME or not.
static int getDeviceId()
          Returns a unique id for this device.
static javax.microedition.lcdui.Display getDisplay()
          Returns the display of this midlet.
static javax.microedition.midlet.MIDlet getMidlet()
          Returns the midlet instance.
static void init(javax.microedition.midlet.MIDlet midlet, javax.microedition.lcdui.Display display)
          Initializes the Device class.
static void vibrate(int onInterval, int offInterval, int repeat)
          Vibrates repeatedly according to specified parameters.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEYCODE_LEFT_SOFT

public static final int KEYCODE_LEFT_SOFT
Canvas keycode for left softbutton

See Also:
Constant Field Values

KEYCODE_RIGHT_SOFT

public static final int KEYCODE_RIGHT_SOFT
Canvas keycode for right softbutton

See Also:
Constant Field Values

KEYCODE_BACK

public static final int KEYCODE_BACK
Canvas keycode for back button

See Also:
Constant Field Values
Method Detail

init

public static void init(javax.microedition.midlet.MIDlet midlet,
                        javax.microedition.lcdui.Display display)
Initializes the Device class.

Parameters:
midlet - The midlet instance.
display - The display.

getMidlet

public static javax.microedition.midlet.MIDlet getMidlet()
Returns the midlet instance.

Returns:
The midlet.

getDisplay

public static javax.microedition.lcdui.Display getDisplay()
Returns the display of this midlet.

Returns:
The display.

canBluetooth

public static boolean canBluetooth()
Returns whether this device implements bluetooth-apis or not.

Returns:
True if JSR82 is implemented, false otherwise.

canVibrate

public static boolean canVibrate()
Returns whether this device can vibrate via J2ME or not.

Returns:
True if vibration functionality is enabled, false otherwise.

vibrate

public static void vibrate(int onInterval,
                           int offInterval,
                           int repeat)
Vibrates repeatedly according to specified parameters.

Parameters:
onInterval - Time in milliseconds to vibrate.
offInterval - Time in milliseconds to pause between each repeat.
repeat - How many times to vibrate-pause.

getDeviceId

public static int getDeviceId()
Returns a unique id for this device. The K750i supports the systemproperty "com.sonyericsson.imei" giving the IMEI number. This is used for calculating a unique id. If this property does not exist, current time is used for id creation instead. The id is cached in RMS and is thus only calculated once.

Returns:
Device identifyer