ewe.sys
Class Device

java.lang.Object
  extended byewe.sys.Device
All Implemented Interfaces:
Runnable, VmConstants

public class Device
extends Object
implements Runnable, VmConstants

This class provides useful utilities for monitoring/controlling the device or for retrieving native resources for the device.


Field Summary
static int BATTERY_AC
          This is a possible parameter for getBatteryState().
static int BATTERY_BACKUP
          This is a possible parameter for getBatteryState().
static int BATTERY_MAIN
          This is a possible parameter for getBatteryState().
static int BATTERY_OPTION_FLAGS
           
static int BATTERY_OPTION_POWER_LEFT
           
static int BATTERY_STATE_UNKNOWN
          This is a possible return value for getBatteryState.
static IImage computer
           
static IImage drive
           
static int FEATURE_CUSTOM_BUTTONS
          Indicates that application custom buttons are present.
static int FEATURE_DIRECTION_PAD
          Indicates that a direction (up/down/left/right) pad is present.
static int FEATURE_FULL_AUDIO
          Indicates that the device has full audio capabilities.
static int FEATURE_KEYBOARD
          Indicates that a keyboard is present.
static int FEATURE_MOUSE
          Indicates that a mouse (as distinct from a pen) is present.
static int FEATURE_MOUSE_OR_PEN
          Indicates that either a mouse or pen is present.
static IImage folderUp
           
static IImage handHeld
           
static int idleTimeOut
           
static IImage palm
           
static int SCREEN_HIGH
           
static int SCREEN_LOW
           
static int SCREEN_NORMAL
           
static int SCREEN_OFF
           
static int SCREEN_UNKNOWN
           
static int STATE_AWAKE
           
static int STATE_OFF
           
static int STATE_SUSPENDED
           
static int STATE_UNKNOWN
           
 
Fields inherited from interface ewe.sys.VmConstants
BUSY_CURSOR, COPY_MULTIPLE_CURSOR, COPY_SINGLE_CURSOR, CROSS_CURSOR, DEFAULT_CURSOR, DONT_DROP_CURSOR, DRAG_MULTIPLE_CURSOR, DRAG_SINGLE_CURSOR, HAND_CURSOR, IBEAM_CURSOR, INVISIBLE_CURSOR, LEFT_RIGHT_CURSOR, MEMORY_MAP_ON_DEMAND, MEMORY_MAP_STRICT, MOVE_CURSOR, NO_CURSOR, RESIZE_CURSOR, SND_ALIAS, SND_ALIAS_ID, SND_ASYNC, SND_FILENAME, SND_LOOP, SND_MEMORY, SND_NODEFAULT, SND_NOSTOP, SND_NOWAIT, SND_RESOURCE, SND_SYNC, UP_DOWN_CURSOR, VM_FILE_SEPARATOR, VM_FLAG_COUNTER_ROTATE_SCREEN, VM_FLAG_HAS_SOFT_KEYS, VM_FLAG_IS_APPLET, VM_FLAG_IS_MOBILE, VM_FLAG_IS_MONOCHROME, VM_FLAG_IS_ZAURUS_EVM, VM_FLAG_LOW_MEMORY, VM_FLAG_NO_CR, VM_FLAG_NO_KEYBOARD, VM_FLAG_NO_MOUSE_POINTER, VM_FLAG_NO_PEN, VM_FLAG_NO_WINDOWS, VM_FLAG_ROTATE_SCREEN, VM_FLAG_SIP_BUTTON_ALWAYS_SHOWN, VM_FLAG_SIP_BUTTON_ON_SCREEN, VM_FLAG_SLOW_MACHINE, VM_FLAG_USE_NATIVE_TEXT_INPUT, VM_FLAG_USING_CLASSES, VM_FLAGS, VM_PATH_SEPARATOR, VM_USE_SIP, WAIT_CURSOR
 
Method Summary
static int getBatteryState(int battery)
          Return the state of the battery.
static int getNativeDrawingSurface(Window window)
          Get the native drawing surface for a Window.
static int getNativeWindowControl(Window window)
          Get the native window control associated with the Ewe Window.
static Point getPositionInNativeDrawingSurface(Control c)
          This locates the x and y offset of the specified Control in its containing Window's drawing surface.
static int getScreen()
          Get the state of the screen.
static Dimension getScreenSize()
          Get the device screen size.
static int getState()
          Get the powered-on state of the device.
static boolean hasFeature(int feature)
          Check if the device has a particular feature.
static boolean hasFlag(int vmFlag)
          See if a VM_FLAG_XXX value is set for the current VM on this device.
static boolean isMobile()
          Return if this device is considered a Mobile Device.
static boolean isSmartPhone()
          Returns if this device is considered a SmartPhone Device - one that has a phone style keyboard, 4 way navigation keys, an Action key, a Back/Cancel key and at least two "Soft" keys.
static boolean preventIdleState(boolean startPrevent)
          Enter or leave a period where you wish for the Device to not power down due to being in an idle state.
 void run()
          This is used internally.
static boolean setScreen(int screen)
          Set the screen state.
static boolean setState(int state)
          Set the powered-on state of the device.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, toString
 

Field Detail

STATE_UNKNOWN

public static final int STATE_UNKNOWN
See Also:
Constant Field Values

STATE_AWAKE

public static final int STATE_AWAKE
See Also:
Constant Field Values

STATE_SUSPENDED

public static final int STATE_SUSPENDED
See Also:
Constant Field Values

STATE_OFF

public static final int STATE_OFF
See Also:
Constant Field Values

SCREEN_UNKNOWN

public static final int SCREEN_UNKNOWN
See Also:
Constant Field Values

SCREEN_OFF

public static final int SCREEN_OFF
See Also:
Constant Field Values

SCREEN_LOW

public static final int SCREEN_LOW
See Also:
Constant Field Values

SCREEN_HIGH

public static final int SCREEN_HIGH
See Also:
Constant Field Values

SCREEN_NORMAL

public static final int SCREEN_NORMAL
See Also:
Constant Field Values

BATTERY_MAIN

public static final int BATTERY_MAIN
This is a possible parameter for getBatteryState().

See Also:
Constant Field Values

BATTERY_BACKUP

public static final int BATTERY_BACKUP
This is a possible parameter for getBatteryState().

See Also:
Constant Field Values

BATTERY_AC

public static final int BATTERY_AC
This is a possible parameter for getBatteryState().

See Also:
Constant Field Values

BATTERY_OPTION_POWER_LEFT

public static final int BATTERY_OPTION_POWER_LEFT
See Also:
Constant Field Values

BATTERY_OPTION_FLAGS

public static final int BATTERY_OPTION_FLAGS
See Also:
Constant Field Values

BATTERY_STATE_UNKNOWN

public static final int BATTERY_STATE_UNKNOWN
This is a possible return value for getBatteryState.

See Also:
Constant Field Values

FEATURE_MOUSE_OR_PEN

public static final int FEATURE_MOUSE_OR_PEN
Indicates that either a mouse or pen is present.

See Also:
Constant Field Values

FEATURE_MOUSE

public static final int FEATURE_MOUSE
Indicates that a mouse (as distinct from a pen) is present.

See Also:
Constant Field Values

FEATURE_KEYBOARD

public static final int FEATURE_KEYBOARD
Indicates that a keyboard is present.

See Also:
Constant Field Values

FEATURE_DIRECTION_PAD

public static final int FEATURE_DIRECTION_PAD
Indicates that a direction (up/down/left/right) pad is present.

See Also:
Constant Field Values

FEATURE_CUSTOM_BUTTONS

public static final int FEATURE_CUSTOM_BUTTONS
Indicates that application custom buttons are present.

See Also:
Constant Field Values

FEATURE_FULL_AUDIO

public static final int FEATURE_FULL_AUDIO
Indicates that the device has full audio capabilities.

See Also:
Constant Field Values

idleTimeOut

public static int idleTimeOut

folderUp

public static IImage folderUp

drive

public static IImage drive

computer

public static IImage computer

palm

public static IImage palm

handHeld

public static IImage handHeld
Method Detail

hasFlag

public static boolean hasFlag(int vmFlag)
See if a VM_FLAG_XXX value is set for the current VM on this device.


isMobile

public static boolean isMobile()
Return if this device is considered a Mobile Device.


isSmartPhone

public static boolean isSmartPhone()
Returns if this device is considered a SmartPhone Device - one that has a phone style keyboard, 4 way navigation keys, an Action key, a Back/Cancel key and at least two "Soft" keys.


getNativeDrawingSurface

public static int getNativeDrawingSurface(Window window)
Get the native drawing surface for a Window.

Parameters:
window - The window.
Returns:
a native 32-bit pointer that can be used in ENI to directly access the window drawing surface, or 0 if that is not availalbe on the running platform.

getNativeWindowControl

public static int getNativeWindowControl(Window window)
Get the native window control associated with the Ewe Window.

Parameters:
window - The window.
Returns:
a native 32-bit pointer that can be used in ENI to directly access the Window control which contains the Ewe window. Under Win32 this will be the Window handle.

getPositionInNativeDrawingSurface

public static Point getPositionInNativeDrawingSurface(Control c)
This locates the x and y offset of the specified Control in its containing Window's drawing surface.

Parameters:
c - The control.
Returns:
A Point that specifies the x and y offset of the specified Control in its containing Window's drawing surface.

getBatteryState

public static int getBatteryState(int battery)
Return the state of the battery.

Parameters:
battery - one of the BATTERY_XXX OR'ed with one of the BATTERY_OPTION_XXX flags.
Returns:
if the battery parameter is OR'ed with BATTERY_OPTION_POWER_LEFT, a value between 0 (empty) and 100 (fully charged) or BATTERY_STATE_UNKNOWN if not known. BATTERY_AC will return either 0 or 100. if the battery parameter is OR'ed with BATTERY_OPTION_FLAGS, a value with some of the BATTERY_STATE_XXX flags set, or BATTERY_STATE_UNKNOWN if not known.

setState

public static boolean setState(int state)
Set the powered-on state of the device.

Parameters:
state - one of the STATE_XXX values.
Returns:
true if the state could be set, false if not.

getState

public static int getState()
Get the powered-on state of the device. This will be one of the STATE_XXX values.


setScreen

public static boolean setScreen(int screen)
Set the screen state.

Parameters:
screen - one of the SCREEN_XXX values.
Returns:
true if it could be set, false if not.

getScreen

public static int getScreen()
Get the state of the screen. It will be one of the SCREEN_XXX values.


getScreenSize

public static Dimension getScreenSize()
Get the device screen size.


hasFeature

public static boolean hasFeature(int feature)
Check if the device has a particular feature.

Parameters:
feature - one of the FEATURE_XXX values.
Returns:
true if the feature is present, false if not.

run

public void run()
This is used internally.

Specified by:
run in interface Runnable

preventIdleState

public static boolean preventIdleState(boolean startPrevent)
Enter or leave a period where you wish for the Device to not power down due to being in an idle state.

Parameters:
startPrevent - true to enter the protected period, false to leave it.
Returns:
true if you can prevent the idle state, false if you cannot.