getsenic / gatt-python

Bluetooth GATT SDK for Python
MIT License
318 stars 86 forks source link

stop discovery and start to connect #30

Open rafifajar22 opened 6 years ago

rafifajar22 commented 6 years ago

I want to connect with ble device, but I only know UUID, therefore I try to discovery with UUID, discovery result managed to get ble device that I want. But when I want to connect, it can not be done because discovery continues to run, I am very confused how to stop discovery and connect with the ble device.

Zurnaz commented 6 years ago

Someone feel free to correct me if there is a better way (I'm still quite new to this library).

I found that once device_discovered is triggered on a scan I can run self.stop() to stop the scanning if the devices matches my requirements. Modified from the example in the readme:

class AnyDeviceManager(gatt.DeviceManager):
    def device_discovered(self, device):
        if(True):
            self.stop()
rafifajar22 commented 6 years ago

is not working, i don't know why super().run() blocking loop

JlnWntr commented 5 years ago

32