File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -212,11 +212,7 @@ def __init__(
212
212
self .m_objPCANBasic = PCANBasic ()
213
213
self .m_PcanHandle = channel
214
214
215
- error , value = self .m_objPCANBasic .GetValue (PCAN_NONEBUS , PCAN_API_VERSION )
216
- if error != PCAN_ERROR_OK :
217
- raise CanInitializationError (f"Failed to read pcan basic api version" )
218
-
219
- apv = version .parse (value .decode ("ascii" ))
215
+ apv = self .get_api_version ()
220
216
if apv < MIN_PCAN_API_VERSION :
221
217
raise CanInitializationError (
222
218
f"Minimum version of pcan api is { MIN_PCAN_API_VERSION } ."
@@ -321,6 +317,13 @@ def bits(n):
321
317
322
318
return complete_text
323
319
320
+ def get_api_version (self ):
321
+ error , value = self .m_objPCANBasic .GetValue (PCAN_NONEBUS , PCAN_API_VERSION )
322
+ if error != PCAN_ERROR_OK :
323
+ raise CanInitializationError (f"Failed to read pcan basic api version" )
324
+
325
+ return version .parse (value .decode ("ascii" ))
326
+
324
327
def status (self ):
325
328
"""
326
329
Query the PCAN bus status.
You can’t perform that action at this time.
0 commit comments