BluetoothStack bluetooth = BluetoothStack.getBluetoothStack();
LocalDevice localDev = LocalDevice.getLocalDevice();
DiscoveryAgent discovery = localDev.getDiscoveryAgent();
RemoteDevice remoteDevice = discovery.getRemoteDevice(remoteAddrLong);
if (remoteDevice != null) {
JSR82Channel channel = new JSR82Channel();
bluetooth.connectL2CAPChannel(channel, remoteDevice, psm);
return channel;
}
else throw new IllegalArgumentException("Unable to locate Bluetooth Device.");
}