JSR-234 1.1

javax.microedition.amms.control.camera
Interface FocusControl

All Superinterfaces:
javax.microedition.media.Control

public interface FocusControl
extends javax.microedition.media.Control

FocusControl controls the focus of the camera device.

Please note, that (optical) zooming might affect the focusing settings. See ZoomControl.setOpticalZoom for details.


Field Summary
static int AUTO
          Autofocus.
static int AUTO_LOCK
          Locks the autofocus.
static int NEXT
          Moves the setting to the next supported level.
static int PREVIOUS
          Moves the setting to the previous supported level.
static int UNKNOWN
          Unknown value.
 
Method Summary
 int getFocus()
          Returns the focus setting of the camera device.
 int getFocusSteps()
          Tells how many steps the focus has.
 boolean getMacro()
          Gets the current macro focus mode.
 int getMinFocus()
          Returns the minimum focus distance supported (either manual or AUTO).
 boolean isAutoFocusSupported()
          Returns true if the automatic focus is supported by being able to set AUTO as a parameter for the setFocus method.
 boolean isMacroSupported()
          Returns true if the macro focus mode is supported.
 boolean isManualFocusSupported()
          Returns true if the manual focus is supported by being able to set the distance (or NEXT or PREVIOUS or Integer.MAX_VALUE) with setFocus method.
 int setFocus(int distance)
          Sets the focus distance.
 void setMacro(boolean enable)
          Toggles the macro focus mode.
 

Field Detail

AUTO

static final int AUTO
Autofocus.

See Also:
Constant Field Values

AUTO_LOCK

static final int AUTO_LOCK
Locks the autofocus.

See Also:
Constant Field Values

NEXT

static final int NEXT
Moves the setting to the next supported level.

See Also:
Constant Field Values

PREVIOUS

static final int PREVIOUS
Moves the setting to the previous supported level.

See Also:
Constant Field Values

UNKNOWN

static final int UNKNOWN
Unknown value.

See Also:
Constant Field Values
Method Detail

setFocus

int setFocus(int distance)
             throws javax.microedition.media.MediaException
Sets the focus distance.

Parameters:
distance - in millimeters or
AUTO for autofocus or
AUTO_LOCK for locking the autofocus or
Interger.MAX_VALUE for focus to infinity or
NEXT for next supported distance (further from the camera) or
PREVIOUS for previous supported distance (closer to the camera).

Setting a value other than AUTO, AUTO_LOCK or Integer.MAX_VALUE might be rounded to the closest distance supported.

If the current focus setting is other than AUTO then setFocus(AUTO_LOCK) will not affect anything.

If the current focus setting is AUTO and either setFocus(PREVIOUS) or setFocus(NEXT) is called then focus is set to previous or next supported distance, respectively, and automatic focus is turned off.

Returns:
the distance that was set or AUTO for autofocus or AUTO_LOCK for locked autofocus or Integer.MAX_VALUE for infinity
Throws:
javax.microedition.media.MediaException - if the given focus setting is not supported
See Also:
isManualFocusSupported(), isAutoFocusSupported()

getFocus

int getFocus()
Returns the focus setting of the camera device.

Returns:
distance in millimeters or AUTO for autofocus or AUTO_LOCK for locked autofocus or Integer.MAX_VALUE for focus to infinity or UNKNOWN if the focus setting is unknown.

getMinFocus

int getMinFocus()
Returns the minimum focus distance supported (either manual or AUTO).

Returns:
the minimum focus distance in millimeters supported or UNKNOWN

getFocusSteps

int getFocusSteps()
Tells how many steps the focus has. That is how many different focusing distances we are able to set. AUTO is not counted as a step and therefore, if manual focus is not supported this method will return 0.

Returns:
the amount of steps

isManualFocusSupported

boolean isManualFocusSupported()
Returns true if the manual focus is supported by being able to set the distance (or NEXT or PREVIOUS or Integer.MAX_VALUE) with setFocus method.

Returns:
true if the manual focus is supported, false otherwise

isAutoFocusSupported

boolean isAutoFocusSupported()
Returns true if the automatic focus is supported by being able to set AUTO as a parameter for the setFocus method.

Returns:
true if the automatic focus is supported, false otherwise

isMacroSupported

boolean isMacroSupported()
Returns true if the macro focus mode is supported.

Returns:
true if the macro focus is supported, false otherwise

setMacro

void setMacro(boolean enable)
              throws javax.microedition.media.MediaException

Toggles the macro focus mode. With this mode on, you can focus closer to the camera compared to a normal focusing mode. On the contrary, the range of available optical zoom settings might be more limited in the macro mode.

Please note, that this method might affect all optical zoom settings in the ZoomControl. This method might also change all the settings in this FocusControl.

Parameters:
enable - true to turn the macro mode on, false to turn it off
Throws:
javax.microedition.media.MediaException - if the given mode is not supported

getMacro

boolean getMacro()
Gets the current macro focus mode.

Returns:
true if the macro focus is enabled, false otherwise

JSR-234 1.1

Copyright © 2004-2007 Nokia Corporation. See the Copyright for details.