init
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DTS.Serialization.IRIGCH10.Packets
|
||||
{
|
||||
public class TransportStreamHeader : ITransportStreamHeader
|
||||
{
|
||||
/*• Transport Stream: 4-byte or 32-bit value. (Byteswap to PC format.)
|
||||
o Bit [3:0] 4-bit Message Format is set to 1.
|
||||
o Bit [7:4] 4-bit Message Type is set to 0.
|
||||
o Bit [31:8] 24-bit UDP message sequence number. It is incremented by 1 for each packet sent out in stream including Time data packet, CGPD (TMATS), and Analog data packets.
|
||||
*/
|
||||
private byte[] _bytes = new byte[4];
|
||||
public int MessageFormat { get; }
|
||||
public int MessageType { get; }
|
||||
public int SequenceNumber { get; }
|
||||
|
||||
public TransportStreamHeader()
|
||||
{
|
||||
|
||||
}
|
||||
public TransportStreamHeader(byte[] input)
|
||||
{
|
||||
if (null == input) { throw new NullReferenceException($"input is null"); }
|
||||
if (TRANSPORT_HEADER_LENGTH != input.Length) { throw new Exception($"Expected {TRANSPORT_HEADER_LENGTH} bytes, received {input.Length}"); }
|
||||
Buffer.BlockCopy(input, 0, _bytes, 0, TRANSPORT_HEADER_LENGTH);
|
||||
var int32 = BitConverter.ToInt32(input, 0);
|
||||
var bits = new BitArray(BitConverter.GetBytes(int32));
|
||||
MessageFormat = Utils.Utils.BitArrayToInt32(bits, 0, 3);
|
||||
MessageType = Utils.Utils.BitArrayToInt32(bits, 4, 7);
|
||||
SequenceNumber = Utils.Utils.BitArrayToInt32(bits, 8, 31);
|
||||
_bytes = input;
|
||||
}
|
||||
public const int TRANSPORT_HEADER_LENGTH = 4;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
/*
|
||||
* DTS.Serialization.SliceRaw.File.IChannelHeader.cs
|
||||
*
|
||||
* Copyright © 2009
|
||||
* Diversified Technical Systems, Inc.
|
||||
* All Rights Reserved
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace DTS.Serialization.SliceRaw
|
||||
{
|
||||
public interface IChannelHeader
|
||||
{
|
||||
///// <summary>
|
||||
///// "Magic Key" required for our binary file type.
|
||||
///// </summary>
|
||||
/////
|
||||
//UInt32 RequiredMagicKey
|
||||
//{
|
||||
// get;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Header version number required for our binary file type.
|
||||
///// </summary>
|
||||
//UInt32 RequiredHeaderVersionNumber
|
||||
//{
|
||||
// get;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// "Magic Key" relatively-UID <see cref="UInt32"/> for our binary file type.
|
||||
/// </summary>
|
||||
uint MagicKey
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="UInt32"/> header version number for our binary file type.
|
||||
/// </summary>
|
||||
uint HeaderVersionNumber
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set offset of sample data start value.
|
||||
/// </summary>
|
||||
ulong OffsetOfSampleDataStart
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set number of samples.
|
||||
/// </summary>
|
||||
ulong NumberOfSamples
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set number of bits per sample.
|
||||
/// </summary>
|
||||
uint NumberOfBitsPerSample
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set signed sample indicator.
|
||||
/// </summary>
|
||||
uint AreSamplesSigned
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set sample rate value.
|
||||
/// </summary>
|
||||
double SampleRate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set number of triggers.
|
||||
/// </summary>
|
||||
ushort NumberOfTriggers
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set the trigger sample numbers
|
||||
/// </summary>
|
||||
ulong[] TriggerSampleNumbers
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set pre test zero level counts.
|
||||
/// </summary>
|
||||
int PreTestZeroLevelCounts
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ADC removed during hardware zeroing
|
||||
/// (added back in for mV values)
|
||||
/// </summary>
|
||||
int RemovedADC
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// excitation voltage
|
||||
/// </summary>
|
||||
double Excitation
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Analog Data Counts (ADC) for 0mV injected signal
|
||||
/// </summary>
|
||||
int ZeroMvInADC
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Average ADC over Zero Window specified for channel
|
||||
/// </summary>
|
||||
int WindowAverageADC
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
int OriginalOffsetADC
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
int TriggerAdjustmentSamples
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/set pre test diagnostics level counts.
|
||||
/// </summary>
|
||||
int PreTestDiagnosticsLevelCounts
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set pre test noise percentage of full scale.
|
||||
/// </summary>
|
||||
double PreTestNoisePercentageOfFullScale
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set post test zero level counts.
|
||||
/// </summary>
|
||||
int PostTestZeroLevelCounts
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set post test diagnostics level counts.
|
||||
/// </summary>
|
||||
int PostTestDiagnosticsLevelCounts
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set data zero level counts.
|
||||
/// </summary>
|
||||
int DataZeroLevelCounts
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set scale factor MV.
|
||||
/// </summary>
|
||||
double ScaleFactorMv
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set sensitivity MV/EU
|
||||
/// </summary>
|
||||
double MvPerEu
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set EU field length (with terminator).
|
||||
/// </summary>
|
||||
ushort EuFieldLengthWithTerminator
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set engineering units.
|
||||
/// </summary>
|
||||
char[] EngineeringUnit
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/set ISO code.
|
||||
/// </summary>
|
||||
char[] IsoCode
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the CRC for the current state of the header.
|
||||
/// </summary>
|
||||
uint Crc32
|
||||
{
|
||||
get;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user