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.
os.system("sudo obexpushd -B -o /home/pi/Desktop/ -n")
I am not familiar with
obexpushdand what it gives you over using the functionality that is there withobexd.My understanding is that you need to create an obex-agent to accept/reject a Bluetooth object push request with
obexd.Monitoring the
InterfacesAddedDBus signal should give you the information that you need to know when a transfer has started. You can then monitor thePropertiesChangedsignal 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):
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.