You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.IO.Ports;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace HBLConsole.Model
- {
- public class ModbusRtu : SerialDeviceBase
- {
- public ModbusRtu()
- {
- Init();
- }
-
- public ObservableCollection<string> Ports { get; set; } = new ObservableCollection<string>();
-
- public ObservableCollection<string> BaudRates { get; set; } = new ObservableCollection<string>();
-
- public ObservableCollection<string> Paritys { get; set; } = new ObservableCollection<string>();
-
- private void Init()
- {
- Ports.Clear();
- foreach (var item in SerialPort.GetPortNames())
- {
- Ports.Add(item);
- }
-
-
- BaudRates.Clear();
-
-
- BaudRates.Add("110");
- int initValue = 300;
- for (int i = 0; i < 17; i++)
- {
- BaudRates.Add(initValue.ToString());
- initValue *= 2;
- }
-
-
- Paritys.Clear();
- foreach (var item in Enum.GetNames(typeof(EParity)))
- {
- Paritys.Add(item);
- }
- }
- }
- }
|