Skip to content

Commit

Permalink
interface.data_received is not async
Browse files Browse the repository at this point in the history
  • Loading branch information
yozik04 committed Sep 22, 2024
1 parent 1717c92 commit 4f0e887
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions paradox/interfaces/text/gsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import logging
import os
from typing import Callable, Optional

import serial_asyncio

Expand Down Expand Up @@ -90,7 +91,7 @@ def on_message(self, message: bytes):
else:
self.queue.put_nowait(message)

def set_recv_callback(self, callback):
def set_recv_callback(self, callback: Optional[Callable[[str], bool]]):
self.recv_callback = callback

def open_timeout(self):
Expand Down Expand Up @@ -219,7 +220,7 @@ async def run(self):

await asyncio.sleep(5)

async def data_received(self, data: str) -> bool:
def data_received(self, data: str) -> bool:
logger.debug(f"Data Received: {data}")

data = data.decode()
Expand Down
2 changes: 1 addition & 1 deletion tests/interfaces/test_gsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async def control_partition(partition, command):
interface.modem_connected = True

data = b"+CMT: test_data"
await interface.data_received(data)
interface.data_received(data)
assert interface.message_cmt == data.decode()

# level = EventLevel.INFO
Expand Down

0 comments on commit 4f0e887

Please sign in to comment.