/// <summary> /// Initializes a new instance of the XtfBasePacket class that contain the values extracted from the given byte array. /// </summary> /// <param name="byteArray">The size of array need to be at least of 14 bytes.</param> public XtfBasePacket(Byte[] byteArray) { _MagicNumber = 0; _HeaderType = 0; _SubChannelNumber = 0; _NumberChannelsToFollow = 0; _Reserved1 = 0; _Reserved2 = 0; _NumberBytesThisRecord = 0; _PacketTime = DateTime.MinValue; using (BinaryReader pd = new BinaryReader(ArrayToStream.BytesToMemory(byteArray))) { if (byteArray.Length >= 14) { // Read the basic information of the packet _MagicNumber = pd.ReadUInt16(); // 0-1 _HeaderType = pd.ReadByte(); // 2 _SubChannelNumber = pd.ReadByte(); // 3 _NumberChannelsToFollow = pd.ReadUInt16(); // 4-5 _Reserved1 = pd.ReadUInt16(); // 6-7 _Reserved2 = pd.ReadUInt16(); // 8-9 _NumberBytesThisRecord = pd.ReadUInt32(); // 10-11-12-13 } } }
/// <summary> /// Initializes a new instance of the BathySnippet1 class that contain the values extracted from the given byte array. /// </summary> /// <param name="byteArray">The size of array need to be at least of 24 bytes.</param> public BathySnippet1(Byte[] byteArray) { _HeaderSize = 0; _DataSize = 0; _PingNumber = 0; _Beam = 0; _SnipSamples = 0; _GainStart = 0; _GainEnd = 0; _FragOffset = 0; _FragSamples = 0; UInt32 chkNumber; using (BinaryReader dp = new BinaryReader(ArrayToStream.BytesToMemory(byteArray))) { if (byteArray.Length >= 24) { chkNumber = dp.ReadUInt32(); // 0-1-2-3 if (chkNumber == MagicId) { _HeaderSize = dp.ReadUInt16(); // 4-5 _DataSize = dp.ReadUInt16(); // 6-7 _PingNumber = dp.ReadUInt32(); // 8-9-10-11 _Beam = dp.ReadUInt16(); // 12-13 _SnipSamples = dp.ReadUInt16(); // 14-15 _GainStart = dp.ReadUInt16(); // 16-17 _GainEnd = dp.ReadUInt16(); // 18-19 _FragOffset = dp.ReadUInt16(); // 20-21 _FragSamples = dp.ReadUInt16(); // 22-23 } } } }
/// <summary> /// Initializes a new instance of the QpsMultiTxEntry class that contain the values extracted from the given byte array. /// </summary> /// <param name="byteArray">The size of array need to be at least of 64 bytes.</param> public QpsMultiTxEntry(Byte[] byteArray) { _Id = 0; _Intensity = 0; _Quality = 0; _TwoWayTravelTime = 0; _DeltaTime = 0; _OffsetX = 0; _OffsetY = 0; _OffsetZ = 0; using (BinaryReader dp = new BinaryReader(ArrayToStream.BytesToMemory(byteArray))) { if (byteArray.Length >= 32) { _Id = dp.ReadInt32(); // 0-1-2-3 _Intensity = dp.ReadSingle(); // 4-5-6-7 _Quality = dp.ReadInt32(); // 8-9-10-11 _TwoWayTravelTime = dp.ReadSingle(); // 12-13-14-15 _DeltaTime = dp.ReadSingle(); // 16-17-18-19 _OffsetX = dp.ReadSingle(); // 20-21-22-23 _OffsetY = dp.ReadSingle(); // 24-25-26-27 _OffsetZ = dp.ReadSingle(); // 28-29-30-31 } } }
/// <summary> /// Initializes a new instance of the PingChannelHeader class that contain the values extracted from the given byte array. /// </summary> /// <param name="byteArray">The size of array need to be at least of 64 bytes.</param> public PingChannelHeader(Byte[] byteArray) { _ChannelNumber = 0; _DownSampleMethod = 0; _SlantRange = 0; _GroundRange = 0; _TimeDelay = 0; _TimeDuration = 0; _SecondsPerPing = 0; _ProcessingFlags = 0; _Frequency = 0; _InitialGainCode = 0; _GainCode = 0; _Bandwidth = 0; _ContactNumber = 0; _ContactClassification = 0; _ContactSubNumber = 0; _ContactType = 0; _NumberSamples = 0; _MillivoltScale = 0; _ContactTimeOffTrack = 0; _ContactCloseNumber = 0; _FixedVSOP = 0; _Weight = 0; using (BinaryReader dp = new BinaryReader(ArrayToStream.BytesToMemory(byteArray))) { if (byteArray.Length >= 60) { _ChannelNumber = dp.ReadUInt16(); // 0-1 _DownSampleMethod = dp.ReadUInt16(); // 2-3 _SlantRange = dp.ReadSingle(); // 4-5-6-7 _GroundRange = dp.ReadSingle(); // 8-9-10-11 _TimeDelay = dp.ReadSingle(); // 12-13-14-15 _TimeDuration = dp.ReadSingle(); // 16-17-18-19 _SecondsPerPing = dp.ReadSingle(); // 20-21-22-23 _ProcessingFlags = dp.ReadUInt16(); // 24-25 _Frequency = dp.ReadUInt16(); // 26-27 _InitialGainCode = dp.ReadUInt16(); // 28-29 _GainCode = dp.ReadUInt16(); // 30-31 _Bandwidth = dp.ReadUInt16(); // 32-33 _ContactNumber = dp.ReadUInt32(); // 34-35-36-37 _ContactClassification = dp.ReadUInt16(); // 38-39 _ContactSubNumber = dp.ReadByte(); // 40 _ContactType = dp.ReadByte(); // 41 _NumberSamples = dp.ReadUInt32(); // 42-43-44-45 _MillivoltScale = dp.ReadUInt16(); // 46-47 _ContactTimeOffTrack = dp.ReadSingle(); // 48-49-50-51 _ContactCloseNumber = dp.ReadByte(); // 52 dp.ReadByte(); // 53 Unused _FixedVSOP = dp.ReadSingle(); // 54-55-56-57 _Weight = dp.ReadInt16(); // 58-59 } } }
/// <summary> /// Initializes a new instance of the ChannelInfo class that contain the values extracted from the given byte array. /// </summary> /// <param name="byteArray">The size of array need to be at least of 128 bytes.</param> public ChannelInfo(Byte[] byteArray) { _TypeOfChannel = ChannelTypes.Subbottom; _SubChannelNumber = 0; _CorrectionFlag = CorrectionFlags.Range; _Polarity = DataPolarity.Bipolar; _BytesPerSample = 0; _SamplesPerChannel = 0; _ChannelName = " "; _VoltScale = 0; _Frequency = 0; _HorizontalBeamAngle = 0; _TiltAngle = 0; _BeamWidth = 0; _OffsetX = 0; _OffsetY = 0; _OffsetZ = 0; _OffsetYaw = 0; _OffsetPitch = 0; _OffsetRoll = 0; _BeamsPerArray = 0; _Latency = 0; using (BinaryReader dp = new BinaryReader(ArrayToStream.BytesToMemory(byteArray))) { if (byteArray.Length >= 128) { _TypeOfChannel = (ChannelTypes)dp.ReadByte(); // 0 _SubChannelNumber = dp.ReadByte(); // 1 _CorrectionFlag = (CorrectionFlags)dp.ReadUInt16(); // 2-3 _Polarity = (DataPolarity)dp.ReadUInt16(); // 4-5 _BytesPerSample = dp.ReadUInt16(); // 6-7 _SamplesPerChannel = dp.ReadUInt32(); // 8-9-10-11 _ChannelName = new String(dp.ReadChars(16)); // 12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27 _VoltScale = dp.ReadSingle(); // 28-29-30-31 _Frequency = dp.ReadSingle(); // 32-33-34-35 _HorizontalBeamAngle = dp.ReadSingle(); // 36-37-38-39 _TiltAngle = dp.ReadSingle(); // 40-41-42-43 _BeamWidth = dp.ReadSingle(); // 44-45-46-47 _OffsetX = dp.ReadSingle(); // 48-49-50-51 _OffsetY = dp.ReadSingle(); // 52-53-54-55 _OffsetZ = dp.ReadSingle(); // 56-57-58-59 _OffsetYaw = dp.ReadSingle(); // 60-61-62-63 _OffsetPitch = dp.ReadSingle(); // 64-65-66-67 _OffsetRoll = dp.ReadSingle(); // 68-69-70-71 _BeamsPerArray = dp.ReadUInt16(); // 72-73 _Latency = dp.ReadSingle(); // 74-75-76-77 } } }
/// <summary> /// Initializes a new instance of the PingChannelData class that contain the values extracted from the given byte array. /// </summary> /// <param name="byteArray">The size of array need to be at least of NumberOfSamples multiplied by BytesPerSample.</param> /// <param name="NumberOfSamples">The number of samples that are stored.</param> /// <param name="BytesPerSample">The quantity of bytes for each sample stored.</param> /// <param name="IsDataUnipolar">The polarity of the data.</param> public PingChannelData(byte[] byteArray, UInt32 NumberOfSamples, UInt16 BytesPerSample, bool IsDataUnipolar) { _chanData = new byte[NumberOfSamples - 1]; if (byteArray.Length >= (NumberOfSamples * BytesPerSample)) { using (BinaryReader dp = new BinaryReader(ArrayToStream.BytesToMemory(byteArray))) { for (UInt32 s = 0; s < NumberOfSamples; s++) { if (IsDataUnipolar) { if (BytesPerSample == 1) { _chanData[s] = ConvertToByte(dp.ReadByte()); } else { if (BytesPerSample == 2) { _chanData[s] = ConvertToByte(dp.ReadUInt16()); } else { _chanData[s] = ConvertToByte(dp.ReadUInt32()); } } } else // Data is Bipolar { if (BytesPerSample == 1) { _chanData[s] = ConvertToByte(dp.ReadSByte()); } else { if (BytesPerSample == 2) { _chanData[s] = ConvertToByte(dp.ReadInt16()); } else { _chanData[s] = ConvertToByte(dp.ReadInt32()); } } } } } } }
/// <summary> /// Initializes a new instance of the BeamXYZA class that contain the values extracted from the given byte array. /// </summary> /// <param name="byteArray">The size of array need to be at least of 31 bytes.</param> public BeamXYZA(Byte[] byteArray) { _PositionOffsetX = 0; _PositionOffsetY = 0; _Depth = 0; _Time = 0; _Amplitude = 0; _Quality = 0; using (BinaryReader dp = new BinaryReader(ArrayToStream.BytesToMemory(byteArray))) { if (byteArray.Length >= 31) { _PositionOffsetY = dp.ReadDouble(); // 0-1-2-3-4-5-6-7 _PositionOffsetX = dp.ReadDouble(); // 8-9-10-11-12-13-14-15 _Depth = dp.ReadSingle(); // 16-17-18-19 _Time = dp.ReadDouble(); // 20-21-22-23-24-25-26-27 _Amplitude = dp.ReadInt16(); // 28-29 _Quality = dp.ReadByte(); // 30 } } }
/// <summary> /// Initializes a new instance of the QpsMbeEntry class that contain the values extracted from the given byte array. /// </summary> /// <param name="byteArray">The size of array need to be at least of 64 bytes.</param> public QpsMbeEntry(Byte[] byteArray) { _Id = 0; _Intensity = 0; _Quality = 0; _TwoWayTravelTime = 0; _DeltaTime = 0; _BeamAngle = 0; _TiltAngle = 0; using (BinaryReader dp = new BinaryReader(ArrayToStream.BytesToMemory(byteArray))) { if (byteArray.Length >= 48) { _Id = dp.ReadInt32(); // 0-1-2-3 _Intensity = dp.ReadDouble(); // 4-5-6-7-8-9-10-11 _Quality = dp.ReadInt32(); // 12-13-14-15 _TwoWayTravelTime = dp.ReadDouble(); // 16-17-18-19-20-21-22-23 _DeltaTime = dp.ReadDouble(); // 24-25-26-27-28-29-30-31 _BeamAngle = dp.ReadDouble(); // 32-33-34-35-36-37-38-39 _TiltAngle = dp.ReadDouble(); // 40-41-42-43-44-45-46-47 } } }
/// <summary> /// Initializes a new instance of the PingHeader class that contain the values extracted from the given byte array. /// </summary> /// <param name="byteArray">The size of array need to be at least of 256 bytes.</param> public PingHeader(Byte[] byteArray) { _HeaderType = 0; _MagicNumber = 0; _SubChannelNumber = 0; _NumberChannelsToFollow = 0; _NumberBytesThisRecord = 256; _PacketTime = DateTime.MinValue; _EventNumber = 0; _PingNumber = 0; _SoundVelocity = 0; _OceanTide = 0; _ConductivityFrequency = 0; _TemperatureFrequency = 0; _PressureFrequency = 0; _PressureTemp = 0; _Conductivity = 0; _WaterTemperature = 0; _Pressure = 0; _ComputedSoundVelocity = 0; _MagX = 0; _MagY = 0; _MagZ = 0; _AuxValue1 = 0; _AuxValue2 = 0; _AuxValue3 = 0; _AuxValue4 = 0; _AuxValue5 = 0; _AuxValue6 = 0; _SpeedLog = 0; _Turbidity = 0; _ShipSpeed = 0; _ShipGyro = 0; _ShipCoordinateY = 0.0; _ShipCoordinateX = 0.0; _ShipAltitude = 0; _ShipDepth = 0; _FixTime = DateTime.MinValue; _SensorSpeed = 0; _KP = 0; _SensorCoordinateY = 0.0; _SensorCoordinateX = 0.0; _SonarStatus = 0; _RangeToFish = 0; _BearingToFish = 0; _CableOut = 0; _Layback = 0; _CableTension = 0; _SensorDepth = 0; _SensorPrimaryAltitude = 0; _SensorAuxAltitude = 0; _SensorPitch = 0; _SensorRoll = 0; _SensorHeading = 0; _Heave = 0; _Yaw = 0; _AttitudeTimeTag = 0; _DistanceOffTrack = 0; _NavigationFixMilliseconds = 0; _ComputerClockTime = DateTime.MinValue; _FishPositionDeltaX = 0; _FishPositionDeltaY = 0; _FishPositionErrorCode = 0; UInt16 Year; UInt16 HSecons; UInt16 chkNumber; Byte Month; Byte Day; Byte Hour; Byte Minutes; Byte Seconds; String TimeString; DateTime outTime; using (BinaryReader dp = new BinaryReader(ArrayToStream.BytesToMemory(byteArray))) { if (byteArray.Length >= 245) { chkNumber = dp.ReadUInt16(); // 0-1 if (chkNumber == XtfDocument.MagicNumber) { _HeaderType = dp.ReadByte(); // 2 _SubChannelNumber = dp.ReadByte(); // 3 _NumberChannelsToFollow = dp.ReadUInt16(); // 4-5 dp.ReadUInt16(); //Unused 6-7 dp.ReadUInt16(); //Unused 8-9 _NumberBytesThisRecord = dp.ReadUInt32(); // 10-11-12-13 //Read the ping time values Year = dp.ReadUInt16(); // 14-15 Month = dp.ReadByte(); // 16 Day = dp.ReadByte(); // 17 Hour = dp.ReadByte(); // 18 Minutes = dp.ReadByte(); // 19 Seconds = dp.ReadByte(); // 20 HSecons = dp.ReadByte(); // 21 dp.ReadUInt16(); //JulianDay 22-23 //Compose the ping time value TimeString = Year.ToString("0000", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Month.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Day.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Hour.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Minutes.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Seconds.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + HSecons.ToString("00", CultureInfo.InvariantCulture); if (DateTime.TryParseExact(TimeString, "yyyy-MM-dd-HH-mm-ss-ff", CultureInfo.InvariantCulture, DateTimeStyles.None, out outTime)) { _PacketTime = outTime; } else { _PacketTime = DateTime.MinValue; } _EventNumber = dp.ReadUInt32(); // 24-25-26-27 _PingNumber = dp.ReadUInt32(); // 28-29-30-31 _SoundVelocity = dp.ReadSingle(); // 32-33-34-35 _OceanTide = dp.ReadSingle(); // 36-37-38-39 dp.ReadUInt32(); //Unused 40-41-42-43 _ConductivityFrequency = dp.ReadSingle(); // 44-45-46-47 _TemperatureFrequency = dp.ReadSingle(); // 48-49-50-51 _PressureFrequency = dp.ReadSingle(); // 52-53-54-55 _PressureTemp = dp.ReadSingle(); // 56-57-58-59 _Conductivity = dp.ReadSingle(); // 60-61-62-63 _WaterTemperature = dp.ReadSingle(); // 64-65-66-67 _Pressure = dp.ReadSingle(); // 68-69-70-71 _ComputedSoundVelocity = dp.ReadSingle(); // 72-73-74-75 _MagX = dp.ReadSingle(); // 76-77-78-79 _MagY = dp.ReadSingle(); // 80-81-82-83 _MagZ = dp.ReadSingle(); // 84-85-86-87 _AuxValue1 = dp.ReadSingle(); // 88-89-90-91 _AuxValue2 = dp.ReadSingle(); // 92-93-94-95 _AuxValue3 = dp.ReadSingle(); // 96-97-98-99 _AuxValue4 = dp.ReadSingle(); // 100-101-102-103 _AuxValue5 = dp.ReadSingle(); // 104-105-106-107 _AuxValue6 = dp.ReadSingle(); // 108-109-110-111 _SpeedLog = dp.ReadSingle(); // 112-113-114-115 _Turbidity = dp.ReadSingle(); // 116-117-118-119 _ShipSpeed = dp.ReadSingle(); // 120-121-122-123 _ShipGyro = dp.ReadSingle(); // 124-125-126-127 _ShipCoordinateY = dp.ReadDouble(); // 128-129-130-131-132-133-134-135 _ShipCoordinateX = dp.ReadDouble(); // 136-137-138-139-140-141-142-143 _ShipAltitude = dp.ReadUInt16(); // 144-145 _ShipDepth = dp.ReadUInt16(); // 146-147 //Read the ping time values Hour = dp.ReadByte(); // 148 Minutes = dp.ReadByte(); // 149 Seconds = dp.ReadByte(); // 150 HSecons = dp.ReadByte(); // 151 //Compose the ping time value TimeString = _PacketTime.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Hour.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Minutes.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Seconds.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + HSecons.ToString("00", CultureInfo.InvariantCulture); if (!DateTime.TryParseExact(TimeString, "yyyy-MM-dd-HH-mm-ss-ff", CultureInfo.InvariantCulture, DateTimeStyles.None, out outTime)) { _FixTime = outTime; } else { _FixTime = DateTime.MinValue; } _SensorSpeed = dp.ReadSingle(); // 152-153-154-155 _KP = dp.ReadSingle(); // 156-157-158-159 _SensorCoordinateY = dp.ReadDouble(); // 160-161-162-163-164-165-166-167 _SensorCoordinateX = dp.ReadDouble(); // 168-169-170-171-172-173-174-175 _SonarStatus = dp.ReadUInt16(); // 176-177 _RangeToFish = dp.ReadUInt16(); // 178-179 _BearingToFish = dp.ReadUInt16(); // 180-181 _CableOut = dp.ReadUInt16(); // 182-183 _Layback = dp.ReadSingle(); // 184-185-186-187 _CableTension = dp.ReadSingle(); // 188-189-190-191 _SensorDepth = dp.ReadSingle(); // 192-193-194-195 _SensorPrimaryAltitude = dp.ReadSingle(); // 196-197-198-199 _SensorAuxAltitude = dp.ReadSingle(); // 200-201-202-203 _SensorPitch = dp.ReadSingle(); // 204-205-206-207 _SensorRoll = dp.ReadSingle(); // 208-209-210-211 _SensorHeading = dp.ReadSingle(); // 212-213-214-215 _Heave = dp.ReadSingle(); // 216-217-218-219 _Yaw = dp.ReadSingle(); // 220-221-222-223 _AttitudeTimeTag = dp.ReadUInt32(); // 224-225-226-227 _DistanceOffTrack = dp.ReadSingle(); // 228-229-230-231 _NavigationFixMilliseconds = dp.ReadUInt32(); // 232-233-234-235 //Read the computer time values Hour = dp.ReadByte(); // 236 Minutes = dp.ReadByte(); // 237 Seconds = dp.ReadByte(); // 238 HSecons = dp.ReadByte(); // 239 //Compose the conputer time value TimeString = _PacketTime.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Hour.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Minutes.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Seconds.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + HSecons.ToString("00", CultureInfo.InvariantCulture); if (!DateTime.TryParseExact(TimeString, "yyyy-MM-dd-HH-mm-ss-ff", CultureInfo.InvariantCulture, DateTimeStyles.None, out outTime)) { _ComputerClockTime = outTime; } else { _ComputerClockTime = DateTime.MinValue; } _FishPositionDeltaX = dp.ReadInt16(); // 240-241 _FishPositionDeltaY = dp.ReadInt16(); // 242-243 _FishPositionErrorCode = dp.ReadByte(); // 244 } } } }
/// <summary> /// Initializes a new instance of the Notes class that contain the values extracted from the given byte array. /// </summary> /// <param name="byteArray">The size of array need to be at least of 256 bytes.</param> public Notes(Byte[] byteArray) { _HeaderType = 1; _MagicNumber = 0; _SubChannelNumber = 0; _NumberChannelsToFollow = 0; _NumberBytesThisRecord = 256; _PacketTime = DateTime.MinValue; _Text = " "; UInt16 chkNumber; UInt16 Year; Byte Month; Byte Day; Byte Hour; Byte Minutes; Byte Seconds; //UInt32 MSeconds; String TimeString; DateTime outTime; using (BinaryReader dp = new BinaryReader(ArrayToStream.BytesToMemory(byteArray))) { if (byteArray.Length >= 256) { chkNumber = dp.ReadUInt16(); // 0-1 if (chkNumber == XtfDocument.MagicNumber) { dp.ReadByte(); //HeaderType 2 _SubChannelNumber = dp.ReadByte(); // 3 _NumberChannelsToFollow = dp.ReadUInt16(); // 4-5 dp.ReadUInt16(); //Unused 6-7 dp.ReadUInt16(); //Unused 8-9 _NumberBytesThisRecord = dp.ReadUInt32(); // 10-11-12-13 //Read the ping time values Year = dp.ReadUInt16(); // 14-15 Month = dp.ReadByte(); // 16 Day = dp.ReadByte(); // 17 Hour = dp.ReadByte(); // 18 Minutes = dp.ReadByte(); // 19 Seconds = dp.ReadByte(); // 20 //MSeconds = dp.ReadUInt32(); //Compose the ping time value TimeString = Year.ToString("0000", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Month.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Day.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Hour.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Minutes.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Seconds.ToString("00", CultureInfo.InvariantCulture); //TimeString = TimeString + "-" + MSeconds.ToString("000000", CultureInfo.InvariantCulture); if (DateTime.TryParseExact(TimeString, "yyyy-MM-dd-HH-mm-ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out outTime)) { _PacketTime = outTime; } else { _PacketTime = DateTime.MinValue; } dp.ReadBytes(35); // Unused 21 to 55 _Text = new String(dp.ReadChars(200)); // 56 to 255 } } } }
/// <summary> /// Initializes a new instance of the AttitudeData class that contain the values extracted from the given byte array. /// </summary> /// <param name="byteArray">The size of array need to be at least of 64 bytes.</param> public AttitudeData(Byte[] byteArray) { _MagicNumber = 0; _HeaderType = 0; _SubChannelNumber = 0; _NumberChannelsToFollow = 0; _NumberBytesThisRecord = 0; _PacketTime = DateTime.MinValue; _Pitch = 0; _Roll = 0; _Heave = 0; _Yaw = 0; _Heading = 0; _TimeTag = 0; _SourceEpoch = 0; _SourceEpochMicroseconds = 0; UInt16 Year; UInt16 MSecons; UInt16 chkNumber; Byte Month; Byte Day; Byte Hour; Byte Minutes; Byte Seconds; String TimeString; DateTime outTime; using (BinaryReader dp = new BinaryReader(ArrayToStream.BytesToMemory(byteArray))) { if (byteArray.Length >= 63) { chkNumber = dp.ReadUInt16(); // 0-1 if (chkNumber == XtfDocument.MagicNumber) { _HeaderType = dp.ReadByte(); // 2 _SubChannelNumber = dp.ReadByte(); // 3 _NumberChannelsToFollow = dp.ReadUInt16(); // 4-5 dp.ReadUInt16(); // 6-7 dp.ReadUInt16(); // 8-9 _NumberBytesThisRecord = dp.ReadUInt32(); // 10-11-12-13 dp.ReadUInt32(); // 14-15-16-17 dp.ReadUInt32(); // 18-19-20-21 _SourceEpochMicroseconds = dp.ReadUInt32(); // 22-23-24-25 _SourceEpoch = dp.ReadUInt32(); // 26-27-28-29 _Pitch = dp.ReadSingle(); // 30-31-32-33 _Roll = dp.ReadSingle(); // 34-35-36-37 _Heave = dp.ReadSingle(); // 38-39-40-41 _Yaw = dp.ReadSingle(); // 42-43-44-45 _TimeTag = dp.ReadUInt32(); // 46-47-48-49 _Heading = dp.ReadSingle(); // 50-51-52-53 //Read the packet time values Year = dp.ReadUInt16(); // 54-55 Month = dp.ReadByte(); // 56 Day = dp.ReadByte(); // 57 Hour = dp.ReadByte(); // 58 Minutes = dp.ReadByte(); // 59 Seconds = dp.ReadByte(); // 60 MSecons = dp.ReadUInt16(); // 61-62 //Compose the packet time value TimeString = Year.ToString("0000", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Month.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Day.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Hour.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Minutes.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Seconds.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + MSecons.ToString("000", CultureInfo.InvariantCulture); if (DateTime.TryParseExact(TimeString, "yyyy-MM-dd-HH-mm-ss-fff", CultureInfo.InvariantCulture, DateTimeStyles.None, out outTime)) { _PacketTime = outTime; } else { _PacketTime = DateTime.MinValue; } } } } }
/// <summary> /// Initializes a new instance of the Navigation class that contain the values extracted from the given byte array. /// </summary> /// <param name="byteArray">The size of array need to be at least of 64 bytes.</param> public Navigation(Byte[] byteArray) { _HeaderType = 42; _MagicNumber = 0; _SubChannelNumber = 0; _NumberChannelsToFollow = 0; _NumberBytesThisRecord = 64; _PacketTime = DateTime.MinValue; _TimeTag = 0; _SourceEpoch = 0; _RawCoordinateX = 0; _RawCoordinateY = 0; _RawAltitude = 0; _TimestampValidity = 0; UInt16 chkNumber; UInt16 Year; Byte Month; Byte Day; Byte Hour; Byte Minutes; Byte Seconds; UInt32 MSeconds; String TimeString; DateTime outTime; using (BinaryReader dp = new BinaryReader(ArrayToStream.BytesToMemory(byteArray))) { if (byteArray.Length >= 58) { chkNumber = dp.ReadUInt16(); // 0-1 if (chkNumber == XtfDocument.MagicNumber) { dp.ReadByte(); //HeaderType 2 _SubChannelNumber = dp.ReadByte(); // 3 _NumberChannelsToFollow = dp.ReadUInt16(); // 4-5 dp.ReadUInt16(); //Unused 6-7 dp.ReadUInt16(); //Unused 8-9 _NumberBytesThisRecord = dp.ReadUInt32(); // 10-11-12-13 //Read the ping time values Year = dp.ReadUInt16(); // 14-15 Month = dp.ReadByte(); // 16 Day = dp.ReadByte(); // 17 Hour = dp.ReadByte(); // 18 Minutes = dp.ReadByte(); // 19 Seconds = dp.ReadByte(); // 20 MSeconds = dp.ReadUInt32(); // 21-22-23-24 //Compose the ping time value TimeString = Year.ToString("0000", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Month.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Day.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Hour.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Minutes.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Seconds.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + MSeconds.ToString("000000", CultureInfo.InvariantCulture); if (DateTime.TryParseExact(TimeString, "yyyy-MM-dd-HH-mm-ss-ffffff", CultureInfo.InvariantCulture, DateTimeStyles.None, out outTime)) { _PacketTime = outTime; } else { _PacketTime = DateTime.MinValue; } _SourceEpoch = dp.ReadUInt32(); // 25-26-27-28 _TimeTag = dp.ReadUInt32(); // 29-30-31-32 _RawCoordinateY = dp.ReadDouble(); // 33-34-35-36-37-38-39-40 _RawCoordinateX = dp.ReadDouble(); // 41-42-43-44-45-46-47-48 _RawAltitude = dp.ReadDouble(); // 49-50-51-52-53-54-55-56 _TimestampValidity = dp.ReadByte(); // 57 } } } }
/// <summary> /// Initializes a new instance of the RawCustomHeader class that contain the values extracted from the given byte array. /// </summary> /// <param name="byteArray">The size of array need to be at least of 64 bytes.</param> public RawCustomHeader(Byte[] byteArray) { _HeaderType = 199; _MagicNumber = 0; _SubChannelNumber = 0; _NumberChannelsToFollow = 0; //_NumberBytesThisRecord = 64; _PacketTime = DateTime.MinValue; _ManufacturerId = 0; _SonarId = 0; _PacketId = 0; _PingNumber = 0; _TimeTag = 0; _NumberCustomerBytes = 0; _NumberBytesThisRecord = NumberCustomerBytes + 64; UInt16 chkNumber; UInt16 Year; Byte Month; Byte Day; Byte Hour; Byte Minutes; Byte Seconds; Byte MSeconds; String TimeString; DateTime outTime; using (BinaryReader dp = new BinaryReader(ArrayToStream.BytesToMemory(byteArray))) { if (byteArray.Length >= 64) { chkNumber = dp.ReadUInt16(); // 0-1 if (chkNumber == XtfDocument.MagicNumber) { dp.ReadByte(); //HeaderType 2 _ManufacturerId = dp.ReadByte(); // 3 _SonarId = dp.ReadUInt16(); // 4-5 _PacketId = dp.ReadUInt16(); // 6-7 dp.ReadUInt16(); // 8-9 Unused _NumberBytesThisRecord = dp.ReadUInt32(); // 10-11-12-13 //Read the ping time values Year = dp.ReadUInt16(); // 14-15 Month = dp.ReadByte(); // 16 Day = dp.ReadByte(); // 17 Hour = dp.ReadByte(); // 18 Minutes = dp.ReadByte(); // 19 Seconds = dp.ReadByte(); // 20 MSeconds = dp.ReadByte(); // 21 //Compose the ping time value TimeString = Year.ToString("0000", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Month.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Day.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Hour.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Minutes.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Seconds.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + MSeconds.ToString("00", CultureInfo.InvariantCulture); if (DateTime.TryParseExact(TimeString, "yyyy-MM-dd-HH-mm-ss-ff", CultureInfo.InvariantCulture, DateTimeStyles.None, out outTime)) { _PacketTime = outTime; } else { _PacketTime = DateTime.MinValue; } dp.ReadUInt16(); // 22-23 Julian Day dp.ReadUInt16(); // 24-25 Unused dp.ReadUInt16(); // 26-27 Unused _PingNumber = dp.ReadUInt32(); // 28-29-30-31 _TimeTag = dp.ReadUInt32(); // 32-33-34-35 _NumberCustomerBytes = dp.ReadUInt32(); // 36-37-38-39 } } } }
/// <summary> /// Initializes a new instance of the RawSerialHeader class that contain the values extracted from the given byte array. /// </summary> /// <param name="byteArray">The size of array need to be at least of 64 bytes.</param> public RawSerialHeader(Byte[] byteArray) { _HeaderType = 6; _MagicNumber = 0; _SubChannelNumber = 0; _NumberChannelsToFollow = 0; _NumberBytesThisRecord = 64; _PacketTime = DateTime.MinValue; _SerialPort = 0; _RawAsciiData = ""; _TimeTag = 0; UInt16 chkNumber; UInt16 Year; Byte Month; Byte Day; Byte Hour; Byte Minutes; Byte Seconds; Byte MSeconds; String TimeString; DateTime outTime; UInt16 StringSize; using (BinaryReader dp = new BinaryReader(ArrayToStream.BytesToMemory(byteArray))) { if (byteArray.Length >= 64) { chkNumber = dp.ReadUInt16(); // 0-1 if (chkNumber == XtfDocument.MagicNumber) { dp.ReadByte(); //HeaderType 2 _SubChannelNumber = dp.ReadByte(); // 3 _NumberChannelsToFollow = dp.ReadUInt16(); // 4-5 dp.ReadUInt16(); //Unused 6-7 dp.ReadUInt16(); //Unused 8-9 _NumberBytesThisRecord = dp.ReadUInt32(); // 10-11-12-13 //Read the ping time values Year = dp.ReadUInt16(); // 14-15 Month = dp.ReadByte(); // 16 Day = dp.ReadByte(); // 17 Hour = dp.ReadByte(); // 18 Minutes = dp.ReadByte(); // 19 Seconds = dp.ReadByte(); // 20 MSeconds = dp.ReadByte(); // 21 //Compose the ping time value TimeString = Year.ToString("0000", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Month.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Day.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Hour.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Minutes.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Seconds.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + MSeconds.ToString("000", CultureInfo.InvariantCulture); if (DateTime.TryParseExact(TimeString, "yyyy-MM-dd-HH-mm-ss-fff", CultureInfo.InvariantCulture, DateTimeStyles.None, out outTime)) { _PacketTime = outTime; } else { _PacketTime = DateTime.MinValue; } dp.ReadUInt16(); // 22-23 Julian Day _TimeTag = dp.ReadUInt32(); // 24-25-26-27 StringSize = dp.ReadUInt16(); // 28-29 if (_NumberBytesThisRecord >= (StringSize + 30)) { _RawAsciiData = new String(dp.ReadChars(StringSize)); } else { _RawAsciiData = new String(dp.ReadChars(Convert.ToInt32(_NumberBytesThisRecord - 30))); } } } } }
/// <summary> /// Initializes a new instance of the BathySnippet0 class that contain the values extracted from the given byte array. /// </summary> /// <param name="byteArray">The size of array need to be at least of 74 bytes.</param> public BathySnippet0(Byte[] byteArray) { _HeaderSize = 0; _DataSize = 0; _PingNumber = 0; _Seconds = 0; _Milliseconds = 0; _Latency = 0; _SonarId1 = 0; _SonarId2 = 0; _SonarModel = 0; _Frequency = 0; _SoundSpeed = 0; _SampleRate = 0; _PingRate = 0; _Range = 0; _Power = 0; _Gain = 0; _PulseWidth = 0; _Spread = 0; _Absorb = 0; _ProjectorType = 0; _ProjectorWidth = 0; _SpacingNumerator = 0; _SpacingDenominator = 0; _ProjectorAngle = 0; _MinRange = 0; _MaxRange = 0; _MinDepth = 0; _MaxDepth = 0; _Filters = 0; _Flags = 0; _HeadTemp = 0; _BeamCount = 0; UInt32 chkNumber; using (BinaryReader dp = new BinaryReader(ArrayToStream.BytesToMemory(byteArray))) { if (byteArray.Length >= 74) { chkNumber = dp.ReadUInt32(); // 0-1-2-3 if (chkNumber == MagicId) { _HeaderSize = dp.ReadUInt16(); // 4-5 _DataSize = dp.ReadUInt16(); // 6-7 _PingNumber = dp.ReadUInt32(); // 8-9-10-11 _Seconds = dp.ReadUInt32(); // 12-13-14-15 _Milliseconds = dp.ReadUInt32(); // 16-17-18-19 _Latency = dp.ReadUInt16(); // 20-21 _SonarId1 = dp.ReadUInt16(); // 22-23 _SonarId2 = dp.ReadUInt16(); // 24-25 _SonarModel = dp.ReadUInt16(); // 26-27 _Frequency = dp.ReadUInt16(); // 28-29 _SoundSpeed = dp.ReadUInt16(); // 30-31 _SampleRate = dp.ReadUInt16(); // 32-33 _PingRate = dp.ReadUInt16(); // 34-35 _Range = dp.ReadUInt16(); // 36-37 _Power = dp.ReadUInt16(); // 38-39 _Gain = dp.ReadUInt16(); // 40-41 _PulseWidth = dp.ReadUInt16(); // 42-43 _Spread = dp.ReadUInt16(); // 44-45 _Absorb = dp.ReadUInt16(); // 46-47 _ProjectorType = dp.ReadUInt16(); // 48-49 _ProjectorWidth = dp.ReadUInt16(); // 50-51 _SpacingNumerator = dp.ReadUInt16(); // 52-53 _SpacingDenominator = dp.ReadUInt16(); // 54-55 _ProjectorAngle = dp.ReadInt16(); // 56-57 _MinRange = dp.ReadUInt16(); // 58-59 _MaxRange = dp.ReadUInt16(); // 60-61 _MinDepth = dp.ReadUInt16(); // 62-63 _MaxDepth = dp.ReadUInt16(); // 64-65 _Filters = dp.ReadUInt16(); // 66-67 _Flags = dp.ReadUInt16(); // 68-69 _HeadTemp = dp.ReadInt16(); // 70-71 _BeamCount = dp.ReadUInt16(); // 72-73 } } } }
/// <summary> /// Initializes a new instance of the HighSpeedSensor class that contain the values extracted from the given byte array. /// </summary> /// <param name="byteArray">The size of array need to be at least of 64 bytes.</param> public HighSpeedSensor(Byte[] byteArray) { _HeaderType = 15; _MagicNumber = 0; _SubChannelNumber = 0; _NumberChannelsToFollow = 0; _NumberBytesThisRecord = 256; _PacketTime = DateTime.MinValue; _NumberSensorBytes = 0; _RelativeBathyPingNumber = 0; UInt16 chkNumber; UInt16 Year; Byte Month; Byte Day; Byte Hour; Byte Minutes; Byte Seconds; UInt16 MSeconds; String TimeString; DateTime outTime; using (BinaryReader dp = new BinaryReader(ArrayToStream.BytesToMemory(byteArray))) { if (byteArray.Length >= 31) { chkNumber = dp.ReadUInt16(); // 0-1 if (chkNumber == XtfDocument.MagicNumber) { _HeaderType = dp.ReadByte(); //HeaderType 2 _SubChannelNumber = dp.ReadByte(); // 3 _NumberChannelsToFollow = dp.ReadUInt16(); // 4-5 dp.ReadUInt16(); //Unused 6-7 dp.ReadUInt16(); //Unused 8-9 _NumberBytesThisRecord = dp.ReadUInt32(); // 10-11-12-13 //Read the ping time values Year = dp.ReadUInt16(); // 14-15 Month = dp.ReadByte(); // 16 Day = dp.ReadByte(); // 17 Hour = dp.ReadByte(); // 18 Minutes = dp.ReadByte(); // 19 Seconds = dp.ReadByte(); // 20 MSeconds = dp.ReadUInt16(); // 21-22 //Compose the ping time value TimeString = Year.ToString("0000", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Month.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Day.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Hour.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Minutes.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Seconds.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + MSeconds.ToString("00", CultureInfo.InvariantCulture); if (DateTime.TryParseExact(TimeString, "yyyy-MM-dd-HH-mm-ss-ff", CultureInfo.InvariantCulture, DateTimeStyles.None, out outTime)) { _PacketTime = outTime; } else { _PacketTime = DateTime.MinValue; } _NumberSensorBytes = dp.ReadUInt32(); // 23-24-25-26 _RelativeBathyPingNumber = dp.ReadUInt32(); // 27-28-29-30 } } } }
/// <summary> /// Initializes a new instance of the QpsSingleBeam class that contain the values extracted from the given byte array. /// </summary> /// <param name="byteArray">The size of array need to be at least of 64 bytes.</param> public QpsSingleBeam(Byte[] byteArray) { _HeaderType = 26; _MagicNumber = 0; _SubChannelNumber = 0; _NumberChannelsToFollow = 0; _NumberBytesThisRecord = 64; _PacketTime = DateTime.MinValue; _TimeTag = 0; _Id = 0; _SoundVelocity = 0; _Intensity = 0; _Quality = 0; _TwoWayTravelTime = 0; UInt16 chkNumber; UInt16 Year; Byte Month; Byte Day; Byte Hour; Byte Minutes; Byte Seconds; UInt16 MSeconds; String TimeString; DateTime outTime; using (BinaryReader dp = new BinaryReader(ArrayToStream.BytesToMemory(byteArray))) { if (byteArray.Length >= 53) { chkNumber = dp.ReadUInt16(); // 0-1 if (chkNumber == XtfDocument.MagicNumber) { dp.ReadByte(); //HeaderType 2 _SubChannelNumber = dp.ReadByte(); // 3 _NumberChannelsToFollow = dp.ReadUInt16(); // 4-5 dp.ReadUInt16(); //Unused 6-7 dp.ReadUInt16(); //Unused 8-9 _NumberBytesThisRecord = dp.ReadUInt32(); // 10-11-12-13 _TimeTag = dp.ReadUInt32(); // 14-15-16-17 _Id = dp.ReadInt32(); // 18-19-20-21 _SoundVelocity = dp.ReadSingle(); // 22-23-24-25 _Intensity = dp.ReadSingle(); // 26-27-28-29 _Quality = dp.ReadInt32(); // 30-31-32-33 _TwoWayTravelTime = dp.ReadSingle(); // 34-35-36-37 //Read the ping time values Year = dp.ReadUInt16(); // 38-39 Month = dp.ReadByte(); // 40 Day = dp.ReadByte(); // 41 Hour = dp.ReadByte(); // 42 Minutes = dp.ReadByte(); // 43 Seconds = dp.ReadByte(); // 44 MSeconds = dp.ReadUInt16(); // 45-46 //Compose the ping time value TimeString = Year.ToString("0000", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Month.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Day.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Hour.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Minutes.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + Seconds.ToString("00", CultureInfo.InvariantCulture); TimeString = TimeString + "-" + MSeconds.ToString("000", CultureInfo.InvariantCulture); if (DateTime.TryParseExact(TimeString, "yyyy-MM-dd-HH-mm-ss-fff", CultureInfo.InvariantCulture, DateTimeStyles.None, out outTime)) { _PacketTime = outTime; } else { _PacketTime = DateTime.MinValue; } } } } }