public interface Camera extends CameraControls
Camera provides access to a camera that has been opened.
Modelled after android.hardware.camera2.CameraDevice, but somewhat simplified.CameraManager.asyncOpenCameraAssumingPermission(org.firstinspires.ftc.robotcore.external.hardware.camera.CameraName, org.firstinspires.ftc.robotcore.external.function.Continuation<? extends org.firstinspires.ftc.robotcore.external.hardware.camera.Camera.StateCallback>, long, java.util.concurrent.TimeUnit),
com.example.android.camera2.cameratoo.CameraTooActivity| Modifier and Type | Interface and Description |
|---|---|
static class |
Camera.Error
Reasons for which a
Camera might have failed after opening. |
static class |
Camera.OpenFailure
Reasons for which a
Camera might have failed to open. |
static interface |
Camera.StateCallback |
static class |
Camera.StateCallbackDefault
An implementation of StateCallback that does nothing by default
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the connection to this camera device as quickly as possible.
|
CameraCaptureRequest |
createCaptureRequest(int androidFormat,
Size size,
int fps)
Create a capture request.
|
CameraCaptureSession |
createCaptureSession(Continuation<? extends CameraCaptureSession.StateCallback> continuation)
Creates a capture session for this device.
|
Camera |
dup()
Returns another
Camera on the same underlying device with an independent close()
effect. |
CameraName |
getCameraName()
Returns the name of this camera device.
|
getControlCameraName getCameraName()
This method can be called even if the device has been closed or has encountered a serious error.
CameraManager.getAllWebcams()CameraCaptureRequest createCaptureRequest(int androidFormat, Size size, int fps) throws CameraException
CameraExceptionCameraCaptureSession.startCapture(org.firstinspires.ftc.robotcore.external.hardware.camera.CameraCaptureRequest, org.firstinspires.ftc.robotcore.external.hardware.camera.CameraCaptureSession.CaptureCallback, org.firstinspires.ftc.robotcore.external.function.Continuation<? extends org.firstinspires.ftc.robotcore.external.hardware.camera.CameraCaptureSession.StatusCallback>)CameraCaptureSession createCaptureSession(Continuation<? extends CameraCaptureSession.StateCallback> continuation) throws CameraException
CameraCaptureSession.StateCallback.onConfigured(CameraCaptureSession)
is called.
If the creation fails, then an exception is thrown.CameraExceptionvoid close()
Immediately after this call, all calls to the camera device or active session interface
will throw a IllegalStateException, except for calls to close(). Once the device has
fully shut down, the Camera.StateCallback.onClosed(org.firstinspires.ftc.robotcore.external.hardware.camera.Camera) callback will be called.
Immediately after this call, besides the final Camera.StateCallback.onClosed(org.firstinspires.ftc.robotcore.external.hardware.camera.Camera) calls, no
further callbacks from the device or the active session will occur, and any remaining
submitted capture requests will be discarded, and no success or failure
callbacks will be invoked.