Comments (11)
Could you perhaps provide a stacktrace of the exception that was passed to onError
?
from android-bluetooth-serial.
Hello Harry,
Thanks for your reply. Here is the stacktrace of the error:
D/BluetoothRunnable: onError, error=java.io.IOException: read failed, socket might closed or timeout, read ret: -1
W/System.err: com.harrysoft.androidbluetoothserial.BluetoothConnectException: java.io.IOException: read failed, socket might closed or timeout, read ret: -1
W/System.err: at com.harrysoft.androidbluetoothserial.BluetoothManager.lambda$openSerialDevice$0$BluetoothManager(BluetoothManager.java:66)
at com.harrysoft.androidbluetoothserial.-$$Lambda$BluetoothManager$fVpVBc1L4ZQfbGyxU14GY2nVwzg.call(lambda)
at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:44)
at io.reactivex.Single.subscribe(Single.java:3220)
at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:571)
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:154)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.io.IOException: read failed, socket might closed or timeout, read ret: -1
W/System.err: at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:900)
at android.bluetooth.BluetoothSocket.waitSocketSignal(BluetoothSocket.java:859)
at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:535)
at com.harrysoft.androidbluetoothserial.BluetoothManager.lambda$openSerialDevice$0$BluetoothManager(BluetoothManager.java:61)
... 13 more
from android-bluetooth-serial.
Hello Harry,
Any ideas?
from android-bluetooth-serial.
Sorry for the delay in responses! Been quite busy and not in a good headspace to work thanks to current epidemic.
It looks like the exception is being thrown when you try to connect:
It looks like the connection is failing. Have you managed to get this library to work for you with other devices?
from android-bluetooth-serial.
Hello Harry,
Thanks for your answer. I try not be be impatient, but I fail sometimes :)
I have not tried to connect to any other Android device yet. Of course the idea is, to be able to connect with any kind of Android phone...
from android-bluetooth-serial.
Sorry, when I meant device I meant a bluetooth device other than your PC, like a bluetooth serial module
from android-bluetooth-serial.
Hello Harry,
No, I have not tried to connect to any other bluetooth device (don't have one).
To be honest: I have abandoned my effort to implement bluetooth. I managed to get the ADB working and I will go with that. Even when IMO both Apple and Android fail to deliver decent USB support...
from android-bluetooth-serial.
Okay, sorry you weren't able to get it working, this seems like a very strange issue...
I would also suggest running a server that listens on a TCP port on your PC, and then connecting to this on your phone via WiFi - this would provide a realtime wireless data stream between your phone and PC, with much better range than bluetooth, but would require you to enter your laptop's IP on your phone and have the devices on a WiFi network... Just an idea! 😄
from android-bluetooth-serial.
Hello Harry,
Thanks for your thoughts!
Actually, the Bluetooth (or now, USB) solution is meant as 'secondary' connectivity option. I have already implemented a Wifi solution using UDP (it is not really necessary to receive all packets, but latency should be low)
from android-bluetooth-serial.
Ah okay, if I get the time I'll try getting my phone connected to my PC via bluetooth and see how it goes...
from android-bluetooth-serial.
Hello Harry,
OK, I'm looking forward to your findings. A 3rd option is always welcome :)
For now, I'll close this thread.
Thanks for your help!
from android-bluetooth-serial.
Related Issues (15)
- Null checks
- Kotlin app HOT 2
- Uncaught exception thrown by finalizer, Socket not created. HOT 3
- BluetoothManager.getInstance() never null HOT 1
- Kotlin library HOT 1
- Not receiving data from Bluetooth device HOT 6
- How can I receive binary data? HOT 2
- Google Play requires that apps target API level 29 or higher. HOT 1
- Java IO exception while using the library in kotlin HOT 5
- Check bluetooth is enabled
- BluetoothManager does not remove closed devices HOT 2
- Tiny typo HOT 2
- Newline driven approach HOT 1
- Importing Library HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-bluetooth-serial.