public class BluetoothServer
extends java.lang.Object
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
Constructor and Description |
---|
BluetoothServer(android.bluetooth.BluetoothAdapter adapter,
java.lang.String serviceName,
BluetoothServerListener listener)
Creates a BluetoothServer instance, registers the given BluetoothServerListener
and starts a server thread that waits for an incomming client
connection request.
|
Modifier and Type | Method and Description |
---|---|
void |
abort()
Closes open streams and the server socket.
|
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 Bluetooth socket of the current connection.
|
public BluetoothServer(android.bluetooth.BluetoothAdapter adapter, java.lang.String serviceName, BluetoothServerListener listener)
adapter
- the BluetoothAdapter for this deviceserviceName
- the name of the service to installlistener
- the BluetoothServerListener that gets a notification
when a client connectspublic java.io.InputStream getInputStream()
public java.io.OutputStream getOutputStream()
public android.bluetooth.BluetoothSocket getSocket()
public void abort()