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(); }
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); }
private static void DoTriggerCamera(CamApiLib api, string message, string baseFilename = null) { Console.WriteLine(" Triggering camera"); var status = api.Trigger(baseFilename); if (status == CAMAPI_STATUS.OKAY) { Console.WriteLine($" {message}"); } else { Console.WriteLine(" Error: Trigger() returned {status}"); Environment.Exit(1); } Thread.Sleep(1000); // takes camera time to process the trigger request api.ExpectState(CAMERA_STATE.TRIGGERED); }
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); }