public TelemetryHandler(Configuration.TelemetryConfiguration config, string ocu_ip_address) { if (config == null) throw new ArgumentNullException("config"); this.configuration = config; reporter = new System.Timers.Timer(); reporter.Interval = config.UpdateInterval; reporter.Elapsed += new System.Timers.ElapsedEventHandler(reporter_Elapsed); udp_sender = new Comms.UDP_Sender(ocu_ip_address, config.TelemetryPort, config.UpdateInterval); }
public Webcam(string camera, IPAddress ipAddress, int port, int frame_rate = 5) { FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); if (videoDevices.Count < 1) throw new Exception("No video input devices available"); if (!string.IsNullOrEmpty(camera)) videoSource = new VideoCaptureDevice(camera); else { videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString); } updateWorker = new Timer(); updateWorker.Elapsed += new ElapsedEventHandler(updateWorker_Elapsed); FrameRate = frame_rate; JPEGQuality = 10; isActive = false; jpegCodec = GetEncoderInfo("image/jpeg"); videoSource.DesiredFrameSize = new Size(320, 240); videoSource.NewFrame += new NewFrameEventHandler(videoSource_NewFrame); udp_sender = new Comms.UDP_Sender(ipAddress, port); raw_frame_queue = new Utility.UpdateQueue<byte[]>(-1); }
public Webcam(string ocu_ipAddress, CameraConfiguration config) { this.config = config; FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); if (videoDevices.Count < 1) throw new Exception("No video input devices available"); if (!string.IsNullOrEmpty(config.DeviceName)) videoSource = new VideoCaptureDevice(config.DeviceName); //videoSource = new VideoCaptureDevice(videoDevices[1].MonikerString); else { videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString); } updateWorker = new Timer(); updateWorker.Elapsed += new ElapsedEventHandler(updateWorker_Elapsed); FrameRate = config.RCU_To_OCU_Framerate; JPEGQuality = config.JPEGQuality; isActive = false; jpegCodec = GetEncoderInfo("image/jpeg"); videoSource.DesiredFrameSize = new Size(320, 240); videoSource.NewFrame += new NewFrameEventHandler(videoSource_NewFrame); udp_sender = new Comms.UDP_Sender(ocu_ipAddress, config.SendPort); raw_frame_queue = new Utility.UpdateQueue<byte[]>(-1); }