diff --git a/can/__init__.py b/can/__init__.py index 9b6a26f58..ee13ff9a2 100644 --- a/can/__init__.py +++ b/can/__init__.py @@ -120,6 +120,7 @@ ) from .listener import AsyncBufferedReader, BufferedReader, Listener, RedirectReader from .message import Message +from .flexray_message import FlexRayVFrReceiveMsgEx from .notifier import Notifier from .thread_safe_bus import ThreadSafeBus from .util import set_logging_level diff --git a/can/flexray_message.py b/can/flexray_message.py new file mode 100644 index 000000000..9c966c099 --- /dev/null +++ b/can/flexray_message.py @@ -0,0 +1,48 @@ +""" +This module contains the implementation of :class:`can.FlexRayVFrReceiveMsgEx`. +""" + +class FlexRayVFrReceiveMsgEx: + """ + The :class:`~can.FlexRayVFrReceiveMsgEx` object is used to represent Flexray message. + """ + + __slots__ = [ + "timestamp", "is_flexray", + "channel", "version", "channelMask", "_dir", "clientIndexFlexRayVFrReceiveMsgEx", + "clusterNo", "frameId", "headerCrc1", "headerCrc2", "byteCount", "dataCount", + "cycle", "tag", "_data", "frameFlags", "appParameter", "frameCrc", "frameLengthNs", + "frameId1", "pduOffset", "blfLogMask", "reservedFlexRayVFrReceiveMsgEx1" + ] + + def __init__( + self, timestamp, is_flexray, channel, version, channelMask, _dir, + clientIndexFlexRayVFrReceiveMsgEx, clusterNo, frameId, headerCrc1, headerCrc2, + byteCount, dataCount, cycle, tag, _data, frameFlags, appParameter, frameCrc, + frameLengthNs, frameId1, pduOffset, blfLogMask, reservedFlexRayVFrReceiveMsgEx1 + ) -> None: + """Create FlexRayVFrReceiveMsgEx object""" + self.timestamp = timestamp + self.is_flexray = is_flexray + self.channel = channel + self.version = version + self.channelMask = channelMask + self._dir = _dir + self.clientIndexFlexRayVFrReceiveMsgEx = clientIndexFlexRayVFrReceiveMsgEx + self.clusterNo = clusterNo + self.frameId = frameId + self.headerCrc1 = headerCrc1 + self.headerCrc2 = headerCrc2 + self.byteCount = byteCount + self.dataCount = dataCount + self.cycle = cycle + self.tag = tag + self._data = _data + self.frameFlags = frameFlags + self.appParameter = appParameter + self.frameCrc = frameCrc + self.frameLengthNs = frameLengthNs + self.frameId1 = frameId1 + self.pduOffset = pduOffset + self.blfLogMask = blfLogMask + self.reservedFlexRayVFrReceiveMsgEx1 = reservedFlexRayVFrReceiveMsgEx1 diff --git a/can/io/blf.py b/can/io/blf.py index 81146233d..f1530554e 100644 --- a/can/io/blf.py +++ b/can/io/blf.py @@ -20,6 +20,7 @@ from typing import Any, BinaryIO, Generator, List, Optional, Tuple, Union, cast from ..message import Message +from ..flexray_message import FlexRayVFrReceiveMsgEx from ..typechecking import StringPathLike from ..util import channel2int, dlc2len, len2dlc from .generic import BinaryIOMessageReader, FileIOMessageWriter @@ -76,6 +77,11 @@ class BLFParseError(Exception): # group name length, marker name length, description length GLOBAL_MARKER_STRUCT = struct.Struct("