Class NXTComm

  • All Implemented Interfaces:
    NXTCommRequest

    public class NXTComm
    extends java.lang.Object
    implements NXTCommRequest
    Initiates communication to a remote NXT. Used by NXTCommand to implement the Lego Communications Protocol (LCP) over Bluetooth.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close the connection
      boolean open​(java.lang.String name, int mode)  
      byte[] sendRequest​(byte[] message, int replyLen)
      Send an LCP message to the NXT and receive a reply
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • open

        public boolean open​(java.lang.String name,
                            int mode)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • sendRequest

        public byte[] sendRequest​(byte[] message,
                                  int replyLen)
                           throws java.io.IOException
        Description copied from interface: NXTCommRequest
        Send an LCP message to the NXT and receive a reply
        Specified by:
        sendRequest in interface NXTCommRequest
        Parameters:
        message - the LCP message
        replyLen - the reply length expected
        Returns:
        the reply
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Description copied from interface: NXTCommRequest
        Close the connection
        Specified by:
        close in interface NXTCommRequest
        Throws:
        java.io.IOException