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 BPASmart.VariableManager.Enums;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.IO.Ports;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
-
- namespace BPASmart.VariableManager.Models
- {
- public class ModbusRtu : ICommunicationDevice
- {
- //public ModbusRtu()
- //{
- // Init();
- //}
-
- /// <summary>
- /// 显示/隐藏设置
- /// </summary>
- //public Visibility ModbusRtuVisible { get; set; } = Visibility.Collapsed;
-
- /// <summary>
- /// 串口端口
- /// </summary>
- public string ComSerialPort { get; set; }
-
- /// <summary>
- /// 波特率,110,300--115200(从300开始乘以2,直到结果等于115200)
- /// </summary>
- public string BaudRate { get; set; } = "9600";
-
- /// <summary>
- /// 数据位,默认为 8
- /// </summary>
- public int DataBit { get; set; } = 8;
-
- /// <summary>
- /// 停止位,默认为 1
- /// </summary>
- public int StopBit { get; set; } = 1;
-
- /// <summary>
- /// 站号,默认为 1
- /// </summary>
- public int StationNo { get; set; } = 1;
-
- /// <summary>
- /// 奇偶校验,无,奇校验,偶校验
- /// </summary>
- public string Parity { get; set; }
-
-
- //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);
- // }
- //}
- }
- }
|