Broadcast Manager

The broadcast manager isn’t yet supported by all interfaces. Currently SockerCAN and IXXAT are supported at least partially. It allows the user to setup periodic message jobs.

If periodic transmission is not supported natively, a software thread based scheduler is used as a fallback.

This example shows the socketcan_ctypes backend using the broadcast manager:

Class based API

class can.broadcastmanager.CyclicTask

Abstract Base for all Cyclic Tasks

stop()

Cancel this periodic task.

class can.broadcastmanager.CyclicSendTaskABC(message, period)

Message send task with defined period

class can.broadcastmanager.LimitedDurationCyclicSendTaskABC(message, period, duration)
class can.broadcastmanager.RestartableCyclicTaskABC(message, period)

Adds support for restarting a stopped cyclic task

start()

Restart a stopped periodic task.

class can.broadcastmanager.ModifiableCyclicTaskABC(message, period)

Adds support for modifying a periodic message

modify_data(message)

Update the contents of this periodically sent message without altering the timing.

Parameters:message – The Message with new can.Message.data.
class can.broadcastmanager.MultiRateCyclicSendTaskABC(channel, message, count, initial_period, subsequent_period)

Exposes more of the full power of the TX_SETUP opcode.

Transmits a message count times at initial_period then continues to transmit message at subsequent_period.

class can.broadcastmanager.ThreadBasedCyclicSendTask(bus, lock, message, period, duration=None)

Fallback cyclic send task using thread.

start()

Restart a stopped periodic task.

stop()

Cancel this periodic task.

Functional API

Note

The functional API in can.broadcastmanager.send_periodic() is now deprecated. Use the object oriented API via can.BusABC.send_periodic() instead.

can.broadcastmanager.send_periodic(bus, message, period, *args, **kwargs)

Send a message every period seconds on the given channel.

Parameters:
Returns:

A started task instance