nxtlib/src/Protocol.cs
/// <summary> 
/// [Native] Read a message from the remote inbox on an NXT.
/// </summary>
/// <param name="remoteInboxNo">The mailbox on the remote NXT.</param>
/// <param name="localInboxNo">The mailbox on the local system.</param>
/// <param name="remove">Set to true to clear the message from the remote inbox.  Set to false otherwise.</param>
/// <returns>Returns the messagebox's contents, as a string.</returns>
[Native] Read a message from the remote inbox on an NXT.
[ Native ] Read a message from the remote inbox on an NXT .
public string MessageRead(MailboxExtended remoteInboxNo, Mailbox localInboxNo, bool remove)
        {
            byte[] request = new byte[] {
            0x00,
            (byte) DirectCommand.MessageRead,
            (byte) remoteInboxNo,
            (byte) localInboxNo,
            (byte) (remove ? 0xFF : 0x00)
            };
            byte[] reply = CompleteRequest(request);
            if (reply[3] != (byte)localInboxNo)
            {
                throw new NXTReplyIncorrect();
            }
            byte localInboxNoOut = reply[3];
            byte messageSize = reply[4];
            string message = Encoding.ASCII.GetString(reply, 5, messageSize).TrimEnd('\0');
            return message;
        }
public string MessageRead ( MailboxExtended remoteInboxNo , Mailbox localInboxNo , bool remove ) { byte [ ] request = new byte [ ] { 0x00 , ( byte ) DirectCommand . MessageRead , ( byte ) remoteInboxNo , ( byte ) localInboxNo , ( byte ) ( remove ? 0xFF : 0x00 ) } ; byte [ ] reply = CompleteRequest ( request ) ; if ( reply [ 3 ] != ( byte ) localInboxNo ) { throw new NXTReplyIncorrect ( ) ; } byte localInboxNoOut = reply [ 3 ] ; byte messageSize = reply [ 4 ] ; string message = Encoding . ASCII . GetString ( reply , 5 , messageSize ) . TrimEnd ( ' \0 ' ) ; return message ; }
[Native] Read a message from the remote inbox on an NXT.
[ Native ] Read a message from the remote inbox on an NXT .
Returns the messagebox's contents, as a string.
Returns the messagebox ' s contents as a string .
remoteInboxNo
MailboxExtended
The mailbox on the remote NXT.
The mailbox on the remote NXT .
localInboxNo
Mailbox
The mailbox on the local system.
The mailbox on the local system .
remove
bool
Set to true to clear the message from the remote inbox.  Set to false otherwise.
Set to true to clear the message from the remote inbox . Set to false otherwise .