Skip to content

Commit

Permalink
Merge pull request #5 from emontnemery/device_filter
Browse files Browse the repository at this point in the history
Add device_filter function
  • Loading branch information
emontnemery committed Feb 8, 2023
2 parents 09ae2f8 + 2c8aef3 commit 835879b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion py_dormakaba_dkey/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

from . import errors
from .commands import Notifications
from .dkey import DKEYLock
from .dkey import DKEYLock, device_filter

__all__ = [
"DKEYLock",
"Notifications",
"device_filter",
"errors",
]
9 changes: 9 additions & 0 deletions py_dormakaba_dkey/dkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@
ACTIVATION_CODE_ALLOWED = "BCDFGHJKLMNPQRSTVWXZ0123456789"


def device_filter(advertisement_data: AdvertisementData) -> bool:
"""Return True if the device is supported."""
uuids = advertisement_data.service_uuids
if SERVICE_UUID in uuids or CHARACTERISTIC_UUID_TO_SERVER in uuids:
return True

return False


class BaseProcedure(ABC):
"""Base class for procedures."""

Expand Down

0 comments on commit 835879b

Please sign in to comment.