public static class Camera.StateCallbackDefault extends java.lang.Object implements Camera.StateCallback
| Constructor and Description |
|---|
StateCallbackDefault() |
| Modifier and Type | Method and Description |
|---|---|
void |
onClosed(Camera camera)
The method called when a camera device has been closed with
Camera.close(). |
void |
onError(Camera camera,
Camera.Error error)
The method called when a camera device has encountered a serious error.
|
void |
onOpened(Camera camera)
The method called when a camera device has finished successfully opening.
|
void |
onOpenFailed(CameraName cameraName,
Camera.OpenFailure failureReason)
A request to open a camera has failed.
|
public void onOpened(Camera camera)
Camera.StateCallbackAt this point, the camera device is ready to use, and Camera.createCaptureSession(org.firstinspires.ftc.robotcore.external.function.Continuation<? extends org.firstinspires.ftc.robotcore.external.hardware.camera.CameraCaptureSession.StateCallback>)
can be called to set up a capture session.
Important: once this method is invoked, callee is responsible for calling
Camera.close() when they are finished using the camera device.
onOpened in interface Camera.StateCallbackcamera - the camera device that has become openedCameraManager.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)public void onOpenFailed(CameraName cameraName, Camera.OpenFailure failureReason)
Camera.StateCallbackonOpenFailed in interface Camera.StateCallbackcameraName - The identity of the camera that failed to open.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)public void onClosed(Camera camera)
Camera.StateCallbackCamera.close().
Any attempt to call methods on this Camera in the
future will likely throw a RuntimeException.
onClosed in interface Camera.StateCallbackcamera - the camera device that has become closedpublic void onError(Camera camera, Camera.Error error)
Camera.StateCallbackThis indicates a failure of the camera device or camera service in
some way. Any attempt to call methods on this Camera in the
future will likely throw a CameraException
There may still be capture completion or camera stream callbacks that will be called after this error is received.
You should clean up the camera with Camera.close() after
this happens. Further attempts at recovery are error-code specific.
onError in interface Camera.StateCallbackcamera - The device reporting the errorerror - The error code