ChristianKuehnel / btlewrap

Bluetooth LowEnergy wrapper for different python backends.
MIT License
35 stars 19 forks source link

Add address_type argument for backends #6

Closed javl closed 5 years ago

javl commented 6 years ago

Thanks for this wrapper. I wanted to use it with a completely different device (from miflora), one that needs the 'random' address type instead of 'public'.

I've added an additional argument to the bluetooth interface to allow this. The default is still 'public' so BluetoothInterface(backend, adapter) is equal to BluetoothInterface(backend, adapter, address_type='public') meaning scripts implementing btewrap without the argument will still work the same, but it also allows you run run BluetoothInterface(backend, adapter, address_type='random') to use the random address type.

I've implemented this in all three backends but was only able to test with bluepy and gatttool as pygatt doesn't seem to work on my system. I think it should work, maybe you can take a look and confirm this?

coveralls commented 6 years ago

Pull Request Test Coverage Report for Build 30


Totals Coverage Status
Change from base Build 28: 0.0%
Covered Lines:
Relevant Lines: 0

💛 - Coveralls
ChristianKuehnel commented 5 years ago

Thx! Just gave it a test and the change works for me as well (with a few smaller changes), see #12.

I'm closing this PR and will merge #12 when the build succeeds.