Skip to content

Release 3.1.0 #516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 53 commits into from
Feb 23, 2019
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
cedb853
Adding neoVI support for receive_own_messages
pierreluctg Sep 28, 2018
87018fa
Merge branch 'develop' into receive_own_messages
hardbyte Sep 30, 2018
679d1a9
Merge branch 'develop' into receive_own_messages
pierreluctg Oct 2, 2018
752406c
Merge branch 'develop' into receive_own_messages
felixdivo Oct 5, 2018
84aa6b1
Merge pull request #434 from pierreluctg/receive_own_messages
felixdivo Oct 5, 2018
bf56c58
Fix some slcan issues (#447)
christiansandberg Oct 6, 2018
eb8ee51
Make typing dependency conditional < python 3.5
maxchill Oct 7, 2018
46206c1
Merge pull request #452 from maxchill/develop
felixdivo Oct 7, 2018
5f2c5ce
Doc update
felixdivo Oct 7, 2018
63325b2
use is_expedned_id instead of extended_id in Message constructor
felixdivo Oct 7, 2018
18f06f8
Merge pull request #454 from hardbyte/felixdivo-patch-1
felixdivo Oct 8, 2018
487da44
Merge branch 'develop' into fix-is_extended_id
felixdivo Oct 8, 2018
ea1d2f0
Merge pull request #455 from hardbyte/fix-is_extended_id
felixdivo Oct 8, 2018
fae631b
Fixed license header
Lauszus Oct 8, 2018
3e7b5e1
Fixed help text for the "--filter" argument, as the filters should be…
Lauszus Oct 8, 2018
e87189b
Merge pull request #456 from Lauszus/license
felixdivo Oct 9, 2018
70ac964
Fix doc to reflect the correct argument `context`
pierreluctg Oct 12, 2018
66ce24e
Changed asc log timestamps to 6 decimal places and uses real message …
Oct 30, 2018
e566caa
Merge branch 'develop' into feature/asctimestamp
ludobouan Oct 30, 2018
0027384
fix rendering of BusABC docstring
patkan Oct 29, 2018
b2b5341
Merge branch 'develop' into feature/asctimestamp
hardbyte Oct 31, 2018
02cba3b
Merge pull request #469 from ludobouan/feature/asctimestamp
hardbyte Nov 1, 2018
9f6f918
Fix Kvaser CANLIB CAN FD data rate setting
ben-powell-ctct Nov 8, 2018
43763ed
Import name deepcopy for __deepcopy__ method
matth314 Dec 14, 2018
3a092bc
Fix slcan message handling (#462)
christiansandberg Dec 18, 2018
6c5955e
Update argument name in thread safe bus set_filters method.
hardbyte Dec 23, 2018
9453cd0
Extend the thread safe bus tests
hardbyte Dec 23, 2018
093509a
Improved listener docs and docstrings (#484)
hardbyte Dec 23, 2018
5d19dba
Fixed help text for the scaling in the viewer
Lauszus Dec 18, 2018
6ab3d8d
Create separate structs for the Mac PCAN driver
Lauszus Dec 18, 2018
90b6021
Introduced structures for the kvaser driver.
sIuv Dec 2, 2018
04a11cb
Added support for bus statistics.
sIuv Dec 2, 2018
560d1e6
Updated documentation for the new kvaser custom-method get_stats.
sIuv Dec 8, 2018
69db2ec
Moved get_stats to a new documentation section called Custom Methods.
sIuv Dec 26, 2018
35c3fbb
Added new interface: CANalystII interface
Nov 30, 2018
8dbbf65
add baudrate option
Dec 18, 2018
e5cede3
add canalysstii documentation
Dec 18, 2018
d290d93
add timing register table
Dec 28, 2018
7d0783c
add to contributors list and history
Dec 29, 2018
b2a7bde
New SYSTEC interface (#466)
idaniel86 Jan 7, 2019
0b9d240
Prepare release 3.1.0 (#485)
hardbyte Jan 7, 2019
1a74330
Documentation update (#486)
hardbyte Jan 7, 2019
c819526
Allow simultaneous access to IXXAT cards (#488)
XelaRellum Jan 11, 2019
3ae0f37
Adding option to override neovi library name
pierreluctg Jan 14, 2019
8d24b3c
Adding ms to ASC formatted date
pierreluctg Jan 22, 2019
39ec1b1
Merge branch 'develop' into override-lib
hardbyte Jan 23, 2019
89f4c20
Adding option to override neovi library name
pierreluctg Jan 24, 2019
de94772
Fix initialization of usb2can Bus interface object (#501)
acolomb Feb 13, 2019
4ea358f
Message class changes (#497)
felixdivo Feb 13, 2019
f8524c1
Update iscan.py
JanGoeteyn Feb 18, 2019
119999d
canalystii interface take msg.is_extend_id into use and fix typo (#513)
atmlvs Feb 22, 2019
44cefbe
fix #510
felixdivo Feb 22, 2019
0348433
release 3.1.0
felixdivo Feb 23, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Example usage
receive_own_messages=True)

# send a message
message = can.Message(arbitration_id=123, extended_id=True,
message = can.Message(arbitration_id=123, is_extended_id=True,
data=[0x11, 0x22, 0x33])
bus.send(message, timeout=0.2)

Expand Down
10 changes: 8 additions & 2 deletions can/interfaces/ics_neovi/neovi_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def __init__(self, channel, can_filters=None, **config):
:type channel: int or str or list(int) or list(str)
:param list can_filters:
See :meth:`can.BusABC.set_filters` for details.
:param bool receive_own_messages:
If transmitted messages should also be received by this bus.
:param bool use_system_timestamp:
Use system timestamp for can messages instead of the hardware time
stamp
Expand Down Expand Up @@ -127,6 +129,7 @@ def __init__(self, channel, can_filters=None, **config):
self._use_system_timestamp = bool(
config.get('use_system_timestamp', False)
)
self._receive_own_messages = config.get('receive_own_messages', True)

self.channel_info = '%s %s CH:%s' % (
self.dev.Name,
Expand Down Expand Up @@ -222,6 +225,9 @@ def _process_msg_queue(self, timeout=0.1):
for ics_msg in messages:
if ics_msg.NetworkID not in self.channels:
continue
is_tx = bool(ics_msg.StatusBitField & ics.SPY_STATUS_TX_MSG)
if not self._receive_own_messages and is_tx:
continue
self.rx_buffer.append(ics_msg)
if errors:
logger.warning("%d error(s) found" % errors)
Expand Down Expand Up @@ -262,7 +268,7 @@ def _ics_msg_to_message(self, ics_msg):
arbitration_id=ics_msg.ArbIDOrHeader,
data=data,
dlc=ics_msg.NumberBytesData,
extended_id=bool(
is_extended_id=bool(
ics_msg.StatusBitField & ics.SPY_STATUS_XTD_FRAME
),
is_fd=is_fd,
Expand All @@ -283,7 +289,7 @@ def _ics_msg_to_message(self, ics_msg):
arbitration_id=ics_msg.ArbIDOrHeader,
data=ics_msg.Data[:ics_msg.NumberBytesData],
dlc=ics_msg.NumberBytesData,
extended_id=bool(
is_extended_id=bool(
ics_msg.StatusBitField & ics.SPY_STATUS_XTD_FRAME
),
is_fd=is_fd,
Expand Down
2 changes: 1 addition & 1 deletion can/interfaces/iscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _recv_internal(self, timeout):
break

msg = Message(arbitration_id=raw_msg.message_id,
extended_id=bool(raw_msg.is_extended),
is_extended_id=bool(raw_msg.is_extended),
timestamp=time.time(), # Better than nothing...
is_remote_frame=bool(raw_msg.remote_req),
dlc=raw_msg.data_len,
Expand Down
2 changes: 1 addition & 1 deletion can/interfaces/ixxat/canlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ def _recv_internal(self, timeout):
rx_msg = Message(
timestamp=self._message.dwTime / self._tick_resolution, # Relative time in s
is_remote_frame=True if self._message.uMsgInfo.Bits.rtr else False,
extended_id=True if self._message.uMsgInfo.Bits.ext else False,
is_extended_id=True if self._message.uMsgInfo.Bits.ext else False,
arbitration_id=self._message.dwMsgId,
dlc=self._message.uMsgInfo.Bits.dlc,
data=self._message.abData[:self._message.uMsgInfo.Bits.dlc],
Expand Down
2 changes: 1 addition & 1 deletion can/interfaces/kvaser/canlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def _recv_internal(self, timeout=None):
rx_msg = Message(arbitration_id=arb_id.value,
data=data_array[:dlc.value],
dlc=dlc.value,
extended_id=is_extended,
is_extended_id=is_extended,
is_error_frame=is_error_frame,
is_remote_frame=is_remote_frame,
is_fd=is_fd,
Expand Down
2 changes: 1 addition & 1 deletion can/interfaces/nican.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def _recv_internal(self, timeout):
channel=self.channel,
is_remote_frame=is_remote_frame,
is_error_frame=is_error_frame,
extended_id=is_extended,
is_extended_id=is_extended,
arbitration_id=arb_id,
dlc=dlc,
data=raw_msg.data[:dlc])
Expand Down
2 changes: 1 addition & 1 deletion can/interfaces/pcan/pcan.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def _recv_internal(self, timeout):

rx_msg = Message(timestamp=timestamp,
arbitration_id=theMsg.ID,
extended_id=bIsExt,
is_extended_id=bIsExt,
is_remote_frame=bIsRTR,
dlc=dlc,
data=theMsg.DATA[:dlc])
Expand Down
2 changes: 1 addition & 1 deletion can/interfaces/serial/serial_can.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def _recv_internal(self, timeout):
Received message and False (because not filtering as taken place).

.. warning::
Flags like extended_id, is_remote_frame and is_error_frame
Flags like is_extended_id, is_remote_frame and is_error_frame
will not be set over this function, the flags in the return
message are the default values.

Expand Down
48 changes: 31 additions & 17 deletions can/interfaces/slcan.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ class slcanBus(BusABC):

_SLEEP_AFTER_SERIAL_OPEN = 2 # in seconds

LINE_TERMINATOR = b'\r'

def __init__(self, channel, ttyBaudrate=115200, bitrate=None,
sleep_after_open=_SLEEP_AFTER_SERIAL_OPEN,
rtscts=False, **kwargs):
"""
:param str channel:
Expand All @@ -59,6 +62,8 @@ def __init__(self, channel, ttyBaudrate=115200, bitrate=None,
Bitrate in bit/s
:param float poll_interval:
Poll interval in seconds when reading messages
:param float sleep_after_open:
Time to wait in seconds after opening serial connection
:param bool rtscts:
turn hardware handshake (RTS/CTS) on and off
"""
Expand All @@ -72,7 +77,9 @@ def __init__(self, channel, ttyBaudrate=115200, bitrate=None,
self.serialPortOrig = serial.serial_for_url(
channel, baudrate=ttyBaudrate, rtscts=rtscts)

time.sleep(self._SLEEP_AFTER_SERIAL_OPEN)
self._buffer = bytearray()

time.sleep(sleep_after_open)

if bitrate is not None:
self.close()
Expand All @@ -87,9 +94,7 @@ def __init__(self, channel, ttyBaudrate=115200, bitrate=None,
bitrate=None, rtscts=False, **kwargs)

def write(self, string):
if not string.endswith('\r'):
string += '\r'
self.serialPortOrig.write(string.encode())
self.serialPortOrig.write(string.encode() + self.LINE_TERMINATOR)
self.serialPortOrig.flush()

def open(self):
Expand All @@ -107,12 +112,20 @@ def _recv_internal(self, timeout):
extended = False
frame = []

readStr = self.serialPortOrig.read_until(b'\r')
# Read everything that is already available
waiting = self.serialPortOrig.read(self.serialPortOrig.in_waiting)
self._buffer += waiting

if not readStr:
return None, False
else:
readStr = readStr.decode()
# Check if a complete message has been received
pos = self._buffer.find(self.LINE_TERMINATOR)
if pos == -1:
# Keep reading...
self._buffer += self.serialPortOrig.read_until(self.LINE_TERMINATOR)
pos = self._buffer.find(self.LINE_TERMINATOR)

if pos != -1:
readStr = self._buffer[0:pos].decode()
del self._buffer[0:pos+1]
if readStr[0] == 'T':
# extended frame
canId = int(readStr[1:9], 16)
Expand All @@ -129,45 +142,46 @@ def _recv_internal(self, timeout):
elif readStr[0] == 'r':
# remote frame
canId = int(readStr[1:4], 16)
dlc = int(readStr[4])
remote = True
elif readStr[0] == 'R':
# remote extended frame
canId = int(readStr[1:9], 16)
dlc = int(readStr[9])
extended = True
remote = True

if canId is not None:
msg = Message(arbitration_id=canId,
extended_id=extended,
is_extended_id=extended,
timestamp=time.time(), # Better than nothing...
is_remote_frame=remote,
dlc=dlc,
data=frame)
return msg, False
else:
return None, False
return None, False

def send(self, msg, timeout=0):
def send(self, msg, timeout=None):
if timeout != self.serialPortOrig.write_timeout:
self.serialPortOrig.write_timeout = timeout

if msg.is_remote_frame:
if msg.is_extended_id:
sendStr = "R%08X0" % (msg.arbitration_id)
sendStr = "R%08X%d" % (msg.arbitration_id, msg.dlc)
else:
sendStr = "r%03X0" % (msg.arbitration_id)
sendStr = "r%03X%d" % (msg.arbitration_id, msg.dlc)
else:
if msg.is_extended_id:
sendStr = "T%08X%d" % (msg.arbitration_id, msg.dlc)
else:
sendStr = "t%03X%d" % (msg.arbitration_id, msg.dlc)

for i in range(0, msg.dlc):
sendStr += "%02X" % msg.data[i]
sendStr += "".join(["%02X" % b for b in msg.data])
self.write(sendStr)

def shutdown(self):
self.close()
self.serialPortOrig.close()

def fileno(self):
if hasattr(self.serialPortOrig, 'fileno'):
Expand Down
2 changes: 1 addition & 1 deletion can/interfaces/socketcan/socketcan.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def capture_message(sock, get_channel=False):
msg = Message(timestamp=timestamp,
channel=channel,
arbitration_id=arbitration_id,
extended_id=is_extended_frame_format,
is_extended_id=is_extended_frame_format,
is_remote_frame=is_remote_transmission_request,
is_error_frame=is_error_frame,
is_fd=is_fd,
Expand Down
2 changes: 1 addition & 1 deletion can/interfaces/usb2can/usb2canInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def message_convert_rx(messagerx):

msgrx = Message(timestamp=messagerx.timestamp,
is_remote_frame=REMOTE_FRAME,
extended_id=ID_TYPE,
is_extended_id=ID_TYPE,
is_error_frame=ERROR_FRAME,
arbitration_id=messagerx.id,
dlc=messagerx.sizeData,
Expand Down
4 changes: 2 additions & 2 deletions can/interfaces/vector/canlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def _recv_internal(self, timeout):
msg = Message(
timestamp=timestamp + self._time_offset,
arbitration_id=msg_id & 0x1FFFFFFF,
extended_id=bool(msg_id & vxlapi.XL_CAN_EXT_MSG_ID),
is_extended_id=bool(msg_id & vxlapi.XL_CAN_EXT_MSG_ID),
is_remote_frame=bool(flags & vxlapi.XL_CAN_RXMSG_FLAG_RTR),
is_error_frame=bool(flags & vxlapi.XL_CAN_RXMSG_FLAG_EF),
is_fd=bool(flags & vxlapi.XL_CAN_RXMSG_FLAG_EDL),
Expand All @@ -292,7 +292,7 @@ def _recv_internal(self, timeout):
msg = Message(
timestamp=timestamp + self._time_offset,
arbitration_id=msg_id & 0x1FFFFFFF,
extended_id=bool(msg_id & vxlapi.XL_CAN_EXT_MSG_ID),
is_extended_id=bool(msg_id & vxlapi.XL_CAN_EXT_MSG_ID),
is_remote_frame=bool(flags & vxlapi.XL_CAN_MSG_FLAG_REMOTE_FRAME),
is_error_frame=bool(flags & vxlapi.XL_CAN_MSG_FLAG_ERROR_FRAME),
is_fd=False,
Expand Down
4 changes: 2 additions & 2 deletions can/io/asc.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __iter__(self):
can_id_num, is_extended_id = self._extract_can_id(can_id_str)
msg = Message(timestamp=timestamp,
arbitration_id=can_id_num & CAN_ID_MASK,
extended_id=is_extended_id,
is_extended_id=is_extended_id,
is_remote_frame=True,
channel=channel)
yield msg
Expand All @@ -111,7 +111,7 @@ def __iter__(self):
yield Message(
timestamp=timestamp,
arbitration_id=can_id_num & CAN_ID_MASK,
extended_id=is_extended_id,
is_extended_id=is_extended_id,
is_remote_frame=False,
dlc=dlc,
data=frame,
Expand Down
6 changes: 3 additions & 3 deletions can/io/blf.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def __iter__(self):
can_data) = CAN_MSG_STRUCT.unpack_from(data, pos)
msg = Message(timestamp=timestamp,
arbitration_id=can_id & 0x1FFFFFFF,
extended_id=bool(can_id & CAN_MSG_EXT),
is_extended_id=bool(can_id & CAN_MSG_EXT),
is_remote_frame=bool(flags & REMOTE_FLAG),
dlc=dlc,
data=can_data[:dlc],
Expand All @@ -227,7 +227,7 @@ def __iter__(self):
length = dlc2len(dlc)
msg = Message(timestamp=timestamp,
arbitration_id=can_id & 0x1FFFFFFF,
extended_id=bool(can_id & CAN_MSG_EXT),
is_extended_id=bool(can_id & CAN_MSG_EXT),
is_remote_frame=bool(flags & REMOTE_FLAG),
is_fd=bool(fd_flags & EDL),
bitrate_switch=bool(fd_flags & BRS),
Expand All @@ -241,7 +241,7 @@ def __iter__(self):
can_data) = CAN_ERROR_EXT_STRUCT.unpack_from(data, pos)
msg = Message(timestamp=timestamp,
is_error_frame=True,
extended_id=bool(can_id & CAN_MSG_EXT),
is_extended_id=bool(can_id & CAN_MSG_EXT),
arbitration_id=can_id & 0x1FFFFFFF,
dlc=dlc,
data=can_data[:dlc],
Expand Down
2 changes: 1 addition & 1 deletion can/io/canutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __iter__(self):
msg = Message(timestamp=timestamp, is_error_frame=True)
else:
msg = Message(timestamp=timestamp, arbitration_id=canId & 0x1FFFFFFF,
extended_id=isExtended, is_remote_frame=isRemoteFrame,
is_extended_id=isExtended, is_remote_frame=isRemoteFrame,
dlc=dlc, data=dataBin, channel=channel)
yield msg

Expand Down
2 changes: 1 addition & 1 deletion can/io/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def __iter__(self):
yield Message(
timestamp=float(timestamp),
is_remote_frame=(remote == '1'),
extended_id=(extended == '1'),
is_extended_id=(extended == '1'),
is_error_frame=(error == '1'),
arbitration_id=int(arbitration_id, base=16),
dlc=int(dlc),
Expand Down
2 changes: 1 addition & 1 deletion can/io/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _assemble_message(frame_data):
return Message(
timestamp=timestamp,
is_remote_frame=bool(is_remote),
extended_id=bool(is_extended),
is_extended_id=bool(is_extended),
is_error_frame=bool(is_error),
arbitration_id=can_id,
dlc=dlc,
Expand Down
6 changes: 3 additions & 3 deletions can/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(self, timestamp=0.0, arbitration_id=0, is_extended_id=None,
is_remote_frame=False, is_error_frame=False, channel=None,
dlc=None, data=None,
is_fd=False, bitrate_switch=False, error_state_indicator=False,
extended_id=True,
extended_id=True, # deprecated in 3.x, removed in 4.x
check=False):
"""
To create a message object, simply provide any of the below attributes
Expand Down Expand Up @@ -221,7 +221,7 @@ def __copy__(self):
new = Message(
timestamp=self.timestamp,
arbitration_id=self.arbitration_id,
extended_id=self.is_extended_id,
is_extended_id=self.is_extended_id,
is_remote_frame=self.is_remote_frame,
is_error_frame=self.is_error_frame,
channel=self.channel,
Expand All @@ -238,7 +238,7 @@ def __deepcopy__(self, memo):
new = Message(
timestamp=self.timestamp,
arbitration_id=self.arbitration_id,
extended_id=self.is_extended_id,
is_extended_id=self.is_extended_id,
is_remote_frame=self.is_remote_frame,
is_error_frame=self.is_error_frame,
channel=deepcopy(self.channel, memo),
Expand Down
Loading