Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions python/fusion_engine_client/parsers/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,12 @@ def on_data(self, data: Union[bytes, int]) -> List[Union[MessageTuple, MessageWi
# Get the class for the received message type and deserialize the message payload. If cls is not None, it is
# a child of @ref MessagePayload that maps to the received @ref MessageType.
cls = message_type_to_class.get(self._header.message_type, None)
payload = bytes(self._buffer[MessageHeader.calcsize():self._msg_len])
contents = None
if cls is not None:
contents = cls()
try:
contents.unpack(buffer=self._buffer, offset=MessageHeader.calcsize())
contents.unpack(buffer=payload, offset=0)
_logger.debug('Decoded FusionEngine message %s.', repr(contents))
except NotImplementedError as e:
print_func = _logger.warning if self._warn_on_unrecognized else _logger.debug
Expand All @@ -277,7 +278,7 @@ def on_data(self, data: Union[bytes, int]) -> List[Union[MessageTuple, MessageWi
self._header.message_type, self._header.payload_size_bytes)

if contents is None:
contents = bytes(self._buffer[MessageHeader.calcsize():self._msg_len])
contents = payload

# Store the result.
result = [self._header, contents]
Expand Down
Loading