forked from openlp/openlp
Restructure send_busy flag
This commit is contained in:
parent
4714cbfcf7
commit
77040050f4
@ -453,12 +453,12 @@ class PJLink1(QTcpSocket):
|
|||||||
out = '%s%s %s%s' % (salt, cmd, opts, CR)
|
out = '%s%s %s%s' % (salt, cmd, opts, CR)
|
||||||
if out in self.send_queue:
|
if out in self.send_queue:
|
||||||
# Already there, so don't add
|
# Already there, so don't add
|
||||||
log.debug('(%s) send_command(out=%s) Already in queue - skipping' % (self.ip, out.strip()))
|
log.debug('(%s) send_command(out="%s") Already in queue - skipping' % (self.ip, out.strip()))
|
||||||
elif not queue and len(self.send_queue) == 0:
|
elif not queue and len(self.send_queue) == 0:
|
||||||
|
|
||||||
return self._send_string(out)
|
return self._send_string(out)
|
||||||
else:
|
else:
|
||||||
log.debug('(%s) send_command(out=%s) adding to queue' % (self.ip, out.strip()))
|
log.debug('(%s) send_command(out="%s") adding to queue' % (self.ip, out.strip()))
|
||||||
self.send_queue.append(out)
|
self.send_queue.append(out)
|
||||||
if not self.send_busy:
|
if not self.send_busy:
|
||||||
self.projectorReceivedData.emit()
|
self.projectorReceivedData.emit()
|
||||||
@ -485,6 +485,9 @@ class PJLink1(QTcpSocket):
|
|||||||
self.send_queue = []
|
self.send_queue = []
|
||||||
self.send_busy = False
|
self.send_busy = False
|
||||||
return
|
return
|
||||||
|
if self.send_busy:
|
||||||
|
# Still waiting for response from last command sent
|
||||||
|
return
|
||||||
if data is not None:
|
if data is not None:
|
||||||
out = data
|
out = data
|
||||||
log.debug('(%s) _send_string(data=%s)' % (self.ip, out.strip()))
|
log.debug('(%s) _send_string(data=%s)' % (self.ip, out.strip()))
|
||||||
@ -520,32 +523,37 @@ class PJLink1(QTcpSocket):
|
|||||||
# Oops - projector error
|
# Oops - projector error
|
||||||
if data.upper() == 'ERRA':
|
if data.upper() == 'ERRA':
|
||||||
# Authentication error
|
# Authentication error
|
||||||
|
self.send_busy = False
|
||||||
self.disconnect_from_host()
|
self.disconnect_from_host()
|
||||||
self.change_status(E_AUTHENTICATION)
|
self.change_status(E_AUTHENTICATION)
|
||||||
log.debug('(%s) emitting projectorAuthentication() signal' % self.ip)
|
log.debug('(%s) emitting projectorAuthentication() signal' % self.ip)
|
||||||
self.projectorAuthentication.emit(self.name)
|
self.projectorAuthentication.emit(self.name)
|
||||||
elif data.upper() == 'ERR1':
|
elif data.upper() == 'ERR1':
|
||||||
# Undefined command
|
# Undefined command
|
||||||
|
self.send_busy = False
|
||||||
self.change_status(E_UNDEFINED, '%s "%s"' %
|
self.change_status(E_UNDEFINED, '%s "%s"' %
|
||||||
(translate('OpenLP.PJLink1', 'Undefined command:'), cmd))
|
(translate('OpenLP.PJLink1', 'Undefined command:'), cmd))
|
||||||
elif data.upper() == 'ERR2':
|
elif data.upper() == 'ERR2':
|
||||||
# Invalid parameter
|
# Invalid parameter
|
||||||
|
self.send_busy = False
|
||||||
self.change_status(E_PARAMETER)
|
self.change_status(E_PARAMETER)
|
||||||
elif data.upper() == 'ERR3':
|
elif data.upper() == 'ERR3':
|
||||||
# Projector busy
|
# Projector busy
|
||||||
|
self.send_busy = False
|
||||||
self.change_status(E_UNAVAILABLE)
|
self.change_status(E_UNAVAILABLE)
|
||||||
elif data.upper() == 'ERR4':
|
elif data.upper() == 'ERR4':
|
||||||
# Projector/display error
|
# Projector/display error
|
||||||
self.change_status(E_PROJECTOR)
|
|
||||||
self.projectorReceivedData.emit()
|
|
||||||
self.send_busy = False
|
self.send_busy = False
|
||||||
|
self.change_status(E_PROJECTOR)
|
||||||
|
self.send_busy = False
|
||||||
|
self.projectorReceivedData.emit()
|
||||||
return
|
return
|
||||||
# Command succeeded - no extra information
|
# Command succeeded - no extra information
|
||||||
elif data.upper() == 'OK':
|
elif data.upper() == 'OK':
|
||||||
log.debug('(%s) Command returned OK' % self.ip)
|
log.debug('(%s) Command returned OK' % self.ip)
|
||||||
# A command returned successfully, recheck data
|
# A command returned successfully, recheck data
|
||||||
self.projectorReceivedData.emit()
|
|
||||||
self.send_busy = False
|
self.send_busy = False
|
||||||
|
self.projectorReceivedData.emit()
|
||||||
return
|
return
|
||||||
|
|
||||||
if cmd in self.PJLINK1_FUNC:
|
if cmd in self.PJLINK1_FUNC:
|
||||||
|
Loading…
Reference in New Issue
Block a user