Skip to content

Commit

Permalink
feat: add basic pxd (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Dec 3, 2023
1 parent b12ff56 commit fd97d07
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
25 changes: 25 additions & 0 deletions src/habluetooth/base_scanner.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@


cdef class BaseHaScanner:

cdef public str adapter
cdef public bint connectable
cdef public str source
cdef public object connector
cdef public unsigned int _connecting
cdef public str name
cdef public bint scanning
cdef public object _last_detection
cdef public object _start_time
cdef public object _cancel_watchdog
cdef public object _loop


cdef class BaseHaRemoteScanner(BaseHaScanner):

cdef public object _new_info_callback
cdef public dict _discovered_device_advertisement_datas
cdef public dict _discovered_device_timestamps
cdef public dict _details
cdef public object _expire_seconds
cdef public object _cancel_track
7 changes: 2 additions & 5 deletions src/habluetooth/base_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import asyncio
import logging
from abc import abstractmethod
from collections.abc import Callable, Generator
from contextlib import contextmanager
from typing import TYPE_CHECKING, Any, Final, final
Expand Down Expand Up @@ -142,13 +141,11 @@ def connecting(self) -> Generator[None, None, None]:
self.scanning = not self._connecting

@property
@abstractmethod
def discovered_devices(self) -> list[BLEDevice]:
def discovered_devices(self) -> list[BLEDevice]: # type: ignore[empty-body]
"""Return a list of discovered devices."""

@property
@abstractmethod
def discovered_devices_and_advertisement_data(
def discovered_devices_and_advertisement_data( # type: ignore[empty-body]
self,
) -> dict[str, tuple[BLEDevice, AdvertisementData]]:
"""Return a list of discovered devices and their advertisement data."""
Expand Down

0 comments on commit fd97d07

Please sign in to comment.