Class NXTConnection

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int LCP
      Lego Communications Protocol (LCP) I/O mode.
      static int PACKET
      PACKET I/O mode.
      static int RAW
      RAW I/O mode.
    • Constructor Summary

      Constructors 
      Constructor Description
      NXTConnection()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void close()  
      java.io.DataInputStream openDataInputStream()
      Open and return a data input stream for a connection.
      java.io.DataOutputStream openDataOutputStream()
      Open and return a data output stream for a connection.
      java.io.InputStream openInputStream()
      Open and return an input stream for a connection.
      java.io.OutputStream openOutputStream()
      Open and return an output stream for a connection.
      abstract int read​(byte[] buf, int length)  
      abstract int read​(byte[] buf, int length, boolean b)  
      abstract int write​(byte[] buffer, int numBytes)  
      • Methods inherited from class java.lang.Object

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

      • LCP

        public static final int LCP
        Lego Communications Protocol (LCP) I/O mode. The LCP is defined by The Lego Company to allow limited remote command control of a NXT brick. See the Lego Mindstorms Site. Look for the Bluetooth Developer Kit in Support | Files | Advanced
        See Also:
        Constant Field Values
      • PACKET

        public static final int PACKET
        PACKET I/O mode. This is default and is probably the best mode to use if you are talking to a NXT using the leJOS classes. Headers are included for each packet of data sent and received.
        See Also:
        Constant Field Values
      • RAW

        public static final int RAW
        RAW I/O mode. This mode is just that and omits any headers. It is used normally for connections to non-NXT devices such as cell phones, etc.
        See Also:
        Constant Field Values
    • Constructor Detail

      • NXTConnection

        public NXTConnection()
    • Method Detail

      • openDataInputStream

        public java.io.DataInputStream openDataInputStream()
        Description copied from interface: InputConnection
        Open and return a data input stream for a connection.
        Specified by:
        openDataInputStream in interface InputConnection
        Returns:
        the data input stream
      • openInputStream

        public java.io.InputStream openInputStream()
        Description copied from interface: InputConnection
        Open and return an input stream for a connection.
        Specified by:
        openInputStream in interface InputConnection
        Returns:
        the input stream
      • close

        public abstract void close()
                            throws java.io.IOException
        Specified by:
        close in interface Connection
        Throws:
        java.io.IOException
      • openDataOutputStream

        public java.io.DataOutputStream openDataOutputStream()
        Description copied from interface: OutputConnection
        Open and return a data output stream for a connection.
        Specified by:
        openDataOutputStream in interface OutputConnection
        Returns:
        the data output stream
      • openOutputStream

        public java.io.OutputStream openOutputStream()
        Description copied from interface: OutputConnection
        Open and return an output stream for a connection.
        Specified by:
        openOutputStream in interface OutputConnection
        Returns:
        the output stream
      • read

        public abstract int read​(byte[] buf,
                                 int length)
      • write

        public abstract int write​(byte[] buffer,
                                  int numBytes)
      • read

        public abstract int read​(byte[] buf,
                                 int length,
                                 boolean b)