コード例 #1
0
 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);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 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);
 }