|
||||||||||
| 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
| Field Summary | |
|---|---|
static boolean |
POWER_OFF
Use with setPowerState(boolean) to turn the camera device off. |
static boolean |
POWER_ON
Use with setPowerState(boolean) to turn the camera device on. |
static int |
SET_POWER_ERROR_CAMERA_ALREADY_ON
Returned by setPowerState(boolean) if the camera was sent a command to power on when it was already on. |
static int |
SET_POWER_ERROR_HARDWARE_FAILURE
Returned by setPowerState(boolean) if the camera could not be powered on due to a hardware failure. |
static int |
SET_POWER_SUCCESS
Returned by setPowerState(boolean) if the camera was succesfully powered on. |
| Method Summary | |
|---|---|
Bitmap |
capture(Bitmap frame)
Grab a Capture frame at the previously selected Capture resolution. |
boolean |
generatePreviewImage(Bitmap dst,
Bitmap src,
int degrees)
Deprecated. use preview(Bitmap) instead |
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()
Deprecated. Use setPowerState(boolean) instead. |
void |
powerOn()
Deprecated. Use setPowerState(boolean) instead. |
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) |
int |
setPowerState(boolean newState)
Set the power state of the camera device. |
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 |
| Field Detail |
|---|
public static final boolean POWER_ON
setPowerState(boolean) to turn the camera device on.
public static final boolean POWER_OFF
setPowerState(boolean) to turn the camera device off.
public static final int SET_POWER_SUCCESS
setPowerState(boolean) if the camera was succesfully powered on.
public static final int SET_POWER_ERROR_HARDWARE_FAILURE
setPowerState(boolean) if the camera could not be powered on due to a hardware failure.
public static final int SET_POWER_ERROR_CAMERA_ALREADY_ON
setPowerState(boolean) if the camera was sent a command to power on when it was already on.
| 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()
setPowerState(boolean) instead.
public final void powerOff()
setPowerState(boolean) instead.
public final int setPowerState(boolean newState)
Turning on the camera when it is already on is harmless and will not reset any camera device settings.
SET_POWER_SUCCESS if successful, SET_POWER_ERROR_HARDWARE_FAILURE if the camera could not be turned on,
or SET_POWER_ERROR_CAMERA_ALREADY_ON if the camera was already on.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 boolean generatePreviewImage(Bitmap dst,
Bitmap src,
int degrees)
preview(Bitmap) instead
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||