BioImager  3.9.1
A .NET microscopy imaging library. Supports various microscopes by using imported libraries & GUI automation. Supported libraries include PriorĀ® & ZeissĀ® & all devices supported by Micromanager 2.0 and python-microscope.
Loading...
Searching...
No Matches
microscope._utils.SharedSerial Class Reference

Public Member Functions

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)
 

Detailed Description

Wraps a `Serial` instance with a lock for synchronization.

Definition at line 111 of file _utils.py.

Constructor & Destructor Documentation

◆ __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

Member Function Documentation

◆ 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

Referenced by microscope.controllers.prior._ProScanIIIConnection.get_command(), microscope.stages.ludl._LudlController.get_command(), and microscope.stages.ludl._LudlController.readline().

◆ 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)

The documentation for this class was generated from the following file: