using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DTS.SensorDB { /// /// stolen from HLApi /// used only sparsely in DataPRO /// public class TSFRackDescription { /// /// the number specified in the .INI file /// private int _number; public int Number { get { return _number; } set { _number = value; } } private int _version; public int Version { get { return _version; } set { _version = value; } } private int _type; public int Type { get { return _type; } set { _type = value; } } private TSFSystemDescription _parent; public TSFSystemDescription Parent { get { return _parent; } set { _parent = value; } } /// /// ?? /// private int _flags; public int Flags; /// /// ?? /// private int _source; public int Source { get { return _source; } set { _source = value; } } /// /// The calculated CRC for this struct /// private ulong _crc32; public ulong CRC32 { get { return _crc32; } set { _crc32 = value; } } // Variables to describe the HW configuration of this rack. /// /// Are the HW* valiables valid? /// private bool _hwInfoValid; public bool HardwareInfoValid { get { return _hwInfoValid; } set { _hwInfoValid = value; } } /// /// How many SIM's do we have? /// private int _hwSIMCount; private int HWSIMCount { get { return _hwSIMCount; } set { _hwSIMCount = value; } } /// /// How many TOM's do we have? /// private int _hwTOMCount; public int HWTOMCount { get { return _hwTOMCount; } set { _hwTOMCount = value; } } /// /// How many analog channels do we have? /// private int _hwAnalogChannelCount; public int HWAnalogChannelCount { get { return _hwAnalogChannelCount; } set { _hwAnalogChannelCount = value; } } /// /// How many squib channels do we have? /// private int _hwSquibChannelCount; public int HWSquibChannelCount { get { return _hwSquibChannelCount; } set { _hwSquibChannelCount = value; } } /// /// How many digital outputs do we have? /// private int _hwDigitalOutputChannelCount; public int HWDigitalOutputChannelCount { get { return _hwDigitalOutputChannelCount; } set { _hwDigitalOutputChannelCount = value; } } /// /// How many digital inputs do we have? /// private int _hwDigitalInputChannelCount; public int HWDigitalInputChannelCount { get { return _hwDigitalInputChannelCount; } set { _hwDigitalInputChannelCount = value; } } /// /// The serial number of this rack /// private string _hwSerialNumber; public string HWSerialNumber { get { return _hwSerialNumber; } set { _hwSerialNumber = value.Trim(); } } /// /// The IP address of this rack /// private string _hwIPAddress; public string HWIPAddress { get { return _hwIPAddress; } set { _hwIPAddress = value; } } /// /// How many entries is there in the HWModuleList? /// public int HWModuleCount { get { return HWModuleList.Length; } } /// /// The address to an array of ModuleDescription's /// private List _hwModuleList = new List(); public TSFModuleDescription[] HWModuleList { get { return _hwModuleList.ToArray(); } set { _hwModuleList = new List(value); } } // This represents the different power sources for this rack /// /// Are the Power* and Battery* variables valid? /// private bool _powerInfoValid = false; public bool PowerInfoValid { get { return _powerInfoValid; } set { _powerInfoValid = value; } } /// /// Current voltage of source 1 /// private double _powerSource1Volts; public double PowerSource1Volts { get { return _powerSource1Volts; } set { _powerSource1Volts = value; } } /// /// Current voltage of source 2 /// private double _powerSource2Volts; public double PowerSource2Volts { get { return _powerSource2Volts; } set { _powerSource2Volts = value; } } /// /// Not really a state, current charge voltage maybe? /// private double _batteryChargeState; public double BatteryChargeState { get { return _batteryChargeState; } set { _batteryChargeState = value; } } /// /// Is it charging or draining? /// private int _batteryChargeDirection; public int BatteryChargeDirection { get { return _batteryChargeDirection; } set { _batteryChargeDirection = value; } } // This represents the digital inputs on this rack /// /// Is the DigitalInputBits valid? /// private bool _digitalInputBitsValid; public bool DigitalInputBitsValid { get { return _digitalInputBitsValid; } set { _digitalInputBitsValid = value; } } /// /// One bit for each digital input /// private ulong _digitalInputBits; public ulong DigitalInputBits { get { return _digitalInputBits; } set { _digitalInputBits = value; } } // Current info about this racks LED's and fault/trigger lines. /// /// Is the LED/Fault/Trigger info below valid? /// private bool _LEDInfoValid; public bool LEDInfoValid { get { return _LEDInfoValid; } set { _LEDInfoValid = value; } } /// /// What color is the cal LED? See HLAPI_LED_* /// private char _calLED; public char CalLED { get { return _calLED; } set { _calLED = value; } } /// /// What color is the armed LED? See HLAPI_LED_* /// private char _armLED; public char ArmLED { get { return _armLED; } set { _armLED = value; } } /// /// What color is the start record LED? See HLAPI_LED_* /// private char _statLED; public char StatLED { get { return _statLED; } set { _statLED = value; } } /// /// Current state of trigger fault /// private bool _triggerFault; public bool TriggerFault { get { return _triggerFault; } set { _triggerFault = value; } } /// /// Current state of the level trigger /// private bool _levelTrigger; public bool LevelTrigger { get { return _levelTrigger; } set { _levelTrigger = value; } } /// /// This boolean indicates if this rack is currently powered down and should be ignored for all operations. /// private bool _isPoweredDown; public bool IsPoweredDown { get { return _isPoweredDown; } set { _isPoweredDown = value; } } /// /// this boolean indicates if this rack (G5) is in a docking station or not /// private bool _isInDockingStation; public bool IsInDockingStation { get { return _isInDockingStation; } set { _isInDockingStation = value; } } public TSFRackDescription() { } public TSFRackDescription(TSFRackDescription copy) { _armLED = copy.ArmLED; _batteryChargeDirection = copy._batteryChargeDirection; _batteryChargeState = copy._batteryChargeState; _calLED = copy._calLED; _crc32 = copy._crc32; _digitalInputBits = copy._digitalInputBits; _digitalInputBitsValid = copy._digitalInputBitsValid; _flags = copy._flags; _hwAnalogChannelCount = copy._hwAnalogChannelCount; _hwDigitalInputChannelCount = copy._hwDigitalInputChannelCount; _hwDigitalOutputChannelCount = copy._hwDigitalOutputChannelCount; _hwInfoValid = copy._hwInfoValid; _hwIPAddress = copy._hwIPAddress; _hwModuleList = new List(); foreach (var m in copy._hwModuleList) { _hwModuleList.Add(new TSFModuleDescription(m, this)); } _hwSerialNumber = copy._hwSerialNumber; _hwSIMCount = copy._hwSIMCount; _hwSquibChannelCount = copy._hwSquibChannelCount; _hwTOMCount = copy._hwTOMCount; _isInDockingStation = copy._isInDockingStation; _isPoweredDown = copy._isPoweredDown; _LEDInfoValid = copy._LEDInfoValid; _levelTrigger = copy._levelTrigger; _parent = copy._parent; _powerInfoValid = copy._powerInfoValid; _powerSource1Volts = copy._powerSource1Volts; _powerSource2Volts = copy._powerSource2Volts; _source = copy._source; _statLED = copy._statLED; _triggerFault = copy._triggerFault; _type = copy._type; _version = copy._version; _number = copy.Number; } public void SetModule(int moduleIndex, int trigMode, int trigChan, int trigDir, double trigLevel, int moduleType) { for (int i = _hwModuleList.Count; i <= moduleIndex; i++) { TSFModuleDescription hwModule = null; if (i == moduleIndex) { hwModule = new TSFModuleDescription(); hwModule.Parent = this; hwModule.Slot = moduleIndex; hwModule.Type = moduleType; } _hwModuleList.Add(hwModule); } } } }