public bool LsRead( Sensor sensor, byte[] readValues, out int bytesRead )
{
byte[] command = new byte[3];
byte[] reply = new byte[20];
// prepare message
command[0] = (byte) NXTCommandType.DirectCommand;
command[1] = (byte) NXTDirectCommand.LsRead;
command[2] = (byte) sensor;
if ( SendCommand( command, reply ) )
{
bytesRead = reply[3];
Array.Copy( reply, 4, readValues, 0, Math.Min( readValues.Length, bytesRead ) );
return true;
}
bytesRead = -1;
return false;
}