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
Peripheral
object. 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 (astr
type on Python 2.x, andbytes
on 3.x).
-
handleDiscovery
(scanEntry, isNewDev, isNewData)¶ Called when advertising data is received from an LE device while a
Scanner
object is active. scanEntry contains device information and advertising data - see theScanEntry
class for details. isNewDev isTrue
if the device (as identified by its MAC address) has not been seen before by the scanner, andFalse
otherwise. isNewData isTrue
if new or updated advertising data is available.