Package totalcross.io.device.bluetooth
Class RemoteDevice
- java.lang.Object
-
- totalcross.io.device.bluetooth.RemoteDevice
-
public class RemoteDevice extends java.lang.ObjectThe RemoteDevice class represents a remote Bluetooth device. It provides basic information about a remote device including the device's Bluetooth address and its friendly name.- Since:
- TotalCross 1.15
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRemoteDevice(java.lang.String address)Creates a Bluetooth device based upon its address.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetBluetoothAddress()Retrieves the Bluetooth address of this device.java.lang.StringgetFriendlyName()Returns the name of this device.java.lang.StringtoString()Returns a string representation of the object in the format "address - friendlyName".
-
-
-
Constructor Detail
-
RemoteDevice
protected RemoteDevice(java.lang.String address)
Creates a Bluetooth device based upon its address. The Bluetooth address must be 12 hex characters long. Valid characters are 0-9, a-f, and A-F. There is no preceding "0x" in the string. For example, valid Bluetooth addresses include but are not limited to:
008037144297
00af8300cd0b
014bd91DA8FC- Parameters:
address- the address of the Bluetooth device as a 12 character hex string- Since:
- TotalCross 1.15
-
-
Method Detail
-
getFriendlyName
public java.lang.String getFriendlyName() throws IOExceptionReturns the name of this device. The Bluetooth specification calls this name the "Bluetooth device name" or the "user-friendly name".- Returns:
- the name of the device, or null if the Bluetooth system does not support this feature; if the local device is able to contact the remote device, the result will never be null; if the remote device does not have a name then an empty string will be returned
- Throws:
IOException- Since:
- TotalCross 1.15
-
getBluetoothAddress
public java.lang.String getBluetoothAddress()
Retrieves the Bluetooth address of this device. The Bluetooth address will be 12 characters long. Valid characters are 0-9 and A-F. This method will never return null.- Returns:
- the Bluetooth address of the remote device
- Since:
- TotalCross 1.15
-
toString
public java.lang.String toString()
Returns a string representation of the object in the format "address - friendlyName".- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of the object in the format "address - friendlyName"
- Since:
- TotalCross 1.30
-
-