Skip to content

Commit b09ff47

Browse files
committed
Refactor socketcan interface into own package
1 parent 24e6da9 commit b09ff47

5 files changed

Lines changed: 13 additions & 12 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from can.interfaces.socketcan.socketcan_ctypes import SocketcanCtypes_Bus
2+
from can.interfaces.socketcan.socketcan_native import SocketcanNative_Bus
3+
from can.interfaces.socketcan import socketcan_constants as constants
File renamed without changes.

can/interfaces/socketcan_ctypes.py renamed to can/interfaces/socketcan/socketcan_ctypes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
from __future__ import print_function
2-
import sys
2+
33
import ctypes
44
import logging
55
import select
6-
6+
import sys
77
from ctypes.util import find_library
88

99
import can
10-
from can.interfaces.socketcan_constants import * # CAN_RAW
10+
from can.broadcastmanager import CyclicSendTaskABC
1111
from can.bus import BusABC
1212
from can.message import Message
13-
from can.broadcastmanager import CyclicSendTaskABC, MultiRateCyclicSendTaskABC
13+
from can.interfaces.socketcan.socketcan_constants import * # CAN_RAW
1414

1515
# Set up logging
1616
log = logging.getLogger('can.socketcan.ctypes')

can/interfaces/socketcan_native.py renamed to can/interfaces/socketcan/socketcan_native.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
can socket and can bcm socket support: >3.4
66
"""
77

8+
import logging
9+
import select
810
import socket
911
import struct
10-
import logging
1112
from collections import namedtuple
12-
import select
13-
1413

1514
log = logging.getLogger('can.socketcan.native')
1615
log.info("Loading socketcan native backend")
@@ -27,11 +26,10 @@
2726

2827
import can
2928

30-
from can.message import Message
31-
from can.interfaces.socketcan_constants import * # CAN_RAW, CAN_*_FLAG
32-
from ..bus import BusABC
29+
from can.interfaces.socketcan.socketcan_constants import * # CAN_RAW, CAN_*_FLAG
30+
from can import Message, BusABC
3331

34-
from ..broadcastmanager import CyclicSendTaskABC
32+
from can.broadcastmanager import CyclicSendTaskABC
3533

3634
# struct module defines a binary packing format:
3735
# https://docs.python.org/3/library/struct.html#struct-format-strings

‎examples/send_one.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import print_function
2-
32
import can
43

4+
55
def send_one():
66
bus = can.interface.Bus()
77
msg = can.Message(arbitration_id=0xc0ffee,

0 commit comments

Comments
 (0)