private void SerialTransceiverAvailable(object sender, EventArgs e) { Src.Serial serial = sender as Src.Serial; if (serial.DataAvailable()) { string data = serial.GetData(); this.healthManager.IngestHealthData(data); } }
public SettingUpdate(Src.Serial port, LocalConsole.Settings.Setting s) { InitializeComponent(); usb = port; setting = s; Init(); }
private bool OpenPortClickCallback(Button click, Src.Serial serial, string port, string baud, Handshake handshake, bool dtrHigh) { if (String.IsNullOrEmpty(port)) { return false; } else if (String.IsNullOrEmpty(baud)) { return false; } if (serial.ToggleSerialState(port, int.Parse(baud), handshake, dtrHigh)) { click.Text = "Close"; } else { click.Text = "Open"; } return serial.IsOpen(); }
public NodeClient() { InitializeComponent(); this.FormBorderStyle = FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.serialConsole = new Src.Serial(); this.consoleDataManager = new Src.LineBuilder(); this.serialTransceiver = new Src.Serial(); this.beeps = new Src.LocalConsole.TagDetections(dataGridDetections); this.info = new Src.LocalConsole.DeviceInfo(dataGridDeviceInfo); Dictionary<string, Control> settingControls = new Dictionary<string, Control>() { {"refresh", buttonSettingsRefresh}, {"save", buttonSettingsSave} }; this.settings = new Src.LocalConsole.SettingsManager(serialConsole, dataGridSettings, settingControls); this.healthManager = new Src.GridHealth.Manager(this.dataGridHealth); this.Icon = Properties.Resources.ctt_logo_icon; tabControlMain.DrawItem += new DrawItemEventHandler(TabControlDrawItem); tabControlMain.SelectedIndexChanged += new EventHandler(TabSelectedIndexChanged); tabControlMain.TabPages.RemoveAt(3); tabControlMain.TabPages.RemoveAt(2); linkSilabsDriver.Links.Add(new LinkLabel.Link() { LinkData = "https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers" }); linkSilabsDriver.LinkClicked += (object sender, LinkLabelLinkClickedEventArgs e) => { System.Diagnostics.Process.Start(e.Link.LinkData as string); }; InitTasksComboBox(); dir = new Src.FileTransfer.NodeDir(serialConsole, new Dictionary<string, Control>() { { "table", dataGridDirectory}, { "progress", progressBarDownload} }); this.InitTabUsb(); InitAboutTab(); this.healthManager.Init(); }
/// <summary> /// Retrieves a list of available COM ports and inserts them into a ComboBox. An open port /// remains selected on subsequent calls (unless disconnected). /// </summary> /// <param name="serial"></param> /// <param name="box"></param> private void ComListToComboBox(Src.Serial serial, ComboBox box) { // Determine if the list of com port names has changed since last checked string selected = serial.GetPortString(box.Items.Cast<string>(), box.SelectedItem as string); // If there was an update, then update the control showing the user the list of port names if (!String.IsNullOrEmpty(selected)) { box.Items.Clear(); box.Items.AddRange(Src.Serial.GetSortedAvailablePorts()); box.SelectedItem = selected; } else if (Src.Serial.GetSortedAvailablePorts().Count() == 0) { // If there are no more ports available, clear the list box.Items.Clear(); box.Text = "Select a Port"; } box.DropDownStyle = ComboBoxStyle.DropDownList; }
private void SerialConsoleAvailable(object sender, EventArgs e) { Src.Serial serial = sender as Src.Serial; if (serial.DataAvailable()) { ProcessConsoleData(serial.GetData()); } }