PM.BLL/Communication/CommandList.cs
/// <summary>
/// Creates the frame, inserting the command data and generating checksum
/// </summary>
Creates the frame, inserting the command data and generating checksum
Creates the frame inserting the command data and generating checksum
private void FinalizeFrame()
        {
            _commandWriter.PrependRange(_prefix);
            uint checksum = 0x0;
            for (int index = _prefix.Length; index < _commandWriter.Size; index++)
            {
                uint currentByte = _commandWriter[index];
                checksum ^= currentByte;
            }
            _commandWriter.WriteByte(checksum);
            _commandWriter.AppendRange(_suffix);
            uint reportId;
            int length = _commandWriter.Length;
            if (length <= 121)
            {
                reportId = 0x02;
                _commandWriter.AddRange(Enumerable.Repeat<uint>(0, 121 - length - 1));
            }
            else
            {
                throw new InvalidOperationException("Buffer is too long!");
            }
            _commandWriter.Insert(0, reportId);
            _frames.Add(_commandWriter.ToArray());
            _commandWriter.Reset();
        }
private void FinalizeFrame ( ) { _commandWriter . PrependRange ( _prefix ) ; uint checksum = 0x0 ; for ( int index = _prefix . Length ; index < _commandWriter . Size ; index ++ ) { uint currentByte = _commandWriter [ index ] ; checksum ^= currentByte ; } _commandWriter . WriteByte ( checksum ) ; _commandWriter . AppendRange ( _suffix ) ; uint reportId ; int length = _commandWriter . Length ; if ( length <= 121 ) { reportId = 0x02 ; _commandWriter . AddRange ( Enumerable . Repeat < uint > ( 0 , 121 - length - 1 ) ) ; } else { throw new InvalidOperationException ( " " ) ; } _commandWriter . Insert ( 0 , reportId ) ; _frames . Add ( _commandWriter . ToArray ( ) ) ; _commandWriter . Reset ( ) ; }
Creates the frame, inserting the command data and generating checksum
Creates the frame inserting the command data and generating checksum
// Apply prefix //checksum //calculate checksum // Append CheckSum // Append suffix //reportId = 0x04; //_commandWriter.AddRange(Enumerable.Repeat<uint>(0, 64 - length - 1));