nxtlib/src/Connect/Bluetooth.cs
/// <summary> 
/// Sends a message via Bluetooth.
/// </summary>
/// <param name="request">The request, as a byte array.</param>
Sends a message via Bluetooth.
Sends a message via Bluetooth .
public override void Send(byte[] request)
        {
            if (!IsConnected) { throw new NXTNotConnected(); }
            lock (commLock)
            {
                Stream stream = client.GetStream();
                int length = request.Length;
                byte[] btRequest = new byte[request.Length + 2];
                btRequest[0] = (byte)(length & 0xFF);
                btRequest[1] = (byte)((length & 0xFF00) >> 8);
                request.CopyTo(btRequest, 2);
                stream.Write(btRequest, 0, btRequest.Length);
            }
            return;
        }
public override void Send ( byte [ ] request ) { if ( ! IsConnected ) { throw new NXTNotConnected ( ) ; } lock ( commLock ) { Stream stream = client . GetStream ( ) ; int length = request . Length ; byte [ ] btRequest = new byte [ request . Length + 2 ] ; btRequest [ 0 ] = ( byte ) ( length & 0xFF ) ; btRequest [ 1 ] = ( byte ) ( ( length & 0xFF00 ) >> 8 ) ; request . CopyTo ( btRequest , 2 ) ; stream . Write ( btRequest , 0 , btRequest . Length ) ; } return ; }
Sends a message via Bluetooth.
Sends a message via Bluetooth .
// Create a Bluetooth request. // Write the request to the NXT brick.
request
byte[]
The request, as a byte array.
The request as a byte array .