This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,536 @@
using DTS.Common.Converters;
using DTS.Common.Enums.DASFactory;
using System.ComponentModel;
using DTS.Common.Constant.DASSpecific;
using System.Windows.Media;
using DTS.Common.Interface.DataRecorders;
namespace DTS.Common.Enums.Hardware
{
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
public enum HardwareTypes
{
SLICE_Base = 0,
SLICE_Bridge = 1,
[Description("SLICE_Distributor_Description")]
SLICE_Distributor = 2,
[Description("TDAS_Pro_Rack_Description")]
TDAS_Pro_Rack = 3,
SLICE2_IEPE_Hi = 4,
SLICE2_IEPE_Lo = 5,
SLICE2_Bridge_Hi = 6,
SLICE2_Bridge_Lo = 7,
SLICE2_Base = 8,
TOM = 9,
SIM = 10,
DIM = 11,
[Description("G5_VDS_Description")]
G5VDS = 12,
Ribeye = 13,
RibeyeLED = 14,
SLICE_IEPE = 15,
[Description("SLICE1_5Nano_Description")]
SLICE1_5_Nano_Base = 16,
[Description("SLICE_Micro_Description")]
SLICE_Micro_Base = 17,
[Description("SLICE_Nano_Description")]
SLICE_NANO_Base = 18,
[Description("SLICE2_SIM_Description")]
SLICE2_SIM = 19,
[Description("SLICE2_DIM_Description")]
SLICE2_DIM = 20,
[Description("SLICE2_TOM_Description")]
SLICE2_TOM = 21,
//G5IPORT=22,
[Description("G5InDummy_Description")]
G5INDUMMY = 23,
[Description("SLICE_EthernetController_Description")]
SLICE_EthernetController = 24,
[Description("SLICE_15Micro_Description")]
SLICE1_5_Micro_Base = 25,
[Description("SLICE_Lab_Ethernet_Description")]
SLICE_LabEthernet = 26,
[Description("SLICE2_SLS_Description")]
SLICE2_SLS = 27,
[Description("SLICE1_G5Stack_Description")]
SLICE1_G5Stack = 28,
[Description("SLICE2_SLT_Description")]
SLICE2_SLT = 29,
[Description("SLICE2_SLD_Description")]
SLICE2_SLD = 30,
[Description("TDAS_LabRack_Description")]
TDAS_LabRack = 31,
[Description("SLICE6_Base_Description")]
SLICE6_Base = 32,
[Description("SLICE6_DB_Description")]
SLICE6DB = 33,
[Description("SLICE6_DBInDummy_Description")]
SLICE6DB_InDummy = 34,
//doesn't exist
//[Description("SLICE6_DBAir_Description")]
//SLICE6DB_AIR = 35,
[Description("SLICE6_AIR_Description")]
SLICE6_AIR = 36,
[Description("PowerPRO_Description")]
PowerPro = 37,
[Description("HardwareType_EMPTY")]
UNDEFINED = 38,
[Description("SLICE_Mini_Distributor_Description")]
SLICE_Mini_Distributor = 39,
[Description("TSR_AIR_Description")]
TSR_AIR = 40, // TSR Air "Rev A"
[Description("TSR_AIR_RevB_Description")]
TSR_AIR_RevB = 41, // TSR Air "Rev B"
[Description("DKR_Description")]
DKR = 42, // NGTSR - NASA SBIR
[Description("DIR_Description")]
DIR = 43, // NGTSR - USAF SBIR
[Description("Embedded_LowG_Module_Description")]
EMB_LIN_ACC_LO = 44,
[Description("Embedded_HighG_Module_Description")]
EMB_LIN_ACC_HI = 45,
[Description("Embedded_Angular_Module_Description")]
EMB_ANG_ACC = 46,
[Description("Embedded_ARS_Module_Description")]
EMB_ANG_ARS = 47,
[Description("Embedded_Atmosphere_Module_Description")]
EMB_ATM = 48,
[Description("Embedded_Magnetometer_Module_Description")]
EMB_MAG = 49,
[Description("Embedded_MagnetSwitch_Module_Description")]
EMB_MAG_SWITCH = 50,
[Description("Embedded_Microphone_Module_Description")]
EMB_MIC = 51,
[Description("Embedded_Optical_Module_Description")]
EMB_OPT = 52,
[Description("Embedded_Clock_Seconds_Module_Description")]
EMB_RTC_S_MARK = 53,
[Description("Embedded_Clock_Nanos_Module_Description")]
EMB_RTC_NS_PAD = 54,
[Description("SLICE6DB3_Description")]
SLICE6DB3 = 55,
[Description("SLICE6ER_Description")]
S6A_EthernetRecorder = 56,
//(25460 Placeholder)
[Description("SLICE_Pro_Distributor_Description")]
SLICE_Pro_Distributor = 57,
//28283 SLICE6AIR-BR (falcon-id) infrastructure
[Description("SLICE6_AIR_BR_Description")]
SLICE6_AIR_BR = 58,
//43955 SLICE-TC infrastructure
[Description("SLICE_TC_Description")]
SLICE6_AIR_TC = 59,
//44870 SPFD
[Description("SLICE_PRO_CAN_FD_Description")]
SLICE_PRO_CAN_FD = 60,
}
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
public enum SLICEBridgeTypes
{
[Description("BRIDGETYPE_BRIDGE_DESCRIPTION")]
Bridge,
[Description("BRIDGETYPE_IEPE_DESCRIPTION")]
IEPE,
[Description("BRIDGETYPE_ARS_DESCRIPTION")]
ARS,
[Description("BRIDGETYPE_ACC_DESCRIPTION")]
ACC,
[Description("BRIDGETYPE_RTC_DESCRIPTION")]
RTC,
[Description("BRIDGETYPE_UART_DESCRIPTION")]
UART,
[Description("BRIDGETYPE_STREAM_OUT_DESCRIPTION")]
StreamOut,
[Description("BRIDGETYPE_THERMOCOUPLER_DESCRIPTION")]
Thermocoupler,
[Description("BRIDGETYPE_CAN_DESCRIPTION")]
CAN
}
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
public enum RackSizes
{
[Description("RACK_SIZE_4M")]
FOUR,
[Description("RACK_SIZE_8M")]
EIGHT
}
public abstract class HardwareConstants
{
//http://manuscript.dts.local/f/cases/37929/Implement-TSRAIR-module-on-off-selection-via-Max-Slice-Enable-system-attribute
public const int TSRAIR_MAXSLICENABLE_VERSION = 28;
//this is the max modules according to firmware (18 channels)
// it does not consider the streaming module nor the UART module which are SW only concepts and not
// part of the module count in firmware
public const int TSRAIR_MAX_MODULES = 6;
public const string TSR_AIR_PREPEND = "TA";
public static bool IsTSRAIRSerialNumber(string serialNumber)
{
if (string.IsNullOrEmpty(serialNumber)) { return false; }
return serialNumber.StartsWith(TSR_AIR_PREPEND);
}
public static SolidColorBrush GetBrushForVoltageStatus(DFConstantsAndEnums.VoltageStatusColor status)
{
switch (status)
{
case DFConstantsAndEnums.VoltageStatusColor.Green:
return BrushesAndColors.BrushApplicationStatusPowerGreen;
case DFConstantsAndEnums.VoltageStatusColor.Red:
return BrushesAndColors.BrushApplicationStatusPowerRed;
case DFConstantsAndEnums.VoltageStatusColor.Yellow:
return BrushesAndColors.BrushApplicationStatusPowerYellow;
case DFConstantsAndEnums.VoltageStatusColor.Off:
default:
return BrushesAndColors.BrushApplicationStatusPowerClear;
}
}
/// <summary>
/// returns whether the device supports trigger inversion or not
/// currently only SLICE1, SLICE1.5, SLICE2 support it and only when connected via USB?
/// protocol version could be a deciding factor for whether a device supports trigger inversion
/// </summary>
/// <param name="type">type of DAS</param>
/// <param name="protocolVersion">protocol version of das</param>
/// <returns>true if the device supports trigger inversion, false otherwise</returns>
public static bool SupportsTriggerInversion(HardwareTypes type, int protocolVersion)
{
switch (type)
{
case HardwareTypes.SLICE1_5_Micro_Base:
case HardwareTypes.SLICE_Base:
case HardwareTypes.SLICE2_Base:
case HardwareTypes.SLICE_IEPE:
case HardwareTypes.SLICE1_5_Nano_Base:
case HardwareTypes.SLICE_Micro_Base:
case HardwareTypes.SLICE_NANO_Base:
case HardwareTypes.SLICE2_SIM:
case HardwareTypes.SLICE2_DIM:
case HardwareTypes.SLICE2_TOM:
case HardwareTypes.SLICE2_SLS:
case HardwareTypes.SLICE1_G5Stack:
case HardwareTypes.SLICE2_SLT:
case HardwareTypes.SLICE2_SLD:
return true;
default: return false;
}
}
/// <summary>
/// returns whether the device supports start inversion or not
/// currently only SLICE1, SLICE1.5, SLICE2 support it and only when connected via USB?
/// protocol version could be a deciding factor for whether a device supports start inversion
/// </summary>
/// <param name="type">type of DAS</param>
/// <param name="protocolVersion">protocol version of das</param>
/// <returns>true if the device supports start inversion, false otherwise</returns>
public static bool SupportsStartInversion(HardwareTypes type, int protocolVersion)
{
switch (type)
{
case HardwareTypes.SLICE1_5_Micro_Base:
case HardwareTypes.SLICE_Base:
case HardwareTypes.SLICE2_Base:
case HardwareTypes.SLICE_IEPE:
case HardwareTypes.SLICE1_5_Nano_Base:
case HardwareTypes.SLICE_Micro_Base:
case HardwareTypes.SLICE_NANO_Base:
case HardwareTypes.SLICE2_SIM:
case HardwareTypes.SLICE2_DIM:
case HardwareTypes.SLICE2_TOM:
case HardwareTypes.SLICE2_SLS:
case HardwareTypes.SLICE1_G5Stack:
case HardwareTypes.SLICE2_SLT:
case HardwareTypes.SLICE2_SLD:
case HardwareTypes.SLICE6_AIR:
return true;
default: return false;
}
}
/// <summary>
/// returns true if the hardware type is a type of ethernet recorder
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public static bool IsEthernetRecorder(HardwareTypes type)
{
return type == HardwareTypes.S6A_EthernetRecorder;
}
public const int INVALID_IDASCOMMUNICATION_RECORD_ID = -1;
/// <summary>
/// this is just a global variable for whether to allow soft disconnects or not
/// and provide access to the variable across modules
/// must be set by the application.
/// </summary>
public static bool AllowSoftDisconnects { get; set; } = false;
public const int DEFAULTMEMORYSIZE_PRO = 16000000;
public const int DEFAULTMEMORYSIZE_DIM = 2000000;
public const int DEFAULTMEMORYSIZE_TOM = 2000000;
/// <summary>
/// returns true if the hardware in question uses embedded sensors
/// </summary>
/// <param name="hardware"></param>
/// <returns></returns>
public static bool HasEmbeddedSensors(HardwareTypes hardware)
{
switch (hardware)
{
case HardwareTypes.EMB_ANG_ACC:
case HardwareTypes.EMB_ANG_ARS:
case HardwareTypes.EMB_ATM:
case HardwareTypes.EMB_LIN_ACC_HI:
case HardwareTypes.EMB_LIN_ACC_LO:
case HardwareTypes.EMB_MAG:
case HardwareTypes.EMB_MAG_SWITCH:
case HardwareTypes.EMB_MIC:
case HardwareTypes.EMB_OPT:
case HardwareTypes.EMB_RTC_NS_PAD:
case HardwareTypes.EMB_RTC_S_MARK:
case HardwareTypes.TSR_AIR:
case HardwareTypes.TSR_AIR_RevB:
case HardwareTypes.DIR:
case HardwareTypes.DKR:
case HardwareTypes.SLICE6_AIR_TC:
return true;
default: return false;
}
}
/// <summary>
/// returns whether the given channel type is supported by the given das for TSR AIR variants
/// 18284 DKR device should only populate channels that are embedded in the device
/// </summary>
/// <param name="hardware"></param>
/// <param name="channelType"></param>
/// <returns></returns>
public static bool HasEmbeddedChannelType(HardwareTypes hardware, string channelType)
{
if (hardware == HardwareTypes.TSR_AIR || hardware == HardwareTypes.TSR_AIR_RevB) { return true; }
switch (channelType)
{
case DFConstantsAndEnums.LOWG_SERIAL_APPEND: return true;
case DFConstantsAndEnums.HIGHG_SERIAL_APPEND: return hardware == HardwareTypes.DIR;
case DFConstantsAndEnums.ARS_SERIAL_APPEND: return false;
case DFConstantsAndEnums.ANGACCEL_SERIAL_APPEND: return true;
case DFConstantsAndEnums.ATMOSPHERIC_SERIAL_APPEND: return false;
case DFConstantsAndEnums.OPTICAL_SERIAL_APPEND: return false;
case DFConstantsAndEnums.MAGNETIC_SERIAL_APPEND: return false;
case DFConstantsAndEnums.MAGNETICSWITCH_SERIAL_APPEND: return false;
case DFConstantsAndEnums.MICROPHONE_SERIAL_APPEND: return hardware != HardwareTypes.DKR;
case DFConstantsAndEnums.RTCSECONDANDMARKER_SERIAL_APPEND:
case DFConstantsAndEnums.RTCCLOCKNANOPAD_SERIAL_APPEND:
return false;
default: return false;
}
}
private static bool IsRecordingModeSupportedCAN(RecordingModes mode)
{
return RecordingModeExtensions.IsACircularBufferMode(mode);
}
/// <summary>
/// returns true if the recording mode is supported on the given hardware and protocol version
/// </summary>
/// <param name="mode">recording mode to check</param>
/// <param name="dasType">hardware type</param>
/// <param name="protocolVersion">protocol version of hardware</param>
/// <param name="includeNativeSupportOnly">Use false (default) to find out if hardware supports given recording mode
/// or an equivalent recording mode (example Circ Buffer, Circ Buffer + UART, use true to only consider the recording
/// mode explicitly and not any related modes</param>
/// <returns>true if the mode is supported, false otherwise</returns>
public static bool IsRecordingModeSupported(RecordingModes mode, HardwareTypes dasType,
int protocolVersion, bool includeNativeSupportOnly = false)
{
if (dasType == HardwareTypes.SLICE6_AIR_TC) { return SLICE6AIRTC.IsRecordingModeSupported(mode); }
if (dasType == HardwareTypes.SLICE_PRO_CAN_FD) { return IsRecordingModeSupportedCAN(mode); }
if (dasType != HardwareTypes.TSR_AIR && dasType != HardwareTypes.TSR_AIR_RevB)
{
switch (mode)
{
//All non-TSRAIR DAS support Recorder and CircularBuffer
case RecordingModes.CircularBuffer:
case RecordingModes.Recorder:
return true;
case RecordingModes.CircularBufferPlusUART:
case RecordingModes.RecorderPlusUART:
if (!includeNativeSupportOnly)
{
return true;
}
break;
}
}
if ((dasType == HardwareTypes.SLICE6DB_InDummy || dasType == HardwareTypes.SLICE6DB3 || dasType == HardwareTypes.SLICE6DB) &&
mode == RecordingModes.RAMActive)
{
return true;
}
bool result;
switch (dasType)
{
case HardwareTypes.SLICE1_5_Micro_Base:
case HardwareTypes.SLICE1_5_Nano_Base:
result = SLICE1_5.IsRecordingModeSupported(mode, protocolVersion);
break;
case HardwareTypes.SLICE6_Base:
result = SLICE6.IsRecordingModeSupported(mode, protocolVersion);
break;
case HardwareTypes.SLICE6_AIR:
result = SLICE6AIR.IsRecordingModeSupported_S6AIR(mode, protocolVersion);
break;
case HardwareTypes.S6A_EthernetRecorder:
//43626 Since S6A_EthernetRecorder is really a SLICE6_AIR with different firmware
//we use the SLICE6AIR class to avoid creating a new class for only a few features.
result = SLICE6AIR.IsRecordingModeSupported_S6EDR(mode, protocolVersion);
break;
case HardwareTypes.SLICE6_AIR_BR:
result = SLICE6AIRBR.IsRecordingModeSupported(mode, protocolVersion);
break;
case HardwareTypes.SLICE2_TOM:
result = SLICE2_TOM.IsRecordingModeSupported(mode, protocolVersion);
break;
case HardwareTypes.TSR_AIR:
case HardwareTypes.TSR_AIR_RevB:
result = TSRAIR.IsRecordingModeSupported(mode, protocolVersion);
break;
//TDAS hardware only supports Recorder and CircularBuffer, so if we get here the mode is not supported
case HardwareTypes.DIM:
case HardwareTypes.G5INDUMMY:
case HardwareTypes.G5VDS:
case HardwareTypes.Ribeye:
case HardwareTypes.RibeyeLED:
case HardwareTypes.SIM:
case HardwareTypes.TDAS_Pro_Rack:
case HardwareTypes.TDAS_LabRack:
case HardwareTypes.TOM:
result = false;
break;
case HardwareTypes.SLICE6_AIR_TC:
result = SLICE6AIRTC.IsRecordingModeSupported(mode);
break;
//All other hardware types support the same modes
default:
switch (mode)
{
case RecordingModes.MultipleEventCircularBuffer:
case RecordingModes.MultipleEventRecorder:
case RecordingModes.HybridRecorder:
case RecordingModes.ContinuousRecorder:
result = true;
break;
default:
result = false;
break;
}
break;
}
return result;
}
/// <summary>
/// Gets the Maximum sample rate for a particular recording mode, first implemented because the maximum sample rate
/// can vary depending on model and the baud rate set for UART recording (39151)
/// </summary>
/// <param name="h"></param>
/// <param name="mode"></param>
/// <param name="protocolVersion"></param>
/// <param name="baudRate"></param>
/// <returns></returns>
public static double MaxSampleRateForRecordingMode(IDASHardware h, RecordingModes mode, int protocolVersion = 1, uint baudRate = 0)
{
switch (h.DASTypeEnum)
{
case HardwareTypes.SLICE6_AIR:
return SLICE6AIR.MaxSampleRateHzForRecordingMode(mode, false, protocolVersion, baudRate);
case HardwareTypes.S6A_EthernetRecorder:
return SLICE6AIR.MaxSampleRateHz_OBRDDR;
default:
return h.GetMaxSampleRateDouble();
}
}
/// <summary>
/// returns true if the streaming profile is supported on the given hardware and protocol version
/// </summary>
/// <param name="profile">streaming profile to check</param>
/// <param name="dasType">hardware type</param>
/// <param name="protocolVersion">protocol version of hardware</param>
/// <returns>true if the profile is supported, false otherwise</returns>
public static bool IsStreamingProfileSupported(UDPStreamProfile profile, HardwareTypes dasType,
int protocolVersion, bool includeNativeSupportOnly = false)
{
bool result;
switch (dasType)
{
case HardwareTypes.SLICE6_Base:
result = SLICE6.IsStreamingProfileSupported(profile, protocolVersion);
break;
case HardwareTypes.SLICE6_AIR:
result = SLICE6AIR.IsStreamingProfileSupported(profile, protocolVersion);
break;
case HardwareTypes.SLICE6_AIR_BR:
result = SLICE6AIRBR.IsStreamingProfileSupported(profile, protocolVersion);
break;
case HardwareTypes.TSR_AIR:
case HardwareTypes.TSR_AIR_RevB:
result = TSRAIR.IsStreamingProfileSupported(profile, protocolVersion);
break;
case HardwareTypes.SLICE6_AIR_TC:
result = SLICE6AIRTC.IsStreamingProfileSupported(profile, protocolVersion);
break;
//All other hardware types can't stream out
default:
result = false;
break;
}
return result;
}
/// <summary>
/// returns true if the clock sync profile is supported on the given hardware and protocol version
/// </summary>
/// <param name="profile">clock sync profile to check</param>
/// <param name="dasType">hardware type</param>
/// <param name="protocolVersion">protocol version of hardware</param>
/// <returns>true if the profile is supported, false otherwise</returns>
public static bool IsClockSyncProfileSupported(ClockSyncProfile profile, HardwareTypes dasType,
int protocolVersion, bool includeNativeSupportOnly, bool master)
{
bool result;
switch (dasType)
{
case HardwareTypes.SLICE6_Base:
result = SLICE6.IsClockSyncProfileSupported(profile, protocolVersion);
break;
case HardwareTypes.SLICE6_AIR:
result = SLICE6AIR.IsClockSyncProfileSupported(profile, protocolVersion);
break;
case HardwareTypes.SLICE6_AIR_TC:
result = SLICE6AIRTC.IsClockSyncProfileSupported(profile, protocolVersion);
break;
case HardwareTypes.SLICE6_AIR_BR:
result = SLICE6AIRBR.IsClockSyncProfileSupported(profile, protocolVersion);
break;
case HardwareTypes.SLICE6DB:
case HardwareTypes.SLICE6DB_InDummy:
result = SLICE6DB.IsClockSyncProfileSupported(profile, protocolVersion);
break;
case HardwareTypes.TSR_AIR:
case HardwareTypes.TSR_AIR_RevB:
result = TSRAIR.IsClockSyncProfileSupported(profile, protocolVersion, master);
break;
//All other hardware types can't sync
default:
result = false;
break;
}
return result;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -0,0 +1,27 @@
using System.Collections.ObjectModel;
using DTS.Common.Base;
namespace DTS.Common.Interface.CustomChannels
{
public interface ICustomChannelsViewModel : IBaseViewModel
{
ICustomChannelsImportView ImportView { get; set; }
ICustomChannelsExportView ExportView { get; set; }
void Unset();
void OnSetActive(bool bImport);
string ExportFileName { get; set; }
string ImportFileName { get; set; }
void ReadImportFile();
ObservableCollection<ICustomChannelModel> AllCustomChannels { get; }
void SelectAll();
void ClearSelection();
void Export();
void Import();
}
}

View File

@@ -0,0 +1,18 @@
using DTS.Common.Base;
using Prism.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTS.Common.Events
{
public class SaveReportToCSVRequestedEvent : PubSubEvent<SaveReportToCSVRequestedEventArgs> { }
public class SaveReportToCSVRequestedEventArgs
{
public string Directory { get; set; }
public IBaseViewModel ParentVM { get; set; }
}
}

View File

@@ -0,0 +1,44 @@
using System;
namespace DTS.Common.Interface.Database
{
public interface IUserDbRecord
{
/// <summary>
/// Database Id of user
/// </summary>
int ID { get; set; }
/// <summary>
/// User name of user
/// Must be unique
/// </summary>
string UserName { get; set; }
/// <summary>
/// string to use when displaying user in UI
/// </summary>
string DisplayName { get; set; }
/// <summary>
/// Password for user
/// Password is a hashed and salted value, passwords are not
/// stored in database
/// </summary>
string Password { get; set; }
/// <summary>
/// Role of user
/// </summary>
short Role { get; set; }
/// <summary>
/// DateTime user was last modified
/// </summary>
DateTime LastModified { get; set; }
/// <summary>
/// User that last modified user
/// </summary>
string LastModifiedBy { get; set; }
/// <summary>
/// whether user should be synchronized between local and remote databases
/// deprecated
/// </summary>
bool LocalOnly { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
using DTS.Common.Base;
// ReSharper disable CheckNamespace
namespace DTS.Common.Interface
{
public interface IExportMainView : IBaseView { }
}

View File

@@ -0,0 +1,68 @@
using System;
using System.Threading.Tasks;
using DTS.Common.Base;
using Prism.Regions;
// ReSharper disable InconsistentNaming
// ReSharper disable CheckNamespace
namespace DTS.Common
{
public interface IDTSRegionManager : IRegionManager
{
/// <summary>
/// Adds View to the Main Region.
/// </summary>
/// <param name="viewDefinition">The View definition.</param>
/// <param name="parameter">The parameter which uses to initialize the View.</param>
void AddView(ViewDefinition viewDefinition, object parameter);
/// <summary>
/// Adds View to the Main Region.
/// </summary>
/// <param name="viewDefinition">The View definition.</param>
/// <param name="parameter">The parameter which uses to initialize the View.</param>
/// <param name="allowMultipleInstances">A value indicating whether to allow to create the multiple views.</param>
void AddView(ViewDefinition viewDefinition, object parameter, bool allowMultipleInstances);
/// <summary>
/// Adds View to the Main Region asynchronously.
/// </summary>
/// <param name="viewDefinition">The View definition.</param>
/// <param name="parameter">The parameter which uses to initialize the service.</param>
Task AddViewAsync(ViewDefinition viewDefinition, object parameter);
/// <summary>
/// Adds View to the Main Region asynchronously.
/// </summary>
/// <param name="viewDefinition">The View definition.</param>
/// <param name="parameter">The parameter which uses to initialize the View.</param>
/// <param name="allowMultipleInstances">A value indicating whether to allow to create the multiple views.</param>
Task AddViewAsync(ViewDefinition viewDefinition, object parameter, bool allowMultipleInstances);
/// <summary>
/// Removes View from the Main Region.
/// </summary>
/// <param name="viewModel">The View-model.</param>
void RemoveView(IBaseViewModel viewModel);
/// <summary>
/// Removes View from the specified region by name
/// </summary>
/// <param name="regionName"></param>
void RemoveViewByRegionName(string regionName);
/// <summary>
/// Reloads data for the specified View.
/// </summary>
/// <param name="interfaceForView">Type of the View's interface.</param>
/// <param name="parameter">The parameter which uses to initialize the View.</param>
void RefreshView(Type interfaceForView, object parameter);
/// <summary>
/// Reloads data for the specified View asynchronously.
/// </summary>
/// <param name="interfaceForView">Type of the View's interface.</param>
/// <param name="parameter">The parameter which uses to initialize the View.</param>
Task RefreshViewAsync(Type interfaceForView, object parameter);
}
}

View File

@@ -0,0 +1,242 @@
using DTS.Common.Enums;
using System;
using System.Linq;
using System.Text;
namespace DTS.Common.Classes.DASFactory
{
/// <summary>
/// this class encapsulates/replaces a uint array that was already in use in FWTU and DP
/// it adds some named fields and some to and from just to make things a little easier
/// </summary>
public class TMNSConfig
{
/// <summary>
/// the TMNS config implementation in firmware is just an array of uint32, so here's the same thing internally
/// </summary>
private uint[] _values;
/// <summary>
/// the TMNS PCM sub frame id
/// </summary>
public uint TMNS_PCMSubFrameId
{
get => GetValue(Fields.TMNS_PCMSubFrameID);
set => SetValue(Fields.TMNS_PCMSubFrameID, value);
}
/// <summary>
/// the TMNS message id
/// </summary>
public uint TMNS_MsgId
{
get => GetValue(Fields.TMNS_MsgId);
set => SetValue(Fields.TMNS_MsgId, value);
}
/// <summary>
/// the TMNS PCM minor per major setting
/// </summary>
public uint TMNS_PCMMinorPerMajor
{
get => GetValue(Fields.TMNS_PCMMinorPerMajor);
set => SetValue(Fields.TMNS_PCMMinorPerMajor, value);
}
/// <summary>
/// the TMNS TMATs port number setting
/// </summary>
public uint TMNS_TMATSPortNumber
{
get => GetValue(Fields.TMNS_TMATSPortNumber);
set => SetValue(Fields.TMNS_TMATSPortNumber, value);
}
/// <summary>
/// the IENA UDP source port number
/// </summary>
public uint IENAUDP_PortNumber
{
get => GetValue(Fields.IENAUDP_PortNumber);
set => SetValue(Fields.IENAUDP_PortNumber, value);
}
/// <summary>
/// reserved field 5
/// </summary>
public uint TMNS5
{
get => GetValue(Fields.TMNS5);
set => SetValue(Fields.TMNS5, value);
}
/// <summary>
/// reserved field 6
/// </summary>
public uint TMNS6
{
get => GetValue(Fields.TMNS6);
set => SetValue(Fields.TMNS6, value);
}
/// <summary>
/// reserved field 7
/// </summary>
public uint TMNS7
{
get => GetValue(Fields.TMNS7);
set => SetValue(Fields.TMNS7, value);
}
/// <summary>
/// all fields in the TMNS config unit array and their order
/// </summary>
public enum Fields
{
TMNS_PCMSubFrameID,
TMNS_MsgId,
TMNS_PCMMinorPerMajor,
TMNS_TMATSPortNumber,
IENAUDP_PortNumber,
TMNS5,
TMNS6,
TMNS7
}
/// <summary>
/// handles common init from all constructors
/// </summary>
private void CommonInit()
{
var fields = Enum.GetValues(typeof(Fields)).Cast<Fields>().ToArray();
_values = new uint[fields.Length];
}
/// <summary>
/// constructor that takes an array of uints in the same order as the TMNS config
/// </summary>
/// <param name="parameters"></param>
public TMNSConfig(uint[] parameters)
{
CommonInit();
if (null == parameters) { return; }
for (var i = 0; i < parameters.Length && i < _values.Length; i++)
{
_values[i] = parameters[i];
}
}
/// <summary>
/// constructor that takes an array of uints comma separated (and allows for enclosing () around whole string)
/// </summary>
/// <param name="parameters"></param>
public TMNSConfig(string parameters)
{
CommonInit();
parameters = parameters.Replace("(", "").Replace(")", "");
var tokens = parameters.Split(new[] { ',' });
for (var i = 0; i < tokens.Length && i < _values.Length; i++)
{
if (uint.TryParse(tokens[i], out var temp))
{
_values[i] = temp;
}
}
}
public TMNSConfig()
{
CommonInit();
}
/// <summary>
/// sets indicated field to indicated value
/// </summary>
/// <param name="field"></param>
/// <param name="value"></param>
public void SetValue(Fields field, uint value)
{
_values[(int)field] = value;
}
/// <summary>
/// gets the value from the indicated field
/// </summary>
/// <param name="field"></param>
/// <returns></returns>
public uint GetValue(Fields field) => _values[(int)field];
public uint[] ToUintArray()
{
var copy = new uint[_values.Length];
_values.CopyTo(copy, 0);
return copy;
}
/// <summary>
/// returns a string suitable for storage (x,...n) of the TMNS config
/// </summary>
/// <returns></returns>
public string ToCSVString()
{
var sb = new StringBuilder();
sb.Append("(");
for (var i = 0; i < _values.Length; i++)
{
if (i > 0) { sb.Append(","); }
sb.Append(_values[i]);
}
sb.Append(")");
return sb.ToString();
}
/// <summary>
/// returns true if the profile is a ch10 streaming profile
/// </summary>
/// <param name="profile"></param>
/// <returns></returns>
public static bool IsCh10(UDPStreamProfile profile)
{
switch (profile)
{
case UDPStreamProfile.CH10_MANUAL_CONFIG:
case UDPStreamProfile.CH10_PCM128_MM:
case UDPStreamProfile.CH10_ANALOG:
case UDPStreamProfile.CH10_PCM_STANDARD:
case UDPStreamProfile.CH10_PCM_SUPERCOM:
case UDPStreamProfile.CH10_PCM_128BIT_2HDR:
case UDPStreamProfile.CH10_ANALOG_2HDR:
case UDPStreamProfile.CH10_PCM_STANDARD_2HDR:
case UDPStreamProfile.CH10_PCM_SUPERCOM_2HDR:
return true;
default:
return false;
}
}
/// <summary>
/// returns true if the streaming profile is an IENA profile
/// </summary>
/// <param name="profile"></param>
/// <returns></returns>
public static bool IsIENA(UDPStreamProfile profile)
{
switch (profile)
{
case UDPStreamProfile.IENA_PTYPE_STREAM: return true;
default: return false;
}
}
/// <summary>
/// returns true if the streaming profile is a TMNS profile
/// </summary>
/// <param name="profile"></param>
/// <returns></returns>
public static bool IsTMNS(UDPStreamProfile profile)
{
switch (profile)
{
case UDPStreamProfile.TMNS_PCM_STANDARD:
case UDPStreamProfile.TMNS_PCM_SUPERCOM:
return true;
default: return false;
}
}
/// <summary>
/// returns true if the streaming profile is a UART profile
/// </summary>
/// <param name="profile"></param>
/// <returns></returns>
public static bool IsUART(UDPStreamProfile profile)
{
switch (profile)
{
case UDPStreamProfile.UART_STREAM: return true;
default: return false;
}
}
}
}