@@ -27,6 +27,55 @@ The following assumes that the commands are executed from the root of the reposi
2727 makes Sphinx complain about more subtle problems.
2828
2929
30+ Creating a new interface/backend
31+ --------------------------------
32+
33+ These steps are a guideline on how to add a new backend to python-can.
34+
35+ - Create a module (either a ``*.py `` or an entire subdirctory depending
36+ on the complexity) inside ``can.interfaces ``
37+ - Implement the central part of the backend: the bus class that extends
38+ :class: `can.BusABC `. See below for more info on this one!
39+ - Register your backend bus class in ``can.interface.BACKENDS `` and
40+ ``can.interfaces.VALID_INTERFACES ``.
41+ - Add docs where appropiate, like in ``doc/interfaces.rst `` and add
42+ an entry in ``doc/interface/* ``.
43+ - Add tests in ``test/* `` where appropiate.
44+
45+ About the ``BusABC `` class
46+ ==========================
47+
48+ Concrete implementations *have to * implement the following:
49+ * :meth: `~can.BusABC.send ` to send individual messages
50+ * :meth: `~can.BusABC._recv_internal ` to receive individual messages
51+ (see note below)
52+ * set the :attr: `~can.BusABC.channel_info ` attribute to a string describing
53+ the underlying bus and/or channel
54+
55+ They *might * implement the following:
56+ * :meth: `~can.BusABC.flush_tx_buffer ` to allow discrading any
57+ messages yet to be sent
58+ * :meth: `~can.BusABC.shutdown ` to override how the bus should
59+ shut down
60+ * :meth: `~can.BusABC.send_periodic ` to override the software based
61+ periodic sending and push it down to the kernel or hardware
62+ * :meth: `~can.BusABC._apply_filters ` to apply efficient filters
63+ to lower level systems like the OS kernel or hardware
64+ * :meth: `~can.BusABC._detect_available_configs ` to allow the interface
65+ to report which configurations are currently available for new
66+ connections
67+ * :meth: `~can.BusABC.state ` property to allow reading and/or changing
68+ the bus state
69+
70+ .. note ::
71+
72+ Previously, concrete bus classes had to override :meth: `~can.BusABC.recv `
73+ directly instead of :meth: `~can.BusABC._recv_internal `, but that has
74+ changed to allow the abstract base class to handle in-software message
75+ filtering as a fallback. Older (custom) interfaces might still be
76+ implemented like that and thus might not provide message filtering.
77+
78+
3079Creating a Release
3180------------------
3281
@@ -41,7 +90,7 @@ Creating a Release
4190- Upload with twine ``twine upload dist/python-can-X.Y.Z* ``
4291- In a new virtual env check that the package can be installed with pip: ``pip install python-can==X.Y.Z ``
4392- Create a new tag in the repository.
44- - Check the release on PyPi, readthedocs and github .
93+ - Check the release on PyPi, Read the Docs and GitHub .
4594
4695
4796Code Structure
0 commit comments