1
- import ctypes
2
1
import time
3
2
from typing import Dict , List , Optional , Tuple
4
3
5
- import can
6
- from ...exceptions import CanInitializationError
4
+ import can .typechecking
7
5
from .boa import *
8
6
9
7
@@ -18,6 +16,12 @@ def __init__(
18
16
data_bitrate : int = 2000000 ,
19
17
** kwargs : object ,
20
18
):
19
+
20
+ super ().__init__ (
21
+ channel = channel ,
22
+ protocol = can .CanProtocol .CAN_FD if fd else can .CanProtocol .CAN_20 ,
23
+ )
24
+
21
25
self .receive_own_messages = receive_own_messages
22
26
23
27
nodeRange = CSI_NodeRange (CSI_NODE_MIN , CSI_NODE_MAX )
@@ -289,12 +293,13 @@ def state(self, new_state: can.BusState) -> None:
289
293
# raise CanOperationError(f"OCI_AdaptCANConfiguration failed with error 0x{ec:X}")
290
294
raise NotImplementedError ("Setting state is not implemented." )
291
295
296
+ @staticmethod
292
297
def _detect_available_configs () -> List [can .typechecking .AutoDetectedConfig ]:
293
298
nodeRange = CSI_NodeRange (CSI_NODE_MIN , CSI_NODE_MAX )
294
299
tree = ctypes .POINTER (CSI_Tree )()
295
300
CSI_CreateProtocolTree (ctypes .c_char_p (b"" ), nodeRange , ctypes .byref (tree ))
296
301
297
- nodes : Dict [str , str ] = []
302
+ nodes : List [ Dict [str , str ] ] = []
298
303
299
304
def _findNodes (tree , prefix ):
300
305
uri = f"{ prefix } /{ tree .contents .item .uriName .decode ()} "
0 commit comments