private void cmbDeviceList_SelectedIndexChanged(object sender, EventArgs e) { if (dutAutoSelectFlag) { } else { currentDevice = devList[cmbDeviceList.SelectedIndex]; } }
private void OnDeviceDiscovered(object sender, Plugin.BLE.Abstractions.EventArgs.DeviceEventArgs args) { DeviceInfomation entry = new DeviceInfomation(); entry.DeviceName = args.Device.Name; entry.UUID = args.Device.Id; entry.RSSI = args.Device.Rssi; RaiseEvent <DeviceFinderArgs>(OnSearchCompleted, this, new DeviceFinderArgs(entry)); }
private void UpdateUI(DeviceInfomation data) { if (this.InvokeRequired) { BeginInvoke(new UpdateUIDeleg(UpdateUI), new object[] { data }); return; } //add to list Debug.WriteLine(String.Format("UI List add {0}", data.DeviceName)); lv_device.AddEntry(data); }
/// <summary> /// Device Finder /// </summary> /// <param name="data"></param> public DeviceFinderArgs(DeviceInfomation data) { _data = data; }
private void UpdateUI(DeviceInfomation data) { if (this.InvokeRequired) { BeginInvoke(new UpdateUIDeleg(UpdateUI), new object[] { data }); return; } //add to list Debug.WriteLine(String.Format("UI List add {0}", data.device_name)); deviceList.AddItem(data); }
public bool AddEntry(DeviceInfomation pEntry) { int i; DeviceInfomation pNewEntry; // Find the next available entry for (i = 0; i < MAX_ENTRIES; i++) { if (devicelist[i] == null) { break; } } // If no entries could be found if (i == MAX_ENTRIES) { return false; } //----------------------------- // Add the entry at location i //----------------------------- // Create new entry pNewEntry = new DeviceInfomation(); // Copy the entry data pNewEntry.mode = pEntry.mode; pNewEntry.time_on_powered = pEntry.time_on_powered; pNewEntry.time_on_network = pEntry.time_on_network; pNewEntry.mac.Address = (byte[])pEntry.mac.Address.Clone(); pNewEntry.ip.Address = (byte[])pEntry.ip.Address.Clone(); pNewEntry.port = pEntry.port; pNewEntry.DHCP = pEntry.DHCP; pNewEntry.serverport = pEntry.serverport; pNewEntry.tcptimeout = pEntry.tcptimeout; pNewEntry.device_name = pEntry.device_name; pNewEntry.description = pEntry.description; // Store address in global array devicelist[i] = pNewEntry; // Increment valid cell count m_numcells++; this.Items.Add(" "); // Update the scroll bar, sort, and redraw window return true; }
private void refreshDutStatus() { if (this.InvokeRequired) { delVoidNoparam del = new delVoidNoparam(refreshDutStatus); try { this.Invoke(del); } catch (InvalidOperationException iex) { } } else { devList = ADB_Process.GetDeivcesList(); dutAutoSelectFlag = true; cmbDeviceList.Items.Clear(); foreach (DeviceInfomation dev in devList) { cmbDeviceList.Items.Add(dev.ID); } if (devList.Count == 0) { currentDevice = null; btnDutStatus.Text = "No device"; btnDutStatus.BackColor = System.Drawing.Color.Crimson; btnDutStatus.ForeColor = System.Drawing.Color.White; dutReady = false; atstReady = false; } else { if (devList.Count == 1) { cmbDeviceList.SelectedIndex = 0; currentDevice = devList[0]; } else { if (currentDevice != null && cmbDeviceList.Items.Contains(currentDevice.ID)) { cmbDeviceList.SelectedItem = currentDevice.ID; } else { currentDevice = null; btnDutStatus.Text = "Select a DUT"; btnDutStatus.BackColor = System.Drawing.Color.Orange; btnDutStatus.ForeColor = System.Drawing.Color.White; } } } if (currentDevice != null) { switch (currentDevice.ConnectingStatus) { case "Offline": btnDutStatus.Text = "Offline"; btnDutStatus.BackColor = System.Drawing.Color.Gray; btnDutStatus.ForeColor = System.Drawing.Color.White; dutReady = false; atstReady = false; break; case "Connected": dutReady = true; if (!atstReady) { atstReady = checkAtstPackageReady(); } if (atstReady) { btnDutStatus.Text = "Ready"; btnDutStatus.BackColor = System.Drawing.Color.Green; btnDutStatus.ForeColor = System.Drawing.Color.White; } else { btnDutStatus.Text = "Need initialize"; btnDutStatus.BackColor = System.Drawing.Color.YellowGreen; btnDutStatus.ForeColor = System.Drawing.Color.White; btnDutStatus_Click(btnDutStatus, new EventArgs()); } break; default: dutReady = false; atstReady = false; btnDutStatus.Text = currentDevice.ConnectingStatus; btnDutStatus.BackColor = System.Drawing.SystemColors.Control; btnDutStatus.ForeColor = System.Drawing.Color.Black; break; } } dutAutoSelectFlag = false; } }
public bool AddEntry(DeviceInfomation pEntry) { int i; DeviceInfomation pNewEntry; // Find the next available entry for (i = 0; i < MAX_ENTRIES; i++) { if (devicelist[i] == null) { break; } } // If no entries could be found if (i == MAX_ENTRIES) { return(false); } //----------------------------- // Add the entry at location i //----------------------------- // Create new entry pNewEntry = new DeviceInfomation(); // Copy the entry data pNewEntry.Mode = pEntry.Mode; pNewEntry.TimeElapsedPowerOn = pEntry.TimeElapsedPowerOn; pNewEntry.TimeElapsedNetwork = pEntry.TimeElapsedNetwork; pNewEntry.MACAddress.Address = (byte[])pEntry.MACAddress.Address.Clone(); pNewEntry.IPAddress.Address = (byte[])pEntry.IPAddress.Address.Clone(); // by Mephist 2012/7/25 pNewEntry.SubnetMask.Address = (byte[])pEntry.SubnetMask.Address.Clone(); pNewEntry.Gateway.Address = (byte[])pEntry.Gateway.Address.Clone(); pNewEntry.Port = pEntry.Port; pNewEntry.DHCPEnabled = pEntry.DHCPEnabled; pNewEntry.TrustedServerEnabled = pEntry.TrustedServerEnabled; pNewEntry.TrustedServer.Address = (byte[])pEntry.TrustedServer.Address.Clone(); pNewEntry.DHCPRetry = pEntry.DHCPRetry; pNewEntry.DeviceName = pEntry.DeviceName; pNewEntry.Description = pEntry.Description; pNewEntry.ConnectMode = pEntry.ConnectMode; pNewEntry.GatewayCheckResetMode = pEntry.GatewayCheckResetMode; // Store address in global array devicelist[i] = pNewEntry; // Increment valid cell count m_numcells++; this.Items.Add(" "); // Update the scroll bar, sort, and redraw window return(true); }