Files
DP44/Common/DTS.Common.ISO/HardwareChannel.cs

61 lines
2.1 KiB
C#
Raw Normal View History

2026-04-17 14:55:32 -04:00
using System;
using System.Data;
using System.Data.SqlClient;
using System.ComponentModel;
using DTS.Common.Storage;
using DTS.Common.Enums.Sensors;
using DTS.Common.Classes.Hardware;
using DTS.Common.Interface.DataRecorders;
// ReSharper disable CheckNamespace
// ReSharper disable ConvertToAutoProperty
namespace DTS.Common.ISO
{
public class HardwareChannel : DASChannelDBRecord, INotifyPropertyChanged
{
private Hardware _parentHardware;
public Hardware ParentDAS
{
get => _parentHardware;
set => SetProperty(ref _parentHardware, value, "ParentDAS");
}
public HardwareChannel() { }
public HardwareChannel(IDASChannelDBRecord record, Hardware h) : base(record)
{
ParentDAS = h;
}
public HardwareChannel(HardwareChannel copy, Hardware h)
{
SupportedSquibFireModes = copy.SupportedSquibFireModes;
SupportedExcitations = copy.SupportedExcitations;
SupportedDigitalOutputModes = copy.SupportedDigitalOutputModes;
SupportedDigitalInputModes = copy.SupportedDigitalInputModes;
SupportedBridges = copy.SupportedBridges;
ParentDAS = h;
LocalOnly = copy.LocalOnly;
DASDisplayOrder = copy.DASDisplayOrder;
ChannelIdx = copy.ChannelIdx;
ModuleArrayIndex = copy.ModuleArrayIndex;
_moduleSerialNumber = copy.ModuleSerialNumber;
}
public static int PhysicalCompare(HardwareChannel left, HardwareChannel right)
{
if (left == right) { return 0; }
if (null == left) { return -1; }
return null == right ? 1 : left.ChannelIdx.CompareTo(right.ChannelIdx);
}
public void Insert()
{
_ = DbOperations.DASChannelsInsert(this, ParentDAS.GetId());
}
public bool IsSupported(SensorConstants.BridgeType bridge)
{
return (SupportedBridges & (int)bridge) == (int)bridge;
}
}
}