public class BarCodeReader.Parameters
extends java.lang.Object
To make reader parameters take effect, applications have to call
BarCodeReader.setParameters(BarCodeReader.Parameters)
. For
example, after setWhiteBalance(java.lang.String)
is
called, white balance is not actually changed until
BarCodeReader.setParameters(BarCodeReader.Parameters)
is called
with the changed parameters object.
Different devices may have different reader capabilities, such as picture
size or flash modes. The application should query the reader capabilities
before setting parameters. For example, the application should call
getSupportedColorEffects()
before
calling setColorEffect(String)
. If the
reader does not support color effects,
getSupportedColorEffects()
will return
null.
限定符和类型 | 方法和说明 |
---|---|
void |
dump()
已过时。
|
java.lang.String |
flatten()
Creates a single string with all the parameters set in this
Parameters object.
|
java.lang.String |
get(java.lang.String key)
Returns the value of a String parameter.
|
java.lang.String |
getAntibanding()
Gets the current antibanding setting.
|
java.lang.String |
getColorEffect()
Gets the current color effect setting.
|
int |
getExposureCompensation()
Gets the current exposure compensation index.
|
float |
getExposureCompensationStep()
Gets the exposure compensation step.
|
java.lang.String |
getFlashMode()
Gets the current flash mode setting.
|
float |
getFocalLength()
Gets the focal length (in millimeter) of the reader.
|
void |
getFocusDistances(float[] output)
Gets the distances from the reader to where an object appears to be
in focus.
|
java.lang.String |
getFocusMode()
Gets the current focus mode setting.
|
float |
getHorizontalViewAngle()
Gets the horizontal angle of view in degrees.
|
int |
getInt(java.lang.String key)
Returns the value of an integer parameter.
|
int |
getJpegQuality()
Returns the quality setting for the JPEG picture.
|
int |
getJpegThumbnailQuality()
Returns the quality setting for the EXIF thumbnail in Jpeg picture.
|
com.zebra.adc.decoder.BarCodeReader.Size |
getJpegThumbnailSize()
Returns the dimensions for EXIF thumbnail in Jpeg picture.
|
int |
getMaxExposureCompensation()
Gets the maximum exposure compensation index.
|
int |
getMaxZoom()
Gets the maximum zoom value allowed for snapshot.
|
int |
getMinExposureCompensation()
Gets the minimum exposure compensation index.
|
int |
getPictureFormat()
Returns the image format for pictures.
|
com.zebra.adc.decoder.BarCodeReader.Size |
getPictureSize()
Returns the dimension setting for pictures.
|
int |
getPreviewFormat()
Returns the image format for preview frames got from
PreviewCallback . |
void |
getPreviewFpsRange(int[] range)
Returns the current minimum and maximum preview fps.
|
int |
getPreviewFrameRate()
已过时。
replaced by
getPreviewFpsRange(int[]) |
com.zebra.adc.decoder.BarCodeReader.Size |
getPreviewSize()
Returns the dimensions setting for preview pictures.
|
java.lang.String |
getSceneMode()
Gets the current scene mode setting.
|
java.util.List<java.lang.String> |
getSupportedAntibanding()
Gets the supported antibanding values.
|
java.util.List<java.lang.String> |
getSupportedColorEffects()
Gets the supported color effects.
|
java.util.List<java.lang.String> |
getSupportedFlashModes()
Gets the supported flash modes.
|
java.util.List<java.lang.String> |
getSupportedFocusModes()
Gets the supported focus modes.
|
java.util.List<com.zebra.adc.decoder.BarCodeReader.Size> |
getSupportedJpegThumbnailSizes()
Gets the supported jpeg thumbnail sizes.
|
java.util.List<java.lang.Integer> |
getSupportedPictureFormats()
Gets the supported picture formats.
|
java.util.List<com.zebra.adc.decoder.BarCodeReader.Size> |
getSupportedPictureSizes()
Gets the supported picture sizes.
|
java.util.List<java.lang.Integer> |
getSupportedPreviewFormats()
Gets the supported preview formats.
|
java.util.List<int[]> |
getSupportedPreviewFpsRange()
Gets the supported preview fps (frame-per-second) ranges.
|
java.util.List<java.lang.Integer> |
getSupportedPreviewFrameRates()
已过时。
replaced by
getSupportedPreviewFpsRange() |
java.util.List<com.zebra.adc.decoder.BarCodeReader.Size> |
getSupportedPreviewSizes()
Gets the supported preview sizes.
|
java.util.List<java.lang.String> |
getSupportedSceneModes()
Gets the supported scene modes.
|
java.util.List<java.lang.String> |
getSupportedWhiteBalance()
Gets the supported white balance.
|
float |
getVerticalViewAngle()
Gets the vertical angle of view in degrees.
|
java.lang.String |
getWhiteBalance()
Gets the current white balance setting.
|
int |
getZoom()
Gets current zoom value.
|
java.util.List<java.lang.Integer> |
getZoomRatios()
Gets the zoom ratios of all zoom values.
|
boolean |
isSmoothZoomSupported()
Returns true if smooth zoom is supported.
|
boolean |
isZoomSupported()
Returns true if zoom is supported.
|
void |
remove(java.lang.String key) |
void |
removeGpsData()
Removes GPS latitude, longitude, altitude, and timestamp from the
parameters.
|
void |
set(java.lang.String key,
int value)
Sets an integer parameter.
|
void |
set(java.lang.String key,
java.lang.String value)
Sets a String parameter.
|
void |
setAntibanding(java.lang.String antibanding)
Sets the antibanding.
|
void |
setColorEffect(java.lang.String value)
Sets the current color effect setting.
|
void |
setExposureCompensation(int value)
Sets the exposure compensation index.
|
void |
setFlashMode(java.lang.String value)
Sets the flash mode.
|
void |
setFocusMode(java.lang.String value)
Sets the focus mode.
|
void |
setGpsAltitude(double altitude)
Sets GPS altitude.
|
void |
setGpsLatitude(double latitude)
Sets GPS latitude coordinate.
|
void |
setGpsLongitude(double longitude)
Sets GPS longitude coordinate.
|
void |
setGpsProcessingMethod(java.lang.String processing_method)
Sets GPS processing method.
|
void |
setGpsTimestamp(long timestamp)
Sets GPS timestamp.
|
void |
setJpegQuality(int quality)
Sets Jpeg quality of captured picture.
|
void |
setJpegThumbnailQuality(int quality)
Sets the quality of the EXIF thumbnail in Jpeg picture.
|
void |
setJpegThumbnailSize(int width,
int height)
Sets the dimensions for EXIF thumbnail in Jpeg picture.
|
void |
setNoDisplayMode(int value) |
void |
setPictureFormat(int pixel_format)
Sets the image format for pictures.
|
void |
setPictureSize(int width,
int height)
Sets the dimensions for pictures.
|
void |
setPreviewFormat(int pixel_format)
Sets the image format for preview pictures.
|
void |
setPreviewFpsRange(int min,
int max)
Sets the maximum and maximum preview fps.
|
void |
setPreviewFrameRate(int fps)
已过时。
replaced by
setPreviewFpsRange(int, int) |
void |
setPreviewSize(int width,
int height)
Sets the dimensions for preview pictures.
|
void |
setRotation(int rotation)
Sets the rotation angle in degrees relative to the orientation of the
reader.
|
void |
setSceneMode(java.lang.String value)
Sets the scene mode.
|
void |
setWhiteBalance(java.lang.String value)
Sets the white balance.
|
void |
setZoom(int value)
Sets current zoom value.
|
void |
unflatten(java.lang.String flattened)
Takes a flattened string of parameters and adds each one to this
Parameters object.
|
public void dump()
public java.lang.String flatten()
The unflatten(String)
method does the reverse.
public void unflatten(java.lang.String flattened)
The flatten()
method does the reverse.
flattened
- a String of parameters (key-value paired) that are
semi-colon delimitedpublic void remove(java.lang.String key)
public void set(java.lang.String key, java.lang.String value)
key
- the key name for the parametervalue
- the String value of the parameterpublic void set(java.lang.String key, int value)
key
- the key name for the parametervalue
- the int value of the parameterpublic java.lang.String get(java.lang.String key)
key
- the key name for the parameterpublic int getInt(java.lang.String key)
key
- the key name for the parameterpublic void setPreviewSize(int width, int height)
The sides of width and height are based on reader orientation. That is, the preview size is the size before it is rotated by display orientation. So applications need to consider the display orientation while setting preview size. For example, suppose the reader supports both 480x320 and 320x480 preview sizes. The application wants a 3:2 preview ratio. If the display orientation is set to 0 or 180, preview size should be set to 480x320. If the display orientation is set to 90 or 270, preview size should be set to 320x480. The display orientation should also be considered while setting picture size and thumbnail size.
width
- the width of the pictures, in pixelsheight
- the height of the pictures, in pixelsBarCodeReader.setDisplayOrientation(int)
,
BarCodeReader.getReaderInfo(int, ReaderInfo)
,
setPictureSize(int, int)
,
setJpegThumbnailSize(int, int)
public com.zebra.adc.decoder.BarCodeReader.Size getPreviewSize()
public void setNoDisplayMode(int value)
public java.util.List<com.zebra.adc.decoder.BarCodeReader.Size> getSupportedPreviewSizes()
public void setJpegThumbnailSize(int width, int height)
Applications need to consider the display orientation. See
setPreviewSize(int, int)
for reference.
width
- the width of the thumbnail, in pixelsheight
- the height of the thumbnail, in pixelssetPreviewSize(int, int)
public com.zebra.adc.decoder.BarCodeReader.Size getJpegThumbnailSize()
public java.util.List<com.zebra.adc.decoder.BarCodeReader.Size> getSupportedJpegThumbnailSizes()
public void setJpegThumbnailQuality(int quality)
quality
- the JPEG quality of the EXIF thumbnail. The range is 1 to
100, with 100 being the best.public int getJpegThumbnailQuality()
public void setJpegQuality(int quality)
quality
- the JPEG quality of captured picture. The range is 1 to
100, with 100 being the best.public int getJpegQuality()
@Deprecated public void setPreviewFrameRate(int fps)
setPreviewFpsRange(int, int)
fps
- the frame rate (frames per second)@Deprecated public int getPreviewFrameRate()
getPreviewFpsRange(int[])
@Deprecated public java.util.List<java.lang.Integer> getSupportedPreviewFrameRates()
getSupportedPreviewFpsRange()
public void setPreviewFpsRange(int min, int max)
PreviewCallback
. The minimum and
maximum preview fps must be one of the elements from
getSupportedPreviewFpsRange()
.min
- the minimum preview fps (scaled by 1000).max
- the maximum preview fps (scaled by 1000).java.lang.RuntimeException
- if fps range is invalid.BarCodeReader.setPreviewCallbackWithBuffer(BarCodeReader.PreviewCallback)
,
getSupportedPreviewFpsRange()
public void getPreviewFpsRange(int[] range)
getSupportedPreviewFpsRange()
.public java.util.List<int[]> getSupportedPreviewFpsRange()
PREVIEW_FPS_MIN_INDEX
,
PREVIEW_FPS_MAX_INDEX
public void setPreviewFormat(int pixel_format)
If this is never called, the default format will be
android.graphics.ImageFormat#NV21
, which uses the NV21
encoding format.
pixel_format
- the desired preview picture format, defined by one of the
android.graphics.ImageFormat
constants. (E.g.,
ImageFormat.NV21 (default),
ImageFormat.RGB_565, or
ImageFormat.JPEG)android.graphics.ImageFormat
public int getPreviewFormat()
PreviewCallback
.android.graphics.ImageFormat
public java.util.List<java.lang.Integer> getSupportedPreviewFormats()
android.graphics.ImageFormat
public void setPictureSize(int width, int height)
Applications need to consider the display orientation. See
setPreviewSize(int, int)
for reference.
width
- the width for pictures, in pixelsheight
- the height for pictures, in pixelssetPreviewSize(int, int)
public com.zebra.adc.decoder.BarCodeReader.Size getPictureSize()
public java.util.List<com.zebra.adc.decoder.BarCodeReader.Size> getSupportedPictureSizes()
public void setPictureFormat(int pixel_format)
pixel_format
- the desired picture format (ImageFormat.NV21,
ImageFormat.RGB_565, or
ImageFormat.JPEG)android.graphics.ImageFormat
public int getPictureFormat()
android.graphics.ImageFormat
public java.util.List<java.lang.Integer> getSupportedPictureFormats()
android.graphics.ImageFormat
public void setRotation(int rotation)
BarCodeReader.PictureCallback
. The reader driver may set orientation in the
EXIF header without rotating the picture. Or the driver may rotate
the picture and the EXIF thumbnail. If the Jpeg picture is rotated,
the orientation in the EXIF header will be missing or 1 (row #0 is
top and column #0 is left side).
If applications want to rotate the picture to match the orientation
of what users see, apps should use
android.view.OrientationEventListener
and ReaderInfo
.
The value from OrientationEventListener is relative to the natural
orientation of the device. ReaderInfo.orientation is the angle
between reader orientation and natural device orientation. The sum of
the two is the rotation angle for back-facing reader. The difference
of the two is the rotation angle for front-facing reader. Note that
the JPEG pictures of front-facing readers are not mirrored as in
preview display.
For example, suppose the natural orientation of the device is portrait. The device is rotated 270 degrees clockwise, so the device orientation is 270. Suppose a back-facing reader sensor is mounted in landscape and the top side of the reader sensor is aligned with the right edge of the display in natural orientation. So the reader orientation is 90. The rotation should be set to 0 (270 + 90).
The reference code is as follows.
#import com.zebra.adc.decoder; public void public void onOrientationChanged(int orientation) { int rotation = 0; if ( orientation == ORIENTATION_UNKNOWN ) return; BarCodeReader.ReaderInfo info = new BarCodeReader.ReaderInfo(); BarCodeReader.getReaderInfo(readerId, info); orientation = (orientation + 45) / 90 * 90; if ( info.facing == BarCodeReader.ReaderInfo.BCRDR_FACING_FRONT ) { rotation = (info.orientation - orientation + 360) % 360; } else { // back-facing reader rotation = (info.orientation + orientation) % 360; } mParameters.setRotation(rotation); }
rotation
- The rotation angle in degrees relative to the orientation
of the reader. Rotation can only be 0, 90, 180 or 270.java.lang.IllegalArgumentException
- if rotation value is invalid.android.view.OrientationEventListener
,
BarCodeReader.getReaderInfo(int, BarCodeReader.ReaderInfo)
public void setGpsLatitude(double latitude)
latitude
- GPS latitude coordinate.public void setGpsLongitude(double longitude)
longitude
- GPS longitude coordinate.public void setGpsAltitude(double altitude)
altitude
- GPS altitude in meters.public void setGpsTimestamp(long timestamp)
timestamp
- GPS timestamp (UTC in seconds since January 1, 1970).public void setGpsProcessingMethod(java.lang.String processing_method)
processing_method
- The processing method to get this location.public void removeGpsData()
public java.lang.String getWhiteBalance()
WHITE_BALANCE_AUTO
,
WHITE_BALANCE_INCANDESCENT
,
WHITE_BALANCE_FLUORESCENT
,
WHITE_BALANCE_WARM_FLUORESCENT
,
WHITE_BALANCE_DAYLIGHT
,
WHITE_BALANCE_CLOUDY_DAYLIGHT
,
WHITE_BALANCE_TWILIGHT
,
WHITE_BALANCE_SHADE
public void setWhiteBalance(java.lang.String value)
value
- new white balance.getWhiteBalance()
public java.util.List<java.lang.String> getSupportedWhiteBalance()
getWhiteBalance()
public java.lang.String getColorEffect()
EFFECT_NONE
,
EFFECT_MONO
,
EFFECT_NEGATIVE
,
EFFECT_SOLARIZE
,
EFFECT_SEPIA
,
EFFECT_POSTERIZE
,
EFFECT_WHITEBOARD
,
EFFECT_BLACKBOARD
,
EFFECT_AQUA
public void setColorEffect(java.lang.String value)
value
- new color effect.getColorEffect()
public java.util.List<java.lang.String> getSupportedColorEffects()
getColorEffect()
public java.lang.String getAntibanding()
ANTIBANDING_AUTO
,
ANTIBANDING_50HZ
,
ANTIBANDING_60HZ
,
ANTIBANDING_OFF
public void setAntibanding(java.lang.String antibanding)
antibanding
- new antibanding value.getAntibanding()
public java.util.List<java.lang.String> getSupportedAntibanding()
getAntibanding()
public java.lang.String getSceneMode()
SCENE_MODE_AUTO
,
SCENE_MODE_ACTION
,
SCENE_MODE_PORTRAIT
,
SCENE_MODE_LANDSCAPE
,
SCENE_MODE_NIGHT
,
SCENE_MODE_NIGHT_PORTRAIT
,
SCENE_MODE_THEATRE
,
SCENE_MODE_BEACH
,
SCENE_MODE_SNOW
,
SCENE_MODE_SUNSET
,
SCENE_MODE_STEADYPHOTO
,
SCENE_MODE_FIREWORKS
,
SCENE_MODE_SPORTS
,
SCENE_MODE_PARTY
,
SCENE_MODE_CANDLELIGHT
public void setSceneMode(java.lang.String value)
value
- scene mode.getSceneMode()
public java.util.List<java.lang.String> getSupportedSceneModes()
getSceneMode()
public java.lang.String getFlashMode()
FLASH_MODE_OFF
,
FLASH_MODE_AUTO
,
FLASH_MODE_ON
,
FLASH_MODE_RED_EYE
,
FLASH_MODE_TORCH
public void setFlashMode(java.lang.String value)
value
- flash mode.getFlashMode()
public java.util.List<java.lang.String> getSupportedFlashModes()
getFlashMode()
public java.lang.String getFocusMode()
BarCodeReader.autoFocus(AutoFocusCallback)
to start the focus if
focus mode is FOCUS_MODE_AUTO or FOCUS_MODE_MACRO.FOCUS_MODE_AUTO
,
FOCUS_MODE_INFINITY
,
FOCUS_MODE_MACRO
,
FOCUS_MODE_FIXED
,
FOCUS_MODE_EDOF
,
FOCUS_MODE_CONTINUOUS_VIDEO
public void setFocusMode(java.lang.String value)
value
- focus mode.getFocusMode()
public java.util.List<java.lang.String> getSupportedFocusModes()
getFocusMode()
public float getFocalLength()
public float getHorizontalViewAngle()
public float getVerticalViewAngle()
public int getExposureCompensation()
getMinExposureCompensation()
to
getMaxExposureCompensation()
. 0 means exposure is not
adjusted.public void setExposureCompensation(int value)
value
- exposure compensation index. The valid value range is from
getMinExposureCompensation()
(inclusive) to
getMaxExposureCompensation()
(inclusive). 0 means
exposure is not adjusted. Application should call
getMinExposureCompensation and getMaxExposureCompensation
to know if exposure compensation is supported.public int getMaxExposureCompensation()
getMinExposureCompensation()
return 0,
exposure compensation is not supported.public int getMinExposureCompensation()
getMaxExposureCompensation()
return 0,
exposure compensation is not supported.public float getExposureCompensationStep()
public int getZoom()
isZoomSupported()
before
using this method.getMaxZoom()
. 0 means the reader is not zoomed.public void setZoom(int value)
BarCodeReader.PictureCallback
. The preview size remains the
same in zoom. Applications should check isZoomSupported()
before using this method.value
- zoom value. The valid range is 0 to getMaxZoom()
.public boolean isZoomSupported()
public int getMaxZoom()
setZoom(int)
.
Applications should call isZoomSupported()
before using this
method. This value may change in different preview size. Applications
should call this again after setting preview size.public java.util.List<java.lang.Integer> getZoomRatios()
isZoomSupported()
before using this method.getMaxZoom()
+ 1. The list is sorted from small to
large. The first element is always 100. The last element is
the zoom ratio of the maximum zoom value.public boolean isSmoothZoomSupported()
public void getFocusDistances(float[] output)
Focus distances may change after calling
BarCodeReader.autoFocus(AutoFocusCallback)
, BarCodeReader.cancelAutoFocus()
, or
BarCodeReader.startPreview()
. Applications can call
BarCodeReader.getParameters()
and this method anytime to get the latest
focus distances. If the focus mode is FOCUS_MODE_CONTINUOUS_VIDEO,
focus distances may change from time to time.
This method is intended to estimate the distance between the reader and the subject. After autofocus, the subject distance may be within near and far focus distance. However, the precision depends on the reader hardware, autofocus algorithm, the focus area, and the scene. The error can be large and it should be only used as a reference.
Far focus distance >= optimal focus distance >= near focus distance. If the focus distance is infinity, the value will be Float.POSITIVE_INFINITY.
output
- focus distances in meters. output must be a float array
with three elements. Near focus distance, optimal focus
distance, and far focus distance will be filled in the
array.FOCUS_DISTANCE_NEAR_INDEX
,
FOCUS_DISTANCE_OPTIMAL_INDEX
,
FOCUS_DISTANCE_FAR_INDEX