--- /tmp/python-can-3.3.2.final~github-2fzkyqtpr/debian/python-can-doc_3.3.2.final~github-2_all.deb +++ python-can-doc_3.3.2.final~github-2_all.deb ├── file list │ @@ -1,3 +1,3 @@ │ -rw-r--r-- 0 0 0 4 2020-01-13 10:22:58.000000 debian-binary │ -rw-r--r-- 0 0 0 3616 2020-01-13 10:22:58.000000 control.tar.xz │ --rw-r--r-- 0 0 0 940860 2020-01-13 10:22:58.000000 data.tar.xz │ +-rw-r--r-- 0 0 0 940844 2020-01-13 10:22:58.000000 data.tar.xz ├── control.tar.xz │ ├── control.tar │ │ ├── ./md5sums │ │ │ ├── ./md5sums │ │ │ │┄ Files differ ├── data.tar.xz │ ├── data.tar │ │ ├── file list │ │ │ @@ -89,43 +89,43 @@ │ │ │ -rw-r--r-- 0 root (0) root (0) 307 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/_static/documentation_options.js │ │ │ -rw-r--r-- 0 root (0) root (0) 286 2019-03-09 14:07:37.000000 ./usr/share/doc/python-can-doc/html/_static/file.png │ │ │ -rw-r--r-- 0 root (0) root (0) 299 2019-03-09 14:07:37.000000 ./usr/share/doc/python-can-doc/html/_static/graphviz.css │ │ │ -rw-r--r-- 0 root (0) root (0) 10847 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/_static/language_data.js │ │ │ -rw-r--r-- 0 root (0) root (0) 90 2019-03-09 14:07:37.000000 ./usr/share/doc/python-can-doc/html/_static/minus.png │ │ │ -rw-r--r-- 0 root (0) root (0) 90 2019-03-09 14:07:37.000000 ./usr/share/doc/python-can-doc/html/_static/plus.png │ │ │ -rw-r--r-- 0 root (0) root (0) 4395 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/_static/pygments.css │ │ │ --rw-r--r-- 0 root (0) root (0) 15187 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/api.html │ │ │ --rw-r--r-- 0 root (0) root (0) 11771 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/asyncio.html │ │ │ --rw-r--r-- 0 root (0) root (0) 37218 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/bcm.html │ │ │ --rw-r--r-- 0 root (0) root (0) 31593 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/bus.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 15195 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/api.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 11772 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/asyncio.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 37228 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/bcm.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 31607 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/bus.html │ │ │ -rw-r--r-- 0 root (0) root (0) 17505 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/configuration.html │ │ │ -rw-r--r-- 0 root (0) root (0) 14575 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/development.html │ │ │ -rw-r--r-- 0 root (0) root (0) 27100 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/genindex.html │ │ │ -rw-r--r-- 0 root (0) root (0) 8008 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/history.html │ │ │ -rw-r--r-- 0 root (0) root (0) 15320 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/index.html │ │ │ -rw-r--r-- 0 root (0) root (0) 10248 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/installation.html │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/ │ │ │ -rw-r--r-- 0 root (0) root (0) 8936 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/canalystii.html │ │ │ --rw-r--r-- 0 root (0) root (0) 10119 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/iscan.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 10124 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/iscan.html │ │ │ -rw-r--r-- 0 root (0) root (0) 9434 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/ixxat.html │ │ │ --rw-r--r-- 0 root (0) root (0) 17879 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/kvaser.html │ │ │ --rw-r--r-- 0 root (0) root (0) 15038 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/neovi.html │ │ │ --rw-r--r-- 0 root (0) root (0) 13876 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/nican.html │ │ │ --rw-r--r-- 0 root (0) root (0) 19860 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/pcan.html │ │ │ --rw-r--r-- 0 root (0) root (0) 17216 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/serial.html │ │ │ --rw-r--r-- 0 root (0) root (0) 12545 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/slcan.html │ │ │ --rw-r--r-- 0 root (0) root (0) 31786 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/socketcan.html │ │ │ --rw-r--r-- 0 root (0) root (0) 20630 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/systec.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 17894 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/kvaser.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 15054 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/neovi.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 13880 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/nican.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 19876 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/pcan.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 17220 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/serial.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 12555 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/slcan.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 31795 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/socketcan.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 20644 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/systec.html │ │ │ -rw-r--r-- 0 root (0) root (0) 12238 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/usb2can.html │ │ │ --rw-r--r-- 0 root (0) root (0) 13853 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/vector.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 13863 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/vector.html │ │ │ -rw-r--r-- 0 root (0) root (0) 6899 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces/virtual.html │ │ │ -rw-r--r-- 0 root (0) root (0) 7745 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/interfaces.html │ │ │ --rw-r--r-- 0 root (0) root (0) 55330 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/internal-api.html │ │ │ --rw-r--r-- 0 root (0) root (0) 64689 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/listeners.html │ │ │ --rw-r--r-- 0 root (0) root (0) 30489 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/message.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 55365 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/internal-api.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 64704 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/listeners.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 30511 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/message.html │ │ │ -rw-r--r-- 0 root (0) root (0) 2112 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/objects.inv │ │ │ -rw-r--r-- 0 root (0) root (0) 4434 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/py-modindex.html │ │ │ -rw-r--r-- 0 root (0) root (0) 8216 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/scripts.html │ │ │ -rw-r--r-- 0 root (0) root (0) 3790 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/search.html │ │ │ -rw-r--r-- 0 root (0) root (0) 32946 2020-01-13 10:22:58.000000 ./usr/share/doc/python-can-doc/html/searchindex.js │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2020-01-13 10:22:58.000000 ./usr/share/doc-base/ │ │ │ -rw-r--r-- 0 root (0) root (0) 272 2020-01-13 10:22:58.000000 ./usr/share/doc-base/python-can-doc │ │ ├── ./usr/share/doc/python-can-doc/html/api.html │ │ │ @@ -70,31 +70,31 @@ │ │ │ │ │ │
│ │ │

Notifier

│ │ │

The Notifier object is used as a message distributor for a bus.

│ │ │
│ │ │
│ │ │ class can.Notifier(bus, listeners, timeout=1.0, loop=None)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Manages the distribution of can.Message instances to listeners.

│ │ │

Supports multiple buses and listeners.

│ │ │
│ │ │

Note

│ │ │

Remember to call stop() after all messages are received as │ │ │ many listeners carry out flush operations to persist data.

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │
  • bus (can.BusABC) – A Bus or a list of buses to listen to.
  • │ │ │ -
  • listeners (list) – An iterable of Listener
  • │ │ │ -
  • timeout (float) – An optional maximum number of seconds to wait for any message.
  • │ │ │ -
  • loop (asyncio.AbstractEventLoop) – An asyncio event loop to schedule listeners in.
  • │ │ │ +
  • listeners (list) – An iterable of Listener
  • │ │ │ +
  • timeout (float) – An optional maximum number of seconds to wait for any message.
  • │ │ │ +
  • loop (asyncio.AbstractEventLoop) – An asyncio event loop to schedule listeners in.
  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ @@ -142,45 +142,45 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Parameters:listener (can.Listener) – Listener to be removed from │ │ │ the list to be notified
Raises:ValueError – if listener was never added to this notifier
Raises:ValueError – if listener was never added to this notifier
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ stop(timeout=5)[source]
│ │ │

Stop notifying Listeners when new Message objects arrive │ │ │ and call stop() on each Listener.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ │ │ │ │ │
Parameters:timeout (float) – Max time in seconds to wait for receive threads to finish. │ │ │ +
Parameters:timeout (float) – Max time in seconds to wait for receive threads to finish. │ │ │ Should be longer than timeout given at instantiation.
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │

Errors

│ │ │
│ │ │
│ │ │ class can.CanError[source]
│ │ │ -

Bases: OSError

│ │ │ +

Bases: OSError

│ │ │

Indicates an error with the CAN network.

│ │ │
│ │ │ │ │ │
│ │ │ │ │ ├── ./usr/share/doc/python-can-doc/html/asyncio.html │ │ │ @@ -45,15 +45,15 @@ │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │

Asyncio support

│ │ │ -

The asyncio module built into Python 3.4 and later can be used to write │ │ │ +

The asyncio module built into Python 3.4 and later can be used to write │ │ │ asynchronous code in a single thread. This library supports receiving messages │ │ │ asynchronously in an event loop using the can.Notifier class.

│ │ │

There will still be one thread per CAN bus but the user application will execute │ │ │ entirely in the event loop, allowing simpler concurrency without worrying about │ │ │ threading issues. Interfaces that have a valid file descriptor will however be │ │ │ supported natively without a thread.

│ │ │

You can also use the can.AsyncBufferedReader listener if you prefer │ │ ├── ./usr/share/doc/python-can-doc/html/bcm.html │ │ │ @@ -330,15 +330,15 @@ │ │ │

The class based api for the broadcast manager uses a series of │ │ │ mixin classes. │ │ │ All mixins inherit from CyclicSendTaskABC │ │ │ which inherits from CyclicTask.

│ │ │
│ │ │
│ │ │ class can.broadcastmanager.CyclicTask[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

Abstract Base for all cyclic tasks.

│ │ │
│ │ │
│ │ │ stop()[source]
│ │ │

Cancel this periodic task.

│ │ │ │ │ │ │ │ │ @@ -359,15 +359,15 @@ │ │ │

Message send task with defined period

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │
  • message (can.Message) – The message to be sent periodically.
  • │ │ │ -
  • period (float) – The rate in seconds at which to send the message.
  • │ │ │ +
  • period (float) – The rate in seconds at which to send the message.
  • │ │ │
│ │ │
│ │ │
│ │ │ │ │ │ @@ -378,16 +378,16 @@ │ │ │

Message send task with a defined duration and period.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │
  • message (can.Message) – The message to be sent periodically.
  • │ │ │ -
  • period (float) – The rate in seconds at which to send the message.
  • │ │ │ -
  • duration (float) – The duration to keep sending this message at given rate.
  • │ │ │ +
  • period (float) – The rate in seconds at which to send the message.
  • │ │ │ +
  • duration (float) – The duration to keep sending this message at given rate.
  • │ │ │
│ │ │
│ │ │
│ │ │ │ │ │ @@ -401,17 +401,17 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │
  • channel – See interface specific documentation.
  • │ │ │
  • message (can.Message) –
  • │ │ │ -
  • count (int) –
  • │ │ │ -
  • initial_period (float) –
  • │ │ │ -
  • subsequent_period (float) –
  • │ │ │ +
  • count (int) –
  • │ │ │ +
  • initial_period (float) –
  • │ │ │ +
  • subsequent_period (float) –
  • │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ @@ -422,15 +422,15 @@ │ │ │

Adds support for modifying a periodic message

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │
  • message (can.Message) – The message to be sent periodically.
  • │ │ │ -
  • period (float) – The rate in seconds at which to send the message.
  • │ │ │ +
  • period (float) – The rate in seconds at which to send the message.
  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ @@ -457,15 +457,15 @@ │ │ │

Adds support for restarting a stopped cyclic task

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │
  • message (can.Message) – The message to be sent periodically.
  • │ │ │ -
  • period (float) – The rate in seconds at which to send the message.
  • │ │ │ +
  • period (float) – The rate in seconds at which to send the message.
  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ @@ -490,15 +490,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/python-can-doc/html/bus.html │ │ │ @@ -73,44 +73,44 @@ │ │ │ as it handles generic tasks like applying filters.

│ │ │
Parameters:
    │ │ │
  • bus (can.BusABC) – A CAN bus which supports sending.
  • │ │ │
  • message (can.Message) – Message to send periodically.
  • │ │ │ -
  • period (float) – The minimum time between sending messages.
  • │ │ │ +
  • period (float) – The minimum time between sending messages.
  • │ │ │
│ │ │
Returns:

A started task instance

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │
  • channel – The can interface identifier. Expected type is backend dependent.
  • │ │ │ -
  • can_filters (list) – See set_filters() for details.
  • │ │ │ -
  • kwargs (dict) – Any backend dependent configurations are passed in this dictionary
  • │ │ │ +
  • can_filters (list) – See set_filters() for details.
  • │ │ │ +
  • kwargs (dict) – Any backend dependent configurations are passed in this dictionary
  • │ │ │
│ │ │
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │

API

│ │ │
│ │ │
│ │ │ class can.BusABC(channel, can_filters=None, **kwargs)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

The CAN Bus Abstract Base Class that serves as the basis │ │ │ for all concrete interfaces.

│ │ │

This class may be used as an iterator over the received messages.

│ │ │

Construct and open a CAN bus instance of the specified type.

│ │ │

Subclasses should call though this method with all given parameters │ │ │ as it handles generic tasks like applying filters.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │
  • channel – The can interface identifier. Expected type is backend dependent.
  • │ │ │ -
  • can_filters (list) – See set_filters() for details.
  • │ │ │ -
  • kwargs (dict) – Any backend dependent configurations are passed in this dictionary
  • │ │ │ +
  • can_filters (list) – See set_filters() for details.
  • │ │ │ +
  • kwargs (dict) – Any backend dependent configurations are passed in this dictionary
  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ @@ -159,17 +159,17 @@ │ │ │
│ │ │ recv(timeout=None)[source]
│ │ │

Block waiting for a message from the Bus.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:timeout (float or None) – seconds to wait for a message or None to wait indefinitely
Parameters:timeout (float or None) – seconds to wait for a message or None to wait indefinitely
Return type:can.Message or None
Return type:can.Message or None
Returns:None on timeout or a can.Message object.
Raises:can.CanError – if an error occurred while reading
│ │ │ @@ -182,15 +182,15 @@ │ │ │

Override this method to enable the transmit path.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -215,18 +215,18 @@ │ │ │ │ │ │
Parameters:
    │ │ │
  • msg (can.Message) – A message object.
  • │ │ │ -
  • timeout (float or None) – If > 0, wait up to this many seconds for message to be ACK’ed or │ │ │ +
  • timeout (float or None) – If > 0, wait up to this many seconds for message to be ACK’ed or │ │ │ for transmit queue to be ready depending on driver implementation. │ │ │ If timeout is exceeded, an exception will be raised. │ │ │ Might not be supported by all interfaces. │ │ │ None blocks indefinitely.
  • │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -305,15 +305,15 @@ │ │ │
│ │ │ stop_all_periodic_tasks(remove_tasks=True)[source]
│ │ │

Stop sending any messages that were started using bus.send_periodic

│ │ │
Parameters:
    │ │ │
  • msg (can.Message) – Message to transmit
  • │ │ │ -
  • period (float) – Period in seconds between each message
  • │ │ │ -
  • duration (float) – The duration to keep sending this message at given rate. If │ │ │ +
  • period (float) – Period in seconds between each message
  • │ │ │ +
  • duration (float) – The duration to keep sending this message at given rate. If │ │ │ no duration is provided, the task will continue indefinitely.
  • │ │ │ -
  • store_task (bool) – If True (the default) the task will be attached to this Bus instance. │ │ │ +
  • store_task (bool) – If True (the default) the task will be attached to this Bus instance. │ │ │ Disable to instead manage tasks manually.
  • │ │ │
│ │ │
Returns:

A started task instance. Note the task can be stopped (and depending on │ │ │ the backend modified) by calling the stop() method.

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Parameters:remove_tasks (bool) – Stop tracking the stopped tasks.
Parameters:remove_tasks (bool) – Stop tracking the stopped tasks.
│ │ │
│ │ │ │ │ │
│ │ ├── ./usr/share/doc/python-can-doc/html/interfaces/iscan.html │ │ │ @@ -58,17 +58,17 @@ │ │ │

Bases: can.bus.BusABC

│ │ │

isCAN interface

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │ -
  • channel (int) – Device number
  • │ │ │ -
  • bitrate (int) – Bitrate in bits/s
  • │ │ │ -
  • poll_interval (float) – Poll interval in seconds when reading messages
  • │ │ │ +
  • channel (int) – Device number
  • │ │ │ +
  • bitrate (int) – Bitrate in bits/s
  • │ │ │ +
  • poll_interval (float) – Poll interval in seconds when reading messages
  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ @@ -77,15 +77,15 @@ │ │ │

Override this method to enable the transmit path.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/python-can-doc/html/interfaces/kvaser.html │ │ │ @@ -59,50 +59,50 @@ │ │ │

Bases: can.bus.BusABC

│ │ │

The CAN Bus implemented for the Kvaser interface.

│ │ │
Parameters:
    │ │ │
  • msg (can.Message) – A message object.
  • │ │ │ -
  • timeout (float or None) – If > 0, wait up to this many seconds for message to be ACK’ed or │ │ │ +
  • timeout (float or None) – If > 0, wait up to this many seconds for message to be ACK’ed or │ │ │ for transmit queue to be ready depending on driver implementation. │ │ │ If timeout is exceeded, an exception will be raised. │ │ │ Might not be supported by all interfaces. │ │ │ None blocks indefinitely.
  • │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters: │ │ │
│ │ │

Backend Configuration

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │ -
  • bitrate (int) – Bitrate of channel in bit/s
  • │ │ │ -
  • accept_virtual (bool) – If virtual channels should be accepted.
  • │ │ │ -
  • tseg1 (int) – Time segment 1, that is, the number of quanta from (but not including) │ │ │ +
  • bitrate (int) – Bitrate of channel in bit/s
  • │ │ │ +
  • accept_virtual (bool) – If virtual channels should be accepted.
  • │ │ │ +
  • tseg1 (int) – Time segment 1, that is, the number of quanta from (but not including) │ │ │ the Sync Segment to the sampling point. │ │ │ If this parameter is not given, the Kvaser driver will try to choose │ │ │ all bit timing parameters from a set of defaults.
  • │ │ │ -
  • tseg2 (int) – Time segment 2, that is, the number of quanta from the sampling │ │ │ +
  • tseg2 (int) – Time segment 2, that is, the number of quanta from the sampling │ │ │ point to the end of the bit.
  • │ │ │ -
  • sjw (int) – The Synchronization Jump Width. Decides the maximum number of time quanta │ │ │ +
  • sjw (int) – The Synchronization Jump Width. Decides the maximum number of time quanta │ │ │ that the controller can resynchronize every bit.
  • │ │ │ -
  • no_samp (int) – Either 1 or 3. Some CAN controllers can also sample each bit three times. │ │ │ +
  • no_samp (int) – Either 1 or 3. Some CAN controllers can also sample each bit three times. │ │ │ In this case, the bit will be sampled three quanta in a row, │ │ │ with the last sample being taken in the edge between TSEG1 and TSEG2. │ │ │ Three samples should only be used for relatively slow baudrates.
  • │ │ │ -
  • driver_mode (bool) – Silent or normal.
  • │ │ │ -
  • single_handle (bool) – Use one Kvaser CANLIB bus handle for both reading and writing. │ │ │ +
  • driver_mode (bool) – Silent or normal.
  • │ │ │ +
  • single_handle (bool) – Use one Kvaser CANLIB bus handle for both reading and writing. │ │ │ This can be set if reading and/or writing is done from one thread.
  • │ │ │ -
  • receive_own_messages (bool) – If messages transmitted should also be received back. │ │ │ +
  • receive_own_messages (bool) – If messages transmitted should also be received back. │ │ │ Only works if single_handle is also False. │ │ │ If you want to receive messages from other applications on the same │ │ │ computer, set this to True or set single_handle to True.
  • │ │ │ -
  • fd (bool) – If CAN-FD frames should be supported.
  • │ │ │ -
  • data_bitrate (int) – Which bitrate to use for data phase in CAN FD. │ │ │ +
  • fd (bool) – If CAN-FD frames should be supported.
  • │ │ │ +
  • data_bitrate (int) – Which bitrate to use for data phase in CAN FD. │ │ │ Defaults to arbitration bitrate.
  • │ │ │
│ │ │
│ │ │
│ │ │ @@ -125,15 +125,15 @@ │ │ │

Override this method to enable the transmit path.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/python-can-doc/html/interfaces/neovi.html │ │ │ @@ -96,27 +96,27 @@ │ │ │

The CAN Bus implemented for the python_ics interface │ │ │ https://github.com/intrepidcs/python_ics

│ │ │
Parameters:
    │ │ │
  • msg (can.Message) – A message object.
  • │ │ │ -
  • timeout (float or None) – If > 0, wait up to this many seconds for message to be ACK’ed or │ │ │ +
  • timeout (float or None) – If > 0, wait up to this many seconds for message to be ACK’ed or │ │ │ for transmit queue to be ready depending on driver implementation. │ │ │ If timeout is exceeded, an exception will be raised. │ │ │ Might not be supported by all interfaces. │ │ │ None blocks indefinitely.
  • │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │ -
  • channel (int or str or list(int) or list(str)) – The channel ids to create this bus with. │ │ │ +
  • channel (int or str or list(int) or list(str)) – The channel ids to create this bus with. │ │ │ Can also be a single integer, netid name or a comma separated │ │ │ string.
  • │ │ │ -
  • can_filters (list) – See can.BusABC.set_filters() for details.
  • │ │ │ -
  • receive_own_messages (bool) – If transmitted messages should also be received by this bus.
  • │ │ │ -
  • use_system_timestamp (bool) – Use system timestamp for can messages instead of the hardware time │ │ │ +
  • can_filters (list) – See can.BusABC.set_filters() for details.
  • │ │ │ +
  • receive_own_messages (bool) – If transmitted messages should also be received by this bus.
  • │ │ │ +
  • use_system_timestamp (bool) – Use system timestamp for can messages instead of the hardware time │ │ │ stamp
  • │ │ │ -
  • serial (str) – Serial to connect (optional, will use the first found if not │ │ │ +
  • serial (str) – Serial to connect (optional, will use the first found if not │ │ │ supplied)
  • │ │ │ -
  • bitrate (int) – Channel bitrate in bit/s. (optional, will enable the auto bitrate │ │ │ +
  • bitrate (int) – Channel bitrate in bit/s. (optional, will enable the auto bitrate │ │ │ feature if not supplied)
  • │ │ │ -
  • fd (bool) – If CAN-FD frames should be supported.
  • │ │ │ -
  • data_bitrate (int) – Which bitrate to use for data phase in CAN FD. │ │ │ +
  • fd (bool) – If CAN-FD frames should be supported.
  • │ │ │ +
  • data_bitrate (int) – Which bitrate to use for data phase in CAN FD. │ │ │ Defaults to arbitration bitrate.
  • │ │ │
  • override_library_name – Absolute path or relative path to the library including filename.
  • │ │ │
│ │ │
│ │ │ @@ -128,15 +128,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ Parameters:device – ics device │ │ │ │ │ │ Returns:ics device serial string │ │ │ │ │ │ -Return type:str │ │ │ +Return type:str │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ @@ -145,15 +145,15 @@ │ │ │

Override this method to enable the transmit path.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/python-can-doc/html/interfaces/nican.html │ │ │ @@ -74,18 +74,18 @@ │ │ │ does not work.

│ │ │ │ │ │
Parameters:
    │ │ │
  • msg (can.Message) – A message object.
  • │ │ │ -
  • timeout (float or None) – If > 0, wait up to this many seconds for message to be ACK’ed or │ │ │ +
  • timeout (float or None) – If > 0, wait up to this many seconds for message to be ACK’ed or │ │ │ for transmit queue to be ready depending on driver implementation. │ │ │ If timeout is exceeded, an exception will be raised. │ │ │ Might not be supported by all interfaces. │ │ │ None blocks indefinitely.
  • │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/python-can-doc/html/interfaces/pcan.html │ │ │ @@ -92,64 +92,64 @@ │ │ │ the PCAN interface includes the flash() │ │ │ and status() methods.

│ │ │
Parameters:
    │ │ │ -
  • channel (str) – Name of the object to open (e.g. ‘CAN0’)
  • │ │ │ -
  • bitrate (int) – Bitrate in bits/s
  • │ │ │ -
  • can_filters (list) – See can.BusABC.set_filters().
  • │ │ │ -
  • log_errors (bool) – If True, communication errors will appear as CAN messages with │ │ │ +
  • channel (str) – Name of the object to open (e.g. ‘CAN0’)
  • │ │ │ +
  • bitrate (int) – Bitrate in bits/s
  • │ │ │ +
  • can_filters (list) – See can.BusABC.set_filters().
  • │ │ │ +
  • log_errors (bool) – If True, communication errors will appear as CAN messages with │ │ │ is_error_frame set to True and arbitration_id will identify │ │ │ the error (default True)
  • │ │ │
│ │ │
Raises:

can.interfaces.nican.NicanError – If starting communication fails

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -175,15 +175,15 @@ │ │ │

Override this method to enable the transmit path.

│ │ │
Parameters:
    │ │ │ -
  • channel (str) – The can interface name. An example would be ‘PCAN_USBBUS1’ │ │ │ +
  • channel (str) – The can interface name. An example would be ‘PCAN_USBBUS1’ │ │ │ Default is ‘PCAN_USBBUS1’
  • │ │ │
  • state (can.bus.BusState) – BusState of the channel. │ │ │ Default is ACTIVE
  • │ │ │ -
  • bitrate (int) – Bitrate of channel in bit/s. │ │ │ +
  • bitrate (int) – Bitrate of channel in bit/s. │ │ │ Default is 500 kbit/s. │ │ │ Ignored if using CanFD.
  • │ │ │ -
  • fd (bool) – Should the Bus be initialized in CAN-FD mode.
  • │ │ │ -
  • f_clock (int) – Clock rate in Hz. │ │ │ +
  • fd (bool) – Should the Bus be initialized in CAN-FD mode.
  • │ │ │ +
  • f_clock (int) – Clock rate in Hz. │ │ │ Any of the following: │ │ │ 20000000, 24000000, 30000000, 40000000, 60000000, 80000000. │ │ │ Ignored if not using CAN-FD. │ │ │ Pass either f_clock or f_clock_mhz.
  • │ │ │ -
  • f_clock_mhz (int) – Clock rate in MHz. │ │ │ +
  • f_clock_mhz (int) – Clock rate in MHz. │ │ │ Any of the following: │ │ │ 20, 24, 30, 40, 60, 80. │ │ │ Ignored if not using CAN-FD. │ │ │ Pass either f_clock or f_clock_mhz.
  • │ │ │ -
  • nom_brp (int) – Clock prescaler for nominal time quantum. │ │ │ +
  • nom_brp (int) – Clock prescaler for nominal time quantum. │ │ │ In the range (1..1024) │ │ │ Ignored if not using CAN-FD.
  • │ │ │ -
  • nom_tseg1 (int) – Time segment 1 for nominal bit rate, │ │ │ +
  • nom_tseg1 (int) – Time segment 1 for nominal bit rate, │ │ │ that is, the number of quanta from (but not including) │ │ │ the Sync Segment to the sampling point. │ │ │ In the range (1..256). │ │ │ Ignored if not using CAN-FD.
  • │ │ │ -
  • nom_tseg2 (int) – Time segment 2 for nominal bit rate, │ │ │ +
  • nom_tseg2 (int) – Time segment 2 for nominal bit rate, │ │ │ that is, the number of quanta from the sampling │ │ │ point to the end of the bit. │ │ │ In the range (1..128). │ │ │ Ignored if not using CAN-FD.
  • │ │ │ -
  • nom_sjw (int) – Synchronization Jump Width for nominal bit rate. │ │ │ +
  • nom_sjw (int) – Synchronization Jump Width for nominal bit rate. │ │ │ Decides the maximum number of time quanta │ │ │ that the controller can resynchronize every bit. │ │ │ In the range (1..128). │ │ │ Ignored if not using CAN-FD.
  • │ │ │ -
  • data_brp (int) – Clock prescaler for fast data time quantum. │ │ │ +
  • data_brp (int) – Clock prescaler for fast data time quantum. │ │ │ In the range (1..1024) │ │ │ Ignored if not using CAN-FD.
  • │ │ │ -
  • data_tseg1 (int) – Time segment 1 for fast data bit rate, │ │ │ +
  • data_tseg1 (int) – Time segment 1 for fast data bit rate, │ │ │ that is, the number of quanta from (but not including) │ │ │ the Sync Segment to the sampling point. │ │ │ In the range (1..32). │ │ │ Ignored if not using CAN-FD.
  • │ │ │ -
  • data_tseg2 (int) – Time segment 2 for fast data bit rate, │ │ │ +
  • data_tseg2 (int) – Time segment 2 for fast data bit rate, │ │ │ that is, the number of quanta from the sampling │ │ │ point to the end of the bit. │ │ │ In the range (1..16). │ │ │ Ignored if not using CAN-FD.
  • │ │ │ -
  • data_sjw (int) – Synchronization Jump Width for fast data bit rate. │ │ │ +
  • data_sjw (int) – Synchronization Jump Width for fast data bit rate. │ │ │ Decides the maximum number of time quanta │ │ │ that the controller can resynchronize every bit. │ │ │ In the range (1..16). │ │ │ Ignored if not using CAN-FD.
  • │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -219,15 +219,15 @@ │ │ │
│ │ │ status()[source]
│ │ │

Query the PCAN bus status.

│ │ │
Parameters:
    │ │ │
  • msg (can.Message) – A message object.
  • │ │ │ -
  • timeout (float or None) – If > 0, wait up to this many seconds for message to be ACK’ed or │ │ │ +
  • timeout (float or None) – If > 0, wait up to this many seconds for message to be ACK’ed or │ │ │ for transmit queue to be ready depending on driver implementation. │ │ │ If timeout is exceeded, an exception will be raised. │ │ │ Might not be supported by all interfaces. │ │ │ None blocks indefinitely.
  • │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Return type:int
Return type:int
Returns:The status code. See values in basic.PCAN_ERROR_
│ │ │
│ │ ├── ./usr/share/doc/python-can-doc/html/interfaces/serial.html │ │ │ @@ -76,24 +76,24 @@ │ │ │ for some special semantics.

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │ -
  • channel (str) – The serial device to open. For example “/dev/ttyS1” or │ │ │ +
  • channel (str) – The serial device to open. For example “/dev/ttyS1” or │ │ │ “/dev/ttyUSB0” on Linux or “COM1” on Windows systems.
  • │ │ │ -
  • baudrate (int) –

    Baud rate of the serial device in bit/s (default 115200).

    │ │ │ +
  • baudrate (int) –

    Baud rate of the serial device in bit/s (default 115200).

    │ │ │
    │ │ │

    Warning

    │ │ │

    Some serial port implementations don’t care about the baudrate.

    │ │ │
    │ │ │
  • │ │ │ -
  • timeout (float) – Timeout for the serial device in seconds (default 0.1).
  • │ │ │ -
  • rtscts (bool) – turn hardware handshake (RTS/CTS) on and off
  • │ │ │ +
  • timeout (float) – Timeout for the serial device in seconds (default 0.1).
  • │ │ │ +
  • rtscts (bool) – turn hardware handshake (RTS/CTS) on and off
  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ ├── ./usr/share/doc/python-can-doc/html/interfaces/slcan.html │ │ │ @@ -70,26 +70,26 @@ │ │ │ class can.interfaces.slcan.slcanBus(channel, ttyBaudrate=115200, bitrate=None, btr=None, sleep_after_open=2, rtscts=False, **kwargs)[source]
│ │ │

Bases: can.bus.BusABC

│ │ │

slcan interface

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Raises:

ValueError – if both bitrate and btr are set

│ │ │ +
Raises:

ValueError – if both bitrate and btr are set

│ │ │
Parameters:
    │ │ │ -
  • channel (str) – port of underlying serial or usb device (e.g. /dev/ttyUSB0, COM8, …) │ │ │ +
  • channel (str) – port of underlying serial or usb device (e.g. /dev/ttyUSB0, COM8, …) │ │ │ Must not be empty.
  • │ │ │ -
  • ttyBaudrate (int) – baudrate of underlying serial or usb device
  • │ │ │ -
  • bitrate (int) – Bitrate in bit/s
  • │ │ │ -
  • btr (str) – BTR register value to set custom can speed
  • │ │ │ -
  • poll_interval (float) – Poll interval in seconds when reading messages
  • │ │ │ -
  • sleep_after_open (float) – Time to wait in seconds after opening serial connection
  • │ │ │ -
  • rtscts (bool) – turn hardware handshake (RTS/CTS) on and off
  • │ │ │ +
  • ttyBaudrate (int) – baudrate of underlying serial or usb device
  • │ │ │ +
  • bitrate (int) – Bitrate in bit/s
  • │ │ │ +
  • btr (str) – BTR register value to set custom can speed
  • │ │ │ +
  • poll_interval (float) – Poll interval in seconds when reading messages
  • │ │ │ +
  • sleep_after_open (float) – Time to wait in seconds after opening serial connection
  • │ │ │ +
  • rtscts (bool) – turn hardware handshake (RTS/CTS) on and off
  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ @@ -98,15 +98,15 @@ │ │ │

Override this method to enable the transmit path.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/python-can-doc/html/interfaces/socketcan.html │ │ │ @@ -228,16 +228,16 @@ │ │ │
Parameters:
    │ │ │
  • msg (can.Message) – A message object.
  • │ │ │ -
  • timeout (float or None) – If > 0, wait up to this many seconds for message to be ACK’ed or │ │ │ +
  • timeout (float or None) – If > 0, wait up to this many seconds for message to be ACK’ed or │ │ │ for transmit queue to be ready depending on driver implementation. │ │ │ If timeout is exceeded, an exception will be raised. │ │ │ Might not be supported by all interfaces. │ │ │ None blocks indefinitely.
  • │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │
  • bcm_socket – An open bcm socket on the desired CAN channel.
  • │ │ │
  • message (can.Message) – The message to be sent periodically.
  • │ │ │ -
  • period (float) – The rate in seconds at which to send the message.
  • │ │ │ -
  • duration (float) – Approximate duration in seconds to send the message.
  • │ │ │ +
  • period (float) – The rate in seconds at which to send the message.
  • │ │ │ +
  • duration (float) – Approximate duration in seconds to send the message.
  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ @@ -274,38 +274,38 @@ │ │ │

Bases: can.bus.BusABC

│ │ │

Implements can.BusABC._detect_available_configs().

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │ -
  • channel (str) – The can interface name with which to create this bus. An example channel │ │ │ +
  • channel (str) – The can interface name with which to create this bus. An example channel │ │ │ would be ‘vcan0’ or ‘can0’. │ │ │ An empty string ‘’ will receive messages from all channels. │ │ │ In that case any sent messages must be explicitly addressed to a │ │ │ channel using can.Message.channel.
  • │ │ │ -
  • receive_own_messages (bool) – If transmitted messages should also be received by this bus.
  • │ │ │ -
  • fd (bool) – If CAN-FD frames should be supported.
  • │ │ │ -
  • can_filters (list) – See can.BusABC.set_filters().
  • │ │ │ +
  • receive_own_messages (bool) – If transmitted messages should also be received by this bus.
  • │ │ │ +
  • fd (bool) – If CAN-FD frames should be supported.
  • │ │ │ +
  • can_filters (list) – See can.BusABC.set_filters().
  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ recv(timeout=None)
│ │ │

Block waiting for a message from the Bus.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:timeout (float) – seconds to wait for a message or None to wait indefinitely
Parameters:timeout (float) – seconds to wait for a message or None to wait indefinitely
Return type:can.Message or None
Return type:can.Message or None
Returns:None on timeout or a can.Message object.
Raises:can.CanError – if an error occurred while reading
│ │ │ @@ -317,15 +317,15 @@ │ │ │

Transmit a message to the CAN bus.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/python-can-doc/html/interfaces/systec.html │ │ │ @@ -80,46 +80,46 @@ │ │ │

Bases: can.bus.BusABC

│ │ │

The CAN Bus implemented for the SYSTEC interface.

│ │ │
Parameters:
    │ │ │
  • msg (can.Message) – A message object.
  • │ │ │ -
  • timeout (float) – Wait up to this many seconds for the transmit queue to be ready. │ │ │ +
  • timeout (float) – Wait up to this many seconds for the transmit queue to be ready. │ │ │ If not given, the call may fail immediately.
  • │ │ │
│ │ │
Raises:

can.CanError – if the message could not be written.

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters: │ │ │
│ │ │

Backend Configuration

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │ -
  • bitrate (int) – Channel bitrate in bit/s. │ │ │ +
  • bitrate (int) – Channel bitrate in bit/s. │ │ │ Default is 500000.
  • │ │ │ -
  • device_number (int) – The device number of the USB-CAN. │ │ │ +
  • device_number (int) – The device number of the USB-CAN. │ │ │ Valid values: 0 through 254. Special value 255 is reserved to detect the first connected device (should only │ │ │ be used, in case only one module is connected to the computer). │ │ │ Default is 255.
  • │ │ │
  • state (can.bus.BusState) – BusState of the channel. │ │ │ Default is ACTIVE.
  • │ │ │ -
  • receive_own_messages (bool) – If messages transmitted should also be received back. │ │ │ +
  • receive_own_messages (bool) – If messages transmitted should also be received back. │ │ │ Default is False.
  • │ │ │ -
  • rx_buffer_entries (int) – The maximum number of entries in the receive buffer. │ │ │ +
  • rx_buffer_entries (int) – The maximum number of entries in the receive buffer. │ │ │ Default is 4096.
  • │ │ │ -
  • tx_buffer_entries (int) – The maximum number of entries in the transmit buffer. │ │ │ +
  • tx_buffer_entries (int) – The maximum number of entries in the transmit buffer. │ │ │ Default is 4096.
  • │ │ │
│ │ │
Raises:
    │ │ │ -
  • ValueError – If invalid input parameter were passed.
  • │ │ │ +
  • ValueError – If invalid input parameter were passed.
  • │ │ │
  • can.CanError – If hardware or CAN interface initialization failed.
  • │ │ │
│ │ │
│ │ │
│ │ │ @@ -127,19 +127,19 @@ │ │ │ static create_filter(extended, from_id, to_id, rtr_only, rtr_too)[source]
│ │ │

Calculates AMR and ACR using CAN-ID as parameter.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -170,15 +170,15 @@ │ │ │ this channel will be deleted automatically for not blocking the other channel.

│ │ │
Parameters:
    │ │ │ -
  • extended (bool) – if True parameters from_id and to_id contains 29-bit CAN-ID
  • │ │ │ -
  • from_id (int) – first CAN-ID which should be received
  • │ │ │ -
  • to_id (int) – last CAN-ID which should be received
  • │ │ │ -
  • rtr_only (bool) – if True only RTR-Messages should be received, and rtr_too will be ignored
  • │ │ │ -
  • rtr_too (bool) – if True CAN data frames and RTR-Messages should be received
  • │ │ │ +
  • extended (bool) – if True parameters from_id and to_id contains 29-bit CAN-ID
  • │ │ │ +
  • from_id (int) – first CAN-ID which should be received
  • │ │ │ +
  • to_id (int) – last CAN-ID which should be received
  • │ │ │ +
  • rtr_only (bool) – if True only RTR-Messages should be received, and rtr_too will be ignored
  • │ │ │ +
  • rtr_too (bool) – if True CAN data frames and RTR-Messages should be received
  • │ │ │
│ │ │
Returns:

Returns list with one filter containing a “can_id”, a “can_mask” and “extended” key.

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/python-can-doc/html/interfaces/vector.html │ │ │ @@ -74,28 +74,28 @@ │ │ │

Bases: can.bus.BusABC

│ │ │

The CAN Bus implemented for the Vector interface.

│ │ │
Parameters:
    │ │ │
  • msg (can.Message) – The CAN message.
  • │ │ │ -
  • timeout (float) – Transmit timeout in seconds (value 0 switches off the “auto delete”)
  • │ │ │ +
  • timeout (float) – Transmit timeout in seconds (value 0 switches off the “auto delete”)
  • │ │ │
│ │ │
Raises:

can.CanError – If the message could not be sent.

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │ -
  • channel (list) – The channel indexes to create this bus with. │ │ │ +
  • channel (list) – The channel indexes to create this bus with. │ │ │ Can also be a single integer or a comma separated string.
  • │ │ │ -
  • poll_interval (float) – Poll interval in seconds.
  • │ │ │ -
  • bitrate (int) – Bitrate in bits/s.
  • │ │ │ -
  • rx_queue_size (int) – Number of messages in receive queue (power of 2). │ │ │ +
  • poll_interval (float) – Poll interval in seconds.
  • │ │ │ +
  • bitrate (int) – Bitrate in bits/s.
  • │ │ │ +
  • rx_queue_size (int) – Number of messages in receive queue (power of 2). │ │ │ CAN: range 16…32768 │ │ │ CAN-FD: range 8192…524288
  • │ │ │ -
  • app_name (str) – Name of application in Hardware Config. │ │ │ +
  • app_name (str) – Name of application in Hardware Config. │ │ │ If set to None, the channel should be a global channel index.
  • │ │ │ -
  • serial (int) – Serial number of the hardware to be used. │ │ │ +
  • serial (int) – Serial number of the hardware to be used. │ │ │ If set, the channel parameter refers to the channels ONLY on the specified hardware. │ │ │ If set, the app_name is unused.
  • │ │ │ -
  • fd (bool) – If CAN-FD frames should be supported.
  • │ │ │ -
  • data_bitrate (int) – Which bitrate to use for data phase in CAN FD. │ │ │ +
  • fd (bool) – If CAN-FD frames should be supported.
  • │ │ │ +
  • data_bitrate (int) – Which bitrate to use for data phase in CAN FD. │ │ │ Defaults to arbitration bitrate.
  • │ │ │
│ │ │
│ │ │
│ │ │ @@ -111,15 +111,15 @@ │ │ │

Override this method to enable the transmit path.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/python-can-doc/html/internal-api.html │ │ │ @@ -99,29 +99,29 @@ │ │ │

Several methods are not documented in the main can.BusABC │ │ │ as they are primarily useful for library developers as opposed to │ │ │ library users. This is the entire ABC bus class with all internal │ │ │ methods:

│ │ │
│ │ │
│ │ │ class can.BusABC(channel, can_filters=None, **kwargs)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

The CAN Bus Abstract Base Class that serves as the basis │ │ │ for all concrete interfaces.

│ │ │

This class may be used as an iterator over the received messages.

│ │ │

Construct and open a CAN bus instance of the specified type.

│ │ │

Subclasses should call though this method with all given parameters │ │ │ as it handles generic tasks like applying filters.

│ │ │
Parameters:
    │ │ │
  • msg (can.Message) – A message object.
  • │ │ │ -
  • timeout (float or None) – If > 0, wait up to this many seconds for message to be ACK’ed or │ │ │ +
  • timeout (float or None) – If > 0, wait up to this many seconds for message to be ACK’ed or │ │ │ for transmit queue to be ready depending on driver implementation. │ │ │ If timeout is exceeded, an exception will be raised. │ │ │ Might not be supported by all interfaces. │ │ │ None blocks indefinitely.
  • │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │
  • channel – The can interface identifier. Expected type is backend dependent.
  • │ │ │ -
  • can_filters (list) – See set_filters() for details.
  • │ │ │ -
  • kwargs (dict) – Any backend dependent configurations are passed in this dictionary
  • │ │ │ +
  • can_filters (list) – See set_filters() for details.
  • │ │ │ +
  • kwargs (dict) – Any backend dependent configurations are passed in this dictionary
  • │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ @@ -137,16 +137,16 @@ │ │ │ as it handles generic tasks like applying filters.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │
  • channel – The can interface identifier. Expected type is backend dependent.
  • │ │ │ -
  • can_filters (list) – See set_filters() for details.
  • │ │ │ -
  • kwargs (dict) – Any backend dependent configurations are passed in this dictionary
  • │ │ │ +
  • can_filters (list) – See set_filters() for details.
  • │ │ │ +
  • kwargs (dict) – Any backend dependent configurations are passed in this dictionary
  • │ │ │
│ │ │
│ │ │
│ │ │ │ │ │ @@ -167,15 +167,15 @@ │ │ │ │ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ __metaclass__
│ │ │ -

alias of abc.ABCMeta

│ │ │ +

alias of abc.ABCMeta

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ __str__()[source]
│ │ │

Return str(self).

│ │ │
│ │ │ @@ -191,15 +191,15 @@ │ │ │ _apply_filters(filters)[source] │ │ │

Hook for applying the filters to the underlying kernel or │ │ │ hardware if supported/implemented by the interface.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Parameters:filters (Iterator[dict]) – See set_filters() for details.
Parameters:filters (Iterator[dict]) – See set_filters() for details.
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ @@ -208,15 +208,15 @@ │ │ │ currently connect with.

│ │ │

This might be quite time consuming.

│ │ │

May not to be implemented by every interface on every platform.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Return type:Iterator[dict]
Return type:Iterator[dict]
Returns:an iterable of dicts, each being a configuration suitable │ │ │ for usage in the interface’s bus constructor.
│ │ │
│ │ │ @@ -230,15 +230,15 @@ │ │ │

This method should not be overridden.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:msg (can.Message) – the message to check if matching
Return type:bool
Return type:bool
Returns:whether the given message matches at least one filter
│ │ │ │ │ │ │ │ │ @@ -266,32 +266,32 @@ │ │ │ change over time for some interfaces, like for example in the │ │ │ Kvaser interface. Thus it cannot be simplified to a constant value.

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ │ │ - │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:

timeout (float) – seconds to wait for a message, │ │ │ +

Parameters:

timeout (float) – seconds to wait for a message, │ │ │ see send()

│ │ │
Return type:

tuple[can.Message, bool] or tuple[None, bool]

│ │ │ +
Return type:

tuple[can.Message, bool] or tuple[None, bool]

│ │ │
Returns:

    │ │ │
  1. a message that was read or None on timeout
  2. │ │ │
  3. a bool that is True if message filtering has already │ │ │ been done and else False
  4. │ │ │
│ │ │

│ │ │
Raises: │ │ │
│ │ │ │ │ │ @@ -303,16 +303,16 @@ │ │ │

Override this method to enable a more efficient backend specific approach.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -347,17 +347,17 @@ │ │ │
│ │ │ recv(timeout=None)[source]
│ │ │

Block waiting for a message from the Bus.

│ │ │
Parameters:
    │ │ │
  • msg (can.Message) – Message to transmit
  • │ │ │ -
  • period (float) – Period in seconds between each message
  • │ │ │ -
  • duration (float) – The duration to keep sending this message at given rate. If │ │ │ +
  • period (float) – Period in seconds between each message
  • │ │ │ +
  • duration (float) – The duration to keep sending this message at given rate. If │ │ │ no duration is provided, the task will continue indefinitely.
  • │ │ │
│ │ │
Returns:

A started task instance. Note the task can be stopped (and depending on │ │ │ the backend modified) by calling the stop() method.

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:timeout (float or None) – seconds to wait for a message or None to wait indefinitely
Parameters:timeout (float or None) – seconds to wait for a message or None to wait indefinitely
Return type:can.Message or None
Return type:can.Message or None
Returns:None on timeout or a can.Message object.
Raises:can.CanError – if an error occurred while reading
│ │ │ @@ -370,15 +370,15 @@ │ │ │

Override this method to enable the transmit path.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -403,18 +403,18 @@ │ │ │ │ │ │
Parameters:
    │ │ │
  • msg (can.Message) – A message object.
  • │ │ │ -
  • timeout (float or None) – If > 0, wait up to this many seconds for message to be ACK’ed or │ │ │ +
  • timeout (float or None) – If > 0, wait up to this many seconds for message to be ACK’ed or │ │ │ for transmit queue to be ready depending on driver implementation. │ │ │ If timeout is exceeded, an exception will be raised. │ │ │ Might not be supported by all interfaces. │ │ │ None blocks indefinitely.
  • │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -493,15 +493,15 @@ │ │ │
│ │ │ stop_all_periodic_tasks(remove_tasks=True)[source]
│ │ │

Stop sending any messages that were started using bus.send_periodic

│ │ │
Parameters:
    │ │ │
  • msg (can.Message) – Message to transmit
  • │ │ │ -
  • period (float) – Period in seconds between each message
  • │ │ │ -
  • duration (float) – The duration to keep sending this message at given rate. If │ │ │ +
  • period (float) – Period in seconds between each message
  • │ │ │ +
  • duration (float) – The duration to keep sending this message at given rate. If │ │ │ no duration is provided, the task will continue indefinitely.
  • │ │ │ -
  • store_task (bool) – If True (the default) the task will be attached to this Bus instance. │ │ │ +
  • store_task (bool) – If True (the default) the task will be attached to this Bus instance. │ │ │ Disable to instead manage tasks manually.
  • │ │ │
│ │ │
Returns:

A started task instance. Note the task can be stopped (and depending on │ │ │ the backend modified) by calling the stop() method.

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Parameters:remove_tasks (bool) – Stop tracking the stopped tasks.
Parameters:remove_tasks (bool) – Stop tracking the stopped tasks.
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -539,31 +539,31 @@ │ │ │
│ │ │
│ │ │

IO Utilities

│ │ │

Contains a generic class for file IO.

│ │ │
│ │ │
│ │ │ class can.io.generic.BaseIOHandler(file, mode='rt')[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

A generic file handler that can be used for reading and writing.

│ │ │

Can be used as a context manager.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Attr file-like file:
 

the file-like object that is kept internally, or None if none │ │ │ was opened

│ │ │
Parameters:
    │ │ │
  • file – a path-like object to open a file, a file-like object │ │ │ to be used as a file or None to not use a file at all
  • │ │ │ -
  • mode (str) – the mode that should be used to open the file, see │ │ │ -open(), ignored if file is None
  • │ │ │ +
  • mode (str) – the mode that should be used to open the file, see │ │ │ +open(), ignored if file is None
  • │ │ │
│ │ │
│ │ │
│ │ │ │ │ │ @@ -580,51 +580,51 @@ │ │ │ │ │ │ │ │ │ │ │ │ Parameters:channel – Channel string (e.g. can0, CAN1) or integer │ │ │ │ │ │ Returns:Channel integer or None if unsuccessful │ │ │ │ │ │ -Return type:int │ │ │ +Return type:int │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ can.util.dlc2len(dlc)[source]
│ │ │

Calculate the data length from DLC.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Parameters:dlc (int) – DLC (0-15)
Parameters:dlc (int) – DLC (0-15)
Returns:Data length in number of bytes (0-64)
Return type:int
Return type:int
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ can.util.len2dlc(length)[source]
│ │ │

Calculate the DLC from data length.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Parameters:length (int) – Length in number of bytes (0-64)
Parameters:length (int) – Length in number of bytes (0-64)
Returns:DLC (0-15)
Return type:int
Return type:int
│ │ │
│ │ │ │ │ │
│ │ │
│ │ ├── ./usr/share/doc/python-can-doc/html/listeners.html │ │ │ @@ -54,20 +54,20 @@ │ │ │

The Listener class is an “abstract” base class for any objects which wish to │ │ │ register to receive notifications of new messages on the bus. A Listener can │ │ │ be used in two ways; the default is to call the Listener with a new │ │ │ message, or by calling the method on_message_received.

│ │ │

Listeners are registered with Notifier object(s) which ensure they are │ │ │ notified whenever a new message is received.

│ │ │

Subclasses of Listener that do not override on_message_received will cause │ │ │ -NotImplementedError to be thrown when a message is received on │ │ │ +NotImplementedError to be thrown when a message is received on │ │ │ the CAN bus.

│ │ │
│ │ │
│ │ │ class can.Listener[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

The basic listener that can be called directly to handle some │ │ │ CAN message:

│ │ │
listener = SomeListener()
│ │ │  msg = my_bus.recv()
│ │ │  
│ │ │  # now either call
│ │ │  listener(msg)
│ │ │ @@ -82,15 +82,15 @@
│ │ │  
│ │ │ on_error(exc)[source]
│ │ │

This method is called to handle any exception in the receive thread.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Parameters:exc (Exception) – The exception causing the thread to stop
Parameters:exc (Exception) – The exception causing the thread to stop
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ @@ -156,15 +156,15 @@ │ │ │ available it blocks for given timeout or until a message is received, or else │ │ │ returns None (whichever is shorter). This method does not block after │ │ │ can.BufferedReader.stop() has been called.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:timeout (float) – The number of seconds to wait for a new message.
Parameters:timeout (float) – The number of seconds to wait for a new message.
Rytpe:can.Message or None
Returns:the message if there is one, or None if there is not.
│ │ │ @@ -193,15 +193,15 @@ │ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ class can.AsyncBufferedReader(loop=None)[source]
│ │ │

Bases: can.listener.Listener

│ │ │ -

A message buffer for use with asyncio.

│ │ │ +

A message buffer for use with asyncio.

│ │ │

See Asyncio support for how to use with can.Notifier.

│ │ │

Can also be used as an asynchronous iterator:

│ │ │
async for msg in reader:
│ │ │      print(msg)
│ │ │  
│ │ │
│ │ │
│ │ │ @@ -263,16 +263,16 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │
  • file – a path-like object to open a file, a file-like object │ │ │ to be used as a file or None to not use a file at all
  • │ │ │ -
  • mode (str) – the mode that should be used to open the file, see │ │ │ -open(), ignored if file is None
  • │ │ │ +
  • mode (str) – the mode that should be used to open the file, see │ │ │ +open(), ignored if file is None
  • │ │ │
│ │ │
│ │ │
│ │ │ │ │ │ @@ -375,15 +375,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ Parameters:
    │ │ │
  • file – a path-like object or a file-like object to write to. │ │ │ If this is a file-like object, is has to open in text │ │ │ write mode, not binary write mode.
  • │ │ │ -
  • append (bool) – if set to True messages are appended to │ │ │ +
  • append (bool) – if set to True messages are appended to │ │ │ the file and no header line is written, else │ │ │ the file is truncated and starts with a newly │ │ │ written header line
  • │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ @@ -476,15 +476,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │
  • file – a str or since Python 3.7 a path like object that points │ │ │ to the database file to use
  • │ │ │ -
  • table_name (str) – the name of the table to store messages in
  • │ │ │ +
  • table_name (str) – the name of the table to store messages in
  • │ │ │
│ │ │
│ │ │
│ │ │

Warning

│ │ │ @@ -542,15 +542,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │
  • file – a str or since Python 3.7 a path like object that points │ │ │ to the database file to use
  • │ │ │ -
  • table_name (str) – the name of the table to look for the messages
  • │ │ │ +
  • table_name (str) – the name of the table to look for the messages
  • │ │ │
│ │ │
│ │ │
│ │ │

Warning

│ │ │ @@ -667,16 +667,16 @@ │ │ │ log_event(message, timestamp=None)[source]
│ │ │

Add a message to the log file.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │ -
  • message (str) – an arbitrary message
  • │ │ │ -
  • timestamp (float) – the absolute timestamp of the event
  • │ │ │ +
  • message (str) – an arbitrary message
  • │ │ │ +
  • timestamp (float) – the absolute timestamp of the event
  • │ │ │
│ │ │
│ │ │
│ │ │ │ │ │ @@ -748,15 +748,15 @@ │ │ │ │ │ │ Parameters:
    │ │ │
  • file – a path-like object or as file-like object to write to │ │ │ If this is a file-like object, is has to opened in text │ │ │ write mode, not binary write mode.
  • │ │ │
  • channel – a default channel to use when the message does not │ │ │ have a channel set
  • │ │ │ -
  • append (bool) – if set to True messages are appended to │ │ │ +
  • append (bool) – if set to True messages are appended to │ │ │ the file, else the file is truncated
  • │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ @@ -840,16 +840,16 @@ │ │ │ log_event(text, timestamp=None)[source] │ │ │

Add an arbitrary message to the log file as a global marker.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │ -
  • text (str) – The group name of the marker.
  • │ │ │ -
  • timestamp (float) – Absolute timestamp in Unix timestamp format. If not given, the │ │ │ +
  • text (str) – The group name of the marker.
  • │ │ │ +
  • timestamp (float) – Absolute timestamp in Unix timestamp format. If not given, the │ │ │ marker will be placed along the last message.
  • │ │ │
│ │ │
│ │ │
│ │ ├── ./usr/share/doc/python-can-doc/html/message.html │ │ │ @@ -48,38 +48,38 @@ │ │ │
│ │ │ │ │ │
│ │ │

Message

│ │ │
│ │ │
│ │ │ class can.Message(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=None, check=False)[source]
│ │ │ -

Bases: object

│ │ │ +

Bases: object

│ │ │

The Message object is used to represent CAN messages for │ │ │ sending, receiving and other purposes like converting between different │ │ │ logging formats.

│ │ │

Messages can use extended identifiers, be remote or error frames, contain │ │ │ data and may be associated to a channel.

│ │ │

Messages are always compared by identity and never by value, because that │ │ │ may introduce unexpected behaviour. See also equals().

│ │ │ -

copy()/deepcopy() is supported as well.

│ │ │ +

copy()/deepcopy() is supported as well.

│ │ │

Messages do not support “dynamic” attributes, meaning any others than the │ │ │ documented ones, since it uses __slots__.

│ │ │

To create a message object, simply provide any of the below attributes │ │ │ together with additional parameters as keyword arguments to the constructor.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Parameters:check (bool) – By default, the constructor of this class does not strictly check the input. │ │ │ +
Parameters:check (bool) – By default, the constructor of this class does not strictly check the input. │ │ │ Thus, the caller must prevent the creation of invalid messages or │ │ │ set this parameter to True, to raise an Error on invalid inputs. │ │ │ Possible problems include the dlc field not matching the length of data │ │ │ or creating a message with both is_remote_frame and is_error_frame set to True.
Raises:ValueError – iff check is set to True and one or more arguments were invalid
Raises:ValueError – iff check is set to True and one or more arguments were invalid
│ │ │

One can instantiate a Message defining data, and optional │ │ │ arguments for all attributes such as arbitration ID, flags, and timestamp.

│ │ │
>>> from can import Message
│ │ │  >>> test = Message(data=[1, 2, 3, 4, 5])
│ │ │ @@ -98,15 +98,15 @@
│ │ │  
│ │ │
│ │ │ timestamp
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Type:float
Type:float
│ │ │

The timestamp field in a CAN message is a floating point number representing when │ │ │ the message was received since the epoch in seconds. Where possible this will be │ │ │ timestamped in hardware.

│ │ │
│ │ │ @@ -114,15 +114,15 @@ │ │ │
│ │ │
│ │ │ arbitration_id
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Type:int
Type:int
│ │ │

The frame identifier used for arbitration on the bus.

│ │ │

The arbitration ID can take an int between 0 and the │ │ │ maximum value allowed depending on the is_extended_id flag │ │ │ (either 211 - 1 for 11-bit IDs, or │ │ │ @@ -136,15 +136,15 @@ │ │ │

│ │ │
│ │ │ data
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Type:bytearray
Type:bytearray
│ │ │

The data parameter of a CAN message is exposed as a bytearray │ │ │ with length between 0 and 8.

│ │ │
>>> example_data = bytearray([1, 2, 3])
│ │ │  >>> print(Message(data=example_data))
│ │ │ @@ -165,15 +165,15 @@
│ │ │  
│ │ │
│ │ │ dlc
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Type:int
Type:int
│ │ │

The DLC parameter of a CAN message is an integer │ │ │ between 0 and 8 representing the frame payload length.

│ │ │

In the case of a CAN FD message, this indicates the data length in │ │ │ number of bytes.

│ │ │ @@ -195,29 +195,29 @@ │ │ │
│ │ │
│ │ │ channel
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Type:str or int or None
Type:str or int or None
│ │ │

This might store the channel from which the message came.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ is_extended_id
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Type:bool
Type:bool
│ │ │

This flag controls the size of the arbitration_id field. │ │ │ Previously this was exposed as id_type.

│ │ │
>>> print(Message(is_extended_id=False))
│ │ │  Timestamp:        0.000000        ID: 0000    S        DLC: 0
│ │ │ @@ -235,15 +235,15 @@
│ │ │  
│ │ │
│ │ │ is_error_frame
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Type:bool
Type:bool
│ │ │

This boolean parameter indicates if the message is an error frame or not.

│ │ │
>>> print(Message(is_error_frame=True))
│ │ │  Timestamp:        0.000000    ID: 00000000    X E      DLC: 0
│ │ │  
│ │ │ @@ -253,15 +253,15 @@ │ │ │
│ │ │
│ │ │ is_remote_frame
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Type:bool
Type:bool
│ │ │

This boolean attribute indicates if the message is a remote frame or a data frame, and │ │ │ modifies the bit in the CAN message’s flags field indicating this.

│ │ │
>>> print(Message(is_remote_frame=True))
│ │ │  Timestamp:        0.000000    ID: 00000000    X   R    DLC: 0
│ │ │ @@ -272,44 +272,44 @@
│ │ │  
│ │ │
│ │ │ is_fd
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Type:bool
Type:bool
│ │ │

Indicates that this message is a CAN FD message.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ bitrate_switch
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Type:bool
Type:bool
│ │ │

If this is a CAN FD message, this indicates that a higher bitrate │ │ │ was used for the data transmission.

│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ error_state_indicator
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ │ │ │
Type:bool
Type:bool
│ │ │

If this is a CAN FD message, this indicates an error active state.

│ │ │
│ │ │ │ │ │
│ │ │ @@ -352,20 +352,20 @@ │ │ │

Compares a given message with this one.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Parameters:
    │ │ │
  • other (can.Message) – the message to compare with
  • │ │ │ -
  • timestamp_delta (float or int or None) – the maximum difference at which two timestamps are │ │ │ +
  • timestamp_delta (float or int or None) – the maximum difference at which two timestamps are │ │ │ still considered equal or None to not compare timestamps
  • │ │ │
│ │ │
Return type:

bool

│ │ │ +
Return type:

bool

│ │ │
Returns:

True iff the given message equals this one

│ │ │