nxtlib/src/Connect/Bluetooth.cs
/// <summary> 
/// Recieves the reply from the NXT.
/// </summary>
/// <returns>Returns the reply from the NXT, as a byte array.</returns>
Recieves the reply from the NXT.
Recieves the reply from the NXT .
public override byte[] RecieveReply()
        {
            if (!IsConnected) { throw new NXTNotConnected(); }
            byte[] byteIn = new byte[256];
            lock (commLock)
            {
                Stream stream = client.GetStream();
                int length = stream.ReadByte() + 256 * stream.ReadByte();
                for (int i = 0; i < length; i++)
                {
                    int data = stream.ReadByte();
                    byte bit = Convert.ToByte(data);
                    byteIn[i] = bit;
                }
            }
            if (byteIn == null) { throw new NXTNoReply(); }
            return byteIn;
        }
public override byte [ ] RecieveReply ( ) { if ( ! IsConnected ) { throw new NXTNotConnected ( ) ; } byte [ ] byteIn = new byte [ 256 ] ; lock ( commLock ) { Stream stream = client . GetStream ( ) ; int length = stream . ReadByte ( ) + 256 * stream . ReadByte ( ) ; for ( int i = 0 ; i < length ; i ++ ) { int data = stream . ReadByte ( ) ; byte bit = Convert . ToByte ( data ) ; byteIn [ i ] = bit ; } } if ( byteIn == null ) { throw new NXTNoReply ( ) ; } return byteIn ; }
Recieves the reply from the NXT.
Recieves the reply from the NXT .
Returns the reply from the NXT, as a byte array.
Returns the reply from the NXT as a byte array .