45 lines
1021 B
Python
45 lines
1021 B
Python
'''
|
|
Created on 19 mar 2020
|
|
|
|
@author: Emanuele Trabattoni
|
|
@copyright: Briq srl
|
|
@contact: Scritto per Briq srl come collaboratore esterno, contiene dei frammenti di codice di proprieta' di Briq srl
|
|
'''
|
|
|
|
import threading, socket, sys, queue, logging
|
|
|
|
Q_TIMEOUT = 2
|
|
URL_ERR = 'tscprinter/errore/'
|
|
URL_EVENT = 'tscprinter/evento/'
|
|
|
|
def stampante(q_in, q_out, ip, ):
|
|
pass
|
|
|
|
|
|
#lancia i thread, uno per stampante
|
|
def main(q_in :queue.Queue, q_out :queue.Queue, q_comm: queue.Queue, logger: logging.getLogger):
|
|
queue_ip_map={}
|
|
|
|
def get_queue_id(ip):
|
|
return True
|
|
|
|
def get_queue_command():
|
|
return q_comm
|
|
|
|
while True:
|
|
try:
|
|
comando = q_comm.get(block=True, timeout=Q_TIMEOUT)
|
|
if comando['name'] == "CONNETTI":
|
|
pass
|
|
elif comando['name'] == "DISCONNETTI":
|
|
pass
|
|
else:
|
|
q_out.put({'url':URL_ERR,
|
|
'msg':{'error':'comando inesistente'}
|
|
})
|
|
logger.error("Comando non Trovato")
|
|
except queue.Empty:
|
|
logger.error("Coda comandi vuota")
|
|
pass
|
|
|