Skip to content
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

Port to Linux #5

Open
elenzil opened this issue Jul 25, 2018 · 10 comments
Open

Port to Linux #5

elenzil opened this issue Jul 25, 2018 · 10 comments

Comments

@elenzil
Copy link
Contributor

elenzil commented Jul 25, 2018

this may function with the current AdaFruit library, we haven't had a chance to test.

@hawflakes
Copy link
Contributor

hawflakes commented Aug 1, 2018

I'd be happy to try it out if you can drop in a libWWHAL.so for the Raspberry Pi.

@elenzil
Copy link
Contributor Author

elenzil commented Sep 4, 2018

just saw your comment, @hawflakes . apologies !
i'll see what i can do.

@liuwencong
Copy link

liuwencong commented Sep 21, 2018

this may function with the current AdaFruit library, we haven't had a chance to test.

Current AdaFruit library doesn't work, I've tried on RaspBerry. At least the AdaFruit library bluez_dbus also needs modification to add manufacturerData property similar as that done in corebluetooth.

trace as following:
(venv27) pi@raspberrypi:~ $ sudo python venv27/WonderPyExamples-master/tutorial/01_hello_world.py
Disconnecting any connected robots..
Searching for robot types: (all) with names: (any).
matching robots: 0 non-matching robots: 0 ................. Traceback (most recent call last):
File "venv27/WonderPyExamples-master/tutorial/01_hello_world.py", line 75, in
WonderPy.core.wwMain.start(MyClass())
File "/home/pi/venv27/WonderPy-master/WonderPy/core/wwMain.py", line 6, in start
WonderPy.core.wwBTLEMgr.WWBTLEManager(delegate_instance, arguments).run()
File "/home/pi/venv27/WonderPy-master/WonderPy/core/wwBTLEMgr.py", line 381, in run
self.ble.run_mainloop_with(self.scan_and_connect)
File "/home/pi/venv27/Adafruit_Python_BluefruitLE-master/Adafruit_BluefruitLE/bluez_dbus/provider.py", line 105, in run_mainloop_with
raise_(self._exception[1], None, self._exception[2])
File "/home/pi/venv27/Adafruit_Python_BluefruitLE-master/Adafruit_BluefruitLE/bluez_dbus/provider.py", line 120, in _user_thread_main
self._return_code = target()
File "/home/pi/venv27/WonderPy-master/WonderPy/core/wwBTLEMgr.py", line 153, in scan_and_connect
rob = WWRobot(d)
File "/home/pi/venv27/WonderPy-master/WonderPy/core/wwRobot.py", line 30, in init
self.parseManufacturerData(btleDevice.manufacturerData)
AttributeError: 'BluezDevice' object has no attribute 'manufacturerData'

@liuwencong
Copy link

liuwencong commented Sep 26, 2018

@elenzil how about implement the functions packets2Json and json2Packets (which is currently in libWWHAL.dylib) with Python to make WonderPy compatible with all kinds of operating systems naturally? Thanks!

@liuwencong
Copy link

another issue is with Adafruit_BluefruitLE\bluez_dbus\device.py, actual services are not superset of expected services, so the criteria in discover need modification.

actual services
set([UUID('af237777-879d-6186-1f49-deca0e85d9c1'), UUID('00001801-0000-1000-8000-00805f9b34fb')])

expected services
set([UUID('af237777-879d-6186-1f49-deca0e85d9c1'), UUID('af237778-879d-6186-1f49-deca0e85d9c1')])

with above modification and hardcode of robot_type and robot_mode, Raspberry can connect to Dash, then only need the library for linux to do the conversion between JSON and packets of command and response of Dash.

@liuwencong
Copy link

(venv27) pi@pi:~ $ clearsudo python venv27/WonderPyExamples-master/tutorial/01_hello_world.py
Disconnecting any connected robots..
Searching for robot types: (all) with names: (any).

matching robots: 0 non-matching robots: 0 .
matching robots: 0 non-matching robots: 0 ..
matching robots: 0 non-matching robots: 0 ...
matching robots: 0 non-matching robots: 0 ....
matching robots: 1 non-matching robots: 0 .....
matching robots: 1 non-matching robots: 0 ......

only found one device
Connecting to WW_ROBOT_DASH "Dash"
Connected to WW_ROBOT_DASH "Dash"
Discovering services...
expected services
set([UUID('af237777-879d-6186-1f49-deca0e85d9c1')])
expected chars
set([UUID('af230006-879d-6186-1f49-deca0e85d9c1'), UUID('af230002-879d-6186-1f49-deca0e85d9c1'), UUID('af230003-879d-6186-1f49-deca0e85d9c1')])
actual services
set([])
actual chars
set([])
actual services
set([])
actual chars
set([])
actual services
set([])
actual chars
set([])
actual services
set([])
actual chars
set([])
actual services
set([])
actual chars
set([])
actual services
set([UUID('af237777-879d-6186-1f49-deca0e85d9c1'), UUID('00001801-0000-1000-8000-00805f9b34fb')])
actual chars
set([UUID('00002a05-0000-1000-8000-00805f9b34fb'), UUID('af230000-879d-6186-1f49-deca0e85d9c1'), UUID('af230001-879d-6186-1f49-deca0e85d9c1'), UUID('af230002-879d-6186-1f49-deca0e85d9c1'), UUID('af230003-879d-6186-1f49-deca0e85d9c1'), UUID('af230004-879d-6186-1f49-deca0e85d9c1'), UUID('af230005-879d-6186-1f49-deca0e85d9c1'), UUID('af230006-879d-6186-1f49-deca0e85d9c1')])
found expected services!
discovered expected services and characteristics.
Sending renegotiation request for 12ms
Connected to 'Dash'!
Starting a thread for Dash.
to send cmds in queue

@paulolc
Copy link

paulolc commented May 5, 2019

It seems you've made some progress @liuwencong... Was it using libWWHAL.so? If so, where can I find it? I'm also trying to get WonderPy working on a Raspberry Pi but I'm still stuck on #18 unable to install WonderPy.

@elenzil
Copy link
Contributor Author

elenzil commented May 16, 2019

Hi All -
many apologies for being so inactive on this project.
i don't foresee myself or other folks at Wonder Workshop being able to contribute much time in the near future, either. :/

but i can provide a few details.

responding to comments in #18, which i'm closing as a dupe of #5:

From what I see, the PyObjC is used to load the native MacOS dynamic library binary "libWWHAL.dylib"

good guess, but slightly off.
PyObjC is a dependency of the AdaFruit bluetooth low energy package,
where it is used to bind to Apple's BTLE services.
I believe it is possible to use the AdaFruit btle package on Linux, but i haven't done it myself.

libWWHAL.dylib is loaded via the regular python library loading methods.
however it is definitely compiled for MacOS, so isn't much good on Linux.
I'll try to carve out some time to compile it for Linux. #5 .

@paulolc
Copy link

paulolc commented Jul 21, 2019

I'll try to carve out some time to compile it for Linux. #5 .

Any luck @elenzil? I could try to compile libWWHAL for Linux myself, if only I had the source ;)

@euivmar
Copy link

euivmar commented Oct 23, 2019

My 2 cents contribution:

https://github.com/adafruit/Adafruit_Python_BluefruitLE

Here you can find the Adafruit_Python_BluefruitLE library for compilation in Linux (including Rasbian).

Also, I have tested this unnofficial git repository and it works in ubuntu!

https://github.com/IlyaSukhanov/morseapi

Maybe, it can be used to improve the official version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants