init
This commit is contained in:
@@ -0,0 +1,161 @@
|
||||
using DTS.Common.Interface.Channels;
|
||||
namespace DTS.Common.Classes.Groups.ChannelSettings
|
||||
{
|
||||
public class ChannelSettingBase : IChannelSetting
|
||||
{
|
||||
//analog parameters
|
||||
public const string RANGE = "Range";
|
||||
public const string CFC = "CFC";
|
||||
//FB 13120 Add FilterClass
|
||||
public const string FilterClass = "FilterClass";
|
||||
public const string POLARITY = "Polarity";
|
||||
public const string POSITION = "Position";
|
||||
public const string ZEROMETHOD = "ZeroMethod";
|
||||
public const string ZEROMETHODSTART = "ZeroMethodStart";
|
||||
public const string ZEROMETHODEND = "ZeroMethodEnd";
|
||||
public const string USERVALUE1 = "UserValue1";
|
||||
public const string USERVALUE2 = "UserValue2";
|
||||
public const string USERVALUE3 = "UserValue3";
|
||||
public const string INITIAL_OFFSET = "InitialOffset";
|
||||
|
||||
/// <summary>
|
||||
/// the string key for the ac coupled enabled channel setting
|
||||
/// http://manuscript.dts.local/f/cases/29760/Implement-ACCoupleEnable-for-TSR-AIR
|
||||
/// </summary>
|
||||
public const string ACCouplingEnabled = "ACCouplingEnabled";
|
||||
//depreciated parameters
|
||||
//public const string LIMIT_DURATION = "LimitDuration";
|
||||
//public const string DURATION = "Duration";
|
||||
//public const string DELAY = "Delay";
|
||||
//33415 Voltage insertion channel should be half bridge
|
||||
public const string BRIDGE_TYPE = "BridgeType";
|
||||
|
||||
//squib parameters
|
||||
public const string SQUIB_CURRENT = "SquibCurrent";
|
||||
public const string SQUIB_LIMIT_DURATION = "SquibLimitDuration";
|
||||
public const string SQUIB_DURATION = "SquibDuration";
|
||||
public const string SQUIB_DELAY = "SquibDelay";
|
||||
public const string SQMODE = "SQMode";
|
||||
|
||||
//digital out parameters
|
||||
public const string DIGITALOUT_LIMIT_DURATION = "DigitalOutLimitDuration";
|
||||
public const string DIGITALOUT_DURATION = "DigitalOutDuration";
|
||||
public const string DIGITALOUT_DELAY = "DigitalOutDelay";
|
||||
public const string OUTPUT_MODE = "OutputMode";
|
||||
|
||||
//digital in parameters
|
||||
public const string DIMODE = "DIMode";
|
||||
public const string DEFAULT_VALUE = "DefaultValue";
|
||||
public const string ACTIVE_VALUE = "ActiveValue";
|
||||
|
||||
//uart parameters 18363
|
||||
public const string BAUD_RATE = "UartBaudRate";
|
||||
public const string DATA_BITS = "UartDataBits";
|
||||
public const string STOP_BITS = "UartStopBits";
|
||||
public const string PARITY = "UartParity";
|
||||
public const string FLOW_CONTROL = "UartFlowControl";
|
||||
public const string DATA_FORMAT = "UartDataFormat";
|
||||
//streamout parameters 18363
|
||||
public const string UDP_PROFILE = "StreamOutUDPProfile";
|
||||
public const string UDP_ADDRESS = "StreamOutUDPAddress";
|
||||
public const string UDP_TIME_CHID = "StreamOutUDPTimeChannelId";
|
||||
public const string UDP_DATA_CHID = "StreamOutUDPDataChannelId";
|
||||
public const string UDP_TMNS_CONFIG = "StreamOutUDPTmNSConfig";
|
||||
public const string IRIG_TDP_INTERVAL_MS = "StreamOutIRIGTimeDataPacketIntervalMs";
|
||||
public const string TMATS_INTERVAL_MS = "StreamOutTMATSIntervalMs";
|
||||
//streamin parameters 26828
|
||||
public const string UDP_ADDRESS_IN = "StreamInUDPAddress";
|
||||
|
||||
//CAN parameters 44881
|
||||
public const string CAN_IS_FD = "CanIsFD";
|
||||
public const string CAN_ARB_BASE_BITRATE = "CanArbBaseBitrate";
|
||||
public const string CAN_ARB_BASE_SJW = "CanArbBaseSJW";
|
||||
public const string CAN_DATA_BITRATE = "CanDataBitrate";
|
||||
public const string CAN_DATA_SJW = "CanDataSJW";
|
||||
public const string CAN_FILE_TYPE = "CanFileType";
|
||||
|
||||
public ChannelSettingBase(int settingType, string name, string defaultValue)
|
||||
{
|
||||
SettingTypeId = settingType;
|
||||
SettingName = name;
|
||||
DefaultValue = defaultValue;
|
||||
}
|
||||
public IChannelSetting Clone()
|
||||
{
|
||||
return new ChannelSettingBase(this);
|
||||
}
|
||||
private ChannelSettingBase(IChannelSetting setting)
|
||||
{
|
||||
ChannelId = setting.ChannelId;
|
||||
SettingTypeId = setting.SettingTypeId;
|
||||
SettingName = setting.SettingName;
|
||||
DefaultValue = setting.DefaultValue;
|
||||
Value = setting.Value;
|
||||
}
|
||||
public long ChannelId { get; set; }
|
||||
public int SettingTypeId { get; protected set; }
|
||||
public string SettingName { get; protected set; }
|
||||
public string DefaultValue { get; protected set; }
|
||||
public string Value { get; set; }
|
||||
|
||||
public double DoubleValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (double.TryParse(Value, System.Globalization.NumberStyles.Any,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out double d))
|
||||
{
|
||||
return d;
|
||||
}
|
||||
return DoubleDefaultValue;
|
||||
}
|
||||
set => Value = value.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
public double DoubleDefaultValue => double.Parse(DefaultValue, System.Globalization.NumberStyles.Any,
|
||||
System.Globalization.CultureInfo.InvariantCulture);
|
||||
|
||||
public int IntValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (int.TryParse(Value, System.Globalization.NumberStyles.Any,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out int d))
|
||||
{
|
||||
return d;
|
||||
}
|
||||
return IntDefaultValue;
|
||||
}
|
||||
set => Value = value.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
public int IntDefaultValue => int.Parse(DefaultValue, System.Globalization.NumberStyles.Any,
|
||||
System.Globalization.CultureInfo.InvariantCulture);
|
||||
|
||||
public bool BoolValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (bool.TryParse(Value, out bool b))
|
||||
{
|
||||
return b;
|
||||
}
|
||||
return BoolDefaultValue;
|
||||
}
|
||||
set => Value = value.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
public bool BoolDefaultValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (bool.TryParse(DefaultValue, out var b))
|
||||
{
|
||||
return b;
|
||||
}
|
||||
if (string.IsNullOrEmpty(DefaultValue)) { return false; }
|
||||
return !DefaultValue.Equals(0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using DTS.Common.Interface.Channels;
|
||||
using System.Data;
|
||||
|
||||
namespace DTS.Common.Classes.Groups.ChannelSettings
|
||||
{
|
||||
public class ChannelSettingRecord : Common.Base.BasePropertyChanged, IChannelSettingRecord
|
||||
{
|
||||
private int _id;
|
||||
public int Id
|
||||
{
|
||||
get => _id;
|
||||
set => SetProperty(ref _id, value, "Id");
|
||||
}
|
||||
|
||||
private string _settingName;
|
||||
public string SettingName
|
||||
{
|
||||
get => _settingName;
|
||||
set => SetProperty(ref _settingName, value, "SettingName");
|
||||
}
|
||||
|
||||
private string _defaultValue;
|
||||
public string DefaultValue
|
||||
{
|
||||
get => _defaultValue;
|
||||
set => SetProperty(ref _defaultValue, value, "DefaultValue");
|
||||
}
|
||||
public ChannelSettingRecord() { }
|
||||
public ChannelSettingRecord(IDataReader reader)
|
||||
{
|
||||
Id = Utility.GetInt(reader, "Id");
|
||||
SettingName = Utility.GetString(reader, "SettingName");
|
||||
DefaultValue = Utility.GetString(reader, "DefaultValue");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using DTS.Common.Base;
|
||||
using DTS.Common.Interface.Channels;
|
||||
using System.Data;
|
||||
|
||||
namespace DTS.Common.Classes.Groups.ChannelSettings
|
||||
{
|
||||
public class GroupChannelSettingRecord : BasePropertyChanged, IGroupChannelSettingRecord
|
||||
{
|
||||
private long _channelId;
|
||||
public long ChannelId
|
||||
{
|
||||
get => _channelId;
|
||||
set => SetProperty(ref _channelId, value, "ChannelId");
|
||||
}
|
||||
private int _settingId;
|
||||
public int SettingId
|
||||
{
|
||||
get => _settingId;
|
||||
set => SetProperty(ref _settingId, value, "SettingId");
|
||||
}
|
||||
private string _settingValue;
|
||||
public string SettingValue
|
||||
{
|
||||
get => _settingValue;
|
||||
set => SetProperty(ref _settingValue, value, "SettingValue");
|
||||
}
|
||||
public GroupChannelSettingRecord() { }
|
||||
public GroupChannelSettingRecord(IDataReader reader, int storedProcedureVersionUsed)
|
||||
{
|
||||
if (storedProcedureVersionUsed >= Constants.BULK_GROUPCHANNELSETTINGS_GET_DB_VERSION)
|
||||
{
|
||||
ChannelId = Utility.GetLong(reader, "ChannelId");
|
||||
}
|
||||
SettingId = Utility.GetInt(reader, "SettingId");
|
||||
SettingValue = Utility.GetString(reader, "SettingValue");
|
||||
}
|
||||
public GroupChannelSettingRecord(long channelId, int settingId, string settingValue)
|
||||
{
|
||||
ChannelId = channelId;
|
||||
SettingId = settingId;
|
||||
SettingValue = settingValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user