using skyscraper5.Mpeg2;
using skyscraper5.Skyscraper.IO;
using skyscraper5.Skyscraper.Plugins;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace skyscraper5.src.InteractionChannel.Model.Descriptors
{
	[SkyscraperPlugin]
	[TsDescriptor(0xaf,"TIM")]
	public class _0xaf_ConnectionControlDescriptor : TsDescriptor
	{
		public _0xaf_ConnectionControlDescriptor(byte[] buffer)
		{
			MemoryStream ms = new MemoryStream(buffer, false);
			SuperframeId = ms.ReadUInt8();
			CscResponseTimeout = ms.ReadUInt32BE();
			CscMaxLosses = ms.ReadUInt8();
			MaxTimeBeforeRetry = ms.ReadUInt32BE();
			Valid = true;
		}

		public byte SuperframeId { get; }
		public uint CscResponseTimeout { get; }
		public byte CscMaxLosses { get; }
		public uint MaxTimeBeforeRetry { get; }

		public override string ToString()
		{
			return String.Format("Connection Control for Superframe {0}", SuperframeId);
		}
	}
}
