Skip to content

Merge develop into master for release 2.2.0 #344

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 181 commits into from
Jul 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
a43d322
Handle error frame messages in CanutilsLogWriter and CanutilsLogReader.
felixdivo Feb 11, 2018
7af1021
Fix issues in USB2CAN with Python3
hardbyte Feb 17, 2018
8e30e60
Support error frame messages in ASCWriter and ASCReader.
felixdivo Feb 11, 2018
d8942ce
Use configured bitrate in pcan. Closes #196
felixdivo Feb 11, 2018
e9579ce
Merge pull request #257 from hardbyte/release-2.1.0
hardbyte Feb 18, 2018
1cb8ebc
Update version to "2.1.1-dev"
hardbyte Feb 18, 2018
8fe1b5a
general cleanups of the main modules
felixdivo Feb 20, 2018
cdc88cb
general cleanup of the can/io/* modules
felixdivo Feb 20, 2018
102be0d
general cleanup of the can/interfaces/ modules (not yes the ones in c…
felixdivo Feb 20, 2018
23d928e
general cleanup of the can/interfaces/*/* modules
felixdivo Feb 20, 2018
78e4834
general cleanup of the tests
felixdivo Feb 20, 2018
fab6f23
general cleanup of the examples
felixdivo Feb 20, 2018
434aa04
general cleanup of misc files & closing opened file in setup.py
felixdivo Feb 20, 2018
1fbc398
removed unused file in kvaser interface
felixdivo Feb 21, 2018
ea8e107
better send_one example
felixdivo Feb 21, 2018
cd00388
Handle error frame messages in CanutilsLogWriter and CanutilsLogReader.
felixdivo Feb 11, 2018
0c5bfb8
Merge branch 'fix-217' of github.com:hardbyte/python-can into fix-217
felixdivo Feb 22, 2018
0127683
small changes in can/io/log.py
felixdivo Feb 22, 2018
40d63c9
make ASCWriter's output consistent with the other loggers
felixdivo Feb 22, 2018
0a6f9e5
more info about building the docs with Sphinx
felixdivo Feb 22, 2018
eb4f866
removed unnessesary call to abs() in SqliteReader
felixdivo Feb 22, 2018
4a17a5f
renamed example file
felixdivo Feb 23, 2018
b0b4a75
added small TODO in sqlite.py
felixdivo Feb 23, 2018
cc06901
Vector: Reduce CPU usage by using Win32 events
christiansandberg Nov 18, 2017
190f949
Add note in documentation about pywin32
christiansandberg Feb 20, 2018
782c2ab
simpler usage of abc.*
felixdivo Feb 23, 2018
0bdd978
fix inport in util.py
felixdivo Feb 23, 2018
72cc66c
structural changes to setup.py & added 'Deprecated' library
felixdivo Feb 22, 2018
a2127da
@deprecated the name SqlReader
felixdivo Feb 22, 2018
be39d1c
removed the version attribute from the deprecated decorator
felixdivo Feb 22, 2018
071152c
fix wrong method call
felixdivo Feb 22, 2018
67a71fc
try to enable useful tests with appveyor
felixdivo Feb 22, 2018
6f1d739
try simplifying .appveyor.yml
felixdivo Feb 22, 2018
e9aec8d
factored out common Travis skipping behaviour and replaced it with ge…
felixdivo Feb 23, 2018
5e0acf5
add appveyor badge to README.md
felixdivo Feb 23, 2018
347fb18
fix problem from another branch so we can test here
felixdivo Feb 23, 2018
4cdea04
fix absolute imports
felixdivo Feb 23, 2018
07be6b5
warn about usage of the old CAN module. fix #267
felixdivo Feb 23, 2018
e4569c4
completely remove SqlReader. closes #263
felixdivo Feb 24, 2018
1c6da93
various improvments (e.g. docs) and added CSVReader as a placeholder
felixdivo Feb 23, 2018
f6ba6b5
added CSVReader
felixdivo Feb 23, 2018
bcc6164
added tests for the CSVReader & CSVWriter pair
felixdivo Feb 23, 2018
2eae299
fix a rounding problem in CSVWriter
felixdivo Feb 23, 2018
bd09a72
described the CSV format
felixdivo Feb 23, 2018
6cb060a
removed problematic import of removed library
felixdivo Feb 24, 2018
fbaa310
Merge branch 'develop' of github.com:hardbyte/python-can into develop
felixdivo Feb 24, 2018
1a34e01
Update README.rst
felixdivo Feb 26, 2018
088423d
factored out some common import functionality
felixdivo Mar 2, 2018
828b10f
cleaning up interface.py
felixdivo Mar 6, 2018
405d569
make class Bus in interface.py extend BusABC (IDEs can now see the at…
felixdivo Mar 6, 2018
e3c5910
changed BusABC to allow for software filtering and added documentation
felixdivo Mar 6, 2018
a5208dd
fix proposed changes in PR
felixdivo Mar 8, 2018
d829915
allow older implementations of BusABC.revc() to continue working
felixdivo Mar 8, 2018
6a4aa5b
remove unused call to BusABC.flush_tx_buffer()
felixdivo Mar 8, 2018
288c8b1
add some unit testing for BusABC._matches_filters()
felixdivo Mar 10, 2018
76dd141
applied requested changes from code review
felixdivo Mar 15, 2018
f72f2ad
Handle error frame messages in CanutilsLogWriter and CanutilsLogReader.
felixdivo Feb 11, 2018
472b0c7
small changes in can/io/log.py
felixdivo Feb 22, 2018
53abda4
make ASCWriter's output consistent with the other loggers
felixdivo Feb 22, 2018
b4fed47
applied requested changes from code review
felixdivo Mar 15, 2018
48ad0fc
Merge branch 'fix-217' of github.com:hardbyte/python-can into fix-217
felixdivo Mar 15, 2018
1051f1e
Added proof-of-concept testing of SocketCAN on Travis CI & Smaller ch…
felixdivo Mar 16, 2018
9db2b27
can.Notifier enhancements (#266)
felixdivo Mar 16, 2018
db63418
Remove `load_default_settings` call in init
pierreluctg Mar 5, 2018
79d8d38
changed CanutilsLogWriter and ASCWriter to behave more similar
felixdivo Mar 17, 2018
d1a6b16
small fixes
felixdivo Mar 17, 2018
58e9f51
Support using the Windows IXXAT driver in Cygwin
Mar 22, 2018
f73f850
Adding bitrate settings for neoVI interface
pierreluctg Mar 23, 2018
deb50be
Updated PCAN interface
edobez Mar 16, 2018
a4f420d
adjusted the ASC test cases to check only rounded timestamps
felixdivo Apr 2, 2018
0b9be03
unified the code in and corrected the ASCWriter class
felixdivo Apr 2, 2018
8f526c5
small corrections
felixdivo Apr 2, 2018
73889eb
Merge pull request #255 from hardbyte/fix-217
felixdivo Apr 8, 2018
afcc678
BLF and ASC log file fixes (#291)
christiansandberg Apr 10, 2018
6dbf15b
ixxat & cygwin: Fix issue where exceptions in driver functions were i…
Mar 28, 2018
723a487
Fix opening ixxat by hardware id on x64 by being explicit about struc…
Mar 28, 2018
40f660c
Fix SocketCAN version selection, many crashes and re-enable tests (#293)
felixdivo Apr 17, 2018
cac8283
added file that are generated by tests to the ignore list
felixdivo Apr 10, 2018
9cccc61
removed the executable flag from test/listener_test.py
felixdivo Apr 10, 2018
d26e035
add nice error handler & tests & added IS_UNIX flag in conifg
felixdivo Apr 10, 2018
9c73316
patched the send/write methods of both socketcan interfaces, the now …
felixdivo Apr 10, 2018
b97a502
fix log levels of socketcan library loading errors
felixdivo Apr 27, 2018
a973d73
Merge branch 'develop' into software-filtering
felixdivo Apr 27, 2018
ddfac97
Feature: API for automatic configuration detection (#278)
felixdivo May 14, 2018
92037c4
Merge branch 'develop' into software-filtering
felixdivo May 14, 2018
f097d93
more docs
felixdivo May 14, 2018
90a823b
more docs
felixdivo May 14, 2018
3e12e3c
added very basic test for message filtering
felixdivo May 14, 2018
a831e48
fix import
felixdivo May 14, 2018
ed1ba8b
switch virtaul interface to new receive method
felixdivo May 14, 2018
805159f
added _recv_internal for kvaser interface
felixdivo May 14, 2018
20518c2
add _receive_internal to socketcan native & ctypes
felixdivo May 14, 2018
ba3d3cb
added _recv_internal for PCAN
felixdivo May 14, 2018
8c590a8
fix for test & better method signatures
felixdivo May 14, 2018
3abbdd7
add timeouts to CI tests
felixdivo May 15, 2018
f1e3c75
remove wrong config fom .appveyor.yml
felixdivo May 15, 2018
0a75a94
fix correct call to _apply_filters
felixdivo May 15, 2018
a7df72a
add fix for parameter name
felixdivo May 15, 2018
30b4157
docs
felixdivo May 15, 2018
e8c6711
docs
felixdivo May 15, 2018
73b3fac
change Vector backend to use new methods
felixdivo May 15, 2018
2f48950
docs
felixdivo May 15, 2018
567fb2e
added new bus methods for neovi interface
felixdivo May 15, 2018
b3df2d7
removed problemativ command line argument on AppVeyor
felixdivo May 16, 2018
f1d0a5e
better error handling in socketcan and correct filtering for native one
felixdivo May 16, 2018
43258be
fixes for PCAN
felixdivo May 16, 2018
2a71dfe
new methods for usb2can
felixdivo May 16, 2018
79f2c4c
added new mthods to slcan
felixdivo May 16, 2018
dec258e
small fixes
felixdivo May 16, 2018
d61c744
new methods for nican backend
felixdivo May 16, 2018
c7607df
better imports in IXXAT
felixdivo May 16, 2018
ab4b3a0
new methods for IXXAT interface
felixdivo May 16, 2018
0b6d3ca
new methods for iscan
felixdivo May 16, 2018
0bb21e6
bugfixes, simplifications, optimizations & new methods for serial can
felixdivo May 16, 2018
f5ea870
small fix for IXXAT import on Python 2
felixdivo May 16, 2018
64e8e66
Add a possibility to use LISTEN ONLY for the CAN Hardware. (#235)
mgiaco May 22, 2018
947363b
Merge branch 'develop' into software-filtering
felixdivo May 22, 2018
188a439
add initial version of CAN FD support for Vector
AntonioCohimbra May 18, 2018
f588b1b
add initial version of CAN FD support for Vector
AntonioCohimbra May 18, 2018
de59ce5
add review changes
AntonioCohimbra May 23, 2018
86aabcd
various cleanups an removed some rotten code
felixdivo May 27, 2018
e1e6931
small doc fixes
felixdivo May 27, 2018
51eae1c
added "Creating a new interface/backend" section to the documentation…
felixdivo May 27, 2018
b1d1f4f
better development docs
felixdivo May 27, 2018
3490c25
documented the removal of the functional API for send_periodic
felixdivo May 27, 2018
6a527fb
moved some docs of the BusABC to the development section
felixdivo May 27, 2018
9c4e10a
Merge branch 'develop' into software-filtering
felixdivo May 27, 2018
220bd28
fix some imports in can.io.*
felixdivo May 27, 2018
4ba482f
Merge pull request #277 from hardbyte/software-filtering
felixdivo May 28, 2018
6ebe610
cleanups, fixes & docs in Bus.__new__() and util.load_config() (#309)
felixdivo May 28, 2018
909a7d2
Merge branch 'develop' into code-cleanups
felixdivo May 28, 2018
e48ca4e
Merge pull request #312 from hardbyte/code-cleanups
felixdivo May 28, 2018
9f354d0
Add a general timeout for tests (#313)
felixdivo May 28, 2018
00f36d1
added a ThreadSafeBus based on the wrapt library
felixdivo May 28, 2018
e937083
add TheradSafeBus to root __init__.py
felixdivo May 28, 2018
62ecb4e
added tests for ThreadSafeBus
felixdivo May 28, 2018
cd147dc
try to fix constructor of ThreadSafeBus
felixdivo May 28, 2018
1b8414e
try to use metaclasses correctly
felixdivo May 28, 2018
7b1f5c2
explicitly require pytest
felixdivo May 28, 2018
b66c610
attempt to fix metaclass in ThreadSafeBus
felixdivo May 28, 2018
458e054
removed BusABC from ThreadSafeBus parent class
felixdivo May 28, 2018
b1761d5
doc
felixdivo May 28, 2018
bd6c5d6
added documentation
felixdivo May 30, 2018
7b1026d
Feature: Context manager (#283)
edobez Jun 4, 2018
3da5bd9
cleanups of context manager tests
felixdivo Jun 4, 2018
51e8c4f
Fix possible problems in Bus constructor (#319)
felixdivo Jun 4, 2018
6b8a9b4
Add support for new BLF files (#316)
christiansandberg Jun 5, 2018
09754ef
Build wheels compatible with py2 and py3
christiansandberg Jun 6, 2018
78368f3
fix proposed doc chnages
felixdivo Jun 6, 2018
c82eea6
remove setuptools dependency
felixdivo Jun 6, 2018
efa99dc
debugging commit for CI server
felixdivo Jun 6, 2018
b68afa4
removed the subprocess32 dependency
felixdivo Jun 6, 2018
fdd5d2a
fix typo in test file name
felixdivo Jun 6, 2018
976276f
debugging commit
felixdivo Jun 6, 2018
06bc2a1
undo last debugging commit
felixdivo Jun 6, 2018
2809518
Add support for Kvaser config detection (#321)
christiansandberg Jun 7, 2018
f3cae06
renamed socketcan helpers test
felixdivo Jun 8, 2018
26ffd06
documentation improvements
felixdivo Jun 8, 2018
db0b20c
corrected unit test
felixdivo Jun 8, 2018
3737bb3
fix unit test #2
felixdivo Jun 8, 2018
0142bb8
fix unit test #3
felixdivo Jun 8, 2018
fbf0594
Removed Python 3.3 CI testing (#322)
felixdivo Jun 9, 2018
3e4b93c
SocketCAN (native) cyclic improvements (#323)
christiansandberg Jun 12, 2018
bb3b117
Merge pull request #315 from hardbyte/feature-synchronized-bus
felixdivo Jun 13, 2018
e6d9e76
Setting _filters to None when filter Iterator is empty (#325)
pierreluctg Jun 13, 2018
022cb48
Adding detect_available_configs support to neovi (#327)
pierreluctg Jun 14, 2018
cc3f5f7
Adding proper bitrate and timestamp support for neovi (#324)
pierreluctg Jun 14, 2018
920a384
Adding NeoVi interface information in history (#329)
pierreluctg Jun 15, 2018
b865a93
Fix 328: Allow more than one filter for vector (#330)
AntonioCohimbra Jun 18, 2018
100ebca
Fix shadowing built-in name "filter"
pierreluctg Jun 20, 2018
dfae0bb
Fixing inconsistent indentation (use of a mixture of tabs and spaces)
pierreluctg Jun 20, 2018
60391e6
Fixing mismatched parameters in a docstring (#334)
pierreluctg Jun 22, 2018
1bdfc56
Stop raising accuracy error for NeoVi (#336)
pierreluctg Jun 25, 2018
b2c03b2
Make can importable without wrapt
christiansandberg Jun 24, 2018
c4752b2
Improved channel handling (#332)
christiansandberg Jun 25, 2018
405ca77
Exclude test package in distribution
christiansandberg Jun 25, 2018
614bb04
Bump version to 2.2.0-dev
christiansandberg Jun 25, 2018
66540e3
Merge socketcan_native and socketcan_ctypes into one (#326)
christiansandberg Jun 26, 2018
85e1274
Feature travis to build sphinx docs (#342)
hardbyte Jun 29, 2018
c61d5c7
Bump version to 2.2.0-rc.1
hardbyte Jun 29, 2018
49eb730
Add changelog highlights and set version to 2.2.0
hardbyte Jun 30, 2018
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
31 changes: 31 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
environment:
matrix:

# For Python versions available on Appveyor, see
# http://www.appveyor.com/docs/installed-software#python

- PYTHON: "C:\\Python27"
- PYTHON: "C:\\Python34"
- PYTHON: "C:\\Python35"
- PYTHON: "C:\\Python36"
- PYTHON: "C:\\Python27-x64"
- PYTHON: "C:\\Python34-x64"
- PYTHON: "C:\\Python35-x64"
- PYTHON: "C:\\Python36-x64"

# Python 3.3 has reached EOL

install:
# Prepend Python installation to PATH
- set PATH=%PYTHON_INSTALL%;%PATH%

# Prepend Python scripts to PATH (e.g. py.test)
- set PATH=%PYTHON_INSTALL%\\Scripts;%PATH%

# We need to install the python-can library itself
- "python -m pip install .[test]"

build: off

test_script:
- "pytest -v --timeout=300"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ nosetests.xml
coverage.xml
*,cover
.hypothesis/
test.*

# Translations
*.mo
Expand Down
22 changes: 14 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ language: python
python:
# CPython:
- "2.7"
- "3.3"
# Python 3.3 has reached EOL and pytest fails there
- "3.4"
- "3.5"
- "3.6"
- "3.7-dev" # TODO: change to "3.7" once it gets released
- "3.7-dev" # TODO: change to "3.7" once it is supported by travis-ci
- "nightly"
# PyPy:
- "pypy"
- "pypy3"
- "pypy3.5"

os:
- linux # Linux is officially supported and we test the library under
Expand All @@ -37,14 +37,20 @@ matrix:
- os: osx
python: "nightly"

# allow all nighly builds to fail, since these python versions might be unstable
# we do not allow dev builds to fail, since these builds are stable enough
allow_failures:
# allow all nighly builds to fail, since these python versions might be unstable
- python: "nightly"

# we do not allow dev builds to fail, since these builds are considered stable enough

install:
- travis_retry pip install .
- travis_retry pip install -r requirements.txt
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo bash test/open_vcan.sh ; fi
- travis_retry pip install .[test]
- travis_retry pip install sphinx

script:
- py.test -v
- pytest -v --timeout=300
# Build Docs with Sphinx
#
# -a Write all files
- if [[ "$TRAVIS_PYTHON_VERSION" == "3.6" ]]; then python -m sphinx -an doc build; fi
13 changes: 13 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@

Version 2.2.0 (2018-06-30)
=====

* Fallback message filtering implemented in Python for interfaces that don't offer better accelerated mechanism.
* SocketCAN interfaces have been merged (Now use `socketcan` instead of either `socketcan_native` and `socketcan_ctypes`),
this is now completely transparent for the library user.
* automatic detection of available configs/channels in supported interfaces.
* Added synchronized (thread-safe) Bus variant.
* context manager support for the Bus class.
* Dropped support for Python 3.3 (officially reached end-of-life in Sept. 2017)
* Deprecated the old `CAN` module, please use the newer `can` entry point (will be removed in version 2.4)

Version 2.1.0 (2018-02-17)
=====

Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include *.txt
recursive-include doc *.rst
recursive-include doc *.rst
16 changes: 10 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
python-can
==========

|release| |docs| |build|
|release| |docs| |build_travis| |build_appveyor|

.. |release| image:: https://img.shields.io/pypi/v/python-can.svg
:target: https://pypi.python.org/pypi/python-can/
:alt: Latest Version
:alt: Latest Version on PyPi

.. |docs| image:: https://readthedocs.org/projects/python-can/badge/?version=stable
:target: https://python-can.readthedocs.io/en/stable/
:alt: Documentation Status
:alt: Documentation build Status

.. |build| image:: https://travis-ci.org/hardbyte/python-can.svg?branch=develop
.. |build_travis| image:: https://travis-ci.org/hardbyte/python-can.svg?branch=develop
:target: https://travis-ci.org/hardbyte/python-can/branches
:alt: CI Server for develop branch
:alt: Travis CI Server for develop branch

.. |build_appveyor| image:: https://ci.appveyor.com/api/projects/status/github/hardbyte/python-can?branch=develop&svg=true
:target: https://ci.appveyor.com/project/hardbyte/python-can/history
:alt: AppVeyor CI Server for develop branch


The **C**\ ontroller **A**\ rea **N**\ etwork is a bus standard designed
Expand All @@ -26,7 +30,7 @@ Python developers; providing `common abstractions to
different hardware devices`, and a suite of utilities for sending and receiving
messages on a can bus.

The library supports Python 2.7, Python 3.3+ as well as PyPy and runs on Mac, Linux and Windows.
The library supports Python 2.7, Python 3.4+ as well as PyPy 2 & 3 and runs on Mac, Linux and Windows.

You can find more information in the documentation, online at
`python-can.readthedocs.org <https://python-can.readthedocs.org/en/stable/>`__.
Expand Down
21 changes: 18 additions & 3 deletions can/CAN.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
#!/usr/bin/env python
# coding: utf-8

"""
This module was once the core of python-can, containing
implementations of all the major classes in the library, now
however all functionality has been refactored out. This api
is left intact for version 2.0 to aide with migration.
however all functionality has been refactored out. This API
is left intact for version 2.0 to 2.3 to aide with migration.

WARNING:
This module is deprecated an will get removed in version 2.4.
Please use `import can` instead.
"""

from __future__ import absolute_import

from can.message import Message
Expand All @@ -14,4 +22,11 @@
import logging

log = logging.getLogger('can')
log.info("Loading python-can via the old CAN api")

# See #267
# Version 2.0 - 2.1: Log a Debug message
# Version 2.2: Log a Warning
# Version 2.3: Log an Error
# Version 2.4: Remove the module
log.warning('Loading python-can via the old "CAN" API is deprecated since v2.0 an will get removed in v2.4. '
'Please use `import can` instead.')
38 changes: 23 additions & 15 deletions can/__init__.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,45 @@
#!/usr/bin/env python
# coding: utf-8

"""
can is an object-orient Controller Area Network interface module.
``can`` is an object-orient Controller Area Network (CAN) interface module.
"""

from __future__ import absolute_import

import logging

__version__ = "2.1.0"
__version__ = "2.2.0"

log = logging.getLogger('can')

rc = dict()


class CanError(IOError):
"""Indicates an error with the CAN network.

"""
pass

from can.listener import Listener, BufferedReader, RedirectReader
from .listener import Listener, BufferedReader, RedirectReader

from can.io import Logger, Printer, LogReader
from can.io import ASCWriter, ASCReader
from can.io import BLFReader, BLFWriter
from can.io import CanutilsLogReader, CanutilsLogWriter
from can.io import CSVWriter
from can.io import SqliteWriter, SqliteReader
from .io import Logger, Printer, LogReader, MessageSync
from .io import ASCWriter, ASCReader
from .io import BLFReader, BLFWriter
from .io import CanutilsLogReader, CanutilsLogWriter
from .io import CSVWriter, CSVReader
from .io import SqliteWriter, SqliteReader

from can.util import set_logging_level
from .util import set_logging_level

from can.message import Message
from can.bus import BusABC
from can.notifier import Notifier
from can.interfaces import VALID_INTERFACES
from .message import Message
from .bus import BusABC
from .thread_safe_bus import ThreadSafeBus
from .notifier import Notifier
from .interfaces import VALID_INTERFACES
from . import interface
from .interface import Bus
from .interface import Bus, detect_available_configs

from can.broadcastmanager import send_periodic, \
CyclicSendTaskABC, \
Expand Down
28 changes: 18 additions & 10 deletions can/broadcastmanager.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
#!/usr/bin/env python3
#!/usr/bin/env python
# coding: utf-8

"""
Exposes several methods for transmitting cyclic messages.
20/09/13

The main entry point to these classes should be through
:meth:`can.BusABC.send_periodic`.
"""

import can
import abc
import logging
import sched

import threading
import time


log = logging.getLogger('can.bcm')
log.debug("Loading base broadcast manager functionality")


class CyclicTask(object):
Expand All @@ -38,6 +41,7 @@ def __init__(self, message, period):
"""
self.message = message
self.can_id = message.arbitration_id
self.arbitration_id = message.arbitration_id
self.period = period
super(CyclicSendTaskABC, self).__init__()

Expand Down Expand Up @@ -72,7 +76,7 @@ def modify_data(self, message):
"""Update the contents of this periodically sent message without altering
the timing.

:param message: The :class:`~can.Message` with new :attr:`Message.data`.
:param message: The :class:`~can.Message` with new :attr:`can.Message.data`.
"""
self.message = message

Expand Down Expand Up @@ -130,9 +134,13 @@ def _run(self):
time.sleep(max(0.0, delay))


def send_periodic(bus, message, period):
"""
Send a message every `period` seconds on the given channel.
def send_periodic(bus, message, period, *args, **kwargs):
"""Send a message every `period` seconds on the given channel.

:param bus: The :class:`can.BusABC` to transmit to.
:param message: The :class:`can.Message` instance to periodically send
:return: A started task instance
"""
return can.interface.CyclicSendTask(bus, message, period)
log.warning("The function `can.send_periodic` is deprecated and will " +
"be removed in version 2.3. Please use `can.Bus.send_periodic` instead.")
return bus.send_periodic(message, period, *args, **kwargs)
Loading