Read the Bluetooth MAC address
Another method that the XBee Java Library provides is getBluetoothMacAddress(), which returns the EUI-48 Bluetooth MAC address of your XBee device in a format such as 00112233AABB.
Reading the Bluetooth MAC address
import com.digi.xbee.api.XBeeDevice; [...] XBeeDevice myXBeeDevice = [...]; myXBeeDevice.open(); System.out.println("The Bluetooth MAC address is: " + myXBeeDevice.getBluetoothMacAddress());
The getBluetoothMacAddress method may fail for the following reasons:
- ACK of the command sent is not received in the configured timeout, throwing a TimeoutException.
- Other errors caught as XBeeException:
- The operating mode of the device is not API or API_ESCAPE, throwing an InvalidOperatingModeException.
- The response of the command is not valid, throwing an ATCommandException.
- There is an error writing to the XBee interface, throwing a generic XBeeException.