Python Forum
Understaning simple reading object - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Understaning simple reading object (/thread-36338.html)



Understaning simple reading object - korenron - Feb-09-2022

Hello,
I'm missing something very simple

I'm reading BLE data using https://github.com/IanHarvey/bluepy

on this part I want to know all the information I can get from the scanning , so I'm trying to prinr "dev"
scanner = Scanner().withDelegate(ScanDelegate())
    devices = scanner.scan(10.0)

    for dev in devices:
        print(dev)
        print ("Device %s (%s), RSSI=%d dB " % (dev.addr, dev.addrType, dev.rssi, ))
I get this
2022-02-09 10:22:31,117 <bluepy.btle.ScanEntry object at 0xb64c6210>
2022-02-09 10:22:31,124 <bluepy.btle.ScanEntry object at 0xb64c6070>
2022-02-09 10:22:31,132 <bluepy.btle.ScanEntry object at 0xb64c61f0>
2022-02-09 10:22:31,149 <bluepy.btle.ScanEntry object at 0xb64c62f0>
2022-02-09 10:22:31,155 <bluepy.btle.ScanEntry object at 0xb64c6190>
2022-02-09 10:22:31,159 <bluepy.btle.ScanEntry object at 0xb64c6250>
my question is
how can I know what kind of informaton there is in the dev object?
I know there is rssi,addr -
but what else?

*** this quesiton is not just gor the ble scan - it's something bigger I'm missing

Thanks ,


RE: Understaning simple reading object - Larz60+ - Feb-09-2022

Please provide enough information to reply.
what is scanner? show with code.
If a package, tell us which one.
If you are trying to get the GitHub code use git clone.


RE: Understaning simple reading object - Gribouillis - Feb-09-2022

Look into the source code of the ScanEntry object, The __init__ method goes like this

    def __init__(self, addr, iface):
        self.addr = addr
        self.iface = iface
        self.addrType = None
        self.rssi = None
        self.connectable = False
        self.rawData = None
        self.scanData = {}
        self.updateCount = 0
You can also print(dir(dev)) to see which members are accessible. Object inspection is easy in Python.


RE: Understaning simple reading object - korenron - Feb-09-2022

this is the answer I needed , (this is what I'm missing)
You can also print(dir(dev)) to see which members are accessible. Object inspection is easy in Python.
thank you very much!