-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ee2da9
commit 8173100
Showing
9 changed files
with
239 additions
and
85 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,2 @@ | ||
from pymbus.telegrams.blocks.data_info import DataInformationBlock | ||
from pymbus.telegrams.blocks.value_info import ValueInformationBlock |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from pymbus.exceptions import MBusError | ||
from pymbus.telegrams.base import ( | ||
TelegramBytesType, | ||
) | ||
from pymbus.telegrams.base import ( | ||
TelegramContainer as TelegramRecord, | ||
) | ||
from pymbus.telegrams.blocks import ( | ||
DataInformationBlock as DIB, | ||
) | ||
from pymbus.telegrams.blocks import ( | ||
ValueInformationBlock as VIB, | ||
) | ||
|
||
|
||
class DataRecord(TelegramRecord): | ||
"""The "Data Record" (DR) class. | ||
Typically encountered as Data Record Header (DRH). | ||
The structure of the DR(H): | ||
----------------- | ||
| DIB | VIB | | ||
----------------- | ||
DIB = Data Information Block. | ||
VIB = Value Information Block. | ||
""" | ||
|
||
def __init__(self, ibytes: TelegramBytesType): | ||
try: | ||
it = iter(ibytes) | ||
except TypeError as e: | ||
msg = f"{ibytes} is not iterable" | ||
raise MBusError(msg) from e | ||
|
||
self._dib = DIB(it) | ||
self._vib = VIB(it) | ||
|
||
@property | ||
def dib(self) -> DIB: | ||
return self._dib | ||
|
||
@property | ||
def vib(self) -> VIB: | ||
return self._vib |
Oops, something went wrong.