using ZB.MOM.WW.OtOpcUa.Driver.FOCAS.Wire;
namespace ZB.MOM.WW.OtOpcUa.Driver.FOCAS.Tests;
///
/// Loads the raw FOCAS response PDUs under Fixtures/v3/ — byte-for-byte captures from a
/// real FANUC 31i-B (Makino, series G431) — and splits them into response blocks with the
/// production . The live-* captures
/// were taken by the sister ignitionoee FOCAS driver's read-only probes of Z-34184 (2026-08-12)
/// and are shared verbatim; the ref-* ones are this repo's own 2026-06-25 capture.
///
internal static class WireFixtures
{
private const int PduHeaderLength = 10;
/// Every response block of the named capture, in wire order.
/// File name under Fixtures/v3/.
/// The parsed response blocks.
public static IReadOnlyList Blocks(string name)
{
var raw = File.ReadAllBytes(Path.Combine(AppContext.BaseDirectory, "Fixtures", "v3", name));
return FocasWireProtocol.ParseResponseBlocks(raw.AsSpan(PduHeaderLength));
}
/// The payload of the first block carrying .
/// File name under Fixtures/v3/.
/// The FOCAS command id to locate.
/// That block's payload bytes.
public static byte[] Payload(string name, ushort command) =>
Blocks(name).First(b => b.Command == command).Payload;
}