private byte[] SendCommand(byte[] buffer) { lock (cameraSettings) { return(WIA.SendCommand(this, buffer)); } }
private byte[] SendCommand(byte[] buffer, int outputBufferLength) { lock (cameraSettings) { return(WIA.SendCommand(this, buffer, outputBufferLength)); } }
static void Main(string[] args) { for (int i = 0; i < args.Length; i++) { switch (args[i].ToLower()) { case "wlog": WIALogger.Run(); return; } } List <SonyCamera> cameras = WIA.FindCameras().ToList(); foreach (SonyCamera camera in new List <SonyCamera>(cameras)) { if (!camera.Connect()) { cameras.Remove(camera); } } Stopwatch stopwatch = new Stopwatch(); int updateDelay = 41;// 24fps //int updateDelay = 33;// 30fps while (true) { stopwatch.Restart(); foreach (SonyCamera camera in cameras) { camera.Update(); } while (stopwatch.ElapsedMilliseconds < updateDelay) { // This may result in stuttering as sleep can take longer than requested (maybe use a Timer?) System.Threading.Thread.Sleep(1); } } }
internal bool Connect(bool fullConnect) { Connected = false; device = WIA.Connect(this); deviceExtras = device as IWiaItemExtras; if (fullConnect) { if (device != null && deviceExtras != null && Handshake()) { Connected = true; } } else { Connected = device != null && deviceExtras != null; } if (!Connected) { device = null; deviceExtras = null; } return(Connected); }