Refactorization : BenchControl -> Rig
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Modbus.QuidoRS
|
||||
{
|
||||
public enum QuidoVariant
|
||||
{
|
||||
QuidoRS_4_4,
|
||||
QuidoRS_8_8,
|
||||
QuidoRS_2_16,
|
||||
QuidoRS_2_32,
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user