using System;
using QCRPG.Framework;
using QCRPG.TSL.FM.Packets;

namespace QCRPG.TSL.FM;

public class FMReceivePacketHandler : ReceivePacketHandlerBase
{
	public FMReceivePacketHandler(PacketListBase packetList)
		: base(packetList)
	{
	}

	protected override PacketBase ConvertBytesToPacket(PacketData packetData)
	{
		ReadI2cResponse readI2cResponse = new ReadI2cResponse();
		if (readI2cResponse.FromByteArray(packetData.bytes))
		{
			return readI2cResponse;
		}
		throw new Exception("Bytes are not a valid packet");
	}
}
