BioImager  4.9.0
A .NET microscopy imaging application based on Bio library. Supports various microscopes by using imported libraries & GUI automation. Supports XInput game controllers to move stage, take images, run ImageJ macros on images or Bio C# scripts.
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)
 

Protected Attributes

 _serial = serial
 
 _lock = threading.RLock()
 

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

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

Member Data Documentation

◆ _lock

microscope._utils.SharedSerial._lock = threading.RLock()
protected

Definition at line 116 of file _utils.py.

◆ _serial

microscope._utils.SharedSerial._serial = serial
protected

Definition at line 115 of file _utils.py.


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