9. cc_serial
9.1. Communication Channel Via Serial
- module
cc_serial
- synopsis
Serial communication channel
- class pykiso.lib.connectors.cc_serial.CCSerial(port, baudrate=9600, bytesize=ByteSize.EIGHT_BITS, parity=Parity.PARITY_NONE, stopbits=StopBits.STOPBITS_ONE, timeout=None, xonxoff=False, rtscts=False, write_timeout=None, dsrdtr=False, inter_byte_timeout=None, exclusive=None, **kwargs)[source]
Connector for serial devices
Init Serial settings
- Parameters
port (
str
) – Device name (e.g. “COM1” for Windows or “/dev/ttyACM0” for Linux)baudrate (
int
) – Baud rate such as 9600 or 115200 etc, defaults to 9600bytesize (
ByteSize
) – Number of data bits. Possible values: FIVEBITS, SIXBITS, SEVENBITS, EIGHTBITS, defaults to EIGHTBITSparity (
Parity
) – Enable parity checking. Possible values: PARITY_NONE, PARITY_EVEN, PARITY_ODD PARITY_MARK, PARITY_SPACE, defaults to PARITY_NONEstopbits (
StopBits
) – Number of stop bits. Possible values: STOPBITS_ONE, STOPBITS_ONE_POINT_FIVE, STOPBITS_TWO, defaults to STOPBITS_ONEtimeout (
Optional
[float
]) – Set a read timeout value in seconds, defaults to Nonexonxoff (
bool
) – Enable software flow contro, defaults to Falsertscts (
bool
) – Enable hardware (RTS/CTS) flow control, defaults to Falsewrite_timeout (
Optional
[float
]) – Set a write timeout value in seconds, defaults to Nonedsrdtr (
bool
) – Enable hardware (DSR/DTR) flow control, defaults to Falseinter_byte_timeout (
Optional
[float
]) – Inter-character timeout, None to disable, defaults to Noneexclusive (
Optional
[bool
]) – Set exclusive access mode (POSIX only). A port cannot be opened in exclusive access mode if it is already open in exclusive access mode., defaults to None
- _cc_receive(timeout=1e-05)[source]
Read bytes from the serial port. Try to read one byte in blocking mode. After blocking read check remaining bytes and read them without a blocking call.
- Parameters
timeout – timeout in seconds, 0 for non blocking read, defaults to 0.00001
- Raises
NotImplementedError – if raw is to True
- Return type
Dict
[str
,Optional
[bytes
]]- Returns
received bytes
- _cc_send(msg, timeout=None)[source]
Sends data to the serial port
- Parameters
msg (
ByteString
) – data to sendtimeout (
Optional
[float
]) – write timeout in seconds. None sets it to blocking, defaults to None
- Raises
SerialTimeoutException - In case a write timeout is configured for the port and the time is exceeded.
- Return type
None