lejos.nxt.comm
Class Bluetooth

java.lang.Object
  extended by lejos.nxt.comm.NXTCommDevice
      extended by lejos.nxt.comm.Bluetooth

public class Bluetooth
extends NXTCommDevice

Provides Bluetooth communications. Allows inbound and outbound connections. Provides access to to device registration.


Field Summary
static byte BT_PENDING_INPUT
           
static byte BT_PENDING_OUTPUT
           
static byte MSG_ACCEPT_CONNECTION
           
static byte MSG_ADD_DEVICE
           
static byte MSG_ANY
           
static byte MSG_BEGIN_INQUIRY
           
static byte MSG_CANCEL_INQUIRY
           
static byte MSG_CLOSE_CONNECTION
           
static byte MSG_CLOSE_CONNECTION_RESULT
           
static byte MSG_CLOSE_PORT
           
static byte MSG_CLOSE_PORT_RESULT
           
static byte MSG_CONNECT
           
static byte MSG_CONNECT_RESULT
           
static byte MSG_CONNECTION_STATUS_RESULT
           
static byte MSG_DUMP_LIST
           
static byte MSG_GET_BRICK_STATUSBYTE
           
static byte MSG_GET_BRICK_STATUSBYTE_RESULT
           
static byte MSG_GET_CONNECTION_STATUS
           
static byte MSG_GET_DISCOVERABLE
           
static byte MSG_GET_DISCOVERABLE_RESULT
           
static byte MSG_GET_FRIENDLY_NAME
           
static byte MSG_GET_FRIENDLY_NAME_RESULT
           
static byte MSG_GET_LINK_QUALITY
           
static byte MSG_GET_LOCAL_ADDR
           
static byte MSG_GET_LOCAL_ADDR_RESULT
           
static byte MSG_GET_OPERATING_MODE
           
static byte MSG_GET_PORT_OPEN
           
static byte MSG_GET_PORT_OPEN_RESULT
           
static byte MSG_GET_VERSION
           
static byte MSG_GET_VERSION_RESULT
           
static byte MSG_GOTO_DFU_MODE
           
static byte MSG_HEARTBEAT
           
static byte MSG_INQUIRY_RESULT
           
static byte MSG_INQUIRY_RUNNING
           
static byte MSG_INQUIRY_STOPPED
           
static byte MSG_LINK_QUALITY_RESULT
           
static byte MSG_LIST_DUMP_STOPPED
           
static byte MSG_LIST_ITEM
           
static byte MSG_LIST_RESULT
           
static byte MSG_LOOKUP_NAME
           
static byte MSG_LOOKUP_NAME_FAILURE
           
static byte MSG_LOOKUP_NAME_RESULT
           
static byte MSG_OPEN_PORT
           
static byte MSG_OPEN_STREAM
           
static byte MSG_OPERATING_MODE_RESULT
           
static byte MSG_PIN_CODE
           
static byte MSG_PIN_CODE_ACK
           
static byte MSG_PORT_OPEN_RESULT
           
static byte MSG_REMOVE_DEVICE
           
static byte MSG_REQUEST_CONNECTION
           
static byte MSG_REQUEST_PIN_CODE
           
static byte MSG_RESET_INDICATION
           
static byte MSG_SET_BRICK_STATUSBYTE
           
static byte MSG_SET_BRICK_STATUSBYTE_RESULT
           
static byte MSG_SET_DISCOVERABLE
           
static byte MSG_SET_DISCOVERABLE_ACK
           
static byte MSG_SET_FACTORY_SETTINGS
           
static byte MSG_SET_FACTORY_SETTINGS_ACK
           
static byte MSG_SET_FRIENDLY_NAME
           
static byte MSG_SET_FRIENDLY_NAME_ACK
           
static byte MSG_SET_OPERATING_MODE
           
static byte MSG_START_HEART
           
static String PIN
           
 
Fields inherited from class lejos.nxt.comm.NXTCommDevice
ADDRESS_LEN, cs, NAME, NAME_LEN, SERIAL_NO
 
Method Summary
static boolean addDevice(RemoteDevice d)
          Add device to known devices
static void btDisable()
           
static void btEnable()
           
static int btGetBC4CmdMode()
          Low-level method to get the BC4 chip mode
static int btPending()
          Low-Level method to access the Bluetooth interface.
static int btRead(byte[] buf, int off, int len)
          Low-level method to read BT data
static void btReceive(byte[] buf)
          Low-level method to receive BT replies or data
static void btSend(byte[] buf, int len)
          Low-level method to send a BT command or data
static void btSetArmCmdMode(int mode)
          Low-level method to switch BC4 chip between command and data (stream) mode.
static void btSetCmdMode(int mode)
          Set the BC4 mode, and wait for that mode to be confirmed by the chip.
static void btSetResetHigh()
          Low-level method to take the BC4 reset line high
static void btSetResetLow()
          Low-level method to take the BC4 reset line low
static int btWrite(byte[] buf, int off, int len)
          Low-level method to write BT data
static boolean cancelInquiry()
          Cancel a Bluetooth inquiry process that has been started using startInquire
static int closeConnection(byte handle)
          Close an open connection
static byte[] closePort()
          Closes the port to disallow incoming connections.
static BTConnection connect(RemoteDevice remoteDevice)
          Connects to a remote device.
static BTConnection connect(String target, int mode)
          Connect to the specified device, either by name or address
static BTConnection connect(String target, int mode, byte[] pin)
          Connect to the specified device, either by name or address
static byte[] getConnectionStatus()
          Get the status of all connections
static NXTCommConnector getConnector()
          Provides access to the singleton connection object.
static String getFriendlyName()
          Get the friendly name of the local device
static RemoteDevice getKnownDevice(String fName)
          Gets a Device of the BC4-Chips internal list of known Devices (those who have been paired before) into the BTDevice Object.
static Vector getKnownDevicesList()
          The internal Chip has a list of already paired Devices.
static String getLocalAddress()
          get the Bluetooth address of the local device
static int getOperatingMode()
          Get the operating mode (stream breaking or not)
static byte[] getPin()
          Return the pin to be used for pairing/connecting to the system
static int getPortOpen()
          Get the port open status, i.e whether connections are being accepted
static boolean getPower()
          Return the current state of the module power
static int getResetCount()
           
static int getSignalStrength(byte handle)
          Get the Bluetooth signal strength (link quality) Higher values mean stronger signal.
static int getStatus()
          Get the persistent status value from the BC4 chip
static byte[] getVersion()
          Get the major and minor version of the BlueCore code
static int getVisibility()
          Get the visibility (discoverable) status of the device
static Vector inquire(int maxDevices, int timeout, byte[] cod)
          Start a Bluetooth inquiry process
static void inquireNotify(int maxDevices, int timeout, DiscoveryListener listy)
          Start a Bluetooth inquiry process and notify listener of each device found.
static void loadSettings()
           
static String lookupName(String addr)
          Look up the name of a device using its address
static byte[] openPort()
          Opens the port to allow incoming connections.
static int readPacket(byte[] buf, int len)
          Read a packet from the stream.
static boolean removeDevice(RemoteDevice d)
          Remove device from known devices
static void reset()
          Force a reset of the Bluetooth module.
static void sendPacket(byte[] buf, int bufLen)
          Send a data packet.
static int setFactorySettings()
          Reset the settings of the BC4 chip to the factory defaults.
static boolean setFriendlyName(String strName)
          Set the name of the local device
static int setOperatingMode(byte mode)
          Set the operating mode
static void setPin(byte[] newPin)
          Set the pin to be used for pairing/connecting to the system
static void setPower(boolean on)
          Set the power to the module
static int setStatus(int status)
          Set the persistent status byte for the BC4 chip
static int setVisibility(byte visible)
          Set Bluetooth visibility (discoverable) on or off for the local device
static BTConnection waitForConnection()
          Uses the current default PIN
static BTConnection waitForConnection(int timeout, int mode)
          Uses the current default PIN
static BTConnection waitForConnection(int timeout, int mode, byte[] pin)
          Wait for a remote device to connect.
 
Methods inherited from class lejos.nxt.comm.NXTCommDevice
addressToString, getAddress, getName, isAddress, nameToString, setAddress, setName, stringToAddress, stringToName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MSG_BEGIN_INQUIRY

public static final byte MSG_BEGIN_INQUIRY
See Also:
Constant Field Values

MSG_CANCEL_INQUIRY

public static final byte MSG_CANCEL_INQUIRY
See Also:
Constant Field Values

MSG_CONNECT

public static final byte MSG_CONNECT
See Also:
Constant Field Values

MSG_OPEN_PORT

public static final byte MSG_OPEN_PORT
See Also:
Constant Field Values

MSG_LOOKUP_NAME

public static final byte MSG_LOOKUP_NAME
See Also:
Constant Field Values

MSG_ADD_DEVICE

public static final byte MSG_ADD_DEVICE
See Also:
Constant Field Values

MSG_REMOVE_DEVICE

public static final byte MSG_REMOVE_DEVICE
See Also:
Constant Field Values

MSG_DUMP_LIST

public static final byte MSG_DUMP_LIST
See Also:
Constant Field Values

MSG_CLOSE_CONNECTION

public static final byte MSG_CLOSE_CONNECTION
See Also:
Constant Field Values

MSG_ACCEPT_CONNECTION

public static final byte MSG_ACCEPT_CONNECTION
See Also:
Constant Field Values

MSG_PIN_CODE

public static final byte MSG_PIN_CODE
See Also:
Constant Field Values

MSG_OPEN_STREAM

public static final byte MSG_OPEN_STREAM
See Also:
Constant Field Values

MSG_START_HEART

public static final byte MSG_START_HEART
See Also:
Constant Field Values

MSG_HEARTBEAT

public static final byte MSG_HEARTBEAT
See Also:
Constant Field Values

MSG_INQUIRY_RUNNING

public static final byte MSG_INQUIRY_RUNNING
See Also:
Constant Field Values

MSG_INQUIRY_RESULT

public static final byte MSG_INQUIRY_RESULT
See Also:
Constant Field Values

MSG_INQUIRY_STOPPED

public static final byte MSG_INQUIRY_STOPPED
See Also:
Constant Field Values

MSG_LOOKUP_NAME_RESULT

public static final byte MSG_LOOKUP_NAME_RESULT
See Also:
Constant Field Values

MSG_LOOKUP_NAME_FAILURE

public static final byte MSG_LOOKUP_NAME_FAILURE
See Also:
Constant Field Values

MSG_CONNECT_RESULT

public static final byte MSG_CONNECT_RESULT
See Also:
Constant Field Values

MSG_RESET_INDICATION

public static final byte MSG_RESET_INDICATION
See Also:
Constant Field Values

MSG_REQUEST_PIN_CODE

public static final byte MSG_REQUEST_PIN_CODE
See Also:
Constant Field Values

MSG_REQUEST_CONNECTION

public static final byte MSG_REQUEST_CONNECTION
See Also:
Constant Field Values

MSG_LIST_RESULT

public static final byte MSG_LIST_RESULT
See Also:
Constant Field Values

MSG_LIST_ITEM

public static final byte MSG_LIST_ITEM
See Also:
Constant Field Values

MSG_LIST_DUMP_STOPPED

public static final byte MSG_LIST_DUMP_STOPPED
See Also:
Constant Field Values

MSG_CLOSE_CONNECTION_RESULT

public static final byte MSG_CLOSE_CONNECTION_RESULT
See Also:
Constant Field Values

MSG_PORT_OPEN_RESULT

public static final byte MSG_PORT_OPEN_RESULT
See Also:
Constant Field Values

MSG_SET_DISCOVERABLE

public static final byte MSG_SET_DISCOVERABLE
See Also:
Constant Field Values

MSG_CLOSE_PORT

public static final byte MSG_CLOSE_PORT
See Also:
Constant Field Values

MSG_CLOSE_PORT_RESULT

public static final byte MSG_CLOSE_PORT_RESULT
See Also:
Constant Field Values

MSG_PIN_CODE_ACK

public static final byte MSG_PIN_CODE_ACK
See Also:
Constant Field Values

MSG_SET_DISCOVERABLE_ACK

public static final byte MSG_SET_DISCOVERABLE_ACK
See Also:
Constant Field Values

MSG_SET_FRIENDLY_NAME

public static final byte MSG_SET_FRIENDLY_NAME
See Also:
Constant Field Values

MSG_SET_FRIENDLY_NAME_ACK

public static final byte MSG_SET_FRIENDLY_NAME_ACK
See Also:
Constant Field Values

MSG_GET_LINK_QUALITY

public static final byte MSG_GET_LINK_QUALITY
See Also:
Constant Field Values

MSG_LINK_QUALITY_RESULT

public static final byte MSG_LINK_QUALITY_RESULT
See Also:
Constant Field Values

MSG_SET_FACTORY_SETTINGS

public static final byte MSG_SET_FACTORY_SETTINGS
See Also:
Constant Field Values

MSG_SET_FACTORY_SETTINGS_ACK

public static final byte MSG_SET_FACTORY_SETTINGS_ACK
See Also:
Constant Field Values

MSG_GET_LOCAL_ADDR

public static final byte MSG_GET_LOCAL_ADDR
See Also:
Constant Field Values

MSG_GET_LOCAL_ADDR_RESULT

public static final byte MSG_GET_LOCAL_ADDR_RESULT
See Also:
Constant Field Values

MSG_GET_FRIENDLY_NAME

public static final byte MSG_GET_FRIENDLY_NAME
See Also:
Constant Field Values

MSG_GET_DISCOVERABLE

public static final byte MSG_GET_DISCOVERABLE
See Also:
Constant Field Values

MSG_GET_PORT_OPEN

public static final byte MSG_GET_PORT_OPEN
See Also:
Constant Field Values

MSG_GET_FRIENDLY_NAME_RESULT

public static final byte MSG_GET_FRIENDLY_NAME_RESULT
See Also:
Constant Field Values

MSG_GET_DISCOVERABLE_RESULT

public static final byte MSG_GET_DISCOVERABLE_RESULT
See Also:
Constant Field Values

MSG_GET_PORT_OPEN_RESULT

public static final byte MSG_GET_PORT_OPEN_RESULT
See Also:
Constant Field Values

MSG_GET_VERSION

public static final byte MSG_GET_VERSION
See Also:
Constant Field Values

MSG_GET_VERSION_RESULT

public static final byte MSG_GET_VERSION_RESULT
See Also:
Constant Field Values

MSG_GET_BRICK_STATUSBYTE_RESULT

public static final byte MSG_GET_BRICK_STATUSBYTE_RESULT
See Also:
Constant Field Values

MSG_SET_BRICK_STATUSBYTE_RESULT

public static final byte MSG_SET_BRICK_STATUSBYTE_RESULT
See Also:
Constant Field Values

MSG_GET_BRICK_STATUSBYTE

public static final byte MSG_GET_BRICK_STATUSBYTE
See Also:
Constant Field Values

MSG_SET_BRICK_STATUSBYTE

public static final byte MSG_SET_BRICK_STATUSBYTE
See Also:
Constant Field Values

MSG_GET_OPERATING_MODE

public static final byte MSG_GET_OPERATING_MODE
See Also:
Constant Field Values

MSG_SET_OPERATING_MODE

public static final byte MSG_SET_OPERATING_MODE
See Also:
Constant Field Values

MSG_OPERATING_MODE_RESULT

public static final byte MSG_OPERATING_MODE_RESULT
See Also:
Constant Field Values

MSG_GET_CONNECTION_STATUS

public static final byte MSG_GET_CONNECTION_STATUS
See Also:
Constant Field Values

MSG_CONNECTION_STATUS_RESULT

public static final byte MSG_CONNECTION_STATUS_RESULT
See Also:
Constant Field Values

MSG_GOTO_DFU_MODE

public static final byte MSG_GOTO_DFU_MODE
See Also:
Constant Field Values

MSG_ANY

public static final byte MSG_ANY
See Also:
Constant Field Values

BT_PENDING_INPUT

public static final byte BT_PENDING_INPUT
See Also:
Constant Field Values

BT_PENDING_OUTPUT

public static final byte BT_PENDING_OUTPUT
See Also:
Constant Field Values

PIN

public static final String PIN
See Also:
Constant Field Values
Method Detail

btWrite

public static int btWrite(byte[] buf,
                          int off,
                          int len)
Low-level method to write BT data

Parameters:
buf - the buffer to send
off - the offset to start the write from.
len - the number of bytes to send
Returns:
number of bytes actually written

btRead

public static int btRead(byte[] buf,
                         int off,
                         int len)
Low-level method to read BT data

Parameters:
buf - the buffer to read data into
off - the offset at which to start the transfer
len - the number of bytes to read
Returns:
number of bytes actually read

btPending

public static int btPending()
Low-Level method to access the Bluetooth interface. Bitwise values returned.

Returns:
0 No data pending 0x1 input pending 0x2 output pending

btSetArmCmdMode

public static void btSetArmCmdMode(int mode)
Low-level method to switch BC4 chip between command and data (stream) mode.

Parameters:
mode - 0=data mode, 1=command mode

btGetBC4CmdMode

public static int btGetBC4CmdMode()
Low-level method to get the BC4 chip mode

Returns:
the current mode

btSetResetLow

public static void btSetResetLow()
Low-level method to take the BC4 reset line low


btSetResetHigh

public static void btSetResetHigh()
Low-level method to take the BC4 reset line high


btSend

public static void btSend(byte[] buf,
                          int len)
Low-level method to send a BT command or data

Parameters:
buf - the buffer to send
len - the number of bytes to send

btReceive

public static void btReceive(byte[] buf)
Low-level method to receive BT replies or data

Parameters:
buf - the buffer to receive data in

btEnable

public static void btEnable()

btDisable

public static void btDisable()

setPin

public static void setPin(byte[] newPin)
Set the pin to be used for pairing/connecting to the system

Parameters:
newPin - the new pin code

getPin

public static byte[] getPin()
Return the pin to be used for pairing/connecting to the system

Returns:
The current pin code

closeConnection

public static int closeConnection(byte handle)
Close an open connection

Parameters:
handle - the handle for the connection
Returns:
the status 0 = success

openPort

public static byte[] openPort()
Opens the port to allow incoming connections.

Returns:
an array of three bytes: success, handle, ps_success

closePort

public static byte[] closePort()
Closes the port to disallow incoming connections.

Returns:
an array of two bytes: success, ps_success

waitForConnection

public static BTConnection waitForConnection(int timeout,
                                             int mode,
                                             byte[] pin)
Wait for a remote device to connect.

Parameters:
timeout - time in ms to wait for connection, 0 == wait for ever
mode - the I/O mode to be used for this connection. NXTConnection.RAW, .LCP, or .PACKET
pin - the pin to use, null use current default
Returns:
a BTConnection

waitForConnection

public static BTConnection waitForConnection()
Uses the current default PIN

Returns:
the Bluetooth connection

waitForConnection

public static BTConnection waitForConnection(int timeout,
                                             int mode)
Uses the current default PIN

Parameters:
timeout - time in ms to wait for connection, 0 == wait for ever
mode - the I/O mode to be used for this connection. NXTConnection.RAW, .LCP, or .PACKET
Returns:
the Bluetooth connection

connect

public static BTConnection connect(RemoteDevice remoteDevice)
Connects to a remote device. Uses the current default pin.

Parameters:
remoteDevice - remote device
Returns:
BTConnection Object or null

connect

public static BTConnection connect(String target,
                                   int mode,
                                   byte[] pin)
Connect to the specified device, either by name or address

Parameters:
target - String name or address
mode - I/O mode for this connection. NXTConnection.RAW, .LCP, or .PACKET
pin - The pin to use for this connection
Returns:
BTConnection object or null

connect

public static BTConnection connect(String target,
                                   int mode)
Connect to the specified device, either by name or address

Parameters:
target - String name or address
mode - I/O mode for this connection. NXTConnection.RAW, .LCP, or .PACKET
Returns:
BTConnection object or null

getSignalStrength

public static int getSignalStrength(byte handle)
Get the Bluetooth signal strength (link quality) Higher values mean stronger signal.

Parameters:
handle - The handle/channel of the connection
Returns:
link quality value 0 to 255.

getFriendlyName

public static String getFriendlyName()
Get the friendly name of the local device

Returns:
the friendly name

setFriendlyName

public static boolean setFriendlyName(String strName)
Set the name of the local device

Parameters:
strName - the friendly name for the device
Returns:
true if ok false if there is an error

getLocalAddress

public static String getLocalAddress()
get the Bluetooth address of the local device

Returns:
the local address

getKnownDevicesList

public static Vector getKnownDevicesList()
The internal Chip has a list of already paired Devices. This Method returns a Vector-List which contains all the known Devices on the List. These need not be reachable. To connect to a "not-known"-Device, you should use the Inquiry-Process. The pairing-Process can also be done with the original Lego-Firmware. The List of known devices will not get lost, when installing the LeJOS Firmware.

Returns:
Vector with List of known Devices

getKnownDevice

public static RemoteDevice getKnownDevice(String fName)
Gets a Device of the BC4-Chips internal list of known Devices (those who have been paired before) into the BTDevice Object.

Parameters:
fName - Friendly-Name of the device
Returns:
BTDevice Object or null, if not found.

addDevice

public static boolean addDevice(RemoteDevice d)
Add device to known devices

Parameters:
d - Remote Device
Returns:
true if add was successful

removeDevice

public static boolean removeDevice(RemoteDevice d)
Remove device from known devices

Parameters:
d - Remote Device
Returns:
true if remove was successful

cancelInquiry

public static boolean cancelInquiry()
Cancel a Bluetooth inquiry process that has been started using startInquire

Returns:
true if the request is cancelled false if there is an error.

inquireNotify

public static void inquireNotify(int maxDevices,
                                 int timeout,
                                 DiscoveryListener listy)
Start a Bluetooth inquiry process and notify listener of each device found. This method is primarily used by DiscoveryAgent.startInquiry() and is run in a separate thread.

Parameters:
maxDevices - the maximum number of devices to discover
timeout - the timeout value in units of 1.28 seconds
listy - The listener to notify

inquire

public static Vector inquire(int maxDevices,
                             int timeout,
                             byte[] cod)
Start a Bluetooth inquiry process

Parameters:
maxDevices - the maximum number of devices to discover
timeout - the timeout value in units of 1.28 seconds
cod - the class of device to look for
Returns:
a vector of all the devices found

lookupName

public static String lookupName(String addr)
Look up the name of a device using its address

Parameters:
addr - device address
Returns:
friendly name of device

getConnectionStatus

public static byte[] getConnectionStatus()
Get the status of all connections

Returns:
byte array of status for each handle

getVersion

public static byte[] getVersion()
Get the major and minor version of the BlueCore code

Returns:
an array of two bytes: major version, minor version

getStatus

public static int getStatus()
Get the persistent status value from the BC4 chip

Returns:
the byte value

setStatus

public static int setStatus(int status)
Set the persistent status byte for the BC4 chip

Parameters:
status - the byte status value
Returns:
< 0 Error

getVisibility

public static int getVisibility()
Get the visibility (discoverable) status of the device

Returns:
1 = visible, 0 = invisible

getPortOpen

public static int getPortOpen()
Get the port open status, i.e whether connections are being accepted

Returns:
1 if the port is open, 0 otherwise

getOperatingMode

public static int getOperatingMode()
Get the operating mode (stream breaking or not)

Returns:
0 = stream breaking mode, 1 = don't break stream mode < 0 Error

setVisibility

public static int setVisibility(byte visible)
Set Bluetooth visibility (discoverable) on or off for the local device

Parameters:
visible - true to set visibility on, false to set it off
Returns:
< 0 error

setFactorySettings

public static int setFactorySettings()
Reset the settings of the BC4 chip to the factory defaults. The NXT should be restarted after this.

Returns:
0 if ok < 0 if error

setOperatingMode

public static int setOperatingMode(byte mode)
Set the operating mode

Parameters:
mode - 0 = Stream breaking, 1 don't break stream
Returns:
< 0 error

reset

public static void reset()
Force a reset of the Bluetooth module. Notes: After this call power will be on. Any existing connections will be closed Any listening threads will be aborted


setPower

public static void setPower(boolean on)
Set the power to the module

Parameters:
on - power on or off

getPower

public static boolean getPower()
Return the current state of the module power

Returns:
power on or off

getResetCount

public static int getResetCount()

loadSettings

public static void loadSettings()

readPacket

public static int readPacket(byte[] buf,
                             int len)
Read a packet from the stream. Do not block and for small packets (< 254 bytes), do not return a partial packet.

Parameters:
buf - Buffer to read data into.
len - Number of bytes to read.
Returns:
> 0 number of bytes read. other values see read.

sendPacket

public static void sendPacket(byte[] buf,
                              int bufLen)
Send a data packet. Must be in data mode.

Parameters:
buf - the data to send
bufLen - the number of bytes to send

btSetCmdMode

public static void btSetCmdMode(int mode)
Set the BC4 mode, and wait for that mode to be confirmed by the chip.

Parameters:
mode - the requested mode 1 == Command mode 0 == Stream mode

getConnector

public static NXTCommConnector getConnector()
Provides access to the singleton connection object. This object can be used to create new connections.

Returns:
the connector object