Module Read line¶
This module contains a repair function for the broken serial read_line() function. Until this function is repaired the substitute readline provided by this module can be used.
class read_line¶
The read_line object contains functionality to obtain lines from a given serial input.
Methods¶
-
read_line.
update
() → int¶ Read the datastring from the given port. In case a single or multiple lines are obtained the number of lines is returned. If no lines are available zero is returned.
-
read_line.
get
() → ’string’ or ‘None’¶ Read the datastring from the given port. In case a line is obtained the string is returned, else ‘None’ is returned.
Example usage¶
The following code shows an example of using the read_line.
from read_line import Read_line
import omc048
serial = omc048.serial(1)
serial.init(9600,nep.RS485,bits=8, parity=None, stop=1, flow=0, timeout=10)
serial_string = read_line(serial)
serial_string.update()
line = serial_string.get()
print(line)