diff --git a/impression/etat_imprimante.py b/impression/etat_imprimante.py index 9fb348e4..92c2e4a5 100644 --- a/impression/etat_imprimante.py +++ b/impression/etat_imprimante.py @@ -30,22 +30,25 @@ def etat_canon(): 'other(1)\ndown(5)' : u"Imprimante hors-service", 'other(1)\nrunning(2)' : u'Imprimante en veille', 'warmup(5)\nrunning(2)' : u'Préchauffage', - 'idle(3)\nwarning(3)' : u"""Imprimante fonctionnelle -(penser à vérifier le niveau d'encre et de papier)""", - 'printing(4)\nwarning(3)' : u"""Impression en cours -(penser à vérifier le niveau d'encre et de papier)""", + 'idle(3)\nwarning(3)' : u'Imprimante fonctionnelle', + 'printing(4)\nwarning(3)' : u'Impression en cours' } try: - msg = liste_msg = [] + raw_msg = msg = [] comm = snmp(host="imprimante.adm.crans.org", version="1", community="public") + for oid in [".hrPrinterStatus.1", ".hrDeviceStatus.1"]: #".hrPrinterDetectedErrorState.1" - msg.append(comm.get_string(oid)) - liste_msg = _dico['\n'.join(msg)].split('\n') - except Exception,err: - liste_msg.append("[%s]" % unicode(err)) + raw_msg.append(comm.get_string(oid)) + msg = _dico['\n'.join(msg)].split('\n') - return liste_msg + if raw_msg[1] == 'warning(3)': + msg += (comm.walk('mib-2.43.18.1.1.8').values() + + except Exception,err: + msg.append("[%s]" % unicode(err)) + + return msg def etat_laserjet(): """ Renvoie une liste des differents ecrans actuels du display de l'imprimante """