Skip to content

Commit 26fe9d4

Browse files
committed
Implement CANProtocol for UDPMulticastBus
1 parent 07defb0 commit 26fe9d4

File tree

1 file changed

+9
-8
lines changed
  • can/interfaces/udp_multicast

1 file changed

+9
-8
lines changed

can/interfaces/udp_multicast/bus.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,21 @@
33
import select
44
import socket
55
import struct
6+
from typing import List, Optional, Tuple, Union
7+
8+
import can
9+
from can import BusABC, CANProtocol
10+
from can.typechecking import AutoDetectedConfig
11+
from .utils import pack_message, unpack_message, check_msgpack_installed
612

713
try:
814
from fcntl import ioctl
915
except ModuleNotFoundError: # Missing on Windows
1016
pass
1117

12-
from typing import List, Optional, Tuple, Union
1318

1419
log = logging.getLogger(__name__)
1520

16-
import can
17-
from can import BusABC
18-
from can.typechecking import AutoDetectedConfig
19-
20-
from .utils import pack_message, unpack_message, check_msgpack_installed
21-
2221

2322
# see socket.getaddrinfo()
2423
IPv4_ADDRESS_INFO = Tuple[str, int] # address, port
@@ -103,7 +102,9 @@ def __init__(
103102
"receiving own messages is not yet implemented"
104103
)
105104

106-
super().__init__(channel, **kwargs)
105+
super().__init__(
106+
channel, **kwargs, protocol=CANProtocol.CAN_FD if fd else CANProtocol.CAN_20
107+
)
107108

108109
self.is_fd = fd
109110
self._multicast = GeneralPurposeUdpMulticastBus(channel, port, hop_limit)

0 commit comments

Comments
 (0)