public List <List <byte> > GetPackets(IEnumerable <byte> input, IXModemProtocolOptions options) { _data = input.ToList(); _options = options; _packetNumber = 1; _position = 0; _packets = new List <List <byte> >(); InitializePacketSize(); while (MorePacketsToBeBuilt) { BuildNextPacket(); PrepareForNextPacketBuild(); } return(_packets); }
public bool CancellationDetected(IEnumerable <byte> input, IXModemProtocolOptions options) { _input = input.ToArray(); _options = options; if (DetectionIsUnnecessary) { return(false); } GetIndicesOfCANBytes(); if (CountOfCANBytesAreInsufficient) { return(false); } if (CancellationConditionFound) { return(true); } return(false); }
public ValidationResult ValidatePacket(IEnumerable <byte> input, IXModemProtocolOptions options) { _data = input.ToList(); _options = options; if (PacketExpectedIsIncorrect) { return(PacketIsDuplicate ? ValidationResult.Duplicate : ValidationResult.Invalid); } if (OnesComplementIsIncorrect) { return(ValidationResult.Invalid); } if (ChecksumIsIncorrect) { return(ValidationResult.Invalid); } _packetNumberExpected++; return(ValidationResult.Valid); }