Giter Site home page Giter Site logo

Comments (11)

harryjph avatar harryjph commented on August 19, 2024

Could you perhaps provide a stacktrace of the exception that was passed to onError?

from android-bluetooth-serial.

WimVriend avatar WimVriend commented on August 19, 2024

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.

WimVriend avatar WimVriend commented on August 19, 2024

Hello Harry,

Any ideas?

from android-bluetooth-serial.

harryjph avatar harryjph commented on August 19, 2024

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:

https://github.com/harry1453/android-bluetooth-serial/blob/v1.0/androidBluetoothSerial/src/main/java/com/harrysoft/androidbluetoothserial/BluetoothManager.java#L61

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.

WimVriend avatar WimVriend commented on August 19, 2024

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.

harryjph avatar harryjph commented on August 19, 2024

Sorry, when I meant device I meant a bluetooth device other than your PC, like a bluetooth serial module

from android-bluetooth-serial.

WimVriend avatar WimVriend commented on August 19, 2024

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.

harryjph avatar harryjph commented on August 19, 2024

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.

WimVriend avatar WimVriend commented on August 19, 2024

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.

harryjph avatar harryjph commented on August 19, 2024

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.

WimVriend avatar WimVriend commented on August 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.