Package eu.woolplatform.utils.bluetooth
Interface BluetoothDevice
-
public interface BluetoothDeviceThis class represents a remote Bluetooth device.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BluetoothSocketconnectToService(String uuid)Connects to the specified service on this remote Bluetooth device.StringgetAddress()Returns the address of the Bluetooth device.StringgetFriendlyName()Returns the friendly name of the Bluetooth device.StringreadFriendlyName()Communicates with the Bluetooth device to get its friendly name.
-
-
-
Method Detail
-
getAddress
String getAddress()
Returns the address of the Bluetooth device. The address is given in the format 00:00:00:00:00:00. That is 12 hexadecimal characters in groups of two.- Returns:
- the address
-
getFriendlyName
String getFriendlyName()
Returns the friendly name of the Bluetooth device. This method does not communicate with the device, but only returns the name that was retrieved earlier by the Bluetooth system. If no friendly name is known, this method returns null.- Returns:
- the friendly name or null
-
readFriendlyName
String readFriendlyName() throws IOException
Communicates with the Bluetooth device to get its friendly name. If the device doesn't report a friendly name, this method returns null. If an error occurs during the communication, this method throws an exception.- Returns:
- the friendly name or null
- Throws:
IOException- if an error occurs during the communication with the device
-
connectToService
BluetoothSocket connectToService(String uuid) throws IOException
Connects to the specified service on this remote Bluetooth device. The UUID should be given in the format 00000000-0000-0000-0000-000000000000. That is 32 hexadecimal characters in four groups with lengths 8 - 4 - 4 - 4 - 12.The common serial port service has this UUID: 00001101-0000-1000-8000-00805F9B34FB
- Parameters:
uuid- the UUID of the service- Returns:
- the Bluetooth socket
- Throws:
IOException- if an error occurs while trying to connect
-
-