Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcp: Make firmware strings (in packet suffix) optional #376

Merged
Prev Previous commit
Next Next commit
Add docstring to parse() methods
  • Loading branch information
MarijnS95 committed May 24, 2023
commit e4931cd008c73c5cb7ed7dd27a06b0a335a19122
2 changes: 2 additions & 0 deletions omnikinverter/tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class _TcpData(BigEndianStructure):

@classmethod
def parse(cls, data: bytes, offset: int = 0) -> dict[str, Any]:
"""Parse `data` into all fields described by this C structure."""
tcp_data = cls.from_buffer_copy(data, offset)

if tcp_data.unknown0 not in [0, UINT16_MAX]: # pragma: no cover
Expand Down Expand Up @@ -155,6 +156,7 @@ class _TcpFirmwareStrings(BigEndianStructure):

@classmethod
def parse(cls, data: bytes, offset: int = 0) -> dict[str, Any]:
"""Parse `data` into all fields described by this C structure."""
tcp_firmware_data = cls.from_buffer_copy(data, offset)

result = {}
Expand Down