Requirement: I need to coect to a remote bluetooth device & port and send data using a device file. 1. First scan the nearest bluetooth devices 2. coect to a remote BT addr & chael and communicate using a device file (/dev/rfcomm0)
I'm stuck at the second step. I'm able to do it through linux shell
sudo rfcomm coect /dev/rfcomm0 00:11:22:33:44:55 1 &
This works and then I open my python interpreter and communicate to the remote device using the rfcomm0 device file.
But my requirement is such that the device addr could be changing. So I want to coect and release the coections through python program.
I tried using python subprocess. But the problem is it retus immediately with a retucode 0 and then the coection is established after certain latency.
import subprocess
host = '00:11:22:33:44:55'
port = "1"
subprocess.call(["rfcomm coect",host,port,"&"],shell=True)
I'm looking if there is any pyBluez or any other python alteative to achieve this.
