Reputation: 13
import gatt
class AnyDeviceManager(gatt.Device):
def device_discovered(self,device):
print("Discovered [%s] %s" % (device.mac_address,device.alias()))
manager = AnyDeviceManager(adapter_name='hci0')
manager.start_discovery()
manager.run()
how to stop printing results again and again. So how do stop getting value again and again
Upvotes: -1
Views: 45
Reputation: 8014
It would seem that you need to track which devices have already been discovered.
There are different ways to do this depending what you want to do with the information.
One example would be:
class AnyDeviceManager(gatt.Device):
device = {}
def device_discovered(self, device):
if device.mac_address not in AnyDeviceManager.device:
print("Discovered [%s] %s" % (device.mac_address, device.alias()))
AnyDeviceManager.device[device.mac_address] = device
Upvotes: 0