Coder Social home page Coder Social logo

Comments (6)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 17, 2024
For source, an example which fails is 
https://github.com/cefn/blueshrimp/blob/master/Androino/bluezsensordisplay/bluez
sensordisplay.py 
...which relies on metaserial to create a consistent wrapper around Bluetooth, 
PySerial or SL4ASerial...
https://github.com/cefn/blueshrimp/tree/master/MetaSerial/metaserial

This code works when launched in SL4A, but I just need to know how to package 
pybluez and metaserial and configure the APK so it will play ball with 
Bluetooth.

Original comment by [email protected] on 15 Mar 2013 at 6:37

from android-python27.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 17, 2024
There is no bluetooth module included in the Python build, so you hit an 
ImportError which kills the process.

You would need either to add a bluetooth module in the Python build of this 
project, or use PY4A Python build in this project as explained here: 
https://code.google.com/p/android-python27/wiki/TutorialHowToChangePythonBuilds

Original comment by [email protected] on 18 Mar 2013 at 6:17

from android-python27.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 17, 2024
NB: you cannot use PyBluez-0.19-py2.6-linux-armv.egg as it's linked against 
libpython2.6.so (and this project uses Python 2.7 by default)

Original comment by [email protected] on 18 Mar 2013 at 6:20

from android-python27.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 17, 2024
That's incredibly useful to learn. 

I hadn't recognised the hard dependency on the python version (or figured the 
importance of different version numbers between Py4A and the canonical APK 
build). That's probably why it was dying all the time. I tried adding the .egg 
contents to a variety of locations within the zips representing the python 
build in the APK, but it would never work without the right version.

I'm trying to apply your suggestion right now - rolling back the version of the 
python builds to 2.6 and then extracting the .egg contents into 
python_extras_r14.zip under the path /python. Does anything else need updating 
to notify that pybluez support is there?

If this works and I can indeed carry on using Py4A for prototyping and 
deployment, it raises a number of questions if anyone has time to help.

Is there any way I could have seen the ImportError as I couldn't figure out 
what the failure condition actually was in the python engine. I must have been 
looking in the wrong place but don't know where the relevant logging goes to. 
There didn't seem to be any error condition as such in the Logcat, which is 
emphasised for bug reporting.

Does the fact Google is migrating away from Bluez (announced at 
http://developer.android.com/about/versions/jelly-bean.html) mean that PyBluez 
is never going to work beyond JellyBean 4.2 so I should immediately be working 
out how to phase it out?

=== Separate Bug/Feature ===

I wouldn't need to use PyBluez at all, if it wasn't that the SL4A 
BluetoothFacade triggers bugs (possibly mine) but only when I deploy in an APK. 
This could potentially be associated with the version too? 

From the bug I experience (connid not ready) it could be that the blocking 
behaviour promised by bluetoothConnect in newer versions of the SL4A facades 
http://www.mithril.com.au/android/doc/BluetoothFacade.html isn't actually 
happening in the APKed version, perhaps because I'm not getting the script.jar 
from the correct/latest source somehow. If it doesn't block, then I'm going 
straight to accessing an unready connection. 

Alternatively it's just failing to connect in the APKed version for some 
different reason, even whilst the console-run version works fine. Are there 
differences between the deployment environments which could explain the same 
SL4A code which works on the console failing on the APK version (originally I 
wasn't using PyBluez at all).

In any case, this SL4A Bluetooth Facade issue is probably a completely 
different bug/feature. Let me know if I should re-file this issue separately.

Original comment by [email protected] on 18 Mar 2013 at 8:16

from android-python27.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 17, 2024
>Is there any way I could have seen the ImportError as I couldn't figure 
>out what the failure condition actually was in the python engine. I must
>have been looking in the wrong place but don't know where the relevant 
>logging goes to. There didn't seem to be any error condition as such in
>the Logcat, which is emphasised for bug reporting.

You should run the script from the command line. Once the apk is installed you 
have all the Python file you need for that, just export the env vars as here: 
https://code.google.com/p/android-python27/wiki/TutorialHowToRunPythonfromShell

Original comment by [email protected] on 19 Mar 2013 at 9:18

from android-python27.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 17, 2024
I find that BluetoothDeviceList activity [in script.jar] can not be started 
normally, but do't know the reason. 
I try to add another BluetoothDeviceList activity [from SL4A source code] to 
the project and start this activity from bluetoothConnect() in 
BluetoothFacade.java [also from SL4A, compile new ones to replace the old ones 
in script.jar] then Bluetooth can work.


Original comment by [email protected] on 19 Jul 2013 at 6:23

from android-python27.

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.