62 lines
1.7 KiB
C#
62 lines
1.7 KiB
C#
///
|
|
/// Copyright (c) 2015-2019 Sensus Slovensko a.s.
|
|
///
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Xml.Serialization;
|
|
using TBF.BenchControl.Generic;
|
|
|
|
namespace TBF.BenchControl.Modbus.QuidoRS
|
|
{
|
|
public enum QuidoVariant
|
|
{
|
|
QuidoRS_2_16,
|
|
QuidoRS_4_4,
|
|
QuidoRS_8_8,
|
|
Count
|
|
}
|
|
|
|
public class QuidoRSCfg : ComponentCfgBase, Generic.IChildComponentCfg
|
|
{
|
|
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(QuidoRSCfg) })[0];
|
|
public override XmlSerializer GetSerializer() { return Serializer; }
|
|
|
|
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new QuidoRSCfgCtrl(); }
|
|
|
|
///
|
|
/// Serialized parameters
|
|
///
|
|
public byte ModbusAddress; /// 1..247
|
|
public QuidoVariant Variant; /// 'QuidoRS_2_16' or 'QuidoRS_8_8'
|
|
public bool WatchdogEnabled;
|
|
public int WatchdogBitNr; /// 0..15
|
|
|
|
/// Private parameterless constructor invoked by all other (public) constructors
|
|
QuidoRSCfg()
|
|
{
|
|
Name = "QuidoRS";
|
|
ParentName = "Modbus";
|
|
ModbusAddress = 49;
|
|
Variant = QuidoVariant.QuidoRS_2_16;
|
|
WatchdogEnabled = false;
|
|
WatchdogBitNr = 4;
|
|
}
|
|
|
|
public QuidoRSCfg(IComponentFactory factory)
|
|
: this()
|
|
{
|
|
this.Factory = factory;
|
|
}
|
|
|
|
public string ToString(int i)
|
|
{
|
|
return string.Format("Name={0}, ModbusAddress={1}, Variant={2}, Parent={2}",
|
|
Name,
|
|
ModbusAddress,
|
|
Variant,
|
|
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName));
|
|
}
|
|
}
|
|
}
|