Changeset 2423
- Timestamp:
- 09/05/05 13:16:56 (19 years ago)
- Location:
- pykota/trunk/pykota/accounters
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/accounters/pjl.py
r2409 r2423 60 60 self.parent = parent 61 61 self.printerHostname = printerhostname 62 self.port = 9100 62 63 self.printerInternalPageCounter = self.printerStatus = None 63 64 self.timedout = 0 … … 70 71 def retrievePJLValues(self) : 71 72 """Retrieves a printer's internal page counter and status via PJL.""" 72 port = 910073 73 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 74 74 try : 75 sock.connect((self.printerHostname, port))75 sock.connect((self.printerHostname, self.port)) 76 76 except socket.error, msg : 77 self.parent.filter.printInfo(_("Problem during connection to %s:%s : %s") % (self.printerHostname, port, msg), "warn")77 self.parent.filter.printInfo(_("Problem during connection to %s:%s : %s") % (self.printerHostname, self.port, msg), "warn") 78 78 else : 79 79 self.parent.filter.logdebug("Connected to printer %s" % self.printerHostname) … … 81 81 sock.send(pjlMessage) 82 82 except socket.error, msg : 83 self.parent.filter.printInfo(_("Problem while sending PJL query to %s:%s : %s") % (self.printerHostname, port, msg), "warn")83 self.parent.filter.printInfo(_("Problem while sending PJL query to %s:%s : %s") % (self.printerHostname, self.port, msg), "warn") 84 84 else : 85 85 self.parent.filter.logdebug("Query sent to %s : %s" % (self.printerHostname, repr(pjlMessage))) … … 95 95 break # our alarm handler was launched, probably 96 96 except socket.error : 97 self.parent.filter.printInfo(_("Problem while receiving PJL answer from %s:%s : %s") % (self.printerHostname, port, msg), "warn")97 self.parent.filter.printInfo(_("Problem while receiving PJL answer from %s:%s : %s") % (self.printerHostname, self.port, msg), "warn") 98 98 else : 99 99 readnext = 0 -
pykota/trunk/pykota/accounters/snmp.py
r2409 r2423 68 68 self.parent = parent 69 69 self.printerHostname = printerhostname 70 self.community = "public" 71 self.port = 161 70 72 self.printerInternalPageCounter = None 71 73 self.printerStatus = None … … 76 78 ver = alpha.protoVersions[alpha.protoVersionId1] 77 79 req = ver.Message() 78 req.apiAlphaSetCommunity( 'public')80 req.apiAlphaSetCommunity(self.community) 79 81 req.apiAlphaSetPdu(ver.GetRequestPdu()) 80 82 req.apiAlphaGetPdu().apiAlphaSetVarBindList((pageCounterOID, ver.Null()), \ … … 83 85 tsp = Manager() 84 86 try : 85 tsp.sendAndReceive(req.berEncode(), (self.printerHostname, 161), (self.handleAnswer, req)) 87 tsp.sendAndReceive(req.berEncode(), \ 88 (self.printerHostname, self.port), \ 89 (self.handleAnswer, req)) 86 90 except (SnmpOverUdpError, select.error), msg : 87 91 self.parent.filter.printInfo(_("Network error while doing SNMP queries on printer %s : %s") % (self.printerHostname, msg), "warn")