nxtlib/src/Protocol.cs
/// <summary> 
/// [Native] Write a message to an incoming box on the NXT.
/// </summary>
/// <param name="box">The mailbox to send the message to.</param>
/// <param name="message">The message to send, as a string.
///   The string must not be longer than 57 characters.</param>
[Native] Write a message to an incoming box on the NXT.
[ Native ] Write a message to an incoming box on the NXT .
public void MessageWrite(Mailbox box, string message)
        {
            if (!message.EndsWith("\0"))
                message += '\0';
            int messageSize = message.Length;
            if (messageSize > 59)
            {
                throw new NXTException("Message may not exceed 57 characters.");
            }
            byte[] request = new byte[4 + messageSize];
            request[0] = (byte)(0x00);
            request[1] = (byte)DirectCommand.MessageWrite;
            request[2] = (byte)box;
            request[3] = (byte)messageSize;
            Encoding.ASCII.GetBytes(message).CopyTo(request, 4);
            CompleteRequest(request);
            return;             
        }
public void MessageWrite ( Mailbox box , string message ) { if ( ! message . EndsWith ( " \0 " ) ) message += ' \0 ' ; int messageSize = message . Length ; if ( messageSize > 59 ) { throw new NXTException ( " " ) ; } byte [ ] request = new byte [ 4 + messageSize ] ; request [ 0 ] = ( byte ) ( 0x00 ) ; request [ 1 ] = ( byte ) DirectCommand . MessageWrite ; request [ 2 ] = ( byte ) box ; request [ 3 ] = ( byte ) messageSize ; Encoding . ASCII . GetBytes ( message ) . CopyTo ( request , 4 ) ; CompleteRequest ( request ) ; return ; }
[Native] Write a message to an incoming box on the NXT.
[ Native ] Write a message to an incoming box on the NXT .
box
Mailbox
The mailbox to send the message to.
The mailbox to send the message to .
message
string
The message to send, as a string.
The string must not be longer than 57 characters.
The message to send as a string . The string must not be longer than 57 characters .