Coder Social home page Coder Social logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
*cough* PythonForAndroid_r4.apk

Original comment by [email protected] on 10 Apr 2013 at 1:14

from python-for-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
I get the same error even without turning off the Device. Transmission of bytes 
works a few times but then fails with this error :-(

Android 2.3


Original comment by paulherweg on 23 Aug 2013 at 11:59

from python-for-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
[deleted comment]

from python-for-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
My work around was to check for a confirmation reply from my bluetooth device 
and if I did not receive a confirmation within a timeout period to attempt to 
automatically reconnect.


input_buffer = []
time_out = time.time() + .5
while('\n' not in input_buffer):
    while(droid.bluetoothReadReady().result == False):
        if(time.time() > time_out):
            raise Exception
    input_buffer.append(droid.bluetoothRead(1).result)


This code has a half second timeout.  It reads in data one character at a time, 
and if it doesn't receive a newline it assumes something went wrong and throws 
an exception.  My exception handler then would automatically reconnect, and try 
sending data again.

This may not work in your case if disconnections are extremely common, or if 
the device does not send a consistent acknowledgement of data received.

Original comment by [email protected] on 23 Aug 2013 at 12:40

from python-for-android.

Related Issues (20)

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.