52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
///
|
|
/// Copyright (c) 2015-2016 Sensus Metering Systems
|
|
///
|
|
using System.IO;
|
|
using System.Collections.Generic;
|
|
using System.IO.Ports;
|
|
using System.Xml.Serialization;
|
|
using TBF.BenchControl.Generic;
|
|
|
|
namespace TBF.BenchControl.Modbus.Common
|
|
{
|
|
public class ModbusCfg : ComponentCfgBase, Generic.IComponentCfg
|
|
{
|
|
public IComponentCfgCtrl GetControl() { return new ModbusCfgCtrl(); }
|
|
|
|
///
|
|
/// Serialized parameters
|
|
///
|
|
public int ComPortNr;
|
|
public int BaudRate;
|
|
public Parity Parity;
|
|
public int DataBits;
|
|
public StopBits StopBits;
|
|
public Handshake Handshake;
|
|
|
|
/// Private parameterless constructor invoked by all other (public) constructors
|
|
ModbusCfg()
|
|
{
|
|
Name = "Modbus";
|
|
ParentName = string.Empty;
|
|
ComPortNr = 3;
|
|
BaudRate = 9600;
|
|
Parity = System.IO.Ports.Parity.None;
|
|
DataBits = 8;
|
|
StopBits = System.IO.Ports.StopBits.One;
|
|
Handshake = System.IO.Ports.Handshake.None;
|
|
}
|
|
|
|
public ModbusCfg(IComponentFactory factory)
|
|
: this()
|
|
{
|
|
this.Factory = factory;
|
|
}
|
|
|
|
public string ToString(int i)
|
|
{
|
|
return string.Format("Name={0}, Com{1}, {2}Bd, {3}-bits, parity={4}, stopBits={5}, {6}",
|
|
Name, ComPortNr, BaudRate, DataBits, Parity, StopBits, Handshake);
|
|
}
|
|
}
|
|
}
|