Skip to content

Commit 306051c

Browse files
committed
Add docstrings
1 parent 9bd4b8c commit 306051c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

can/interfaces/socketcand/socketcand.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,28 @@ def connect_to_server(s, host, port):
7777

7878
class SocketCanDaemonBus(can.BusABC):
7979
def __init__(self, channel, host, port, tcp_tune=False, can_filters=None, **kwargs):
80+
"""Connects to a CAN bus served by socketcand.
81+
82+
It will attempt to connect to the server for up to 10s, after which a
83+
TimeoutError exception will be thrown.
84+
85+
If the handshake with the socketcand server fails, a CanError exception
86+
is thrown.
87+
88+
:param channel:
89+
The can interface name served by socketcand.
90+
An example channel would be 'vcan0' or 'can0'.
91+
:param host:
92+
The host address of the socketcand server.
93+
:param port:
94+
The port of the socketcand server.
95+
:param tcp_tune:
96+
This tunes the TCP socket for low latency (TCP_NODELAY, and
97+
TCP_QUICKACK).
98+
This option is not available under windows.
99+
:param can_filters:
100+
See :meth:`can.BusABC.set_filters`.
101+
"""
80102
self.__host = host
81103
self.__port = port
82104

@@ -197,9 +219,15 @@ def _expect_msg(self, msg):
197219
raise can.CanError(f"{msg} message expected!")
198220

199221
def send(self, msg, timeout=None):
222+
"""Transmit a message to the CAN bus.
223+
224+
:param msg: A message object.
225+
:param timeout: Ignored
226+
"""
200227
ascii_msg = convert_can_message_to_ascii_message(msg)
201228
self._tcp_send(ascii_msg)
202229

203230
def shutdown(self):
231+
"""Stops all active periodic tasks and closes the socket."""
204232
super().shutdown()
205233
self.__socket.close()

0 commit comments

Comments
 (0)