The DefaultDelegate class¶
bluepy functions which receive Bluetooth messages asynchronously -
such as notifications, indications, and advertising data - pass this information
to the user by calling methods on a ‘delegate’ object.
To be useful, the delegate object will be from a class created by the user.
Bluepy’s DefaultDelegate is a base class for this - you should override
some or all of the methods here with your own application-specific code.
Instance Methods¶
-
handleNotification(cHandle, data)¶ Called when a notification or indication is received from a connected
Peripheralobject. cHandle is the (integer) handle for the characteristic - this can be used to distinguish between notifications from multiple sources on the same peripheral. data is the characteristic data (astrtype on Python 2.x, andbyteson 3.x).
-
handleDiscovery(scanEntry, isNewDev, isNewData)¶ Called when advertising data is received from an LE device while a
Scannerobject is active. scanEntry contains device information and advertising data - see theScanEntryclass for details. isNewDev isTrueif the device (as identified by its MAC address) has not been seen before by the scanner, andFalseotherwise. isNewData isTrueif new or updated advertising data is available.