Enable and disable Bluetooth

Before connecting to your XBee device over Bluetooth Low Energy, you first have to enable this interface. The XBee Java Library provides two methods to enable or disable this interface:

Method Description

enableBluetooth()

Enables the Bluetooth Low Energy interface of your XBee device.

disableBluetooth()

Disables the Bluetooth Low Energy interface of your XBee device.

Enable and disable the Bluetooth interface

import com.digi.xbee.api.XBeeDevice;
 
[...]
 
// Instantiate and open an XBee device object.
XBeeDevice myXBeeDevice = new XBeeDevice("COM1", 9600);
myXBeeDevice.open();
 
// Enable the Bluetooth interface.
myXBeeDevice.enableBluetooth();
 
[...]
 
// Disable the Bluetooth interface.
myXBeeDevice.disableBluetooth();

These methods may fail for the following reasons: