20
20
from .util import load_config
21
21
from .interfaces import BACKENDS
22
22
23
+ from can .interfaces .socketcan .socketcan import CyclicSendTask , MultiRateCyclicSendTask
24
+
23
25
# Required by "detect_available_configs" for argument interpretation
24
26
if sys .version_info .major > 2 :
25
27
basestring = str
@@ -37,14 +39,6 @@ def _get_class_for_interface(interface):
37
39
ImportError if there was a problem while importing the
38
40
interface or the bus class within that
39
41
"""
40
-
41
- # filter out the socketcan special case
42
- if interface == 'socketcan' :
43
- try :
44
- interface = can .util .choose_socketcan_implementation ()
45
- except Exception as e :
46
- raise ImportError ("Cannot choose socketcan implementation: {}" .format (e ))
47
-
48
42
# Find the correct backend
49
43
try :
50
44
module_name , class_name = BACKENDS [interface ]
@@ -175,43 +169,3 @@ def detect_available_configs(interfaces=None):
175
169
result += available
176
170
177
171
return result
178
-
179
-
180
- class CyclicSendTask (CyclicSendTaskABC ):
181
-
182
- @staticmethod
183
- def __new__ (cls , channel , * args , ** kwargs ):
184
-
185
- config = load_config (config = {'channel' : channel })
186
-
187
- # Import the correct implementation of CyclicSendTask
188
- if config ['interface' ] == 'socketcan_ctypes' :
189
- from can .interfaces .socketcan .socketcan_ctypes import CyclicSendTask as _ctypesCyclicSendTask
190
- cls = _ctypesCyclicSendTask
191
- elif config ['interface' ] == 'socketcan_native' :
192
- from can .interfaces .socketcan .socketcan_native import CyclicSendTask as _nativeCyclicSendTask
193
- cls = _nativeCyclicSendTask
194
- else :
195
- raise can .CanError ("Current CAN interface doesn't support CyclicSendTask" )
196
-
197
- return cls (config ['channel' ], * args , ** kwargs )
198
-
199
-
200
- class MultiRateCyclicSendTask (MultiRateCyclicSendTaskABC ):
201
-
202
- @staticmethod
203
- def __new__ (cls , channel , * args , ** kwargs ):
204
-
205
- config = load_config (config = {'channel' : channel })
206
-
207
- # Import the correct implementation of CyclicSendTask
208
- if config ['interface' ] == 'socketcan_ctypes' :
209
- from can .interfaces .socketcan .socketcan_ctypes import MultiRateCyclicSendTask as _ctypesMultiRateCyclicSendTask
210
- cls = _ctypesMultiRateCyclicSendTask
211
- elif config ['interface' ] == 'socketcan_native' :
212
- from can .interfaces .socketcan .socketcan_native import MultiRateCyclicSendTask as _nativeMultiRateCyclicSendTask
213
- cls = _nativeMultiRateCyclicSendTask
214
- else :
215
- can .log .info ("Current CAN interface doesn't support CyclicSendTask" )
216
-
217
- return cls (config ['channel' ], * args , ** kwargs )
0 commit comments