Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
connect/disconnect instead of start/stop and reconnect when sending t…
…elegram fails
- Loading branch information
Showing
5 changed files
with
59 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
""" | ||
Abstract base for a specific KNX/IP connection (Tunneling or Routing). | ||
* It handles connection and disconnections | ||
* It starts and stops a udp client | ||
* It packs Telegrams into KNX Frames and passes them to a udp client | ||
""" | ||
from abc import ABC, abstractmethod | ||
|
||
from xknx.telegram import Telegram | ||
|
||
|
||
class Interface(ABC): | ||
"""Abstract base class for KNX/IP connections.""" | ||
|
||
@abstractmethod | ||
async def connect(self) -> bool: | ||
"""Connect to KNX bus. Returns True on success.""" | ||
|
||
@abstractmethod | ||
async def disconnect(self) -> None: | ||
"""Disconnect from KNX bus.""" | ||
|
||
@abstractmethod | ||
async def send_telegram(self, telegram: Telegram) -> None: | ||
"""Send Telegram to KNX bus.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters