Skip to content

Commit d6fabc6

Browse files
committed
Implement CanProtocol for EtasBus
1 parent a20af38 commit d6fabc6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

can/interfaces/etas/__init__.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import ctypes
21
import time
32
from typing import Dict, List, Optional, Tuple
43

5-
import can
6-
from ...exceptions import CanInitializationError
4+
import can.typechecking
75
from .boa import *
86

97

@@ -18,6 +16,12 @@ def __init__(
1816
data_bitrate: int = 2000000,
1917
**kwargs: object,
2018
):
19+
20+
super().__init__(
21+
channel=channel,
22+
protocol=can.CanProtocol.CAN_FD if fd else can.CanProtocol.CAN_20,
23+
)
24+
2125
self.receive_own_messages = receive_own_messages
2226

2327
nodeRange = CSI_NodeRange(CSI_NODE_MIN, CSI_NODE_MAX)
@@ -289,12 +293,13 @@ def state(self, new_state: can.BusState) -> None:
289293
# raise CanOperationError(f"OCI_AdaptCANConfiguration failed with error 0x{ec:X}")
290294
raise NotImplementedError("Setting state is not implemented.")
291295

296+
@staticmethod
292297
def _detect_available_configs() -> List[can.typechecking.AutoDetectedConfig]:
293298
nodeRange = CSI_NodeRange(CSI_NODE_MIN, CSI_NODE_MAX)
294299
tree = ctypes.POINTER(CSI_Tree)()
295300
CSI_CreateProtocolTree(ctypes.c_char_p(b""), nodeRange, ctypes.byref(tree))
296301

297-
nodes: Dict[str, str] = []
302+
nodes: List[Dict[str, str]] = []
298303

299304
def _findNodes(tree, prefix):
300305
uri = f"{prefix}/{tree.contents.item.uriName.decode()}"

0 commit comments

Comments
 (0)