public interface CameraManager
CameraManager
is the main entrypoint for accessing USB Video Class (UVC) webcams.
Modelled after android.hardware.camera2.CameraManager
Modifier and Type | Method and Description |
---|---|
void |
asyncOpenCameraAssumingPermission(CameraName cameraName,
Continuation<? extends Camera.StateCallback> continuation,
long reopenDuration,
java.util.concurrent.TimeUnit reopenTimeUnit)
Asynchronously opens a connection to a camera with the given name.
|
java.util.List<WebcamName> |
getAllWebcams()
Return the list of currently connected camera devices which are USB webcams.
|
SwitchableCameraName |
nameForSwitchableCamera(CameraName... cameraNames)
Returns a name of a virtual camera comprised of a sequence of other camera.
|
CameraName |
nameForUnknownCamera()
Returns a
CameraName which is guaranteed never to represent that of an actual
camera. |
CameraName |
nameFromCameraDirection(VuforiaLocalizer.CameraDirection cameraDirection)
Returns a camera name indicating a particular
VuforiaLocalizer.CameraDirection . |
Camera |
requestPermissionAndOpenCamera(Deadline deadline,
CameraName cameraName,
Continuation<? extends Camera.StateCallback> continuation)
Synchronously requests permission to opens the camera of the indicated name, then opens that
camera.
|
java.util.List<WebcamName> getAllWebcams()
CameraName nameFromCameraDirection(VuforiaLocalizer.CameraDirection cameraDirection)
VuforiaLocalizer.CameraDirection
.
Using this method, both camera directions and webcam names can be indicated with a
uniform name representation.VuforiaLocalizer.CameraDirection
CameraName nameForUnknownCamera()
CameraName
which is guaranteed never to represent that of an actual
camera. This can be useful in situations where a value distinguished from null and
actual camera names is desired.CameraName
which is guaranteed never to represent that of an actual cameraSwitchableCameraName nameForSwitchableCamera(CameraName... cameraNames)
SwitchableCamera
Camera requestPermissionAndOpenCamera(Deadline deadline, CameraName cameraName, Continuation<? extends Camera.StateCallback> continuation)
Camera
is returned. It is the caller's responsibility
to ultimately call Camera.close()
when they are done using the camera.
If unsuccessful, then null is returned.
If a Camera.StateCallback
continuation is provided, that callback is notified of
life-cycle events of the camera. In particular, it is guaranteed that one of Camera.StateCallback.onOpened(Camera)
or Camera.StateCallback.onOpenFailed(org.firstinspires.ftc.robotcore.external.hardware.camera.CameraName, org.firstinspires.ftc.robotcore.external.hardware.camera.Camera.OpenFailure)
will be called.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)
,
CameraName.asyncRequestCameraPermission(Context, Deadline, org.firstinspires.ftc.robotcore.external.function.Continuation<? extends org.firstinspires.ftc.robotcore.external.function.Consumer<java.lang.Boolean>>)
,
CameraName.requestCameraPermission(Deadline)
void asyncOpenCameraAssumingPermission(CameraName cameraName, Continuation<? extends Camera.StateCallback> continuation, long reopenDuration, java.util.concurrent.TimeUnit reopenTimeUnit)
If the camera is successfully opened, Camera.StateCallback.onOpened(org.firstinspires.ftc.robotcore.external.hardware.camera.Camera)
will
be invoked with the newly opened Camera
. The camera device can then be set up
for operation by calling Camera.createCaptureSession(org.firstinspires.ftc.robotcore.external.function.Continuation<? extends org.firstinspires.ftc.robotcore.external.hardware.camera.CameraCaptureSession.StateCallback>)
Camera.StateCallback.onOpenFailed(org.firstinspires.ftc.robotcore.external.hardware.camera.CameraName, org.firstinspires.ftc.robotcore.external.hardware.camera.Camera.OpenFailure)
is called.cameraName
- The name of the camera device to opencontinuation
- The code to be invoked to handle callback notificationsrequestPermissionAndOpenCamera(Deadline, 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>)
,
CameraName.asyncRequestCameraPermission(Context, Deadline, org.firstinspires.ftc.robotcore.external.function.Continuation<? extends org.firstinspires.ftc.robotcore.external.function.Consumer<java.lang.Boolean>>)
,
CameraName.requestCameraPermission(Deadline)