@@ -609,9 +609,7 @@ def _detect_available_configs():
609609 ):
610610 continue
611611 LOG .info (
612- "Channel index %d: %s" ,
613- channel_config .channelIndex ,
614- channel_config .name .decode ("ascii" ),
612+ "Channel index %d: %s" , channel_config .channelIndex , channel_config .name
615613 )
616614 configs .append (
617615 {
@@ -620,19 +618,15 @@ def _detect_available_configs():
620618 "channel" : channel_config .hwChannel ,
621619 "serial" : channel_config .serialNumber ,
622620 # data for use in VectorBus.set_application_config():
623- "hw_type" : xldefine . XL_HardwareType ( channel_config .hwType ) ,
621+ "hw_type" : channel_config .hwType ,
624622 "hw_index" : channel_config .hwIndex ,
625623 "hw_channel" : channel_config .hwChannel ,
626624 # additional information:
627625 "supports_fd" : bool (
628626 channel_config .channelCapabilities
629627 & xldefine .XL_ChannelCapabilities .XL_CHANNEL_FLAG_CANFD_ISO_SUPPORT
630628 ),
631- "isOnBus" : bool (channel_config .isOnBus ),
632- "name" : channel_config .name .decode (),
633- "channelIndex" : channel_config .channelIndex ,
634- "channelMask" : channel_config .channelMask ,
635- "transceiverName" : channel_config .transceiverName .decode (),
629+ "vector_channel_config" : channel_config ,
636630 }
637631 )
638632 return configs
@@ -735,7 +729,23 @@ def set_timer_rate(self, timer_rate_ms: int) -> None:
735729 xldriver .xlSetTimerRate (self .port_handle , timer_rate_10us )
736730
737731
738- def get_channel_configs () -> List [xlclass .XLchannelConfig ]:
732+ class VectorChannelConfig (typing .NamedTuple ):
733+ name : str
734+ hwType : xldefine .XL_HardwareType
735+ hwIndex : int
736+ hwChannel : int
737+ channelIndex : int
738+ channelMask : int
739+ channelCapabilities : xldefine .XL_ChannelCapabilities
740+ channelBusCapabilities : xldefine .XL_BusCapabilities
741+ isOnBus : bool
742+ connectedBusType : xldefine .XL_BusTypes
743+ serialNumber : int
744+ articleNumber : int
745+ transceiverName : str
746+
747+
748+ def get_channel_configs () -> List [VectorChannelConfig ]:
739749 if xldriver is None :
740750 return []
741751 driver_config = xlclass .XLdriverConfig ()
@@ -745,4 +755,28 @@ def get_channel_configs() -> List[xlclass.XLchannelConfig]:
745755 xldriver .xlCloseDriver ()
746756 except VectorError :
747757 pass
748- return [driver_config .channel [i ] for i in range (driver_config .channelCount )]
758+
759+ channel_list : List [VectorChannelConfig ] = []
760+ for i in range (driver_config .channelCount ):
761+ xlcc : xlclass .XLchannelConfig = driver_config .channel [i ]
762+ vcc = VectorChannelConfig (
763+ name = xlcc .name .decode (),
764+ hwType = xldefine .XL_HardwareType (xlcc .hwType ),
765+ hwIndex = xlcc .hwIndex ,
766+ hwChannel = xlcc .hwChannel ,
767+ channelIndex = xlcc .channelIndex ,
768+ channelMask = xlcc .channelMask ,
769+ channelCapabilities = xldefine .XL_ChannelCapabilities (
770+ xlcc .channelCapabilities
771+ ),
772+ channelBusCapabilities = xldefine .XL_BusCapabilities (
773+ xlcc .channelBusCapabilities
774+ ),
775+ isOnBus = bool (xlcc .isOnBus ),
776+ connectedBusType = xldefine .XL_BusTypes (xlcc .connectedBusType ),
777+ serialNumber = xlcc .serialNumber ,
778+ articleNumber = xlcc .articleNumber ,
779+ transceiverName = xlcc .transceiverName .decode (),
780+ )
781+ channel_list .append (vcc )
782+ return channel_list
0 commit comments