Skip to content

Commit addf99f

Browse files
Small update to docs
1 parent 1f8aaa9 commit addf99f

8 files changed

Lines changed: 73 additions & 51 deletions

File tree

can/bus.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ def send(self, msg, timeout=None):
5656
"""Transmit a message to CAN bus.
5757
Override this method to enable the transmit path.
5858
59-
:param msg: A :class:`can.Message` object.
59+
:param can.Message msg: A message object.
6060
:param float timeout:
61-
If > 0, wait up to this many seconds for message to be ACK:ed.
61+
If > 0, wait up to this many seconds for message to be ACK:ed or
62+
for transmit queue to be ready depending on driver implementation.
6263
If timeout is exceeded, an exception will be raised.
6364
Might not be supported by all interfaces.
6465

can/logger.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424

2525

2626
def main():
27-
parser = argparse.ArgumentParser(description="Log CAN traffic, printing messages to stdout or to a given file")
27+
parser = argparse.ArgumentParser(
28+
"python -m can.logger",
29+
description="Log CAN traffic, printing messages to stdout or to a given file")
2830

2931
parser.add_argument("-f", "--file_name", dest="log_file",
3032
help="""Path and base log filename, extension can be .txt, .asc, .csv, .db, .npz""",

can/player.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414

1515

1616
def main():
17-
parser = argparse.ArgumentParser(description="Replay CAN traffic")
17+
parser = argparse.ArgumentParser(
18+
"python -m can.player",
19+
description="Replay CAN traffic")
1820

1921
parser.add_argument("-f", "--file_name", dest="log_file",
2022
help="""Path and base log filename, extension can be .txt, .asc, .csv, .db, .npz""",

can/server.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99

1010
def main():
11-
parser = argparse.ArgumentParser(description="Remote CAN server")
11+
parser = argparse.ArgumentParser(
12+
"python -m can.server",
13+
description="Remote CAN server")
1214

1315
parser.add_argument('-v', action='count', dest="verbosity",
1416
help='''How much information do you want to see at the command line?

doc/bcm.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
Broadcast Manager
33
=================
44

5-
The broadcast manager isn't yet supported by all interfaces. It allows the user
6-
to setup periodic message jobs.
5+
The broadcast manager isn't yet supported by all interfaces.
6+
Currently SockerCAN and IXXAT are supported at least partially.
7+
It allows the user to setup periodic message jobs.
8+
9+
If periodic transmission is not supported natively, a software thread based
10+
scheduler is used as a fallback.
711

812
This example shows the ctypes socketcan using the broadcast manager:
913

doc/bin.rst

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ can.logger
88

99
Command line help (``python -m can.logger --help``)::
1010

11-
usage: canlogger [-h] [-f LOG_FILE] [-v] [-c CHANNEL]
12-
[-i {pcan,remote,ixxat,socketcan_ctypes,virtual,usb2can,nican,serial,kvaser,socketcan,socketcan_native}]
13-
[--filter ...]
11+
usage: python -m can.logger [-h] [-f LOG_FILE] [-v] [-c CHANNEL]
12+
[-i {iscan,slcan,virtual,socketcan_ctypes,usb2can,ixxat,socketcan_native,kvaser,neovi,vector,nican,pcan,serial,remote,socketcan}]
13+
[--filter ...] [-b BITRATE]
1414

1515
Log CAN traffic, printing messages to stdout or to a given file
1616

@@ -27,30 +27,33 @@ Command line help (``python -m can.logger --help``)::
2727
might be a rfcomm device: "/dev/rfcomm0" With the
2828
socketcan interfaces valid channel examples include:
2929
"can0", "vcan0"
30-
-i {pcan,remote,ixxat,socketcan_ctypes,virtual,usb2can,nican,serial,kvaser,socketcan,socketcan_native}, --interface {pcan,remote,ixxat,socketcan_ctypes,virtual,usb2can,nican,serial,kvaser,socketcan,socketcan_native}
30+
-i {iscan,slcan,virtual,socketcan_ctypes,usb2can,ixxat,socketcan_native,kvaser,neovi,vector,nican,pcan,serial,remote,socketcan}, --interface {iscan,slcan,virtual,socketcan_ctypes,usb2can,ixxat,socketcan_native,kvaser,neovi,vector,nican,pcan,serial,remote,socketcan}
3131
Specify the backend CAN interface to use. If left
3232
blank, fall back to reading from configuration files.
3333
--filter ... Comma separated filters can be specified for the given
3434
CAN interface: <can_id>:<can_mask> (matches when
3535
<received_can_id> & mask == can_id & mask)
3636
<can_id>~<can_mask> (matches when <received_can_id> &
3737
mask != can_id & mask)
38+
-b BITRATE, --bitrate BITRATE
39+
Bitrate to use for the CAN bus.
3840

3941

4042
can.player
4143
----------
4244

4345
Command line help (``python -m can.player --help``)::
4446

45-
usage: canplayer [-h] [-f LOG_FILE] [-v] [-c CHANNEL]
46-
[-i {pcan,remote,ixxat,socketcan_ctypes,virtual,usb2can,nican,serial,kvaser,socketcan,socketcan_native}]
47-
[--ignore-timestamps] [-g GAP] [-s SKIP]
48-
input-file
47+
usage: python -m can.player [-h] [-f LOG_FILE] [-v] [-c CHANNEL]
48+
[-i {kvaser,virtual,slcan,nican,neovi,ixxat,serial,usb2can,socketcan_ctypes,remote,socketcan_native,iscan,vector,pcan,socketcan}]
49+
[-b BITRATE] [--ignore-timestamps] [-g GAP]
50+
[-s SKIP]
51+
input-file
4952

5053
Replay CAN traffic
5154

5255
positional arguments:
53-
input-file The file to replay. Supported types: .db
56+
input-file The file to replay. Supported types: .db, .blf
5457

5558
optional arguments:
5659
-h, --help show this help message and exit
@@ -65,12 +68,14 @@ Command line help (``python -m can.player --help``)::
6568
might be a rfcomm device: "/dev/rfcomm0" With the
6669
socketcan interfaces valid channel examples include:
6770
"can0", "vcan0"
68-
-i {pcan,remote,ixxat,socketcan_ctypes,virtual,usb2can,nican,serial,kvaser,socketcan,socketcan_native}, --interface {pcan,remote,ixxat,socketcan_ctypes,virtual,usb2can,nican,serial,kvaser,socketcan,socketcan_native}
71+
-i {kvaser,virtual,slcan,nican,neovi,ixxat,serial,usb2can,socketcan_ctypes,remote,socketcan_native,iscan,vector,pcan,socketcan}, --interface {kvaser,virtual,slcan,nican,neovi,ixxat,serial,usb2can,socketcan_ctypes,remote,socketcan_native,iscan,vector,pcan,socketcan}
6972
Specify the backend CAN interface to use. If left
7073
blank, fall back to reading from configuration files.
74+
-b BITRATE, --bitrate BITRATE
75+
Bitrate to use for the CAN bus.
7176
--ignore-timestamps Ignore timestamps (send all frames immediately with
7277
minimum gap between frames)
73-
-g GAP, --gap GAP <ms> minimum time between replayed frames
78+
-g GAP, --gap GAP <s> minimum time between replayed frames
7479
-s SKIP, --skip SKIP <s> skip gaps greater than 's' seconds
7580

7681

@@ -80,30 +85,29 @@ can.server
8085

8186
Command line help (``python -m can.server --help``)::
8287

83-
usage: canserver [-h] [-v] [-c CHANNEL]
84-
[-i {pcan,remote,ixxat,socketcan_ctypes,virtual,usb2can,nican,serial,kvaser,socketcan,socketcan_native}]
85-
[-b BITRATE] [-H HOST] [-p PORT]
86-
87-
Remote CAN server
88-
89-
optional arguments:
90-
-h, --help show this help message and exit
91-
-v How much information do you want to see at the command
92-
line? You can add several of these e.g., -vv is DEBUG
93-
-c CHANNEL, --channel CHANNEL
94-
Most backend interfaces require some sort of channel.
95-
For example with the serial interface the channel
96-
might be a rfcomm device: "/dev/rfcomm0" With the
97-
socketcan interfaces valid channel examples include:
98-
"can0", "vcan0". The server will only serve this
99-
channel. Start additional servers at different ports
100-
to share more channels.
101-
-i {pcan,remote,ixxat,socketcan_ctypes,virtual,usb2can,nican,serial,kvaser,socketcan,socketcan_native}, --interface {pcan,remote,ixxat,socketcan_ctypes,virtual,usb2can,nican,serial,kvaser,socketcan,socketcan_native}
102-
Specify the backend CAN interface to use. If left
103-
blank, fall back to reading from configuration files.
104-
-b BITRATE, --bitrate BITRATE
105-
Force to use a specific bitrate. This will override
106-
any requested bitrate by the clients.
107-
-H HOST, --host HOST Host to listen to (default 0.0.0.0).
108-
-p PORT, --port PORT TCP port to listen on (default 54701).
88+
usage: python -m can.server [-h] [-v] [-c CHANNEL]
89+
[-i {kvaser,nican,vector,iscan,virtual,socketcan,socketcan_ctypes,usb2can,socketcan_native,neovi,serial,pcan,ixxat,remote,slcan}]
90+
[-b BITRATE] [-H HOST] [-p PORT]
10991

92+
Remote CAN server
93+
94+
optional arguments:
95+
-h, --help show this help message and exit
96+
-v How much information do you want to see at the command
97+
line? You can add several of these e.g., -vv is DEBUG
98+
-c CHANNEL, --channel CHANNEL
99+
Most backend interfaces require some sort of channel.
100+
For example with the serial interface the channel
101+
might be a rfcomm device: "/dev/rfcomm0" With the
102+
socketcan interfaces valid channel examples include:
103+
"can0", "vcan0". The server will only serve this
104+
channel. Start additional servers at different ports
105+
to share more channels.
106+
-i {kvaser,nican,vector,iscan,virtual,socketcan,socketcan_ctypes,usb2can,socketcan_native,neovi,serial,pcan,ixxat,remote,slcan}, --interface {kvaser,nican,vector,iscan,virtual,socketcan,socketcan_ctypes,usb2can,socketcan_native,neovi,serial,pcan,ixxat,remote,slcan}
107+
Specify the backend CAN interface to use. If left
108+
blank, fall back to reading from configuration files.
109+
-b BITRATE, --bitrate BITRATE
110+
Force to use a specific bitrate. This will override
111+
any requested bitrate by the clients.
112+
-H HOST, --host HOST Host to listen to (default 0.0.0.0).
113+
-p PORT, --port PORT TCP port to listen on (default 54701).

doc/configuration.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ the **interface** and **channel** before importing from ``can.interfaces``.
2424
bus = Bus()
2525

2626

27+
You can also specify the interface and channel for each Bus instance::
28+
29+
import can
30+
31+
bus = can.interface.Bus(bustype='socketcan', channel='vcan0', bitrate=500000)
32+
33+
2734
Configuration File
2835
------------------
2936

doc/index.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,31 @@ python-can
22
==========
33

44

5-
The **python-can** library provides controller area network support for
5+
The **python-can** library provides Controller Area Network support for
66
`Python <http://python.org/download/>`__, providing common abstractions to
77
different hardware devices, and a suite of utilities for sending and receiving
8-
messages on a can bus.
8+
messages on a CAN bus.
99

1010
**python-can** runs any where Python runs; from high powered computers
11-
with commercial `can to usb` devices right down to low powered devices running
11+
with commercial `CAN to usb` devices right down to low powered devices running
1212
linux such as a BeagleBone or RaspberryPi.
1313

1414
More concretely, some example uses of the library:
1515

16-
- Passively logging what occurs on a can bus. For example monitoring a
16+
- Passively logging what occurs on a CAN bus. For example monitoring a
1717
commercial vehicle using its **OBD-II** port.
1818

19-
- Testing of hardware that interacts via can. Modules found in
19+
- Testing of hardware that interacts via CAN. Modules found in
2020
modern cars, motocycles, boats, and even wheelchairs have had components tested
2121
from Python using this library.
2222

2323
- Prototyping new hardware modules or software algorithms in-the-loop. Easily
2424
interact with an existing bus.
2525

26-
- Creating virtual modules to prototype can bus communication.
26+
- Creating virtual modules to prototype CAN bus communication.
2727

2828

29-
Brief example of the library in action: connecting to a can bus, creating and sending a message:
29+
Brief example of the library in action: connecting to a CAN bus, creating and sending a message:
3030

3131

3232
.. literalinclude:: ../examples/send_one.py

0 commit comments

Comments
 (0)