Skip to content

Commit

Permalink
Corrected bytes(Packet) implementation for non-Message based packets.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcferrill committed Apr 20, 2022
1 parent 43b9223 commit 292f151
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
trigger:
- master

name: '1.1.17'
name: '1.1.18'

jobs:

Expand Down
2 changes: 1 addition & 1 deletion chapter10/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .c10 import C10, TYPES
from .packet import Packet, InvalidPacket
version = '1.1.17'
version = '1.1.18'
8 changes: 7 additions & 1 deletion chapter10/packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,13 @@ def _raw_body(self):
"""Returns the raw bytes of the packet body, including the CSDW."""

# Pack messages into body
body = b''.join(bytes(m) for m in self._messages)
if getattr(self, 'Message', None):
body = b''.join(bytes(m) for m in self._messages)

# Pull raw bytes if not a message-based packet
else:
self.buffer.seek(36 if self.secondary_header else 24)
body = self.buffer.read(self.data_length - 4)
return self.csdw_format.pack(self.__dict__) + body

def __bytes__(self):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pychapter10"
version = "1.1.17"
version = "1.1.18"
description = "A parser library for the IRIG 106 Chapter 10 data format."
authors = [
{name = "Micah Ferrill", email = "ferrillm@avtest.com"},
Expand Down

0 comments on commit 292f151

Please sign in to comment.