Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# *.egg

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
19 changes: 18 additions & 1 deletion can/interfaces/ixxat/canlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from can.broadcastmanager import (
LimitedDurationCyclicSendTaskABC,
RestartableCyclicTaskABC,
ModifiableCyclicTaskABC,
)
from can.ctypesutil import CLibrary, HANDLE, PHANDLE, HRESULT as ctypes_HRESULT

Expand Down Expand Up @@ -713,7 +714,7 @@ def shutdown(self):
_canlib.vciDeviceClose(self._device_handle)


class CyclicSendTask(LimitedDurationCyclicSendTaskABC, RestartableCyclicTaskABC):
class CyclicSendTask(LimitedDurationCyclicSendTaskABC, RestartableCyclicTaskABC, ModifiableCyclicTaskABC):
"""A message in the cyclic transmit list."""

def __init__(self, scheduler, msgs, period, duration, resolution):
Expand All @@ -736,8 +737,24 @@ def __init__(self, scheduler, msgs, period, duration, resolution):
self._msg.uMsgInfo.Bits.dlc = self.messages[0].dlc
for i, b in enumerate(self.messages[0].data):
self._msg.abData[i] = b
# self.updateMsgData(msg.data)
# for i, b in enumerate(msg.data):
# self._msg.abData[i] = b
self.start()

def updateMsgData(self, data):
for i, b in enumerate(data):
self._msg.abData[i] = b

def modify_data(self, msg):
self.updateMsgData(msg.data)
if self._index is None:
self.start()
else:
_canlib.canSchedulerRemMessage(self._scheduler, self._index)
_canlib.canSchedulerAddMessage(self._scheduler, self._msg, self._index)
_canlib.canSchedulerStartMessage(self._scheduler, self._index, self._count)

def start(self):
"""Start transmitting message (add to list if needed)."""
if self._index is None:
Expand Down