public native long rfServerAcceptAndOpenRfServerConnection(long handle) throws IOException;
public void connectionRfCloseServerConnection(long clientHandle) throws IOException {
connectionRfCloseClientConnection(clientHandle);
}
// --- Shared Client and Server RFCOMM connections
public int connectionRfRead(long handle) throws IOException {
byte[] data = new byte[1];
int size = connectionRfRead(handle, data, 0, 1);
if (size == -1) {
return -1;
}
return 0xFF & data[0];
}
public native int connectionRfRead(long handle, byte[] b, int off, int len) throws IOException;
public native int connectionRfReadAvailable(long handle) throws IOException;
public native void connectionRfWrite(long handle, int b) throws IOException;
public native void connectionRfWrite(long handle, byte[] b, int off, int len) throws IOException;
public native void connectionRfFlush(long handle) throws IOException;
public native long getConnectionRfRemoteAddress(long handle) throws IOException;
// --- Client and Server L2CAP connections
private void validateMTU(int receiveMTU, int transmitMTU) {
if (receiveMTU > l2cap_receiveMTU_max) {
throw new IllegalArgumentException("invalid ReceiveMTU value " + receiveMTU);
}
}
private native long l2OpenClientConnectionImpl(long localDeviceBTAddress, long address, int channel, boolean authenticate, boolean encrypt, int receiveMTU,
public long l2ServerOpen(BluetoothConnectionNotifierParams params, int receiveMTU, int transmitMTU, ServiceRecordImpl serviceRecord) throws IOException {
validateMTU(receiveMTU, transmitMTU);
long socket = l2ServerOpenImpl(this.localDeviceBTAddress, params.authorize, params.authenticate, params.encrypt, params.master, params.timeouts,