Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## lejos.pc.comm
Class NXTCommFantom

    java.lang.Object
      lejos.pc.comm.NXTCommFantom

All Implemented Interfaces:
  NXTComm

    public class NXTCommFantom

extends java.lang.Object
implements NXTComm

Implementation of NXTComm using the the LEGO Fantom API. Not yet functional. Should not be used directly - use NXTCommFactory to create an appropriate NXTComm object for your system and the protocol you are using.

Constructor Summary
`NXTCommFantom()`

Method Summary
`int` | `available()` Request the number of bytes available to read.
`void` | `close()` Closes the connection to the NXT.
`java.io.InputStream` | `getInputStream()` Return an InputStream for reading a stream of data from the NXT over this connection.
`java.io.OutputStream` | `getOutputStream()` Return an OutputStream for writing a stream of data to the NXT over this connection.
`void` | `jfantom_close(long nxt)`
`java.lang.String[]` | `jfantom_find()`
`long` | `jfantom_open(java.lang.String nxt)`
`byte[]` | `jfantom_read_data(long nxt, int len)`
`void` | `jfantom_send_data(long nxt, byte[] message, int len, int replyLen)`
`boolean` | `open(NXTInfo nxtInfo)` Connect to a NXT found by a search or created from mname and address.
`byte[]` | `read()` Read data from a NXT that has an open connection.
`NXTInfo[]` | `search(java.lang.String name, int protocol)` Search for NXTs over USB, Bluetooth or both
`byte[]` | `sendRequest(byte[] data, int replyLen)` Send an LCP message to the NXT and receive a reply
`void` | `write(byte[] data)` Write data to a NXT that has an open connection.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### NXTCommFantom

    public NXTCommFantom()

Method Detail

### jfantom_find

    public java.lang.String[] jfantom_find()

### jfantom_open

    public long jfantom_open(java.lang.String nxt)

### jfantom_close

    public void jfantom_close(long nxt)

### jfantom_send_data

    public void jfantom_send_data(long nxt,
                                  byte[] message,
                                  int len,
                                  int replyLen)

### jfantom_read_data

    public byte[] jfantom_read_data(long nxt,
                                    int len)

### search

    public NXTInfo[] search(java.lang.String name,
                            int protocol)

  Description copied from interface: `NXTComm`
  Search for NXTs over USB, Bluetooth or both

  Specified by:
    `search` in interface `NXTComm`
  Parameters:
    `name` - name of the NXT or null
    `protocol` - bitwise combination of NXTCommFactory.BLUETOOTH and NXTCommFactory.USB
  Returns:
    a NXTInfo object describing the NXt found and the connection to it

### open

    public boolean open(NXTInfo nxtInfo)

  Description copied from interface: `NXTComm`
  Connect to a NXT found by a search or created from mname and address.

  Specified by:
    `open` in interface `NXTComm`
  Parameters:
    `nxtInfo` - the NXTInfo object for the NXT
  Returns:
    true iff the open succeeded

### close

    public void close()

  Description copied from interface: `NXTComm`
  Closes the connection to the NXT.

  Specified by:
    `close` in interface `NXTComm`

### sendRequest

    public byte[] sendRequest(byte[] data,
                              int replyLen)

  Description copied from interface: `NXTComm`
  Send an LCP message to the NXT and receive a reply

  Specified by:
    `sendRequest` in interface `NXTComm`
  Parameters:
    `data` - the LCP message
    `replyLen` - the reply length expected
  Returns:
    the reply

### read

    public byte[] read()
                throws java.io.IOException

  Description copied from interface: `NXTComm`
  Read data from a NXT that has an open connection. Used for stream connections.

  Specified by:
    `read` in interface `NXTComm`
  Returns:
    the data
  Throws:
    `java.io.IOException`

### available

    public int available()
                  throws java.io.IOException

  Description copied from interface: `NXTComm`
  Request the number of bytes available to read.

  Specified by:
    `available` in interface `NXTComm`
  Returns:
    the number of bytes available
  Throws:
    `java.io.IOException`

### write

    public void write(byte[] data)
               throws java.io.IOException

  Description copied from interface: `NXTComm`
  Write data to a NXT that has an open connection.

  Specified by:
    `write` in interface `NXTComm`
  Parameters:
    `data` - the data to be written. Used for stream connections.
  Throws:
    `java.io.IOException`

### getOutputStream

    public java.io.OutputStream getOutputStream()

  Description copied from interface: `NXTComm`
  Return an OutputStream for writing a stream of data to the NXT over this connection.

  Specified by:
    `getOutputStream` in interface `NXTComm`
  Returns:
    the OutputStream object

### getInputStream

    public java.io.InputStream getInputStream()

  Description copied from interface: `NXTComm`
  Return an InputStream for reading a stream of data from the NXT over this connection.

  Specified by:
    `getInputStream` in interface `NXTComm`
  Returns:
    the InputStream object

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD