namespace YD_TrainingCompetition_Api.Protocols; public sealed class JumpProtocolParser : IJumpProtocolParser { public bool TryParse(ReadOnlySpan frame, out JumpFrame? parsed) { parsed = null; if (frame.Length < 12) { return false; } if (frame[0] != 0xAA || frame[11] != 0x55) { return false; } if (frame[1] != 0x00 && frame[1] != 0xAA) { return false; } parsed = new JumpFrame { DeviceNo = frame[2], Counter = frame[3] * 256 + frame[4], Battery = frame[5], Mode = frame[6], RemainingSeconds = frame[7] * 256 + frame[8] }; return true; } }