Files
DP44/Common/DTS.Common.Serialization/IRIGCH10/TMATS/StorageInformation.cs
2026-04-17 14:55:32 -04:00

1497 lines
47 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
namespace IRIGCh10
{
public enum SubFrameSyncTags
{
[Description("ISF1")]
[MaxLength(32)]
SubframeIDCounterName,
[Description("ISF2")]
[MaxLength(2)]
SubframeSyncType
}
public enum SubframeSyncTypes
{
[Description("ID")]
IDCounter,
[Description("OT")]
Other
}
public class SubframeSync
{
private TMATSectionNumberedArray<SubFrameSyncTags> _subframeSyncTags;
public SubframeSync(int number=1)
{
_subframeSyncTags = new TMATSectionNumberedArray<SubFrameSyncTags>(AttributeIdentifiers.PCMFormatAttributes, number,
"ISF\\N", 99);
}
public void SetSubframeIDCounterNamer(int number, string val)
{
_subframeSyncTags.SetValue(number, SubFrameSyncTags.SubframeIDCounterName, val);
}
public void SetSubframeSyncType(int number, SubframeSyncTypes syncType)
{
_subframeSyncTags.SetValue(number, SubFrameSyncTags.SubframeSyncType,
DescriptionDecoder.GetDescription(syncType));
}
public string Serialize()
{
return _subframeSyncTags.Serialize();
}
}
public enum StorageTags
{
[Description("ID")]
[MaxLength(32)]
DataSourceID,
[MaxLength(32)]
[Description("RID")]
StorageId,
[Description("R1")]
[MaxLength(32)]
StorageDescription
}
public enum TimeDataTags
{
[Description("TTF-")]
TimeDataTypeFormat,
[Description("TFMT-")]
TimeFormat,
[Description("TSRC-")]
TimeSource
}
public enum TimeFormats
{
[Description("A")]
IRIGA,
[Description("B")]
IRIGB,
[Description("G")]
IRIGG,
[Description("I")]
Internal,
[Description("N")]
NativeGPS,
[Description("U")]
UTCFromGPS,
[Description("X")]
None
}
public enum MessageDataTypeAttributes
{
[Description("R-@x\\MTF-@n")]
[MaxLength(1)]
MessageDataTypeFormat,
[Description("R-@x\\NMS\\N-@n")]
[MaxLength(5)]
NumberOfMessageSubChannels,
[Description("R-@x\\MSCN-n-m")]
[MaxLength(5)]
MessageSubChannelNumber,
[Description("R-@x\\MCNM-@n-@m")]
[MaxLength(32)]
MessageSubChannelName
}
public class MessageDataType
{
private readonly int X;
public MessageDataType(int x)
{
X = x;
}
private Dictionary<int, string> _MessageTypeFormat = new Dictionary<int, string>();
/// <summary>
/// MESSAGE DATA TYPE FORMAT: FORMAT 0 (MESSAGE DATA) 0
/// </summary>
/// <param name="n"></param>
/// <param name="value"></param>
public void SetMessageTypeFormat(int n, string value)
{
_MessageTypeFormat[n] = value;
}
private readonly Dictionary<int, int> _NumberOfMessageSubChannels = new Dictionary<int, int>();
/// <summary>
/// SPECIFY THE NUMBER OF MESSAGE SUB-CHANNELS INCLUDED WITHIN
/// THIS CHANNEL
/// </summary>
/// <param name="n"></param>
/// <param name="value"></param>
public void SetNumberOfMessageSubChannels(int n, int value)
{
_NumberOfMessageSubChannels[n] = value;
}
private Dictionary<int, Dictionary<int, int>> _MessageSubChannelNumber =
new Dictionary<int, Dictionary<int, int>>();
/// <summary>
/// SPECIFY THE MESSAGE SUB-CHANNEL NUMBER.
/// </summary>
/// <param name="n"></param>
/// <param name="m"></param>
/// <param name="value"></param>
public void SetMessageSubChannelNumber(int n, int m, int value)
{
if (!_MessageSubChannelNumber.ContainsKey(n))
{
_MessageSubChannelNumber[n] = new Dictionary<int, int>();
}
_MessageSubChannelNumber[n][m] = value;
}
private Dictionary<int, Dictionary<int, string>> _MessageSubChannelName =
new Dictionary<int, Dictionary<int, string>>();
public void SetMessageSubChannelName(int n, int m, string value)
{
if( !_MessageSubChannelName.ContainsKey(n)){ _MessageSubChannelName[n] = new Dictionary<int, string>(); }
if( !_MessageSubChannelName[n].ContainsKey(m) ){ _MessageSubChannelName[n][m] = value; }
}
public string Serialize()
{
var sb = new StringBuilder();
//R-1\MTF-4:0;
using (var enumTypes = _MessageTypeFormat.GetEnumerator())
{
while (enumTypes.MoveNext())
{
sb.AppendLine($"R-{X}\\MTF-{enumTypes.Current.Key}:{enumTypes.Current.Value};");
}
}
//R-1\NMS\N-4:1;
using (var enumSubChannelNums = _NumberOfMessageSubChannels.GetEnumerator())
{
while (enumSubChannelNums.MoveNext())
{
sb.AppendLine($"R-{X}\\NMS\\N-{enumSubChannelNums.Current.Key}:{enumSubChannelNums.Current.Value};");
}
}
//R-1\MSCN-4-1:1;
using (var enumSubChannelNumber = _MessageSubChannelNumber.GetEnumerator())
{
while (enumSubChannelNumber.MoveNext())
{
using (var enumSubSub = enumSubChannelNumber.Current.Value.GetEnumerator())
{
while (enumSubSub.MoveNext())
{
sb.AppendLine(
$"R-{X}\\MSCN-{enumSubChannelNumber.Current.Key}-{enumSubSub.Current.Key}:{enumSubSub.Current.Value};");
}
}
}
}
//R-1\MCNM-4-1:sio/0/in2-30;
using (var enumSubChannelName = _MessageSubChannelName.GetEnumerator())
{
while (enumSubChannelName.MoveNext())
{
using (var enumSubSub = enumSubChannelName.Current.Value.GetEnumerator())
{
while (enumSubSub.MoveNext())
{
sb.AppendLine($"R-{X}\\MCNM-{enumSubChannelName.Current.Key}-{enumSubSub.Current.Key}:{enumSubSub.Current.Value};");
}
}
}
}
return sb.ToString();
}
}
public enum TimeSources
{
[Description("I")]
Internal,
[Description("E")]
External,
[Description("R")]
ExternalFromRMM,
[Description("X")]
None
}
public class Storage : TMATSSection<StorageTags>
{
/// <summary>
/// DATA SOURCE ID CONSISTENT WITH GENERAL INFORMATION GROUP
/// </summary>
public string DataSourceID
{
get => GetValue(StorageTags.DataSourceID);
set => SetValueWithLength(StorageTags.DataSourceID, value);
}
/// <summary>
/// TAPE OR STORAGE IDENTIFICATION
/// </summary>
public string StorageID
{
get => GetValue(StorageTags.StorageId);
set => SetValueWithLength(StorageTags.StorageId, value);
}
public string StorageDescription
{
get => GetValue(StorageTags.StorageDescription);
set => SetValueWithLength(StorageTags.StorageDescription, value);
}
private StorageCharacteristics _storageCharacteristics = new StorageCharacteristics(1);
private RecorderInformation _recorderInformation = new RecorderInformation(1);
private RecorderData _recorderData = new RecorderData(1);
private TMATSectionNumberedArray<PCMDataTypeTags> _pcmDataChannels =
new TMATSectionNumberedArray<PCMDataTypeTags>(AttributeIdentifiers.StorageSourceAttributes, 1, null,
ushort.MaxValue);
private RecordingEventDefinitions _recordingEventDefinitions = new RecordingEventDefinitions(1);
private TMATSectionNumberedArray<TimeDataTags> _timeData =
new TMATSectionNumberedArray<TimeDataTags>(AttributeIdentifiers.StorageSourceAttributes, 1, null, 1);
public void SetDataSourceID(int number, string value)
{
_recorderData.SetValue(number, DataTags.DataSourceID, value);
}
public void SetChannelDataType(int number, ChannelDataTypes dataType)
{
_recorderData.SetValue(number, DataTags.ChannelDataType, DescriptionDecoder.GetDescription(dataType));
}
public void SetTrackNumber(int number, ushort trackNumber)
{
_recorderData.SetValue(number, DataTags.TrackNumber, trackNumber.ToString());
}
/// <summary>
/// INDICATES IF SOURCE IS ENABLED. SOURCE MUST BE ENABLED TO
/// GENERATE DATA PACKETS.
/// </summary>
/// <param name="number"></param>
/// <param name="bEnabled"></param>
public void SetChannelEnabled(int number, bool bEnabled)
{
_recorderData.SetValue(number, DataTags.ChannelEnable, bEnabled ? "T" : "F");
}
public void SetChannelDataLinkName(int number, string value)
{
_recorderData.SetValue(number, DataTags.ChannelDataLinkName, value);
}
public void SetPhysicalChannelNumber(int number, ushort channelNumber)
{
_recorderData.SetValue(number, DataTags.RecorderPhysicalChannelNumber, channelNumber.ToString());
}
public void SetTimeChannelDataTypeFormat()
{
_timeData.SetValue(1, TimeDataTags.TimeDataTypeFormat, "1");
}
public void SetTimeFormat(TimeFormats format)
{
_timeData.SetValue(1, TimeDataTags.TimeFormat,
DescriptionDecoder.GetDescription(format));
}
public void SetTimeSource(TimeSources source)
{
_timeData.SetValue(1, TimeDataTags.TimeSource,
DescriptionDecoder.GetDescription(source));
}
public void SetPCMDataTimeFormat(int number)
{
_pcmDataChannels.SetValue(number, PCMDataTypeTags.PCMDataTypeFormat, "1");
}
public void SetPCMInputClockEdge(int number, InputClockEdges edge)
{
_pcmDataChannels.SetValue(number, PCMDataTypeTags.InputClockEdge,
DescriptionDecoder.GetDescription(edge));
}
public void SetPCMDataPackingOption(int number, DataPackingOptions option)
{
_pcmDataChannels.SetValue(number, PCMDataTypeTags.DataPackingOption,
DescriptionDecoder.GetDescription(option));
}
public void SetPCMInputSignalType(int number, InputSignalTypes signalType)
{
_pcmDataChannels.SetValue(number, PCMDataTypeTags.InputSignalType,
DescriptionDecoder.GetDescription(signalType));
}
public void SetPCMVideoTypeFormat(int number, VideoFormats format)
{
_pcmDataChannels.SetValue(number, PCMDataTypeTags.PCMVideoTypeFormat,
DescriptionDecoder.GetDescription(format));
}
public int NumberOfChannels
{
get => _recorderData.GetCount();
set => _recorderData.SetCount(value);
}
public bool OriginalStorage
{
get => _recorderInformation.OriginalStorage;
set => _recorderInformation.OriginalStorage = value;
}
public DateTime? DateTimeCreated
{
get => _recorderInformation.DateAndTimeCreated;
set => _recorderInformation.DateAndTimeCreated = value;
}
public int? NumberOfSourceBits
{
get => _storageCharacteristics.NumberOfSourceBits;
set => _storageCharacteristics.NumberOfSourceBits = value;
}
/// <summary>
/// INDICATES IF INDEX IS ENABLED. INDEX MUST BE ENABLED TO
/// GENERATE INDEX PACKETS.
/// </summary>
public bool RecordingEventsEnabled
{
get => _recordingEventDefinitions.RecordingEventsEnabled;
set => _recordingEventDefinitions.RecordingEventsEnabled = value;
}
private RecordingIndex _recordingIndex = new RecordingIndex(1);
/// <summary>
/// INDICATES IF INDEX IS ENABLED. INDEX MUST BE ENABLED TO
/// GENERATE INDEX PACKETS.
/// </summary>
public bool RecordingIndexEnabled
{
get => _recordingIndex.RecordingIndexEnabled;
set => _recordingIndex.RecordingIndexEnabled = value;
}
public RecordingIndexTypes RecordingIndexType
{
get => _recordingIndex.RecordingIndexType;
set => _recordingIndex.RecordingIndexType = value;
}
/// <summary>
/// IDENTIFY THE NUMBER OF MICROSECONDS FOR EACH INDEX
/// ENTRY GENERATION
/// </summary>
public int RecordingIndexTimeValue
{
get => _recordingIndex.IndexTimeValue;
set => _recordingIndex.IndexTimeValue = value;
}
/// <summary>
/// IDENTIFY THE NUMBER OF PACKETS FOR EACH INDEX ENTRY
/// GENERATION
/// </summary>
public int RecordingIndexCountValue
{
get => _recordingIndex.IndexCountValue;
set => _recordingIndex.IndexCountValue = value;
}
public Storage(int number) : base(AttributeIdentifiers.StorageSourceAttributes, number)
{
}
public override string Serialize()
{
var sb = new StringBuilder();
var s = base.Serialize();
if (!string.IsNullOrWhiteSpace(s))
{
sb.Append(s);
}
s = _storageCharacteristics.Serialize();
if (!string.IsNullOrWhiteSpace(s))
{
sb.Append(s);
}
s = _recorderInformation.Serialize();
if (!string.IsNullOrWhiteSpace(s))
{
sb.Append(s);
}
s = _recorderData.Serialize();
if (!string.IsNullOrWhiteSpace(s))
{
sb.Append(s);
}
s = _pcmDataChannels.Serialize();
if (!string.IsNullOrWhiteSpace(s))
{
sb.Append(s);
}
s = _recordingEventDefinitions.Serialize();
if (!string.IsNullOrWhiteSpace(s))
{
sb.Append(s);
}
s = _recordingIndex.Serialize();
if (!string.IsNullOrWhiteSpace(s))
{
sb.Append(s);
}
s = _timeData.Serialize();
if (!string.IsNullOrWhiteSpace(s))
{
sb.Append(s);
}
return sb.ToString();
}
}
public class StorageCharacteristics : TMATSSection<StorageCharactersticTags>
{
/// <summary>
/// SPECIFY THE TAPE OR STORAGE TYPE: ANALOG - ANAL
/// CASSETTE - CASS HDDR - HDDR PARALLEL - PARA
/// SOLID STATE RECORDER - SSR OTHER - OTHR, DEFINE IN COMMENTS
/// RECORD.
/// </summary>
public StorageTypes? StorageType
{
get
{
var s = GetValue(StorageCharactersticTags.StorageType);
if (string.IsNullOrWhiteSpace(s))
{
return null;
}
var types = Enum.GetValues(typeof(StorageTypes)).Cast<StorageTypes>().ToArray();
foreach (var storagetype in types)
{
if (DescriptionDecoder.GetDescription(storagetype) == s)
{
return storagetype;
}
}
return null;
}
set
{
if (null == value)
{
SetValueWithLength(StorageCharactersticTags.StorageType, string.Empty);
}
else
{
var attr = DescriptionDecoder.GetDescription((StorageTypes) value);
SetValueWithLength(StorageCharactersticTags.StorageType, attr);
}
}
}
/// <summary>
/// NAME OF MANUFACTURER OF THE TAPE OR THE STORAGE MEDIA
/// </summary>
public string StorageManufacturer
{
get => GetValue(StorageCharactersticTags.StorageManufacturer);
set => SetValueWithLength(StorageCharactersticTags.StorageManufacturer, value);
}
/// <summary>
/// SPECIFY MANUFACTURERS TAPE OR STORAGE MEDIA DESIGNATION CODE.
/// </summary>
public string StorageCode
{
get => GetValue(StorageCharactersticTags.StorageCode);
set => SetValueWithLength(StorageCharactersticTags.StorageCode, value);
}
/// <summary>
/// PHYSICAL DIMENSION OF TAPE WIDTH, IN INCHES
/// </summary>
public string TapeWidth
{
get => GetValue(StorageCharactersticTags.TapeWidth);
set => SetValueWithLength(StorageCharactersticTags.TapeWidth, value);
}
/// <summary>
/// STATE THE REEL SIZE, INCHES:
/// </summary>
public TapeHousings? TapeHousing
{
get
{
var s = GetValue(StorageCharactersticTags.TapeHousing);
if( string.IsNullOrWhiteSpace(s)){ return null; }
var housings = Enum.GetValues(typeof(TapeHousings))
.Cast<TapeHousings>().ToArray();
foreach (var housing in housings)
{
if( DescriptionDecoder.GetDescription(housing) == s )
{
return housing;
}
}
return null;
}
set
{
if (null == value)
{
SetValueWithLength(StorageCharactersticTags.TapeHousing, string.Empty);
}
else
{
SetValueWithLength(StorageCharactersticTags.TapeHousing,
DescriptionDecoder.GetDescription((TapeHousings) value));
}
}
}
/// <summary>
/// STATE THE TYPE OF TRACKS ON THE TAPE:
/// </summary>
public TrackTypes? TypeOfTracks
{
get
{
var s = GetValue(StorageCharactersticTags.TypeOfTracks);
if( string.IsNullOrWhiteSpace(s)){ return null; }
var tracks = Enum.GetValues(typeof(TrackTypes))
.Cast<TrackTypes>().ToArray();
foreach (var track in tracks)
{
if (DescriptionDecoder.GetDescription(track) == s)
{
return track;
}
}
return null;
}
set
{
if (null == value)
{
SetValueWithLength(StorageCharactersticTags.TypeOfTracks, string.Empty);
}
else
{
SetValueWithLength(StorageCharactersticTags.TypeOfTracks,
DescriptionDecoder.GetDescription((TrackTypes)value));
}
}
}
///// <summary>
///// STATE THE NUMBER OF TRACKS ON THE TAPE OR THE NUMBER OF
///// CHANNELS ON THE STORAGE MEDIA.
///// </summary>
//public string NumberOfTracks
//{
// get => GetValue(StorageCharactersticTags.NumberOfTracks);
// set => SetValue(StorageCharactersticTags.NumberOfTracks, value);
//}
/// <summary>
/// STATE RECORD SPEED (inches/second).
/// </summary>
public string RecordSpeed
{
get => GetValue(StorageCharactersticTags.RecordSpeed);
set => SetValueWithLength(StorageCharactersticTags.RecordSpeed, value);
}
public RecordingBandwidth? DataPackingDensity
{
get
{
var val = GetValue(StorageCharactersticTags.DataPackingDensity);
if (string.IsNullOrWhiteSpace(val))
{
return null;
}
var bandwidths = Enum.GetValues(typeof(RecordingBandwidth))
.Cast<RecordingBandwidth>().ToArray();
foreach (var bandwidth in bandwidths)
{
if (DescriptionDecoder.GetDescription(bandwidth) == val)
{
return bandwidth;
}
}
return null;
}
set
{
if (null == value)
{
SetValueWithLength(StorageCharactersticTags.DataPackingDensity
, string.Empty);
}
else
{
SetValueWithLength(StorageCharactersticTags.DataPackingDensity,
DescriptionDecoder.GetDescription((RecordingBandwidth) value));
}
}
}
public bool? TapeRewound
{
get
{
var val = GetValue(StorageCharactersticTags.TapeRewound);
if (string.IsNullOrWhiteSpace(val))
{
return null;
}
if (val == "Y")
{
return true;
}
return false;
}
set
{
if (null == value)
{
SetValueWithLength(StorageCharactersticTags.TapeRewound, string.Empty);
}
else
{
SetValueWithLength(StorageCharactersticTags.TapeRewound,
((bool) value) ? "Y" : "N");
}
}
}
/// <summary>
/// NUMBER OF MOST SIGNIFICANT BITS OF THE CHANNEL ID USED FOR
/// MULTIPLEXER SOURCE ID. DEFAULT IS ZERO (ONE SOURCE).
/// </summary>
public int? NumberOfSourceBits
{
get => GetIntOrNull(StorageCharactersticTags.NumberOfSourceBits);
set => SetIntOrNull(StorageCharactersticTags.NumberOfSourceBits, value);
}
public StorageCharacteristics(int number) : base(AttributeIdentifiers.StorageSourceAttributes, number)
{
}
}
public enum RecordingBandwidth
{
[Description("IM")]
IntermediateBand,
[Description("WB")]
WideBand,
[Description("DD")]
DoubleDensity,
[Description("OT")]
Other
}
public enum TrackTypes
{
[Description("LO")]
Logitudinal,
[Description("RO")]
Rotary
}
public enum TapeHousings
{
[Description("10.5")]
TenHalf,
[Description("14.0")]
Fourteen,
[Description("15.0")]
Fifteen,
[Description("16.0")]
Sixteen,
[Description("OTHER")]
Other
}
public enum StorageTypes
{
[Description("ANAL")]
Analog,
[Description("CASS")]
Cassette,
[Description("HDDR")]
HDDR,
[Description("PARA")]
Parallel,
[Description("SSR")]
SolidStateRecorder,
[Description("OTHR")]
Other
}
public enum StorageCharactersticTags
{
[MaxLength(4)]
[Description("TC1")]
StorageType,
[MaxLength(8)]
[Description("TC2")]
StorageManufacturer,
[MaxLength(8)]
[Description("TC3")]
StorageCode,
[MaxLength(4)]
[Description("TC4")]
TapeWidth,
[MaxLength(5)]
[Description("TC5")]
TapeHousing,
[MaxLength(2)]
[Description("TT")]
TypeOfTracks,
//[MaxLength(2)]
//[Description("N")]
//NumberOfTracks,
[Description("TC6")]
[MaxLength(4)]
RecordSpeed,
[Description("TC7")]
[MaxLength(2)]
DataPackingDensity,
[Description("TC8")]
[MaxLength(1)]
TapeRewound,
[Description("NSB")]
[MaxLength(2)]
NumberOfSourceBits
}
public enum RecorderInformationTags
{
[Description("RI1")]
[MaxLength(8)]
StorageManufacturer,
[Description("RI2")]
[MaxLength(8)]
StorgeModel,
[Description("RI3")]
[MaxLength(1)]
OriginalStorage,
[Description("RI4")]
[MaxLength(19)]
DateAndTimeCreated
}
public class RIPointOfContact : TMATSSection<GeneralInformationGroup.Information.PointOfContactTags>
{
public RIPointOfContact(int number) : base(AttributeIdentifiers.StorageSourceAttributes, number)
{
}
}
public enum DubbingOrganizationPOC
{
[Description("DPOC1")]
[MaxLength(24)]
Name,
[Description("DPOC2")]
[MaxLength(48)]
Agency,
[Description("DPOC3")]
[MaxLength(48)]
Address,
[Description("DPOC4")]
[MaxLength(20)]
Telephone
}
public class DubbingOrganizationPersonOfContact : TMATSSection<DubbingOrganizationPOC>
{
public DubbingOrganizationPersonOfContact(int number) :
base(AttributeIdentifiers.StorageSourceAttributes, number)
{
}
}
public class RecorderInformation : TMATSSection<RecorderInformationTags>
{
/// <summary>
/// NAME OF TAPE DRIVE OR STORAGE DEVICE MANUFACTURER
/// </summary>
public string StorageManufacturer
{
get => GetValue(RecorderInformationTags.StorageManufacturer);
set => SetValueWithLength(RecorderInformationTags.StorageManufacturer, value);
}
/// <summary>
/// MANUFACTURERS MODEL NUMBER OF TAPE DRIVE OR STORAGE DEVICE USED
/// TO CREATE THE TAPE OR STORAGE MEDIA
/// </summary>
public string StorageModel
{
get => GetValue(RecorderInformationTags.StorgeModel);
set => SetValueWithLength(RecorderInformationTags.StorgeModel, value);
}
public bool OriginalStorage
{
get
{
var val = GetValue(RecorderInformationTags.OriginalStorage);
if (string.IsNullOrWhiteSpace(val))
{
return true;
}
return "Y" == val;
}
set
{
SetValueWithLength(RecorderInformationTags.OriginalStorage,
value ? "Y" : "N");
}
}
/// <summary>
/// DATE AND TIME TAPE OR STORAGE MEDIA WAS CREATED:
/// </summary>
public DateTime? DateAndTimeCreated
{
get
{
var val = GetValue(RecorderInformationTags.DateAndTimeCreated);
if (string.IsNullOrWhiteSpace(val))
{
return null;
}
if (DateTime.TryParseExact(val, "MM-dd-yyyy-HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture,
System.Globalization.DateTimeStyles.None,
out var dt))
{
return dt;
}
return null;
}
set
{
if (null == value)
{
SetValueWithLength(RecorderInformationTags.DateAndTimeCreated,
string.Empty);
}
else
{
var dt = (DateTime) value;
//SetValueWithLength(RecorderInformationTags.DateAndTimeCreated,
// $"{dt.Month:00}-{dt.Day:00}-{dt.Year:0000}-{dt.Hour:00}-{dt.Minute:00}-{dt.Second:00}");
//Example is only setting date??
SetValueWithLength(RecorderInformationTags.DateAndTimeCreated,
$"{dt.Month:00}-{dt.Day:00}-{dt.Year:0000}");
}
}
}
/// <summary>
/// POINT OF CONTACT AT THE FACILITY CREATING THE TAPE OR STORAGE
/// MEDIA:Name
/// </summary>
public string CreatingOrganizationPOCName
{
get => _pointOfContact.GetValue(GeneralInformationGroup.Information.PointOfContactTags.Name);
set => _pointOfContact.SetValueWithLength( GeneralInformationGroup.Information.PointOfContactTags.Name,
value);
}
/// <summary>
/// POINT OF CONTACT AT THE FACILITY CREATING THE TAPE OR STORAGE
/// MEDIA:Agency
/// </summary>
public string CreatingOrganizationPOCAgency
{
get => _pointOfContact.GetValue(GeneralInformationGroup.Information.PointOfContactTags.Agency);
set => _pointOfContact.SetValueWithLength(GeneralInformationGroup.Information.PointOfContactTags.Agency,
value);
}
/// <summary>
/// POINT OF CONTACT AT THE FACILITY CREATING THE TAPE OR STORAGE
/// MEDIA:Address
/// </summary>
public string CreatingOrganizationPOCAddress
{
get => _pointOfContact.GetValue(GeneralInformationGroup.Information.PointOfContactTags.Address);
set => _pointOfContact.SetValueWithLength(GeneralInformationGroup.Information.PointOfContactTags.Address,
value);
}
/// <summary>
/// POINT OF CONTACT AT THE FACILITY CREATING THE TAPE OR STORAGE
/// MEDIA:Telephone
/// </summary>
public string CreatingOrganizationPOCTelephone
{
get => _pointOfContact.GetValue(GeneralInformationGroup.Information.PointOfContactTags.Telephone);
set => _pointOfContact.SetValueWithLength(GeneralInformationGroup.Information.PointOfContactTags.Telephone,
value);
}
/// <summary>
/// DATE THE DUB WAS MADE:
/// </summary>
public DateTime? DateOfDub
{
get
{
var val = _dateOfDubs.GetValue(DateOfDubTags.DateOfDub);
if (string.IsNullOrWhiteSpace(val))
{
return null;
}
if (DateTime.TryParseExact(val, "MM-dd-yyyy", System.Globalization.CultureInfo.InvariantCulture,
System.Globalization.DateTimeStyles.None, out var dt))
{
return dt;
}
return null;
}
set
{
if (null == value)
{
_dateOfDubs.SetValueWithLength(DateOfDubTags.DateOfDub,
string.Empty);
}
else
{
var dt = (DateTime) value;
_dateOfDubs.SetValueWithLength(DateOfDubTags.DateOfDub,
$"{dt.Month:00}-{dt.Day:00}-{dt.Year:0000}");
}
}
}
/// <summary>
/// POINT OF CONTACT AT THE DUBBING AGENCY: NAME
/// </summary>
public string DubbingOrganizationPOCName
{
get => _dubbingPOC.GetValue(DubbingOrganizationPOC.Name);
set => _dubbingPOC.SetValueWithLength(DubbingOrganizationPOC.Name, value);
}
/// <summary>
/// POINT OF CONTACT AT THE DUBBING AGENCY: ADDRESS
/// </summary>
public string DubbingOrganizationPOCAddress
{
get => _dubbingPOC.GetValue(DubbingOrganizationPOC.Address);
set => _dubbingPOC.SetValueWithLength(DubbingOrganizationPOC.Address, value);
}
/// <summary>
/// POINT OF CONTACT AT THE DUBBING AGENCY: AGENCY
/// </summary>
public string DubbingOrganizationPOCAgency
{
get => _dubbingPOC.GetValue(DubbingOrganizationPOC.Agency);
set => _dubbingPOC.SetValueWithLength(DubbingOrganizationPOC.Agency, value);
}
/// <summary>
/// POINT OF CONTACT AT THE DUBBING AGENCY: TELEPHONE
/// </summary>
public string DubbingOrganizationTelephone
{
get => _dubbingPOC.GetValue(DubbingOrganizationPOC.Telephone);
set => _dubbingPOC.SetValueWithLength(DubbingOrganizationPOC.Telephone, value);
}
private RIPointOfContact _pointOfContact = new RIPointOfContact(1);
private DateOfDubs _dateOfDubs = new DateOfDubs(1);
private DubbingOrganizationPersonOfContact _dubbingPOC = new DubbingOrganizationPersonOfContact(1);
public RecorderInformation(int number) : base(AttributeIdentifiers.StorageSourceAttributes, number)
{
}
public override string Serialize()
{
var sb = new StringBuilder();
var s = base.Serialize();
if (!string.IsNullOrWhiteSpace(s))
{
sb.Append(s);
}
s = _pointOfContact.Serialize();
if (!string.IsNullOrWhiteSpace(s))
{
sb.Append(s);
}
s = _dateOfDubs.Serialize();
if (!string.IsNullOrWhiteSpace(s))
{
sb.Append(s);
}
s = _dubbingPOC.Serialize();
if (!string.IsNullOrWhiteSpace(s))
{
sb.Append(s);
}
return sb.ToString();
}
}
public enum DateOfDubTags
{
[Description("RI5")]
[MaxLength(10)]
DateOfDub
}
public class DateOfDubs : TMATSSection<DateOfDubTags>
{
public DateOfDubs(int number) : base(AttributeIdentifiers.StorageSourceAttributes, number)
{
}
}
public enum NumberOfTracksTags
{
[Description("N")]
[MaxLength(2)]
NumberOfTracks
}
public class NumberOfTracks : TMATSSection<NumberOfTracksTags>
{
public NumberOfTracks(int number) : base(AttributeIdentifiers.StorageSourceAttributes, number)
{
}
}
public enum RecordingEventDefinitionsTags
{
[Description("EV\\E")]
[MaxLength(1)]
RecordingEventsEnabled
}
public class RecordingEventDefinitions : TMATSSection<RecordingEventDefinitionsTags>
{
/// <summary>
/// INDICATES IF EVENTS ARE ENABLED. EVENTS MUST BE ENABLED TO
/// GENERATE EVENT PACKETS
/// </summary>
public bool RecordingEventsEnabled
{
get
{
var val = GetValue(RecordingEventDefinitionsTags.RecordingEventsEnabled);
if (string.IsNullOrWhiteSpace(val)) { return false; }
if ("T" == val){ return true; }
return false;
}
set
{
SetValueWithLength(RecordingEventDefinitionsTags.RecordingEventsEnabled,
value ? "T" : "F");
}
}
private TMATSectionNumberedArray<RecordingEventTags> _events =
new TMATSectionNumberedArray<RecordingEventTags>(AttributeIdentifiers.StorageSourceAttributes, 1,
$"R-1\\EV\\N", 999);
public RecordingEventDefinitions(int number) : base(AttributeIdentifiers.StorageSourceAttributes, number)
{
}
public override string Serialize()
{
return _events.Serialize();
}
}
public enum NumberOfRecordingEventsTags
{
[Description("EV\\N")]
NumberOfRecordingEvents
}
public class NumberOfRecordingEvents : TMATSSection<NumberOfRecordingEventsTags>
{
public NumberOfRecordingEvents(int number) : base(AttributeIdentifiers.StorageSourceAttributes, number)
{
}
}
public enum EventTypes
{
[Description("E")]
External,
[Description("D")]
MeasurementDiscrete,
[Description("L")]
MeasurementLimit,
[Description("R")]
Recorder,
[Description("O")]
Other
}
public enum EventPriorities
{
[Description("1")]
Priority1,
[Description("2")]
Priority2,
[Description("3")]
Priority3,
[Description("4")]
Priority4,
[Description("5")]
Priority5
}
public enum EventCaptureModes
{
[Description("1")]
Mode1,
[Description("2")]
Mode2,
[Description("3")]
Mode3,
[Description("4")]
Mode4,
[Description("5")]
Mode5,
[Description("6")]
Mode6
}
public enum RecordingEventTags
{
[Description("EV\\ID-")]
[MaxLength(32)]
EventID,
[Description("EV\\D-")]
[MaxLength(256)]
EventDescription,
[Description("EV\\T-")]
[MaxLength(1)]
EventType,
[Description("EV\\P-")]
[MaxLength(1)]
EventPriority,
[Description("EV\\CM-")]
[MaxLength(1)]
EventCaptureMode,
[Description("EV\\IC-")]
[MaxLength(1)]
EventInitialCapture,
[Description("EV\\LC-")]
[MaxLength(8)]
RecordingEventLimitCount,
[Description("EV\\MS-")]
[MaxLength(32)]
EventMeasurementSource,
[Description("EV\\MN-")]
[MaxLength(32)]
EventMeasurementName,
}
public enum RecordingIndexTags
{
[Description("IDX\\E")]
[MaxLength(1)]
RecordingIndexEnabled,
[Description("IDX\\IT")]
[MaxLength(1)]
RecordingIndexType,
[Description("IDX\\ITV")]
[MaxLength(8)]
IndexTimeValue,
[Description("IDX\\ICV")]
[MaxLength(4)]
IndexCountValue
}
public enum RecordingIndexTypes
{
[Description("T")]
Time,
[Description("C")]
Count
}
public class RecordingIndex : TMATSSection<RecordingIndexTags>
{
/// <summary>
/// INDICATES IF INDEX IS ENABLED. INDEX MUST BE ENABLED TO
/// GENERATE INDEX PACKETS.
/// </summary>
public bool RecordingIndexEnabled
{
get
{
var val = GetValue(RecordingIndexTags.RecordingIndexEnabled);
if (string.IsNullOrWhiteSpace(val)) { return false; }
return val == "T";
}
set => SetValueWithLength(RecordingIndexTags.RecordingIndexEnabled, value ? "T" : "F");
}
public RecordingIndexTypes RecordingIndexType
{
get
{
var val = GetValue(RecordingIndexTags.RecordingIndexType);
if (string.IsNullOrWhiteSpace(val))
{
return RecordingIndexTypes.Time;
}
if (val == "C")
{
return RecordingIndexTypes.Count;
}
return RecordingIndexTypes.Time;
}
set => SetValueWithLength(RecordingIndexTags.RecordingIndexType,
DescriptionDecoder.GetDescription(value));
}
/// <summary>
/// IDENTIFY THE NUMBER OF MICROSECONDS FOR EACH INDEX
/// ENTRY GENERATION
/// </summary>
public int IndexTimeValue
{
get
{
var val = GetValue(RecordingIndexTags.IndexTimeValue);
if (string.IsNullOrWhiteSpace(val))
{
return 0;
}
if (int.TryParse(val, System.Globalization.NumberStyles.Any,
System.Globalization.CultureInfo.InvariantCulture,
out var iTemp))
{
return iTemp;
}
return 0;
}
set
{
SetValueWithLength(RecordingIndexTags.IndexTimeValue,
value.ToString(System.Globalization.CultureInfo.InvariantCulture));
SetValueWithLength(RecordingIndexTags.IndexCountValue,
string.Empty);
}
}
/// <summary>
/// IDENTIFY THE NUMBER OF PACKETS FOR EACH INDEX ENTRY
/// GENERATION
/// </summary>
public int IndexCountValue
{
get
{
var val = GetValue(RecordingIndexTags.IndexCountValue);
if (string.IsNullOrWhiteSpace(val))
{
return 0;
}
if (int.TryParse(val, System.Globalization.NumberStyles.Any,
System.Globalization.CultureInfo.InvariantCulture,
out var iTmp))
{
return iTmp;
}
return 0;
}
set
{
SetValueWithLength(RecordingIndexTags.IndexCountValue,
value.ToString(System.Globalization.CultureInfo.InvariantCulture));
SetValueWithLength(RecordingIndexTags.IndexTimeValue, string.Empty);
}
}
public RecordingIndex(int number) : base(AttributeIdentifiers.StorageSourceAttributes, 1)
{
}
}
public enum DataDirections
{
[Description("FWD")]
Forward,
[Description("REV")]
Reverse
}
public enum ChannelDataTypes
{
[Description("PCMIN")]
PCMInput,
[Description("ANAIN")]
AnalogInput,
[Description("DISIN")]
DiscreteInput,
[Description("TIMEIN")]
IRIGTimeInput,
[Description("VIDIN")]
VideoInput,
[Description("UARTIN")]
UARTInput,
[Description("1553IN")]
Input1553,
[Description("429IN")]
ARINC429Input,
[Description("MSGIN")]
MessageDataInput,
[Description("IMGIN")]
ImageDataInput,
[Description("1394IN")]
IEEE1394Input,
[Description("PARIN")]
ParallelInput,
[Description("ETHIN")]
EthernetInput
}
public class RecorderData : TMATSectionNumberedArray<DataTags>
{
public RecorderData(int number) : base(AttributeIdentifiers.StorageSourceAttributes, number, "N", 99)
{
}
}
public enum DataTags
{
[Description("TK1-")]
[MaxLength(5)]//max 2 bytes as an unsigned short, but it's
//represented as a string ....
TrackNumber,
[Description("TK2-")]
[MaxLength(6)]
RecordingTechnique,
[Description("DSI-")]
[MaxLength(32)]
DataSourceID,
[Description("TK3-")]
[MaxLength(3)]
DataDirection,
[Description("TK4-")]
[MaxLength(5)]
RecorderPhysicalChannelNumber,
[Description("CHE-")]
[MaxLength(1)]
ChannelEnable,
[Description("CDT-")]
[MaxLength(6)]
ChannelDataType,
[Description("CDLN-")]
[MaxLength(32)]
ChannelDataLinkName
}
public enum DataPackingOptions
{
[Description("UN")]
Unpacked,
[Description("PFS")]
PackedWithFrameSync,
[Description("TM")]
ThroughputMode
}
public enum InputClockEdges
{
[Description("0")]
ZeroDegrees,
[Description("180")]
OneHundredEightyDegrees
}
public enum InputSignalTypes
{
[Description("SE")]
SingleEnded,
[Description("DIFF")]
Differential,
[Description("RS422")]
RS422StandardDifferential,
[Description("TTL")]
SingleEndedWithTTL
}
public enum InputTerminations
{
[Description("LOW-Z")]
LowZ,
[Description("HIGH-Z")]
HighZ
}
public enum VideoFormats
{
[Description("NONE")]
None,
[Description("MPEG1")]
MPEG1,
[Description("MPEG2")]
MPEG2,
[Description("H261")]
H261,
[Description("WAVE")]
WAVE,
[Description("OTHER")]
OTHER
}
public enum PCMDataTypeTags
{
[Description("PDTF-")]
[MaxLength(1)]
PCMDataTypeFormat,
[Description("PDP-")]
[MaxLength(3)]
DataPackingOption,
[Description("ICE-")]
[MaxLength(3)]
InputClockEdge,
[Description("IST-")]
[MaxLength(5)]
InputSignalType,
[Description("ITH-")]
[MaxLength(5)]
InputThreshold,
[Description("ITM-")]
[MaxLength(6)]
InputTermination,
[Description("PTF-")]
[MaxLength(5)]
PCMVideoTypeFormat
}
}