public class BluetoothClient
extends java.lang.Object
 <uses-permission android:name="android.permission.BLUETOOTH" />
 <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
 | Constructor and Description | 
|---|
BluetoothClient(android.bluetooth.BluetoothAdapter adapter,
               java.lang.String serverAddressHex)
Creates a BluetoothClient instance for the given server's MAC address. 
 | 
BluetoothClient(android.bluetooth.BluetoothDevice serverDevice)
Creates a BluetoothClient instance for the given server's Bluetooth name. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
boolean | 
connect()
Attemps to connect the client to the server. 
 | 
void | 
disconnect()
Closes the opened input and output stream and releases the Bluetooth connection. 
 | 
java.lang.String | 
getAddressHex()
Returns the server address in colon hex format (NN:NN:NN:NN:NN:NN). 
 | 
long | 
getAddressLong()
Returns the server address as long. 
 | 
java.io.InputStream | 
getInputStream()
Returns the InputStream of the Bluetooth connection. 
 | 
java.io.OutputStream | 
getOutputStream()
Returns the OutputStream of the Bluetooth connection. 
 | 
android.bluetooth.BluetoothSocket | 
getSocket()
Returns the BluetoothSocket of the Bluetooth connection. 
 | 
boolean | 
isConnected()
Returns the connection state. 
 | 
public BluetoothClient(android.bluetooth.BluetoothDevice serverDevice)
serverDevice - the valid BluetoothDevice reference of the server, 
 obtained by a Bluetooth searchpublic BluetoothClient(android.bluetooth.BluetoothAdapter adapter,
               java.lang.String serverAddressHex)
adapter - the BluetoothAdapter for this deviceserverAddressHex - the Bluetooth MAC address of the server in colon
 hex format (NN:NN:NN:NN:NN:NN)public boolean connect()
public void disconnect()
public boolean isConnected()
public android.bluetooth.BluetoothSocket getSocket()
public java.io.InputStream getInputStream()
public java.io.OutputStream getOutputStream()
public java.lang.String getAddressHex()
public long getAddressLong()