AForge.Robotics.Lego.NXTBrick.GetVersion C# (CSharp) Method

GetVersion() public method

Get firmware version of NXT brick.
public GetVersion ( string &protocolVersion, string &firmwareVersion ) : bool
protocolVersion string Protocol version number.
firmwareVersion string Firmware version number.
return bool
        public bool GetVersion( out string protocolVersion, out string firmwareVersion )
        {
            byte[] reply = new byte[7];

            if ( SendCommand( new byte[] { (byte) NXTCommandType.SystemCommand,
                (byte) NXTSystemCommand.GetFirmwareVersion }, reply ) )
            {
                protocolVersion = string.Format( "{0}.{1}", reply[4], reply[3] );
                firmwareVersion = string.Format( "{0}.{1}", reply[6], reply[5] );
                return true;
            }

            protocolVersion = null;
            firmwareVersion = null;

            return false;
        }