@@ -295,12 +295,12 @@ def _find_global_channel_idx(
295295        if  serial  is  not None :
296296            hw_type : Optional [xldefine .XL_HardwareType ] =  None 
297297            for  channel_config  in  channel_configs :
298-                 if  channel_config .serial_number  !=  serial :
298+                 if  channel_config .serialNumber  !=  serial :
299299                    continue 
300300
301-                 hw_type  =  xldefine .XL_HardwareType (channel_config .hw_type )
302-                 if  channel_config .hw_channel  ==  channel :
303-                     return  channel_config .channel_index 
301+                 hw_type  =  xldefine .XL_HardwareType (channel_config .hwType )
302+                 if  channel_config .hwChannel  ==  channel :
303+                     return  channel_config .channelIndex 
304304
305305            if  hw_type  is  None :
306306                err_msg  =  f"No interface with serial { serial }  
@@ -331,7 +331,7 @@ def _find_global_channel_idx(
331331
332332        # check if channel is a valid global channel index 
333333        for  channel_config  in  channel_configs :
334-             if  channel  ==  channel_config .channel_index :
334+             if  channel  ==  channel_config .channelIndex :
335335                return  channel 
336336
337337        raise  CanInitializationError (
@@ -727,28 +727,26 @@ def _detect_available_configs() -> List[AutoDetectedConfig]:
727727        LOG .info ("Found %d channels" , len (channel_configs ))
728728        for  channel_config  in  channel_configs :
729729            if  (
730-                 not  channel_config .channel_bus_capabilities 
730+                 not  channel_config .channelBusCapabilities 
731731                &  xldefine .XL_BusCapabilities .XL_BUS_ACTIVE_CAP_CAN 
732732            ):
733733                continue 
734734            LOG .info (
735-                 "Channel index %d: %s" ,
736-                 channel_config .channel_index ,
737-                 channel_config .name ,
735+                 "Channel index %d: %s" , channel_config .channelIndex , channel_config .name 
738736            )
739737            configs .append (
740738                {
741739                    # data for use in VectorBus.__init__(): 
742740                    "interface" : "vector" ,
743-                     "channel" : channel_config .hw_channel ,
744-                     "serial" : channel_config .serial_number ,
741+                     "channel" : channel_config .hwChannel ,
742+                     "serial" : channel_config .serialNumber ,
745743                    # data for use in VectorBus.set_application_config(): 
746-                     "hw_type" : channel_config .hw_type ,
747-                     "hw_index" : channel_config .hw_index ,
748-                     "hw_channel" : channel_config .hw_channel ,
744+                     "hw_type" : channel_config .hwType ,
745+                     "hw_index" : channel_config .hwIndex ,
746+                     "hw_channel" : channel_config .hwChannel ,
749747                    # additional information: 
750748                    "supports_fd" : bool (
751-                         channel_config .channel_capabilities 
749+                         channel_config .channelCapabilities 
752750                        &  xldefine .XL_ChannelCapabilities .XL_CHANNEL_FLAG_CANFD_ISO_SUPPORT 
753751                    ),
754752                    "vector_channel_config" : channel_config ,
@@ -877,53 +875,22 @@ def set_timer_rate(self, timer_rate_ms: int) -> None:
877875        self .xldriver .xlSetTimerRate (self .port_handle , timer_rate_10us )
878876
879877
880- class  VectorCanParams (NamedTuple ):
881-     bitrate : int 
882-     sjw : int 
883-     tseg1 : int 
884-     tseg2 : int 
885-     sam : int 
886-     output_mode : xldefine .XL_OutputMode 
887-     can_op_mode : xldefine .XL_CANFD_BusParams_CanOpMode 
888- 
889- 
890- class  VectorCanFdParams (NamedTuple ):
891-     bitrate : int 
892-     data_bitrate : int 
893-     sjw_abr : int 
894-     tseg1_abr : int 
895-     tseg2_abr : int 
896-     sam_abr : int 
897-     sjw_dbr : int 
898-     tseg1_dbr : int 
899-     tseg2_dbr : int 
900-     output_mode : xldefine .XL_OutputMode 
901-     can_op_mode : xldefine .XL_CANFD_BusParams_CanOpMode 
902- 
903- 
904- class  VectorBusParams (NamedTuple ):
905-     bus_type : xldefine .XL_BusTypes 
906-     can : VectorCanParams 
907-     canfd : VectorCanFdParams 
908- 
909- 
910878class  VectorChannelConfig (NamedTuple ):
911879    """NamedTuple which contains the channel properties from Vector XL API.""" 
912880
913881    name : str 
914-     hw_type : xldefine .XL_HardwareType 
915-     hw_index : int 
916-     hw_channel : int 
917-     channel_index : int 
918-     channel_mask : int 
919-     channel_capabilities : xldefine .XL_ChannelCapabilities 
920-     channel_bus_capabilities : xldefine .XL_BusCapabilities 
921-     is_on_bus : bool 
922-     connected_bus_type : xldefine .XL_BusTypes 
923-     bus_params : VectorBusParams 
924-     serial_number : int 
925-     article_number : int 
926-     transceiver_name : str 
882+     hwType : xldefine .XL_HardwareType 
883+     hwIndex : int 
884+     hwChannel : int 
885+     channelIndex : int 
886+     channelMask : int 
887+     channelCapabilities : xldefine .XL_ChannelCapabilities 
888+     channelBusCapabilities : xldefine .XL_BusCapabilities 
889+     isOnBus : bool 
890+     connectedBusType : xldefine .XL_BusTypes 
891+     serialNumber : int 
892+     articleNumber : int 
893+     transceiverName : str 
927894
928895
929896def  _get_xl_driver_config () ->  xlclass .XLdriverConfig :
@@ -940,38 +907,6 @@ def _get_xl_driver_config() -> xlclass.XLdriverConfig:
940907    return  driver_config 
941908
942909
943- def  _read_bus_params_from_c_struct (bus_params : xlclass .XLbusParams ) ->  VectorBusParams :
944-     return  VectorBusParams (
945-         bus_type = xldefine .XL_BusTypes (bus_params .busType ),
946-         can = VectorCanParams (
947-             bitrate = bus_params .data .can .bitRate ,
948-             sjw = bus_params .data .can .sjw ,
949-             tseg1 = bus_params .data .can .tseg1 ,
950-             tseg2 = bus_params .data .can .tseg2 ,
951-             sam = bus_params .data .can .sam ,
952-             output_mode = xldefine .XL_OutputMode (bus_params .data .can .outputMode ),
953-             can_op_mode = xldefine .XL_CANFD_BusParams_CanOpMode (
954-                 bus_params .data .can .canOpMode 
955-             ),
956-         ),
957-         canfd = VectorCanFdParams (
958-             bitrate = bus_params .data .canFD .arbitrationBitRate ,
959-             data_bitrate = bus_params .data .canFD .dataBitRate ,
960-             sjw_abr = bus_params .data .canFD .sjwAbr ,
961-             tseg1_abr = bus_params .data .canFD .tseg1Abr ,
962-             tseg2_abr = bus_params .data .canFD .tseg2Abr ,
963-             sam_abr = bus_params .data .canFD .samAbr ,
964-             sjw_dbr = bus_params .data .canFD .sjwDbr ,
965-             tseg1_dbr = bus_params .data .canFD .tseg1Dbr ,
966-             tseg2_dbr = bus_params .data .canFD .tseg2Dbr ,
967-             output_mode = xldefine .XL_OutputMode (bus_params .data .canFD .outputMode ),
968-             can_op_mode = xldefine .XL_CANFD_BusParams_CanOpMode (
969-                 bus_params .data .canFD .canOpMode 
970-             ),
971-         ),
972-     )
973- 
974- 
975910def  get_channel_configs () ->  List [VectorChannelConfig ]:
976911    """Read channel properties from Vector XL API.""" 
977912    try :
@@ -984,23 +919,22 @@ def get_channel_configs() -> List[VectorChannelConfig]:
984919        xlcc : xlclass .XLchannelConfig  =  driver_config .channel [i ]
985920        vcc  =  VectorChannelConfig (
986921            name = xlcc .name .decode (),
987-             hw_type = xldefine .XL_HardwareType (xlcc .hwType ),
988-             hw_index = xlcc .hwIndex ,
989-             hw_channel = xlcc .hwChannel ,
990-             channel_index = xlcc .channelIndex ,
991-             channel_mask = xlcc .channelMask ,
992-             channel_capabilities = xldefine .XL_ChannelCapabilities (
922+             hwType = xldefine .XL_HardwareType (xlcc .hwType ),
923+             hwIndex = xlcc .hwIndex ,
924+             hwChannel = xlcc .hwChannel ,
925+             channelIndex = xlcc .channelIndex ,
926+             channelMask = xlcc .channelMask ,
927+             channelCapabilities = xldefine .XL_ChannelCapabilities (
993928                xlcc .channelCapabilities 
994929            ),
995-             channel_bus_capabilities = xldefine .XL_BusCapabilities (
930+             channelBusCapabilities = xldefine .XL_BusCapabilities (
996931                xlcc .channelBusCapabilities 
997932            ),
998-             is_on_bus = bool (xlcc .isOnBus ),
999-             bus_params = _read_bus_params_from_c_struct (xlcc .busParams ),
1000-             connected_bus_type = xldefine .XL_BusTypes (xlcc .connectedBusType ),
1001-             serial_number = xlcc .serialNumber ,
1002-             article_number = xlcc .articleNumber ,
1003-             transceiver_name = xlcc .transceiverName .decode (),
933+             isOnBus = bool (xlcc .isOnBus ),
934+             connectedBusType = xldefine .XL_BusTypes (xlcc .connectedBusType ),
935+             serialNumber = xlcc .serialNumber ,
936+             articleNumber = xlcc .articleNumber ,
937+             transceiverName = xlcc .transceiverName .decode (),
1004938        )
1005939        channel_list .append (vcc )
1006940    return  channel_list 
0 commit comments