public virtual void OnNext(byte value)
        {
            try
            {
                switch (_decodeStep)
                {
                case DecodeStep.Sync:
                    _decodeStep = SyncStep(value);
                    break;

                case DecodeStep.Length:
                    _decodeStep = GetLengthStep(value);
                    break;

                case DecodeStep.FillBuffer:
                    _decodeStep = FillBufferStep(value);
                    break;

                case DecodeStep.FillSignature:
                    _decodeStep = SignatureStep(value);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            catch (Exception e)
            {
                _logger.Fatal(e, $"Fatal error to decode packet:{e.Message}");
                Debug.Assert(false, e.Message);
            }
        }
Example #2
0
        public virtual void OnNext(byte value)
        {
            switch (_decodeStep)
            {
            case DecodeStep.Sync:
                _decodeStep = SyncStep(value);
                break;

            case DecodeStep.Length:
                _decodeStep = GetLengthStep(value);
                break;

            case DecodeStep.FillBuffer:
                _decodeStep = FillBufferStep(value);
                break;

            case DecodeStep.FillSignature:
                _decodeStep = SignatureStep(value);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }