History log of /frameworks/base/core/java/android/bluetooth/BluetoothInputStream.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
71c3c7806acb2b2b7b8441817c26a2101d447bbe 02-Sep-2009 Nick Pelly <npelly@google.com> Immediately destroy BluetoothSocket's on close().

Unfortunatley, shutdown() on the underlying fd does not actually stop a
listening socket from listening. You need to call close() on the fd to
do this. There is no way around it.

So this means the Java BluetoothSocket code has to call destroyNative() during
BluetoothSocket.close().

Since native methods cannot be called after destroyNative(), add a ReadWrite
lock and mClosed field to protect access to native methods.

This fixes the "resource busy" error when Bluetooth OPP and Bluetooth PBAP
tried to resume listening after turning BT off and then on.
/frameworks/base/core/java/android/bluetooth/BluetoothInputStream.java
8edae3dfd3f594ca1b24c8365561f1f8c059440e 19-Jun-2009 Nick Pelly <npelly@google.com> Fix bug in BluetoothInputStream.read().

InputStream.read() must return values in range [0, 255]. But the previous code
would sign extend when casting to int so return [-128, 127]. Bitwise AND with
0xff to remove sign extension.
/frameworks/base/core/java/android/bluetooth/BluetoothInputStream.java
47e82dee6b18c33fab8c2cdf4f68b20d3663079e 02-Jun-2009 Nick Pelly <npelly@google.com> Implement bulk read and writes for Bluetooth sockets.

Before: 0.1 kB/s
After: 100 kB/s
(in my java BT speed test app)
/frameworks/base/core/java/android/bluetooth/BluetoothInputStream.java
0b6955a48bad9aee01ae2f0c06d3f168ca603ab7 27-May-2009 Nick Pelly <npelly@google.com> New BluetoothSocket API.

Modeled on blocking java.net.Socket and java.net.ServerSocket library.

Public interface is:

public final class BluetoothSocket implements Closeable {
public static BluetoothSocket createRfcommSocket(String address, int port) throws IOException;
public static BluetoothSocket createInsecureRfcommSocket(String address, int port) throws IOException;

public void connect() throws IOException;
public void close() throws IOException;

public String getAddress();
public InputStream getInputStream() throws IOException;
public OutputStream getOutputStream() throws IOException;
}

public final class BluetoothServerSocket implements Closeable {
public static BluetoothServerSocket listenUsingRfcommOn(int port) throws IOException;
public static BluetoothServerSocket listenUsingUnsecureRfcommOn(int port) throws IOException;

public BluetoothSocket accept() throws IOException;
public BluetoothSocket accept(int timeout) throws IOException;
public void close() throws IOException;

}
/frameworks/base/core/java/android/bluetooth/BluetoothInputStream.java