|
| None | __init__ (self, serial.Serial serial) |
| |
| threading.RLock | lock (self) |
| |
| bytes | readline (self) |
| |
| typing.List[bytes] | readlines (self, int hint=-1) |
| |
| bytes | read_until (self, bytes terminator=b"\n", typing.Optional[int] size=None) |
| |
| int | write (self, bytes data) |
| |
Wraps a `Serial` instance with a lock for synchronization.
Definition at line 111 of file _utils.py.
◆ __init__()
| None microscope._utils.SharedSerial.__init__ |
( |
| self, |
|
|
serial.Serial | serial ) |
Definition at line 114 of file _utils.py.
114 def __init__(self, serial: serial.Serial) -> None:
115 self._serial = serial
116 self._lock = threading.RLock()
117
◆ lock()
| threading.RLock microscope._utils.SharedSerial.lock |
( |
| self | ) |
|
Definition at line 119 of file _utils.py.
119 def lock(self) -> threading.RLock:
120 return self._lock
121
◆ read_until()
| bytes microscope._utils.SharedSerial.read_until |
( |
| self, |
|
|
bytes | terminator = b"\n", |
|
|
typing.Optional[int] | size = None ) |
Definition at line 132 of file _utils.py.
134 ) -> bytes:
135 with self._lock:
136 return self._serial.read_until(terminator, size=size)
137
◆ readline()
| bytes microscope._utils.SharedSerial.readline |
( |
| self | ) |
|
Definition at line 122 of file _utils.py.
122 def readline(self) -> bytes:
123 with self._lock:
124 return self._serial.readline()
125
◆ readlines()
| typing.List[bytes] microscope._utils.SharedSerial.readlines |
( |
| self, |
|
|
int | hint = -1 ) |
Definition at line 126 of file _utils.py.
126 def readlines(self, hint: int = -1) -> typing.List[bytes]:
127 with self._lock:
128 return self._serial.readlines(hint)
129
◆ write()
| int microscope._utils.SharedSerial.write |
( |
| self, |
|
|
bytes | data ) |
Definition at line 138 of file _utils.py.
138 def write(self, data: bytes) -> int:
139 with self._lock:
140 return self._serial.write(data)
◆ _lock
| microscope._utils.SharedSerial._lock = threading.RLock() |
|
protected |
◆ _serial
| microscope._utils.SharedSerial._serial = serial |
|
protected |
The documentation for this class was generated from the following file:
- BioImager/PythonMicroscope/microscope/_utils.py