etat imprimante, pour l'intranet
(en fait, c'est le mme que l'autre avec un encode en moins par ce que a n'allait pas avec l'utf-8 de l'intranet) darcs-hash:20061110142439-f46e9-8cc1e1026c4856d78f83054838d7ed1fdedbde57.gz
This commit is contained in:
parent
e3f5fcb44c
commit
b4bb0bc33e
1 changed files with 38 additions and 0 deletions
38
lib/impression/etat_imprimante.py
Executable file
38
lib/impression/etat_imprimante.py
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: iso-8859-15 -*-
|
||||
|
||||
import sys
|
||||
sys.path.append("/usr/scripts/gestion")
|
||||
|
||||
import hptools
|
||||
|
||||
dico = {
|
||||
u"PrÁt": u"Prêtb",
|
||||
u"Pr menus, appuy \x1e": u"",
|
||||
u"Powersave activÅ": u"En veille",
|
||||
u"Verification": u"Vérification imprimante",
|
||||
u"imprimante": u"",
|
||||
u"PrÅchauffage": u"Préchauffage",
|
||||
u"Traitement de la": u"Impression en cours",
|
||||
u"tÀche du bac 4": u"",
|
||||
u"COMMANDER CARTOUCHE": u"",
|
||||
u"CYAN": u"",
|
||||
u"MAGENTA": u"",
|
||||
}
|
||||
|
||||
class ErreurCommunication(Exception):
|
||||
pass
|
||||
|
||||
def etat():
|
||||
""" Renvoie une liste des differents ecrans actuels du display de l'imprimante """
|
||||
liste_oid = ["mib-2.43.16.5.1.2.1.1","mib-2.43.16.5.1.2.1.2","mib-2.43.16.5.1.2.1.3","mib-2.43.16.5.1.2.1.4","mib-2.43.16.5.1.2.1.5"]
|
||||
try:
|
||||
comm = hptools.snmp(host="laserjet.adm.crans.org",version="1",community="public")
|
||||
liste_msg = []
|
||||
for oid in liste_oid:
|
||||
msg = comm.get_string(oid).decode("ISO-8859-1")
|
||||
msg = dico.get(msg, msg)
|
||||
if msg: liste_msg.append(msg)
|
||||
except Exception,err:
|
||||
raise ErreurCommunication, str(err)
|
||||
return liste_msg
|
Loading…
Add table
Add a link
Reference in a new issue