public void RemoveDriver(INDIClient c) { if (Drivers.Contains(c)) { Drivers.Remove(c); } }
public void AddDriver(INDIClient c) { if (!Drivers.Contains(c)) { Drivers.Add(c); } }
public INDIForm(INDIClient host, string device = "") { Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); this.FormClosing += _FormClosing; server = host; Device = device; Connect(); }
public INDIServer(string[] clients, string address = "localhost:7624") { Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); Address = address; foreach (string s in clients) { INDIClient c = new INDIClient(s); AddDriver(c); } }
public override void isNewBlob(Object sender, IsNewBlobEventArgs e) { base.isNewBlob(sender, e); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); try { if (e.Vector.Device == Name) { INDIClient caller = (INDIClient)sender; for (int i = 0; i < e.Vector.Values.Count; i++) { Console.WriteLine("Received BLOB " + e.Vector.Values[i].Name + " of size " + e.Vector.Values[i].size + " from device " + e.Device + "@" + caller.Address + ":" + caller.Port); IsNewBlob?.Invoke(this, new INDICameraBlobEventArgs(e.Vector.Values[i].value, e.Vector.Values[i].Name, e.Vector.Name, e.Vector.Values[0].format)); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public INDIChooser(string address = "127.0.0.1", int port = 7624) { Int32 y = 15; Label l = new Label(); l.Text = "Connect to address:"; l.Location = new Point(5, y); l.Size = new Size(190, 23); y += 33; Address.BorderStyle = BorderStyle.FixedSingle; Address.Name = "address"; Address.Text = address + ":" + port.ToString(); Address.Location = new Point(5, y); Address.Size = new Size(190, 23); y += 33; Controls.Add(Address); Controls.Add(l); Button b = new Button(); b.FlatStyle = FlatStyle.Flat; b.Text = "Connect"; b.Location = new Point(5, y); b.Size = new Size(190, 23); y += 33; b.Click += delegate { Device.Items.Clear(); client = new INDIClient(Address.Text); client.DeviceAdded += Indi_DeviceAdded; client.Connect(); if (client.Connected) { client.QueryProperties(); } }; Controls.Add(b); DeviceType.FlatStyle = FlatStyle.Flat; DeviceType.Text = "Select device"; DeviceType.Size = new Size(190, 23); DeviceType.Location = new Point(5, y); string[] types = Enum.GetNames(typeof(DRIVER_INTERFACE)); DeviceType.Items.AddRange(types); DeviceType.DropDownStyle = ComboBoxStyle.DropDownList; DeviceType.SelectedIndexChanged += Device_SelectedIndexChanged; y += 33; Controls.Add(DeviceType); Device.FlatStyle = FlatStyle.Flat; Device.Text = "Select device"; Device.Size = new Size(190, 23); Device.Location = new Point(5, y); Device.DropDownStyle = ComboBoxStyle.DropDownList; Device.SelectedIndexChanged += Device_SelectedIndexChanged; y += 33; Controls.Add(Device); b = new Button(); b.FlatStyle = FlatStyle.Flat; b.Text = "OK"; b.Location = new Point(5, y); b.Size = new Size(190, 23); y += 33; b.Click += delegate { if (client == null || !client.Connected) { MessageBox.Show("Not Connected to any server!", "ERROR"); } else if (deviceSelected == "") { MessageBox.Show("No device selected!", "ERROR"); } else { Close(); } }; Controls.Add(b); b = new Button(); b.FlatStyle = FlatStyle.Flat; b.Text = "Cancel"; b.Location = new Point(5, y); b.Size = new Size(190, 23); y += 33; b.Click += delegate { if (client != null) { client.Disconnect(); client.Dispose(); } client = null; Close(); }; Controls.Add(b); this.ClientSize = new Size(200, y); this.FormBorderStyle = FormBorderStyle.FixedToolWindow; }
public INDICamera(string name, INDIClient host, bool client = true) : base(name, host, client) { EnableBLOB(true); if (!client) { AddNumberVector(new INumberVector(Name, "CCD_EXPOSURE", "Exposure", "Main Control", "rw", "", new List <INDINumber> { new INDINumber("CCD_EXPOSURE_VALUE", "Duration (s)", "%5.2f", 0.05, 10000.0, 0.05, 1.0) })); AddSwitchVector(new ISwitchVector(Name, "CCD_ABORT_EXPOSURE", "Expose Abort", "Main Control", "rw", "AtMostOne", new List <INDISwitch> { new INDISwitch("ABORT", "Abort", false) })); AddNumberVector(new INumberVector(Name, "CCD_TEMPERATURE", "Temperature", "Main Control", "rw", "", new List <INDINumber> { new INDINumber("CCD_TEMPERATURE_VALUE", "Temperature (C)", "%5.2f", -50.0, 50.0, 0.0, 20.0) })); AddNumberVector(new INumberVector(Name, "CCD_FRAME", "Frame", "Image Settings", "rw", "", new List <INDINumber> { new INDINumber("X", "Left", "%4.0f", 0.0, 16000.0, 1.0, 0.0), new INDINumber("Y", "Top", "%4.0f", 0.0, 16000.0, 1.0, 0.0), new INDINumber("WIDTH", "Width", "%4.0f", 0.0, 16000.0, 1.0, 16000.0), new INDINumber("HEIGHT", "Height", "%4.0f", 0.0, 16000.0, 1.0, 16000.0) })); AddNumberVector(new INumberVector(Name, "CCD_BINNING", "Binning", "Image Settings", "rw", "", new List <INDINumber> { new INDINumber("HOR_BIN", "X", "%2.0f", 1.0, 4.0, 1.0, 1.0), new INDINumber("VER_BIN", "Y", "%2.0f", 1.0, 4.0, 1.0, 1.0) })); AddSwitchVector(new ISwitchVector(Name, "CCD_COMPRESSION", "Image", "Image Settings", "rw", "OneOfMany", new List <INDISwitch> { new INDISwitch("CCD_COMPRESS", "Compress", false), new INDISwitch("CCD_RAW", "Raw", true) })); AddSwitchVector(new ISwitchVector(Name, "CCD_FRAME_TYPE", "Frame Type", "Image Settings", "rw", "OneOfMany", new List <INDISwitch> { new INDISwitch("FRAME_LIGHT", "Light", true), new INDISwitch("FRAME_BIAS", "Bias", false), new INDISwitch("FRAME_DARK", "Dark", false), new INDISwitch("FRAME_FLAT", "Flat", false) })); AddNumberVector(new INumberVector(Name, "CCD_INFO", "CCD Information", "Image Info", "ro", "", new List <INDINumber> { new INDINumber("CCD_MAX_X", "Resolution x", "%4.0f", 1.0, 16000.0, 0.0, 16000.0), new INDINumber("CCD_MAX_Y", "Resolution y", "%4.0f", 1.0, 16000.0, 0.0, 16000.0), new INDINumber("CCD_PIXEL_SIZE", "Pixel size (um)", "%5.2f", 1.0, 40.0, 0.0, 9.0), new INDINumber("CCD_PIXEL_SIZE_X", "Pixel size X", "%5.2f", 1.0, 40.0, 0.0, 9.0), new INDINumber("CCD_PIXEL_SIZE_Y", "Pixel size Y", "%5.2f", 1.0, 40.0, 0.0, 9.0), new INDINumber("CCD_BITSPERPIXEL", "Bits per pixel", "%3.0f", 8.0, 64.0, 0.0, 16.0) })); AddTextVector(new ITextVector(Name, "CCD_CFA", "Bayer Info", "Image Info", "ro", "", new List <INDIText> { new INDIText("CFA_OFFSET_X", "X Offset", "0"), new INDIText("CFA_OFFSET_Y", "Y Offset", "0"), new INDIText("CFA_TYPE", "Filter", "") })); AddBlobVector(new IBlobVector(Name, "CCD", "Image Data", "Image Streams", "ro", "", new List <INDIBlob> { new INDIBlob("CCD1", Name + " image data", ".fits", new byte[1], 1), })); DriverInterface |= DRIVER_INTERFACE.CCD_INTERFACE; } }