Methods Summary |
---|
private native int | available0()Returns the number of bytes available to be read from the connection
without blocking.
Note: the method gets native connection handle directly from
handle field of BTSPPConnectionImpl object.
|
public void | close()Closes this connection.
synchronized (this) {
if (isClosed()) {
return;
}
resetRemoteDevice();
objects--;
if (objects == 0) {
close0();
}
}
|
private native void | close0()Closes client connection.
Note: the method gets native connection handle directly from
handle field of L2CAPConnectionImpl object.
|
private native void | connect0(byte[] addr, int cn)Starts client connection establishment.
Note: the method gets native connection handle directly from
handle field of BTSPPConnectionImpl object.
|
private native void | create0(boolean auth, boolean enc, boolean master)Creates a client connection object.
Note: the method gets native connection handle directly from
handle field of BTSPPConnectionImpl object.
|
private void | doOpen()Opens client connection.
/*
* create native connection object
* Note: the method <code>create0</code> sets resulting native
* connection handle directly to the field <code>handle<code>.
*/
create0(url.authenticate, url.encrypt, url.master);
byte[] address = BluetoothUtils.getAddressBytes(url.address);
try {
// establish connection
connect0(address, url.port);
} catch (IOException e) {
throw new BluetoothConnectionException(
BluetoothConnectionException.FAILED_NOINFO,
e.getMessage());
}
|
private native void | finalize()Native finalizer.
Releases all native resources used by this connection.
|
public java.lang.String | getRemoteDeviceAddress()Retrieves remote address for the connection.
return BluetoothUtils.getAddressString(remoteDeviceAddress);
|
private static native void | initialize()Native static class initializer.
|
public final java.io.DataInputStream | openDataInputStream()Open and return a data input stream for a connection.
return new DataInputStream(openInputStream());
|
public final java.io.DataOutputStream | openDataOutputStream()Open and return a data output stream for a connection.
return new DataOutputStream(openOutputStream());
|
public final java.io.InputStream | openInputStream()Open and return an input stream for a connection.
checkOpen();
checkReadMode();
synchronized (this) {
if (isOpened) {
throw new IOException("No more input streams");
}
isOpened = true;
objects++;
}
return new SPPInputStream();
|
public final java.io.OutputStream | openOutputStream()Open and return an output stream for a connection.
checkOpen();
checkWriteMode();
synchronized (this) {
if (osOpened) {
throw new IOException("No more output streams");
}
osOpened = true;
objects++;
}
return new SPPOutputStream();
|
private native int | receive0(byte[] buf, int off, int size)Reads data from a packet received via Bluetooth stack.
Note: the method gets native connection handle directly from
handle field of BTSPPConnectionImpl object.
|
private native int | send0(byte[] buf, int off, int size)Sends the specified data via Bluetooth stack.
Note: the method gets native connection handle directly from
handle field of L2CAPConnectionImpl object.
|
private native void | setThisConnHandle0(BTSPPNotifierImpl notif)Retrieves native connection handle from temporary storage
inside BTSPPNotifierImpl instance
and sets it to this BTSPPConnectionImpl instance.
Note: the method sets native connection handle directly to
handle field of BTSPPConnectionImpl object.
|