Skip to content

Commit

Permalink
Merge branch 'main' into fix/mqtt-sample-not-working
Browse files Browse the repository at this point in the history
  • Loading branch information
mochipon authored Aug 1, 2022
2 parents 41efa49 + e15fe11 commit 0181b40
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 23 deletions.
10 changes: 0 additions & 10 deletions pysesameos2/chsesame2.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,6 @@ def setIntention(self, intent: CHSesame2Intention) -> None:
logger.debug(f"setIntention: {intent}")
self._intention = intent

def setDeviceStatusCallback(
self, callback: Optional[Callable[["CHSesame2"], None]]
) -> None:
"""Set a device status callback.
Args:
callback (Optional[Callable[[CHSesame2], None]]): The callback to be called on device status changing.
"""
pass

async def connect(self) -> None:
adv = self.getAdvertisement()
if not adv:
Expand Down
10 changes: 0 additions & 10 deletions pysesameos2/chsesamebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,6 @@ def setIntention(self, intent: CHSesame2Intention) -> None:
logger.debug(f"setIntention: {intent}")
self._intention = intent

def setDeviceStatusCallback(
self, callback: Optional[Callable[["CHSesameBot"], None]]
) -> None:
"""Set a device status callback.
Args:
callback (Optional[Callable[[CHSesameBot], None]]): The callback to be called on device status changing.
"""
pass

async def connect(self) -> None:
adv = self.getAdvertisement()
if not adv:
Expand Down
9 changes: 6 additions & 3 deletions pysesameos2/device.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio
import logging
import uuid
from typing import TYPE_CHECKING, Any, Callable, Optional, Union
from typing import TYPE_CHECKING, Any, Callable, Optional, TypeVar, Union

from bleak.backends.characteristic import BleakGATTCharacteristic

Expand Down Expand Up @@ -82,6 +82,9 @@ def setSesame2PublicKey(self, key: Union[bytes, str]) -> None:
self._sesame2PublicKey = key


CHD = TypeVar("CHD", bound="CHDevices")


class CHDevices:
def __init__(self) -> None:
"""Generic Implementation for Candyhouse products."""
Expand All @@ -90,7 +93,7 @@ def __init__(self) -> None:
self._registered: bool = False
self._rssi: int = -100
self._deviceStatus: CHSesame2Status = CHSesame2Status.NoBleSignal # type: ignore
self._deviceStatus_callback: Optional[Callable[[CHDevices], None]] = None
self._deviceStatus_callback: Optional[Callable[[CHD], None]] = None
self._advertisement: Optional[BLEAdvertisement] = None
self._key: CHDeviceKey = CHDeviceKey()
self._login_event = asyncio.Event()
Expand Down Expand Up @@ -264,7 +267,7 @@ def setAdvertisement(self, adv: Optional["BLEAdvertisement"] = None) -> None:
self.setDeviceStatus(CHSesame2Status.ReceivedBle)

def setDeviceStatusCallback(
self, callback: Optional[Callable[["CHDevices"], None]]
self, callback: Optional[Callable[[CHD], None]]
) -> None:
"""Set a device status callback.
Expand Down

0 comments on commit 0181b40

Please sign in to comment.