OpenBluetoothToolbox / SimpleBLE

SimpleBLE - the all-in-one Bluetooth library for MacOS, iOS, Windows, Linux and Android.
https://www.simpleble.org
Other
660 stars 111 forks source link

TypeError of bluetooth_enabled() #217

Closed ToastTO closed 1 year ago

ToastTO commented 1 year ago

When I use the this function bluetooth_enabled, it shows me this error... ` Traceback (most recent call last): File "c:\Users\823ka\OneDrive\Documents\education app\simplepy.py", line 12, in BLE_enable = adapter.bluetooth_enabled() TypeError: bluetooth_enabled(): incompatible function arguments. The following argument types are supported:

  1. () -> bool ` and here is my code:
    
    adapters = simplepyble.Adapter.get_adapters()
    adapter = adapters[0]

BLE_enable = adapter.bluetooth_enabled() print(BLE_enable)


suppose I dont need to input for this funciton, rigth ? But how come have this error,  thx!
kdewald commented 1 year ago

Hey @ToastTO, thanks for reaching out.

bluetooth_enabled is also a class methods, not an instance method. The correct code would be:

adapters = simplepyble.Adapter.get_adapters()
BLE_enable = simplepyble.Adapter.bluetooth_enabled()