Skip to content

Commit 15171fa

Browse files
refactored out bluetooth backend wrapper into new library btlewrap (#91)
* refactored out bluetooth backend wrapper into new library btlewrap * fixed dependencies
1 parent d7a69d8 commit 15171fa

23 files changed

+18
-753
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,5 @@ target/
6767
#PyCharm project files
6868
.idea/
6969
.test_mac
70-
.pytest_cache/
70+
.pytest_cache/
71+
venv

demo.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
import logging
77
import sys
88

9+
from btlewrap import available_backends, BluepyBackend, GatttoolBackend, PygattBackend
10+
911
from miflora.miflora_poller import MiFloraPoller, \
1012
MI_CONDUCTIVITY, MI_MOISTURE, MI_LIGHT, MI_TEMPERATURE, MI_BATTERY
11-
from miflora import miflora_scanner, available_backends, BluepyBackend, GatttoolBackend, PygattBackend
13+
from miflora import miflora_scanner
1214

1315

1416
def valid_miflora_mac(mac, pat=re.compile(r"C4:7C:8D:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}")):

miflora/__init__.py

-12
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,3 @@
99
sys.version_info.major,
1010
sys.version_info.minor,
1111
sys.executable))
12-
13-
14-
from miflora.backends.bluepy import BluepyBackend # noqa: E402 # pylint: disable=wrong-import-position
15-
from miflora.backends.gatttool import GatttoolBackend # noqa: E402 # pylint: disable=wrong-import-position
16-
from miflora.backends.pygatt import PygattBackend # noqa: E402 # pylint: disable=wrong-import-position
17-
from miflora.backends import BluetoothBackendException # noqa: F401 E402 # pylint: disable=wrong-import-position
18-
_ALL_BACKENDS = [BluepyBackend, GatttoolBackend, PygattBackend]
19-
20-
21-
def available_backends():
22-
"""Returns a list of all available backends."""
23-
return [b for b in _ALL_BACKENDS if b.check_backend()]

miflora/backends/__init__.py

-114
This file was deleted.

miflora/backends/bluepy.py

-105
This file was deleted.

0 commit comments

Comments
 (0)