|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Text;
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
namespace Mesnac.Basic
|
|
|
{
|
|
|
public class ModbusRTUInfo
|
|
|
{
|
|
|
private string _rtuaddr = "1";
|
|
|
private string _rtucom= "COM1";
|
|
|
private UInt32 _Baud = 9600;
|
|
|
private uint _databit = 8;
|
|
|
private uint _stopbit = 1;
|
|
|
private uint _checkbit=0;
|
|
|
private int _timeout = 300;
|
|
|
[Description("RTU设备的地址1-255"), Category("设备地址")]
|
|
|
public string RtuAddr
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _rtuaddr;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
_rtuaddr = value;
|
|
|
}
|
|
|
}
|
|
|
[Description("串口号,如COM1"), Category("串口设置")]
|
|
|
public string ComPort
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _rtucom;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
_rtucom = value;
|
|
|
}
|
|
|
}
|
|
|
[Description("串口波特率,如9600"), Category("串口设置")]
|
|
|
public UInt32 BaudRate
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _Baud;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
_Baud = value;
|
|
|
}
|
|
|
}
|
|
|
[Description("数据位,如8"), Category("串口设置")]
|
|
|
public uint Databits
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _databit;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
_databit = value;
|
|
|
}
|
|
|
}
|
|
|
[Description("停止位,如1"), Category("串口设置")]
|
|
|
public uint Stopbit
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _stopbit;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
_stopbit = value;
|
|
|
}
|
|
|
}
|
|
|
[Description("奇偶校验位,0,None,1,Odd,2,Even"), Category("串口设置")]
|
|
|
public uint Parity
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _checkbit;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
_checkbit = value;
|
|
|
}
|
|
|
}
|
|
|
[Description("通信超时时间,大于零,ms"), Category("串口设置")]
|
|
|
public int TimeOut
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return _timeout;
|
|
|
}
|
|
|
set
|
|
|
{
|
|
|
_timeout = value;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|