Skip to content
Advertisement

Python opp obex server using Bluez-obex and pydbus?

For my project, I need to downlink .zip files over Bluetooth. I am using python and obex for this. I have a working python opp client implemented (shout-out to ukBaz for the help), but I am still using os to start the server, so the rest of my server program has no idea when a file is received. The rest of the program is completed, but without output from the server, I can’t trigger the unzip function to run. I’ve read the bluez-obex API documentation and there doesn’t seem to be anything on starting a server. Is there another way of doing this? My code is below.

JavaScript

Advertisement

Answer

I am not familiar with obexpushd and what it gives you over using the functionality that is there with obexd.

My understanding is that you need to create an obex-agent to accept/reject a Bluetooth object push request with obexd.

Monitoring the InterfacesAdded DBus signal should give you the information that you need to know when a transfer has started. You can then monitor the PropertiesChanged signal for when the status changes.

I was able to push a photo from my phone to a Raspberry Pi with the following running on the RPi (I had my phone and RPi already paired):

JavaScript

This code just accepts any request that is made of it. This is probably a bad thing to do and people might want to add some checking (or prompt the user) if the file should be accepted.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement