|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdanger.system.CameraDevice
public final class CameraDevice
Class for communicating with a camera plugged into the device
| Method Summary | |
|---|---|
byte[] |
capture()
Deprecated. As of release 3.0, replaced by capture(Bitmap) |
Bitmap |
capture(Bitmap frame)
Grab a Capture frame at the previously selected Capture resolution. |
boolean |
generatePreviewImage(Bitmap dst,
Bitmap src,
int degrees)
Quickly generates a preview image of the captured data. |
int |
getCaptureColorSpace()
Return the colorspace currently selected for Capture. |
int |
getCaptureHeight()
Deprecated. As of release 3.0, replaced by sendCommand(String) |
int |
getCaptureWidth()
Deprecated. As of release 3.0, replaced by sendCommand(String) |
int |
getPreviewColorSpace()
Return the colorspace currently selected for Preview. |
int |
getPreviewHeight()
Deprecated. As of release 3.0, replaced by sendCommand(String) |
int |
getPreviewWidth()
Deprecated. As of release 3.0, replaced by sendCommand(String) |
int[][] |
getSupportedResolutions()
Deprecated. As of release 3.0, replaced by sendCommand(String) |
static CameraDevice |
getSystemCamera()
Access method for getting a handle to the camera device. |
void |
powerOff()
Turn the camera device OFF. |
void |
powerOn()
Turn the camera device ON. |
int |
preview(Bitmap b)
Grab a Preview frame at the previously selected Preview resolution. |
String |
sendCommand(String command)
Camera control/status interface. |
void |
setCaptureResolution(int width,
int height)
Deprecated. As of release 3.0, replaced by sendCommand(String) |
void |
setFlashOnCapture(boolean flash)
Deprecated. As of release 3.0, replaced by sendCommand(String) |
void |
setLightCondition(boolean lowLight)
Deprecated. As of release 3.0, replaced by sendCommand(String) |
void |
setPreviewResolution(int width,
int height)
Deprecated. As of release 3.0, replaced by sendCommand(String) |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static CameraDevice getSystemCamera()
Currently, there is only ever one CameraDevice. You cannot create your own instance of this class.
If there is ever a device with more than one camera, we will need to extend this.
public final void powerOn()
public final void powerOff()
public final int[][] getSupportedResolutions()
sendCommand(String)
public final int getPreviewColorSpace()
public final int getPreviewWidth()
sendCommand(String)
public final int getPreviewHeight()
sendCommand(String)
public final int getCaptureColorSpace()
public final int getCaptureWidth()
sendCommand(String)
public final int getCaptureHeight()
sendCommand(String)
public final void setLightCondition(boolean lowLight)
sendCommand(String)
lowLight - If True, use low-light mode. If False, use normal mode.public final void setFlashOnCapture(boolean flash)
sendCommand(String)
Note that the flash can only be enabled or disabled. The new sendCommand(String)
API adds support for auto flash mode.
flash - If True, enable the flash. If False, disable the flash.
public final void setPreviewResolution(int width,
int height)
sendCommand(String)
Note that no return value is provided to let you know if it succeeded.
width - Desired preview width.height - Desired preview height.
public final void setCaptureResolution(int width,
int height)
sendCommand(String)
Note that no return value is provided to let you know if it succeeded.
width - Desired Capture width.height - Desired Capture height.public final String sendCommand(String command)
token,arg1,arg2,...argn
Responses depend on command/status request, but the default is:
ok
Status requests use the same token as the corresponding command, but prepended with a ? character.
Supported command/status requests:
?resavail Query available resolutions (returns list)
resprev,width,height Set Preview resolution
?resprev Query Preview resolution
rescap,width,height Set Capture resolution
?rescap Query Capture resolution
lowlight,on/off Set lowlight mode on or off
?lowlight Query lowlight mode
gain,auto/0-maxgain Set gain
?gain Query gain
?maxgain Query max allowed gain setting
exposure,auto/0-maxexposure Set exposure
?exposure Query exposure
?maxexposure Query max allowed exposure setting
flash,auto/on/off Set flash mode
?flash Query flash mode
?lightlevel Query current light level
?maxlightlevel Query max possible light level
?sensorname Query the camera model
bandingfilter,50/60 Set the banding filter for 50Hz or 60Hz mode
?bandingfilter Query the banding filter setting
noisefilter,on/off Turn the noise filter (sharpness) on or off
?noisefilter Query the noise filter (sharpness) setting
command - Command/Status request string to process.
public final int preview(Bitmap b)
b - Bitmap with the same size and colorspace as the Preview size and colorspace.
public final Bitmap capture(Bitmap frame)
frame - Bitmap with the same size and colorspace as the Capture size and colorspace.
public final byte[] capture()
capture(Bitmap)
Deprecated because of performance/user-experience issues with this method's simplistic approach to buffer allocation and JPEG encoding.
public final boolean generatePreviewImage(Bitmap dst,
Bitmap src,
int degrees)
dst - Destination bitmap for preview image, cannot be null.src - Source bitmap for preview image, cannot be null.degrees - Number of degrees to rotate preview.
Can be positive or negative. Specify 0 for no rotation.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||