public CamApiExample(IConfiguration configuration) { DoCaptureTest = configuration["CaptureTest"] == "1"; DoFavoritesTest = configuration["FavoritesTest"] == "1"; DoMultiCaptureTest = configuration["MultiCaptureTest"] == "1"; api = new CamApiLib(configuration["Address"], configuration["Debug"] == "1"); }
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); }
public CaptureTests(CamApiLib api) { this.api = api; }
public FavoritesTests(CamApiLib api) { this.api = api; }
public static void TriggerCamera(this MultiCaptureTests _this, CamApiLib api, string message, string baseFilename = null) { DoTriggerCamera(api, message, baseFilename); }
public static void RunCamera(this MultiCaptureTests _this, CamApiLib api, CamDictionary allowedSettings, string message) { DoRunCamera(api, allowedSettings, message); }