Files
tbf/TBF/BenchControl/Ambient/Comet/AmbientCfg.cs
T

76 lines
2.4 KiB
C#

///
/// Copyright (c) 2013-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.Ambient.Comet
{
public class AmbientCfg : ComponentCfgBase, Generic.IComponentCfg, SchematicDrawing.IDrawingItemCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(AmbientCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new AmbientCfgCtrl(); }
///
/// Serialized parameters
///
public int ComPortNr;
public int BaudRate;
public Parity Parity;
public int DataBits;
public StopBits StopBits;
public Handshake Handshake;
public bool SetDtrToOne;
/// Schematic drawing info
public SchematicDrawing.Shape Shape { get; set; }
public int X { get; set; }
public int Y { get; set; }
public SchematicDrawing.Sz Sz { get; set; }
public SchematicDrawing.Orient Orient { get; set; }
public bool Flip { get; set; }
public int LblX { get; set; }
public int LblY { get; set; }
public SchematicDrawing.Orient LblOrient { get; set; }
public int ValX { get; set; }
public int ValY { get; set; }
public double ValFact { get; set; }
public string ValFmt { get; set; }
public SchematicDrawing.Orient ValOrient { get; set; }
/// Private parameterless constructor invoked by all other (public) constructors
AmbientCfg()
{
Name = "Ambient";
ParentName = string.Empty;
ComPortNr = 6;
BaudRate = 9600;
Parity = System.IO.Ports.Parity.None;
DataBits = 8;
StopBits = System.IO.Ports.StopBits.Two;
Handshake = System.IO.Ports.Handshake.None;
SetDtrToOne = false;
Shape = SchematicDrawing.Shape.Ambient;
}
public AmbientCfg(IComponentFactory factory)
: this()
{
this.Factory = factory;
}
public bool IsHidden() { return (X == 0) && (Y == 0); }
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);
}
}
}