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.StateCallback
At 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.StateCallback
camera
- 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.StateCallback
onOpenFailed
in interface Camera.StateCallback
cameraName
- 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.StateCallback
Camera.close()
.
Any attempt to call methods on this Camera in the
future will likely throw a RuntimeException
.
onClosed
in interface Camera.StateCallback
camera
- the camera device that has become closedpublic void onError(Camera camera, Camera.Error error)
Camera.StateCallback
This 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.StateCallback
camera
- The device reporting the errorerror
- The error code