Skip to content

Commit

Permalink
Manually set property values if an ACK is received
Browse files Browse the repository at this point in the history
  • Loading branch information
nocarryr committed Apr 22, 2017
1 parent 9829369 commit cef0ab5
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions vidhubcontrol/backends/telnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,13 @@ async def set_crosspoints(self, *args):
tx_bfr += b'\n\n'
async with self.emission_lock('crosspoints'):
await self.send_to_client(tx_bfr)
r = await self.wait_for_response()
if r is None or r.startswith('NAK'):
return False
r = await self.wait_for_ack_or_nak()
if not r:
return False
xpts = self.crosspoints[:]
for out_idx, in_idx in args:
xpts[out_idx] = in_idx
self.crosspoints[:] = xpts
return True
async def set_output_label(self, out_idx, label):
return await self.set_output_labels((out_idx, label))
Expand All @@ -205,9 +209,13 @@ async def set_output_labels(self, *args):
tx_bfr += b'\n\n'
async with self.emission_lock('output_labels'):
await self.send_to_client(tx_bfr)
r = await self.wait_for_response()
if r is None or r.startswith('NAK'):
return False
r = await self.wait_for_ack_or_nak()
if not r:
return False
lbls = self.output_labels[:]
for out_idx, label in args:
lbls[out_idx] = label
self.output_labels = lbls[:]
return True
async def set_input_label(self, in_idx, label):
return await self.set_input_labels((in_idx, label))
Expand All @@ -220,9 +228,13 @@ async def set_input_labels(self, *args):
tx_bfr += b'\n\n'
async with self.emission_lock('input_labels'):
await self.send_to_client(tx_bfr)
r = await self.wait_for_response()
if r is None or r.startswith('NAK'):
return False
r = await self.wait_for_ack_or_nak()
if not r:
return False
lbls = self.input_labels[:]
for in_idx, label in args:
lbls[in_idx] = label
self.input_labels = lbls[:]
return True

class SmartScopeTelnetBackend(TelnetBackendBase, SmartScopeBackendBase):
Expand Down

0 comments on commit cef0ab5

Please sign in to comment.