javax.bluetooth
Class LocalDevice

java.lang.Object
  extended by javax.bluetooth.LocalDevice

public class LocalDevice
extends Object

Singleton class representing a local NXT Bluetooth device. Most methods are standard, except you can also set the friendly name with this class.

Author:
BB

Method Summary
protected  char[] convertBytesToChars(byte[] byteArray)
           
protected  byte[] convertCharsToBytes(char[] charArray, int length)
           
 String getBluetoothAddress()
          Returns the local Bluetooth address of NXT brick.
 DeviceClass getDeviceClass()
          The Lego Bluecore code can't retrieve this from the chip.
 int getDiscoverable()
          Indicates whether the NXT brick is visible to other devices
 String getFriendlyName()
          Returns the friendly name of a Bluetooth device.
static LocalDevice getLocalDevice()
           
static String getProperty(String property)
          UNIMPLEMENTED! Returns null always.
static boolean isPowerOn()
          Power state of the Bluecore 4 chip in the NXT brick.
 boolean setDiscoverable(int mode)
          Normally the mode values are found in javax.bluetooth.DiscoveryAgent.
 boolean setFriendlyName(String name)
          Changes the friendly name of the NXT brick.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait
 

Method Detail

getLocalDevice

public static LocalDevice getLocalDevice()
                                  throws BluetoothStateException
Throws:
BluetoothStateException

getFriendlyName

public String getFriendlyName()
Returns the friendly name of a Bluetooth device. NOTE: If you want to set the friendly name, it can be done through the LCP class or using the NXJExplorer program on your personal computer.

Returns:
the friendly name

setFriendlyName

public boolean setFriendlyName(String name)
Changes the friendly name of the NXT brick. NOTE: This method is not part of the standard JSR 82 API because not all Bluetooth devices can change their friendly name. This method does not work. Technically this should be done through LCP so USB can also change it.

Returns:
true = success, false = failed

convertCharsToBytes

protected byte[] convertCharsToBytes(char[] charArray,
                                     int length)
</