Example #1
0
        public void RunCaptureCancelPostFill(CamDictionary allowedSettings)
        {
            // Example showing full pre-trigger buffer fill, trigger, cancel while post-trigger buffer is filling
            this.RunCamera(api, allowedSettings, "\nFill pre-trigger buffer, trigger, cancel while post-trigger buffer is filling");

            api.WaitForTransition("Waiting for pre-trigger buffer to fill", CAMERA_STATE.RUNNING, 10);
            api.ExpectState(CAMERA_STATE.RUNNING_PRETRIGGER_FULL);

            this.TriggerCamera(api, "Camera triggered, starting to fill post-trigger buffer");

            Console.WriteLine("    Canceling trigger while post-trigger buffer is filling");
            Console.WriteLine($"        {api.GetStatusString()}");

            api.Cancel();
            api.WaitForTransition("Waiting for cancel to be processed", CAMERA_STATE.TRIGGERED, 10);

            api.ExpectRunningState();
        }
Example #2
0
        private void MultishotCaptureVideo(CAMERA_STATE PostCaptureExpectedState, bool CancelDuringPostTriggerFill = false, string baseFilename = null)
        {
            // Example showing full pre-trigger buffer fill, trigger, save video capture process
            api.ExpectRunningState();
            api.WaitForTransition("Waiting for pre-trigger buffer to fill", CAMERA_STATE.RUNNING, 10);
            api.ExpectState(CAMERA_STATE.RUNNING_PRETRIGGER_FULL);

            this.TriggerCamera(api, "Camera triggered, filling post-trigger buffer", baseFilename);
            Console.WriteLine($"    Percentage pre-trigger buffer filled before trigger: {api.GetPretriggerFillLevel()}");

            if (CancelDuringPostTriggerFill)
            {
                var status = api.Cancel();

                Console.WriteLine($"    Video captured canceled during post trigger fill: {status}");
                Thread.Sleep(1000);
                api.ExpectRunningState();
                return;
            }

            api.WaitForTransition("Waiting for post-trigger buffer to fill", CAMERA_STATE.TRIGGERED, 10);
            api.ExpectState(PostCaptureExpectedState);
        }
Example #3
0
        private static void DoRunCamera(CamApiLib api, CamDictionary allowedSettings, string message)
        {
            api.ExpectRunningState();

            if (!string.IsNullOrEmpty(message))
            {
                Console.WriteLine(message);
            }
            Console.WriteLine("    Calibrating camera using allowed settings");

            CAMAPI_STATUS status = api.Run(allowedSettings);

            if (status == CAMAPI_STATUS.OKAY)
            {
                Console.WriteLine("    Run started");
            }
            else
            {
                Console.WriteLine("    Error: Run() returned {status}");
                Environment.Exit(1);
            }

            api.ExpectState(CAMERA_STATE.RUNNING);
        }