public JT808_0x0705 Deserialize(ReadOnlySpan <byte> bytes, out int readSize, IJT808Config config) { int offset = 0; JT808_0x0705 jT808_0X0705 = new JT808_0x0705 { CanItemCount = JT808BinaryExtensions.ReadUInt16Little(bytes, ref offset), FirstCanReceiveTime = JT808BinaryExtensions.ReadDateTime5Little(bytes, ref offset), CanItems = new List <JT808CanProperty>() }; for (var i = 0; i < jT808_0X0705.CanItemCount; i++) { JT808CanProperty jT808CanProperty = new JT808CanProperty { CanId = JT808BinaryExtensions.ReadBytesLittle(bytes, ref offset, 4) }; if (jT808CanProperty.CanId.Length != 4) { throw new JT808Exception(Enums.JT808ErrorCode.NotEnoughLength, $"{nameof(jT808CanProperty.CanId)}->4"); } jT808CanProperty.CanData = JT808BinaryExtensions.ReadBytesLittle(bytes, ref offset, 8); if (jT808CanProperty.CanData.Length != 8) { throw new JT808Exception(Enums.JT808ErrorCode.NotEnoughLength, $"{nameof(jT808CanProperty.CanData)}->8"); } jT808_0X0705.CanItems.Add(jT808CanProperty); } readSize = offset; return(jT808_0X0705); }
public JT808_0x8106 Deserialize(ReadOnlySpan <byte> bytes, out int readSize) { int offset = 0; JT808_0x8106 jT808_0X8106 = new JT808_0x8106(); jT808_0X8106.ParameterCount = JT808BinaryExtensions.ReadByteLittle(bytes, ref offset); jT808_0X8106.Parameters = JT808BinaryExtensions.ReadBytesLittle(bytes, ref offset, jT808_0X8106.ParameterCount * 4); readSize = offset; return(jT808_0X8106); }
public JT808_0x8103_0x0110 Deserialize(ReadOnlySpan <byte> bytes, out int readSize) { int offset = 0; JT808_0x8103_0x0110 jT808_0x8103_0x0110 = new JT808_0x8103_0x0110(); jT808_0x8103_0x0110.ParamLength = JT808BinaryExtensions.ReadByteLittle(bytes, ref offset); jT808_0x8103_0x0110.ParamValue = JT808BinaryExtensions.ReadBytesLittle(bytes, ref offset, jT808_0x8103_0x0110.ParamLength); readSize = offset; return(jT808_0x8103_0x0110); }
public JT808_0x8A00 Deserialize(ReadOnlySpan <byte> bytes, out int readSize) { int offset = 0; JT808_0x8A00 jT808_0X8A00 = new JT808_0x8A00(); jT808_0X8A00.E = JT808BinaryExtensions.ReadUInt32Little(bytes, ref offset); jT808_0X8A00.N = JT808BinaryExtensions.ReadBytesLittle(bytes, ref offset, 128); readSize = offset; return(jT808_0X8A00); }
public JT808_0x8800 Deserialize(ReadOnlySpan <byte> bytes, out int readSize) { int offset = 0; JT808_0x8800 jT808_0X8800 = new JT808_0x8800(); jT808_0X8800.MultimediaId = JT808BinaryExtensions.ReadUInt32Little(bytes, ref offset); jT808_0X8800.RetransmitPackageCount = JT808BinaryExtensions.ReadByteLittle(bytes, ref offset); jT808_0X8800.RetransmitPackageIds = JT808BinaryExtensions.ReadBytesLittle(bytes, ref offset, jT808_0X8800.RetransmitPackageCount * 2); readSize = offset; return(jT808_0X8800); }
public JT808_0x8003 Deserialize(ReadOnlySpan <byte> bytes, out int readSize) { int offset = 0; JT808_0x8003 jT808_0X8003 = new JT808_0x8003(); jT808_0X8003.OriginalMsgNum = JT808BinaryExtensions.ReadUInt16Little(bytes, ref offset); jT808_0X8003.AgainPackageCount = JT808BinaryExtensions.ReadByteLittle(bytes, ref offset); jT808_0X8003.AgainPackageData = JT808BinaryExtensions.ReadBytesLittle(bytes, ref offset, jT808_0X8003.AgainPackageCount * 2); readSize = offset; return(jT808_0X8003); }
public JT808_0x0901 Deserialize(ReadOnlySpan <byte> bytes, out int readSize) { int offset = 0; JT808_0x0901 jT808_0X0901 = new JT808_0x0901(); var compressMessageLength = JT808BinaryExtensions.ReadUInt32Little(bytes, ref offset); var data = JT808BinaryExtensions.ReadBytesLittle(bytes, ref offset, (int)compressMessageLength); jT808_0X0901.UnCompressMessage = JT808GlobalConfig.Instance.Compress.Decompress(data); jT808_0X0901.UnCompressMessageLength = (uint)jT808_0X0901.UnCompressMessage.Length; readSize = offset; return(jT808_0X0901); }
public JT808_0x8A00 Deserialize(ReadOnlySpan <byte> bytes, out int readSize) { int offset = 0; JT808_0x8A00 jT808_0X8A00 = new JT808_0x8A00(); jT808_0X8A00.E = JT808BinaryExtensions.ReadUInt32Little(bytes, ref offset); jT808_0X8A00.N = JT808BinaryExtensions.ReadBytesLittle(bytes, ref offset, 128); if (jT808_0X8A00.N.Length != 128) { throw new JT808Exception(Enums.JT808ErrorCode.NotEnoughLength, $"{nameof(jT808_0X8A00.N)}->128"); } readSize = offset; return(jT808_0X8A00); }
public JT808_0x8108 Deserialize(ReadOnlySpan <byte> bytes, int offset, IJT808FormatterResolver formatterResolver, out int readSize) { offset = 0; JT808_0x8108 jT808_0X8108 = new JT808_0x8108(); jT808_0X8108.UpgradeType = (JT808UpgradeType)JT808BinaryExtensions.ReadByteLittle(bytes, ref offset); jT808_0X8108.MakerId = JT808BinaryExtensions.ReadStringLittle(bytes, ref offset, 5); jT808_0X8108.VersionNumLength = JT808BinaryExtensions.ReadByteLittle(bytes, ref offset); jT808_0X8108.VersionNum = JT808BinaryExtensions.ReadStringLittle(bytes, ref offset, jT808_0X8108.VersionNumLength); jT808_0X8108.UpgradePackageLength = JT808BinaryExtensions.ReadInt32Little(bytes, ref offset); jT808_0X8108.UpgradePackage = JT808BinaryExtensions.ReadBytesLittle(bytes, ref offset, jT808_0X8108.UpgradePackageLength); readSize = offset; return(jT808_0X8108); }
public JT808_0x0801 Deserialize(ReadOnlySpan <byte> bytes, out int readSize) { int offset = 0; JT808_0x0801 jT808_0X0801 = new JT808_0x0801(); jT808_0X0801.MultimediaId = JT808BinaryExtensions.ReadUInt32Little(bytes, ref offset); jT808_0X0801.MultimediaType = JT808BinaryExtensions.ReadByteLittle(bytes, ref offset); jT808_0X0801.MultimediaCodingFormat = JT808BinaryExtensions.ReadByteLittle(bytes, ref offset); jT808_0X0801.EventItemCoding = JT808BinaryExtensions.ReadByteLittle(bytes, ref offset); jT808_0X0801.ChannelId = JT808BinaryExtensions.ReadByteLittle(bytes, ref offset); jT808_0X0801.Position = JT808FormatterExtensions.GetFormatter <JT808_0x0200>().Deserialize(bytes.Slice(offset), out int bufReadSize); offset += 28; jT808_0X0801.MultimediaDataPackage = JT808BinaryExtensions.ReadBytesLittle(bytes, ref offset); readSize = offset; return(jT808_0X0801); }
public JT808_0x8108 Deserialize(ReadOnlySpan <byte> bytes, out int readSize, IJT808Config config) { int offset = 0; JT808_0x8108 jT808_0X8108 = new JT808_0x8108 { UpgradeType = (JT808UpgradeType)JT808BinaryExtensions.ReadByteLittle(bytes, ref offset), MakerId = JT808BinaryExtensions.ReadStringLittle(bytes, ref offset, 5), VersionNumLength = JT808BinaryExtensions.ReadByteLittle(bytes, ref offset) }; jT808_0X8108.VersionNum = JT808BinaryExtensions.ReadStringLittle(bytes, ref offset, jT808_0X8108.VersionNumLength); jT808_0X8108.UpgradePackageLength = JT808BinaryExtensions.ReadInt32Little(bytes, ref offset); jT808_0X8108.UpgradePackage = JT808BinaryExtensions.ReadBytesLittle(bytes, ref offset, jT808_0X8108.UpgradePackageLength); readSize = offset; return(jT808_0X8108); }
public JT808_0x0705 Deserialize(ReadOnlySpan <byte> bytes, out int readSize) { int offset = 0; JT808_0x0705 jT808_0X0705 = new JT808_0x0705(); jT808_0X0705.CanItemCount = JT808BinaryExtensions.ReadUInt16Little(bytes, ref offset); jT808_0X0705.FirstCanReceiveTime = JT808BinaryExtensions.ReadDateTime5Little(bytes, ref offset); jT808_0X0705.CanItems = new List <JT808Properties.JT808CanProperty>(); for (var i = 0; i < jT808_0X0705.CanItemCount; i++) { JT808Properties.JT808CanProperty jT808CanProperty = new JT808Properties.JT808CanProperty(); jT808CanProperty.CanId = JT808BinaryExtensions.ReadBytesLittle(bytes, ref offset, 4); jT808CanProperty.CanData = JT808BinaryExtensions.ReadBytesLittle(bytes, ref offset, 8); jT808_0X0705.CanItems.Add(jT808CanProperty); } readSize = offset; return(jT808_0X0705); }