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

LsGetStatus() public method

Get status of Low Speed bus.
public LsGetStatus ( Sensor sensor, int &readyBytes ) : bool
sensor Sensor Sensor to get the status from.
readyBytes int Number of bytes that are ready to be read from the bus.
return bool
        public bool LsGetStatus( Sensor sensor, out int readyBytes )
        {
            byte[] command = new byte[3];
            byte[] reply = new byte[4];

            // prepare message
            command[0] = (byte) NXTCommandType.DirectCommand;
            command[1] = (byte) NXTDirectCommand.LsGetStatus;
            command[2] = (byte) sensor;

            if ( SendCommand( command, reply ) )
            {
                readyBytes = reply[3];
                return true;
            }

            readyBytes = -1;
            return false;
        }