lejos.pc.comm
Class NXTCommFactory

java.lang.Object
  extended by lejos.pc.comm.NXTCommFactory

public class NXTCommFactory
extends java.lang.Object

Creates a version of NXTComm appropriate to the OS in use and protocol (Bluetooth or USB) that is requested.


Field Summary
static int ALL_PROTOCOLS
          Use either USB or Bluetooth for the connection.
static int BLUETOOTH
          Use Bluetooth for the connection
static int USB
          Use USB for the connection
 
Constructor Summary
NXTCommFactory()
           
 
Method Summary
static NXTComm createNXTComm(int protocol)
          Load a comms driver for a protocol (USB or Bluetooth)
static java.util.Properties getNXJCache()
          Load the Bluetooth name cache as properties
static java.util.Properties getNXJProperties()
          Load the leJOS NXJ properties
static void saveNXJCache(java.util.Properties props, java.lang.String comment)
          Save the leJOS NXJ Properties
static void saveNXJProperties(java.util.Properties props, java.lang.String comment)
          Save the leJOS NXJ Properties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USB

public static final int USB
Use USB for the connection

See Also:
Constant Field Values

BLUETOOTH

public static final int BLUETOOTH
Use Bluetooth for the connection

See Also:
Constant Field Values

ALL_PROTOCOLS

public static final int ALL_PROTOCOLS
Use either USB or Bluetooth for the connection. Normally, USB is tested first since it fails faster.

See Also:
Constant Field Values
Constructor Detail

NXTCommFactory

public NXTCommFactory()
Method Detail

createNXTComm

public static NXTComm createNXTComm(int protocol)
                             throws NXTCommException
Load a comms driver for a protocol (USB or Bluetooth)

Parameters:
protocol - the protocol
Returns:
a driver that supports the nxtComm interface
Throws:
NXTCommException

getNXJProperties

public static java.util.Properties getNXJProperties()
                                             throws NXTCommException
Load the leJOS NXJ properties

Returns:
the Properties object
Throws:
NXTCommException

getNXJCache

public static java.util.Properties getNXJCache()
                                        throws NXTCommException
Load the Bluetooth name cache as properties

Returns:
the Properties object
Throws:
NXTCommException

saveNXJProperties

public static void saveNXJProperties(java.util.Properties props,
                                     java.lang.String comment)
                              throws java.io.IOException
Save the leJOS NXJ Properties

Parameters:
props - the complete set of properties
comment - a comment that is written to the file
Throws:
java.io.IOException

saveNXJCache

public static void saveNXJCache(java.util.Properties props,
                                java.lang.String comment)
                         throws java.io.IOException
Save the leJOS NXJ Properties

Parameters:
props - the complete set of properties
comment - a comment that is written to the file
Throws:
java.io.IOException