IanHarvey / bluepy

Python interface to Bluetooth LE on Linux
Other
1.6k stars 491 forks source link

Getting the Raw advertissement payload #460

Open rufus01 opened 2 years ago

rufus01 commented 2 years ago

Hi there,

I'm using your library to scan near by devices. In addition to the provided fields I would like to use the raw advertising message. Is there a way to do that ?

Thanks Rufus

RenierM26 commented 2 years ago

Hi There,

devices = bluepy.btle.Scanner(self._interface).scan(
                    scan_timeout, passive
                )

for dev in devices:
            if dev.getValueText(7) == SERVICE_UUID:

dev.getValueText() will return Hex value dev.getValue() will return bytes in python > 3.6 Not sure in older versions.

You can also get the full data from bluepy.btle.Scanner.scanned["device_mac"] (self.scanned variable in the Scanner class)