init
This commit is contained in:
@@ -0,0 +1,185 @@
|
||||
using DTS.Common.Interface.DASFactory;
|
||||
using DTS.Common.Interface.DataRecorders;
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace DTS.DASLib.Service.StateMachine
|
||||
{
|
||||
public class HardwareDiscoveryParameters
|
||||
{
|
||||
public bool ReadIds { get; set; } = false;
|
||||
/// <summary>
|
||||
/// ip addresses that we expliticly want to connect to
|
||||
/// if not specified in known tdas or known slice ip addresses will try connecting as both slice and tdas
|
||||
/// </summary>
|
||||
public string[] Addresses { get; set; } = new string[0];
|
||||
/// <summary>
|
||||
/// range of address to ping
|
||||
/// items must be in the form of aaa.bbb.ccc.ddd
|
||||
/// will ping all addresses iterating from item1 upto the 4th byte on item 2
|
||||
/// any ip that responds will be added to ips to connect to
|
||||
/// if it's not known whether it's a SLICE or TDAS then will be added to both lists to connect to
|
||||
/// </summary>
|
||||
public Tuple<string, string>[] AddressRanges { get; set; } = new Tuple<string, string>[0];
|
||||
/// <summary>
|
||||
/// ip address that are known to be TDAS, so we don't have to try connecting to as a slice
|
||||
/// </summary>
|
||||
public string[] KnownTDASIPAddresses { get; set; } = new string[0];
|
||||
/// <summary>
|
||||
/// ip addresses that are known to be SLICE, so we don't have to try connecting to as a TDAS
|
||||
/// </summary>
|
||||
public string[] KnownSLICEIPAddresses { get; set; } = new string[0];
|
||||
/// <summary>
|
||||
/// controls whether we should remain in state or not
|
||||
/// sometimes the user just wants to see the hardware detected and not go onto resolve channels or any additional
|
||||
/// actions
|
||||
/// </summary>
|
||||
public bool ProceedWhenDone { get; set; } = false;
|
||||
/// <summary>
|
||||
/// whether all das are required to be found
|
||||
/// </summary>
|
||||
public bool RequireAllDASFound { get; set; } = false;
|
||||
/// <summary>
|
||||
/// whether to proceed to download state after completion
|
||||
/// </summary>
|
||||
public bool GoToDownload { get; set; } = false;
|
||||
/// <summary>
|
||||
/// controls whether we are ping and connecting or just pinging ...
|
||||
/// </summary>
|
||||
public bool Connect { get; set; } = false;
|
||||
/// <summary>
|
||||
/// controls whether UDP/Multicast discovery should be performed
|
||||
/// </summary>
|
||||
public bool UseMulticastDiscover { get; set; } = false;
|
||||
public int ConnectTimeoutMS { get; set; } = 30000; //30 seconds
|
||||
/// <summary>
|
||||
/// whether to run auto-sense or not
|
||||
/// note that DisableAutoSense overrules this setting
|
||||
/// </summary>
|
||||
public bool RunAutoSense { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// specific device to query, when present
|
||||
/// this is used to signal that there's a device already attached that
|
||||
/// we want to requery
|
||||
/// this is done when the device configuration is changed
|
||||
/// </summary>
|
||||
public IDASCommunication RequeryDevice { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// serial numbers that are required to connect
|
||||
/// </summary>
|
||||
public string[] RequiredSerials { get; set; } = new string[0];
|
||||
/// <summary>
|
||||
/// controls whether to perform hardware checks (voltage/memory/firmware/etc)
|
||||
/// after connecting to hardware
|
||||
/// </summary>
|
||||
public bool DoHardwareChecks { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// hardware that we expect to be connected once ping and connect completes
|
||||
/// used as part of DoHardwareChecks
|
||||
/// </summary>
|
||||
public IDASHardware[] ExpectedHardware { get; set; } = new IDASHardware[0];
|
||||
|
||||
public delegate bool UnitIsInDbDelegate(IDASCommunication das);
|
||||
public UnitIsInDbDelegate UnitIsInDbQuery { get; set; } = null;
|
||||
|
||||
public delegate string FirmwareExpectedVersionDelegate(IDASCommunication das);
|
||||
public FirmwareExpectedVersionDelegate UnitExpectedFirmwareQuery { get; set; } = null;
|
||||
|
||||
public delegate bool IsCalDateExpiredDelegate(IDASCommunication das);
|
||||
public IsCalDateExpiredDelegate CalDateExpiredQuery { get; set; } = null;
|
||||
|
||||
public delegate long UnitExpectedMaxMemoryDelegate(IDASCommunication das);
|
||||
public UnitExpectedMaxMemoryDelegate UnitExpectedMaxMemoryQuery { get; set; } = null;
|
||||
|
||||
public delegate void UpdateMaxMemoryDelegate(IDASCommunication das);
|
||||
public UpdateMaxMemoryDelegate UpdateMaxMemoryAction { get; set; } = null;
|
||||
/// <summary>
|
||||
/// whether to check the input/battery voltage for units or not
|
||||
/// </summary>
|
||||
public bool DoVoltageChecks { get; set; } = true;
|
||||
public void Reset()
|
||||
{
|
||||
ReadIds = false;
|
||||
Addresses = new string[0];
|
||||
AddressRanges = new Tuple<string, string>[0];
|
||||
ProceedWhenDone = false;
|
||||
RequireAllDASFound = false;
|
||||
KnownSLICEIPAddresses = new string[0];
|
||||
KnownTDASIPAddresses = new string[0];
|
||||
RequeryDevice = null;
|
||||
RequiredSerials = new string[0];
|
||||
DoHardwareChecks = false;
|
||||
ExpectedHardware = new IDASHardware[0];
|
||||
UnitIsInDbQuery = null;
|
||||
UnitExpectedFirmwareQuery = null;
|
||||
CalDateExpiredQuery = null;
|
||||
UnitExpectedMaxMemoryQuery = null;
|
||||
UpdateMaxMemoryAction = null;
|
||||
DoVoltageChecks = true;
|
||||
}
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine($"ReadIds={ReadIds.ToString()}");
|
||||
sb.AppendLine($"Addresses={string.Join(",", Addresses)}");
|
||||
sb.Append("AddressRanges=");
|
||||
for (int i = 0; i < AddressRanges.Length; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
sb.Append(", ");
|
||||
}
|
||||
sb.Append($"({AddressRanges[i].Item1},{AddressRanges[i].Item2})");
|
||||
}
|
||||
sb.AppendLine();
|
||||
sb.AppendLine($"ProceedWhenDone={ProceedWhenDone.ToString()}");
|
||||
sb.AppendLine($"RequireAllDASFound={RequireAllDASFound.ToString()}");
|
||||
sb.AppendLine($"KnownSLICEIPAddresses={string.Join(",", KnownSLICEIPAddresses)}");
|
||||
sb.AppendLine($"KnownTDASIPAddresses={string.Join(",", KnownTDASIPAddresses)}");
|
||||
sb.Append("RequiryDevice=");
|
||||
if (null == RequeryDevice)
|
||||
{
|
||||
sb.AppendLine("null");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine(RequeryDevice.SerialNumber);
|
||||
}
|
||||
|
||||
sb.AppendLine($"RequiredSerials={string.Join(",", RequiredSerials)}");
|
||||
sb.AppendLine($"DoHardwareChecks={DoHardwareChecks.ToString()}");
|
||||
sb.Append("ExpectedHardware=");
|
||||
for (var i = 0; i < ExpectedHardware.Length; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
sb.Append(", ");
|
||||
}
|
||||
sb.Append(ExpectedHardware[i].SerialNumber);
|
||||
}
|
||||
sb.AppendLine();
|
||||
|
||||
sb.Append("UnitIsInDbQuery=");
|
||||
sb.AppendLine(null == UnitIsInDbQuery ? "[null]" : "[defined]");
|
||||
|
||||
sb.Append("UnitExpectedFirmwareQuery=");
|
||||
sb.AppendLine(null == UnitExpectedFirmwareQuery ? "[null]" : "[defined]");
|
||||
|
||||
sb.Append("CalDateExpiredQuery=");
|
||||
sb.AppendLine(null == CalDateExpiredQuery ? "[null]" : "[defined]");
|
||||
|
||||
sb.Append("UnitExpectedMaxMemoryQuery=");
|
||||
sb.AppendLine(null == UnitExpectedMaxMemoryQuery ? "[null]" : "[defined]");
|
||||
|
||||
sb.Append("UpdateMaxMemoryAction=");
|
||||
sb.AppendLine(null == UpdateMaxMemoryAction ? "[null]" : "[defined]");
|
||||
|
||||
sb.Append("DoVoltageChecks=");
|
||||
sb.AppendLine(DoVoltageChecks.ToString());
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user