init
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
using DTS.Common.Converters;
|
||||
using DTS.Common.Interface.DASFactory;
|
||||
using DTS.Common.Interface.DASFactory.Diagnostics.HardwareList;
|
||||
using DTS.Common.Interface.DataRecorders;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Net;
|
||||
|
||||
namespace DTS.Common.Interface.Hardware
|
||||
{
|
||||
public interface IAllATDStatus
|
||||
{
|
||||
IATDStatus [] ATDs { get; }
|
||||
void AddDevice(IDeviceArmStatus device, string parent);
|
||||
void PopulateFromHardware(IDASHardware[] hardware);
|
||||
AllATDStatuses OverallStatus { get; }
|
||||
}
|
||||
|
||||
public enum AllATDStatuses
|
||||
{
|
||||
NotConnected,
|
||||
Connecting,
|
||||
AllConnected,
|
||||
AllArmed,
|
||||
Errors
|
||||
}
|
||||
public interface IATDStatus
|
||||
{
|
||||
AllATDStatuses Status { get; }
|
||||
IDistributorArmStatus [] Distributors { get; }
|
||||
void AddDistributor(IDistributorArmStatus distributor);
|
||||
IPAddress IP { get; }
|
||||
void SetIP(IPAddress ip);
|
||||
void UpdateAggregateStatus();
|
||||
}
|
||||
public interface IDistributorArmStatus
|
||||
{
|
||||
bool EmptyDistributor { get; }
|
||||
IDeviceArmStatus Distributor { get; }
|
||||
void SetDistributor(IDeviceArmStatus distributor);
|
||||
DistributorStatuses DistributorStatus { get; }
|
||||
void SetDistributorStatus(DistributorStatuses status);
|
||||
AllATDStatuses AggregateStatus { get; }
|
||||
IDeviceArmStatus [] Devices { get; }
|
||||
void AddDevice(IDeviceArmStatus device);
|
||||
string SerialNumber { get; }
|
||||
void SetSerialNumber(string serial);
|
||||
void UpdateAggregateStatus();
|
||||
DateTime? LastSeen { get; }
|
||||
float? InputVoltage { get; }
|
||||
float? BackupVoltage { get; }
|
||||
void UpdateStatusFromQATS(IUDPQATSEntry qats);
|
||||
}
|
||||
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
|
||||
public enum DistributorStatuses
|
||||
{
|
||||
[Description("DistributorStatus_OFFLINE")]
|
||||
NotConnected,
|
||||
[Description("DistributorStatus_ONLINE")]
|
||||
Connected,
|
||||
[Description("DistributorStatus_ARMED")]
|
||||
Armed,
|
||||
[Description("DistributorStatus_IDLE")]
|
||||
NotArmed,
|
||||
[Description("DistributorStatus_ARMEDFAULTED")]
|
||||
Errored
|
||||
}
|
||||
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
|
||||
public enum DASStatuses
|
||||
{
|
||||
[Description("DASStatus_Offline")]
|
||||
MissingNotBooted,
|
||||
[Description("DASStatus_Online")]
|
||||
BootedNotArmedYet,
|
||||
[Description("DASStatus_Online")]
|
||||
BootedNeverArmed,
|
||||
[Description("DASStatus_ARMED")]
|
||||
ArmedReady,
|
||||
[Description("DASStatus_ARMEDFAULTED")]
|
||||
ArmedButFailedDiag,
|
||||
[Description("DASStatus_READYFORDL")]
|
||||
ReadyForDownload
|
||||
}
|
||||
[Flags]
|
||||
public enum DiagStatuses
|
||||
{
|
||||
Passed,
|
||||
NoResults,
|
||||
FailedShunt,
|
||||
FailedOffset,
|
||||
FailedTilt,
|
||||
FailedTemperature
|
||||
}
|
||||
public interface IDeviceArmStatus
|
||||
{
|
||||
bool HasArmed { get; set; }
|
||||
DASStatuses DASStatus { get; }
|
||||
void SetDASStatus(DASStatuses status);
|
||||
DiagStatuses DiagStatus { get; }
|
||||
void SetDiagStatus(DiagStatuses status);
|
||||
IDistributorArmStatus Distributor { get; }
|
||||
void SetDistributor(IDistributorArmStatus distributor);
|
||||
IDASHardware Hardware { get; }
|
||||
void SetHardware(IDASHardware hardware);
|
||||
IDASCommunication DASCommunication { get; }
|
||||
void SetDASCommunication(IDASCommunication das);
|
||||
string SerialNumber{ get; }
|
||||
void SetSerialNumber(string serial);
|
||||
DateTime? LastSeen { get; }
|
||||
float? InputVoltage { get; }
|
||||
float? BackupVoltage { get; }
|
||||
void UpdateStatusFromQATS(IUDPQATSEntry qats);
|
||||
string ShuntResults { get; }
|
||||
string OffsetResults { get; }
|
||||
double? TiltX { get; }
|
||||
double? TiltY { get; }
|
||||
double? TiltZ { get; }
|
||||
string IPAddress { get; }
|
||||
bool Triggered { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace DTS.Common.Enums.DBExport
|
||||
{
|
||||
/// <summary>
|
||||
/// different tags for an ISODll.FineLocation2
|
||||
/// </summary>
|
||||
public enum CustomFinLoc2Fields
|
||||
{
|
||||
Date,
|
||||
Expired,
|
||||
Fine_Loc_2,
|
||||
History,
|
||||
Last_Change,
|
||||
Last_Change_Text,
|
||||
Remarks,
|
||||
S_GUID,
|
||||
SortKey,
|
||||
Text_L1,
|
||||
Text_L2,
|
||||
Version,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Practices.Prism.Modularity;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace DTS.Common
|
||||
{
|
||||
public class AggregateModuleCatalog : IModuleCatalog
|
||||
{
|
||||
private readonly List<IModuleCatalog> _catalogs = new List<IModuleCatalog>();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AggregateModuleCatalog"/> class.
|
||||
/// </summary>
|
||||
public AggregateModuleCatalog()
|
||||
{
|
||||
_catalogs.Add(new ModuleCatalog());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of catalogs.
|
||||
/// </summary>
|
||||
/// <value>A read-only collection of catalogs.</value>
|
||||
private IEnumerable<IModuleCatalog> Catalogs => _catalogs.AsReadOnly();
|
||||
|
||||
/// <summary>
|
||||
/// Adds the catalog to the list of catalogs
|
||||
/// </summary>
|
||||
/// <param name="catalog">The catalog to add.</param>
|
||||
public void AddCatalog(IModuleCatalog catalog)
|
||||
{
|
||||
if (catalog == null)
|
||||
throw new ArgumentNullException($"catalog");
|
||||
//var canAdd = true;
|
||||
|
||||
//if(_catalogs.Any(c=> c.GetType() == typeof(DirectoryModuleCatalog)))
|
||||
//{
|
||||
// if (catalog.GetType() == typeof(DirectoryModuleCatalog) && _catalog.GetType() == typeof(DirectoryModuleCatalog))
|
||||
// {
|
||||
// if(((DirectoryModuleCatalog)catalog).ModulePath)
|
||||
// }
|
||||
//}
|
||||
_catalogs.Add(catalog);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the <see cref="ModuleInfo"/> classes that are in the <see cref="ModuleCatalog"/>.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public IEnumerable<ModuleInfo> Modules
|
||||
{
|
||||
get { return Catalogs.SelectMany(x => x.Modules); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the list of <see cref="ModuleInfo"/>s that <paramref name="moduleInfo"/> depends on.
|
||||
/// </summary>
|
||||
/// <param name="moduleInfo">The <see cref="ModuleInfo"/> to get the <see cref="ModuleCatalog"/>.</param>
|
||||
/// <returns>
|
||||
/// An enumeration of <see cref="ModuleInfo"/> that <paramref name="moduleInfo"/> depends on.
|
||||
/// </returns>
|
||||
public IEnumerable<ModuleInfo> GetDependentModules(ModuleInfo moduleInfo)
|
||||
{
|
||||
var catalog = _catalogs.Single(x => x.Modules.Contains(moduleInfo));
|
||||
return catalog.GetDependentModules(moduleInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the collection of <see cref="ModuleInfo"/>s that contain both the <see cref="ModuleInfo"/>s in
|
||||
/// <paramref name="modules"/>, but also all the modules they depend on.
|
||||
/// </summary>
|
||||
/// <param name="modules">The modules to get the dependencies for.</param>
|
||||
/// <returns>
|
||||
/// A collection of <see cref="ModuleInfo"/> that contains both all <see cref="ModuleInfo"/>s in <paramref name="modules"/>
|
||||
/// and also all the <see cref="ModuleInfo"/> they depend on.
|
||||
/// </returns>
|
||||
public IEnumerable<ModuleInfo> CompleteListWithDependencies(IEnumerable<ModuleInfo> modules)
|
||||
{
|
||||
var modulesGroupedByCatalog = modules.GroupBy(module => _catalogs.Single(catalog => catalog.Modules.Contains(module)));
|
||||
return modulesGroupedByCatalog.SelectMany(x => x.Key.CompleteListWithDependencies(x));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the catalog, which may load and validate the modules.
|
||||
/// </summary>
|
||||
public void Initialize()
|
||||
{
|
||||
foreach (var catalog in Catalogs)
|
||||
{
|
||||
catalog.Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a <see cref="ModuleInfo"/> to the <see cref="ModuleCatalog"/>.
|
||||
/// </summary>
|
||||
/// <param name="moduleInfo">The <see cref="ModuleInfo"/> to add.</param>
|
||||
public void AddModule(ModuleInfo moduleInfo)
|
||||
{
|
||||
_catalogs[0].AddModule(moduleInfo);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user