예제 #1
0
        public override void OnDisconnected(CameraDevice camera)
        {
            _cameraOpenCloseLock.Release();

            camera.Close();

            _cameraDeviceStateEventArgs.Camera = null;
            OnDisconnedted(this, _cameraDeviceStateEventArgs);
        }
예제 #2
0
        public override void OnOpened(CameraDevice camera)
        {
            _cameraOpenCloseLock.Release();

            _cameraDeviceStateEventArgs.Camera = camera;
            OnOpened(this, _cameraDeviceStateEventArgs);

            _createCameraCaptureSession();               // Creates CameraCaptureSession
        }
예제 #3
0
        public override void OnError(CameraDevice camera, CameraError error)
        {
            _cameraOpenCloseLock.Release();

            camera.Close();

            _cameraDeviceStateEventArgs.Camera = null;
            _cameraDeviceStateEventArgs.Error  = error;
            OnError(this, _cameraDeviceStateEventArgs);

            // Undone: Stop Activity/Service
        }
예제 #4
0
        /// <summary>
        /// Closes the camera.
        /// </summary>
        /// <returns>Completed Task.</returns>
        protected virtual Task CloseCamera()
        {
            if (CameraCaptureSession != null)
            {
                CameraCaptureSession.Close();
                CameraCaptureSession = null;
            }

            if (CameraDevice != null)
            {
                CameraDevice.Close();
                CameraDevice = null;
            }

            return(Task.CompletedTask);
        }
 public Camera2Controls(Android.Hardware.Camera2.CameraDevice camera)
 {
     this.camera = camera;
 }
 internal void SetCamera(Android.Hardware.Camera2.CameraDevice camera)
 {
     this.camera = camera;
 }