If the gatttool interactive mode (part of Bluez) works for you, then Pygatt is a good cover around this tool. In a good condition. Uses pexpect to interact with gatttool. Also wraps "hcitool lescan" for scanning Bluetooth devices. Basic usage example:
import pygatt.backend adapter = pygatt.backends.GATTToolBackend() adapter.start() device = adapter.connect('xx:xx:xx:xx:xx:xx', 5, 'random') device.char_write_handle(0x23,[0x20, 0x21]) device.subscribe('00008a22-0000-1000-8000-00805f9b34fb',callback = mycallback, indication=True)
Keptenkurk
source share