-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
read failed, socket might closed or timeout, read ret: -1 #38
Comments
Did you manage to solve this issue? Discovery works fine, but this library is useless when you can't actually connect. |
I didn't until now. |
Seems like you need to
then |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi when i try to make a connection with a device it gives me this error
After making a connection with the device , the phone send a connection request with a pair number and the other phone accepts it , but it still gives me the error.
this is my code
rxBluetooth.observeDevices() .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Consumer<BluetoothDevice>() { @Override public void accept(BluetoothDevice bluetoothDevice) throws Exception { if(bluetoothDevice.getName() != null && bluetoothDevice.getName().equals("Test")) { Log.e("RxBt",bluetoothDevice.getName()); rxBluetooth.cancelDiscovery(); connectToDevice(bluetoothDevice); } if(bluetoothDevice.getAddress() != null) Log.e("RxBt",bluetoothDevice.getAddress()); //addDevice(bluetoothDevice); } });
Connecting to device method
private void connectToDevice(BluetoothDevice bluetoothDevice) { Log.e("connectToDevice()","connectToDevice invoked."); UUID uuid = UUID.fromString("f77d314e-9730-4a0b-a3a8-0d283eff53ea"); rxBluetooth.observeConnectDevice(bluetoothDevice, uuid) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(new Consumer<BluetoothSocket>() { @Override public void accept(BluetoothSocket socket) throws Exception { // Connected to the device, do anything with the socket Log.e("connectToDevice()","Start of Connection."); } }, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) throws Exception { Log.e("connectToDevice()",throwable.getMessage()); } }); }
The text was updated successfully, but these errors were encountered: