OnPa
Posts: 1
Joined: Tue Oct 01, 2019 1:13 pm

BluePy (or other BT library) pairing devices with PIN solution

Tue Oct 01, 2019 1:22 pm

Hi,
I'm searching for method, how to make setting of BREDR OFF and LE ON mode by python commands. I didn't find any framework or library for doing it, so I used calling "sudo btmgmt power off", "sudo btmgmt bredr off", "sudo btmgmt power on" and "sudo btmgmt le on" sequence with Popen command.
But another issue is pairing BT adapter with BT device. My device uses pairing PIN, and this is the issue. Calling external utility "bluetoothctl" is not comfortable, despite she fact running scan on a interrupting it.

Does somebody have solved this problem - pairing BT device using PIN in Python just in Python ?

Thanks,
Ondrej

User avatar
Douglas6
Posts: 4781
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: BluePy (or other BT library) pairing devices with PIN solution

Tue Oct 01, 2019 7:31 pm

The BlueZ source code includes a Python pairing agent you can find here: https://git.kernel.org/pub/scm/bluetoot ... mple-agent

[EDIT: I just re-read your post. It sounds like you are using BLE, in which case the classic Bluetooth simple-agent won't help you. Pairing is not really a BLE concept so you may need to better explain what you are trying to do, in order to get more helpful responses. For example, what is your device?]

Return to “Python”