init
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
using System;
|
||||
using DTS.Common.Enums.DASFactory;
|
||||
using System.Xml;
|
||||
using System.IO.Ports;
|
||||
using DTS.Common.Enums;
|
||||
using DTS.Common.Utilities.Logging;
|
||||
|
||||
namespace DTS.DASLib.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// Class for storing/applying CAN settings as a channel
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class CANInputDASChannel : InputDASChannel
|
||||
{
|
||||
/// <summary>
|
||||
/// CTOR to populate a channel's owning module and channel WRT that module. Calls
|
||||
/// base class CTOR.
|
||||
/// </summary>
|
||||
/// <param name="owner">Module that contains this channel.</param>
|
||||
/// <param name="channelNumber">ChannelNumber of this channel WRT owning module.</param>
|
||||
public CANInputDASChannel(DASModule owner, int channelNumber)
|
||||
: base(owner, channelNumber)
|
||||
{
|
||||
SerialNumber = owner.SerialNumber();
|
||||
}
|
||||
|
||||
public CANInputDASChannel()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Serial number of the sensor.
|
||||
/// </summary>
|
||||
public string SerialNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the hardware channel
|
||||
/// </summary>
|
||||
public string HardwareChannelName { get; set; }
|
||||
|
||||
public bool IsFD { get; set; }
|
||||
public int ArbBaseBitrate { get; set; }
|
||||
public int ArbBaseSJW { get; set; }
|
||||
public int DataBitrate { get; set; }
|
||||
public int DataSJW { get; set; }
|
||||
public string FileType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the channel has a serial number in the SerialNumber field, it is "Configured".
|
||||
/// </summary>
|
||||
public override bool IsConfigured()
|
||||
{
|
||||
return !string.IsNullOrEmpty(SerialNumber);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"CAN{ModuleChannelNumber}";
|
||||
}
|
||||
public override void WriteXml(XmlWriter writer)
|
||||
{
|
||||
base.WriteXml(writer);
|
||||
|
||||
// SerialNumber
|
||||
XMLHelper.PutString(writer, "SerialNumber", SerialNumber);
|
||||
XMLHelper.PutString(writer, "HardwareChannelName", HardwareChannelName);
|
||||
XMLHelper.PutString(writer, "IsFD", IsFD.ToString());
|
||||
XMLHelper.PutString(writer, "ArbBaseBitrate", ArbBaseBitrate.ToString());
|
||||
XMLHelper.PutString(writer, "ArbBaseSJW", ArbBaseSJW.ToString());
|
||||
XMLHelper.PutString(writer, "DataBitrate", DataBitrate.ToString());
|
||||
XMLHelper.PutString(writer, "DataSJW", DataSJW.ToString());
|
||||
XMLHelper.PutString(writer, "FileType", FileType);
|
||||
}
|
||||
private const string SERIALNUMBER_TAG = "SerialNumber";
|
||||
private const string HARDWARECHANNELNAME_TAG = "HardwareChannelName";
|
||||
private const string ISFD_TAG = "IsFD";
|
||||
private const string ARBBASEBITRATE_TAG = "ArbBaseBitrate";
|
||||
private const string ARBBASESJW_TAG = "ArbBaseSJW";
|
||||
private const string DATABITRATE_TAG = "DataBitrate";
|
||||
private const string DATASJW_TAG = "DataSJW";
|
||||
private const string FILETYPE_TAG = "FileType";
|
||||
protected override void HandleElement(XmlReader reader)
|
||||
{
|
||||
base.HandleElement(reader);
|
||||
if (reader.NodeType == XmlNodeType.Element)
|
||||
{
|
||||
switch (reader.Name)
|
||||
{
|
||||
case SERIALNUMBER_TAG:
|
||||
SerialNumber = XMLHelper.GetString(reader);
|
||||
break;
|
||||
case HARDWARECHANNELNAME_TAG:
|
||||
HardwareChannelName = XMLHelper.GetString(reader);
|
||||
break;
|
||||
case ISFD_TAG:
|
||||
IsFD = Convert.ToBoolean(XMLHelper.GetString(reader));
|
||||
break;
|
||||
case ARBBASEBITRATE_TAG:
|
||||
ArbBaseBitrate = Convert.ToInt32(XMLHelper.GetString(reader));
|
||||
break;
|
||||
case ARBBASESJW_TAG:
|
||||
ArbBaseSJW = Convert.ToInt32(XMLHelper.GetString(reader));
|
||||
break;
|
||||
case DATABITRATE_TAG:
|
||||
DataBitrate = Convert.ToInt32(XMLHelper.GetString(reader));
|
||||
break;
|
||||
case DATASJW_TAG:
|
||||
DataSJW = Convert.ToInt32(XMLHelper.GetString(reader));
|
||||
break;
|
||||
case FILETYPE_TAG:
|
||||
FileType = XMLHelper.GetString(reader);
|
||||
break;
|
||||
default:
|
||||
// let child handle it
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
using DTS.Common.Interface.DASFactory;
|
||||
using DTS.Common.Interface.StatusAndProgressBar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DTS.Common.Enums;
|
||||
using System.IO.Ports;
|
||||
using DTS.Common.Classes.DSP;
|
||||
|
||||
namespace DTS.DASLib.Service
|
||||
{
|
||||
public interface IConfigurationActions
|
||||
{
|
||||
/// <summary>
|
||||
/// for DAS that support setting channel types and auto detecting attached sensor types
|
||||
/// this sets the channels back into auto detect configuration and out of a forced
|
||||
/// configuration.
|
||||
/// an example of this is SLICE 2 which supports forced IEPE and forced bridge (and autodect)
|
||||
/// this sets the bridge type and queries each channel for channel type and stores the result in ConfigData channels
|
||||
/// [(c as AnalogInputDASChannel).IEPEChannel]
|
||||
/// </summary>
|
||||
/// <param name="callback"></param>
|
||||
/// <param name="userData"></param>
|
||||
void AutoDetect(bool bQueryConfiguration, ServiceCallback callback, object userData);
|
||||
/// <summary>
|
||||
/// Verify that the ConfigData property is correctly constructed
|
||||
/// </summary>
|
||||
/// <param name="DoStrictCheck">Set to true if your're arming</param>
|
||||
void VerifyConfig(bool DoStrictCheck);
|
||||
void VerifyConfig(bool DoStrictCheck, ErrorCallback FailedChallengeFunc);
|
||||
|
||||
/// <summary>
|
||||
/// sets the user attributes for first use date to the given date
|
||||
/// to unset the date the firstUseDate should be set to MsqlDateTime.MinValue
|
||||
/// </summary>
|
||||
/// <param name="firstUseDate"></param>
|
||||
/// <param name="callback"></param>
|
||||
/// <param name="userData"></param>
|
||||
void SetFirstUseDate(DateTime firstUseDate, ServiceCallback callback, object userData);
|
||||
/// <summary>
|
||||
/// resets trigger/start line attributes in SLICE,
|
||||
/// calls ArmOff for TDAS
|
||||
/// </summary>
|
||||
void StoreTestSetupXML(ServiceCallback callback, object userData, string testSetupXML);
|
||||
void ResetHardwareLines(ServiceCallback callback, object userData);
|
||||
void CheckAAFilterRate(ServiceCallback callback, object userData);
|
||||
|
||||
void QueryTestSetup(ServiceCallback callback,
|
||||
object userData);
|
||||
/// <summary>
|
||||
/// Apply the data in the ConfigData property to the DAS
|
||||
/// </summary>
|
||||
/// <param name="callback">The function to call with information</param>
|
||||
/// <param name="userData">Whatever you want to pass along</param>
|
||||
/// <param name="MaxAAF">array of double for Max AAF, 0 is TDAS, 1 is G5, not needed for slice, so not used</param>
|
||||
/// <param name="tmatsIntervals">lookup with interval between sending TMATS while streaming
|
||||
/// key is unit and value is time in ms</param>
|
||||
void Configure(ServiceCallback callback,
|
||||
object userData,
|
||||
bool bEventConfig,
|
||||
bool DummyConfig,
|
||||
double[] MaxAAF,
|
||||
bool configureDigitalOutputs,
|
||||
uint crc,
|
||||
bool turnOffAAFRealtime,
|
||||
IStreamingFilterProfile dspFilterType,
|
||||
bool discardDiagnostics, Dictionary<IDASCommunication, ushort> timeChannelIds, Dictionary<IDASCommunication, ushort> dataChannelIds,
|
||||
Dictionary<IDASCommunication, UDPStreamProfile> streamProfiles, Dictionary<IDASCommunication, int> streamADCPerPacket, Dictionary<IDASCommunication, ushort> irigTDPIntervals,
|
||||
Dictionary<IDASCommunication, string> addresses, Dictionary<IDASCommunication, uint[]> tmnsConfigs,
|
||||
Dictionary<IDASCommunication, uint> baudRates, Dictionary<IDASCommunication, uint> dataBits, Dictionary<IDASCommunication, StopBits> stopBits,
|
||||
Dictionary<IDASCommunication, Parity> parities, Dictionary<IDASCommunication, Handshake> flowControls, Dictionary<IDASCommunication, UartDataFormat> dataFormats,
|
||||
Dictionary<IDASCommunication, ushort> tmatsIntervals
|
||||
);
|
||||
/// <summary>
|
||||
/// Apply level triggers only [no other configuration actions]
|
||||
/// </summary>
|
||||
/// <param name="callback"></param>
|
||||
/// <param name="userData"></param>
|
||||
void ApplyLevelTriggers(ServiceCallback callback, object userData);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve configuration from DAS and store it in the ConfigData property
|
||||
/// </summary>
|
||||
/// <param name="callback">The function to call with information</param>
|
||||
/// <param name="userData">Whatever you want to pass along</param>
|
||||
void QueryConfiguration(ServiceCallback callback, object userData, uint crc, string strConfig, bool bReadIds, bool bDeviceScaleFactors = true, bool sourceDASStorageList = false);
|
||||
|
||||
/// <summary>
|
||||
/// updates the configuration on the units using a file as input data
|
||||
/// 17872 Use DASConfig XMLs on disk when performing an emergency download with DAS that have blank filestore(s)
|
||||
/// </summary>
|
||||
void UpdateConfigurationFromFile(ServiceCallback callback, object userData, string filePath);
|
||||
/// <summary>
|
||||
/// Retrieve the EID's and store it in the ConfigData property
|
||||
/// </summary>
|
||||
/// <param name="callback">The function to call with information</param>
|
||||
/// <param name="userData">Whatever you want to pass along</param>
|
||||
void UpdateIDs(ServiceCallback callback, object userData);
|
||||
|
||||
void UpdateId(ServiceCallback callback, object userData, DASModule module, DASChannel channel);
|
||||
|
||||
void CheckSafetyState(bool bArmed, ServiceCallback callback, object userData);
|
||||
|
||||
/// <summary>
|
||||
/// Reboot a device
|
||||
/// FB15335: Move UART and ClockProfile sets to RunTest -> Hardware NavStep, add Reboot
|
||||
/// </summary>
|
||||
/// <param name="callback">The function to call with information</param>
|
||||
/// <param name="userData">Whatever you want to pass along</param>
|
||||
void Reboot(ServiceCallback callback, object userData);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user