@@ -685,7 +685,7 @@ def popup_vector_hw_configuration(wait_for_finish: int = 0) -> None:
685
685
@staticmethod
686
686
def get_application_config (
687
687
app_name : str , app_channel : int
688
- ) -> Tuple [xldefine .XL_HardwareType , int , int ]:
688
+ ) -> Tuple [Union [ int , xldefine .XL_HardwareType ] , int , int ]:
689
689
"""Retrieve information for an application in Vector Hardware Configuration.
690
690
691
691
:param app_name:
@@ -702,26 +702,31 @@ def get_application_config(
702
702
if xldriver is None :
703
703
raise CanInterfaceNotImplementedError ("The Vector API has not been loaded" )
704
704
705
- hw_type = ctypes .c_uint ()
706
- hw_index = ctypes .c_uint ()
707
- hw_channel = ctypes .c_uint ()
705
+ _hw_type = ctypes .c_uint ()
706
+ _hw_index = ctypes .c_uint ()
707
+ _hw_channel = ctypes .c_uint ()
708
708
_app_channel = ctypes .c_uint (app_channel )
709
709
710
710
xldriver .xlGetApplConfig (
711
711
app_name .encode (),
712
712
_app_channel ,
713
- hw_type ,
714
- hw_index ,
715
- hw_channel ,
713
+ _hw_type ,
714
+ _hw_index ,
715
+ _hw_channel ,
716
716
xldefine .XL_BusTypes .XL_BUS_TYPE_CAN ,
717
717
)
718
- return xldefine .XL_HardwareType (hw_type .value ), hw_index .value , hw_channel .value
718
+ try :
719
+ hw_type = xldefine .XL_HardwareType (_hw_type .value )
720
+ except ValueError :
721
+ hw_type = _hw_type .value
722
+
723
+ return hw_type , _hw_index .value , _hw_channel .value
719
724
720
725
@staticmethod
721
726
def set_application_config (
722
727
app_name : str ,
723
728
app_channel : int ,
724
- hw_type : xldefine .XL_HardwareType ,
729
+ hw_type : Union [ int , xldefine .XL_HardwareType ] ,
725
730
hw_index : int ,
726
731
hw_channel : int ,
727
732
** kwargs : Any ,
@@ -783,7 +788,7 @@ def set_timer_rate(self, timer_rate_ms: int) -> None:
783
788
784
789
class VectorChannelConfig (NamedTuple ):
785
790
name : str
786
- hwType : xldefine .XL_HardwareType
791
+ hwType : Union [ int , xldefine .XL_HardwareType ]
787
792
hwIndex : int
788
793
hwChannel : int
789
794
channelIndex : int
@@ -811,9 +816,15 @@ def get_channel_configs() -> List[VectorChannelConfig]:
811
816
channel_list : List [VectorChannelConfig ] = []
812
817
for i in range (driver_config .channelCount ):
813
818
xlcc : xlclass .XLchannelConfig = driver_config .channel [i ]
819
+
820
+ try :
821
+ hw_type = xldefine .XL_HardwareType (xlcc .hwType )
822
+ except ValueError :
823
+ hw_type = xlcc .hwType
824
+
814
825
vcc = VectorChannelConfig (
815
826
name = xlcc .name .decode (),
816
- hwType = xldefine . XL_HardwareType ( xlcc . hwType ) ,
827
+ hwType = hw_type ,
817
828
hwIndex = xlcc .hwIndex ,
818
829
hwChannel = xlcc .hwChannel ,
819
830
channelIndex = xlcc .channelIndex ,
0 commit comments