MCPcopy Create free account
hub / github.com/LabPy/lantz / send

Method send

lantz/drivers/legacy/usbtmc.py:156–176  ·  view source on GitHub ↗
(self, command, termination=None, encoding=None)

Source from the content-addressed store, hash-verified

154 return interfaces[0]
155
156 def send(self, command, termination=None, encoding=None):
157 if termination is None:
158 termination = self.SEND_TERMINATION
159 if encoding is None:
160 encoding = self.ENCODING
161
162 message = bytes(command + termination, encoding)
163 self.log_debug('Sending {}', message)
164
165 begin, end, size = 0, 0, len(message)
166 bytes_sent = 0
167 while not end > size:
168 begin, end = end, begin + self.RECV_CHUNK
169
170 self._btag = (self._btag % 255) + 1
171
172 data = BulkOutMessage.build_array(self._btag, end > size, message[begin:end])
173
174 bytes_sent += self.raw_send(data)
175
176 return bytes_sent
177
178 send.__doc__ = TextualMixin.send.__doc__
179

Callers

nothing calls this directly

Calls 3

log_debugMethod · 0.80
build_arrayMethod · 0.45
raw_sendMethod · 0.45

Tested by

no test coverage detected