mathiasfrey / ecrterm

Python ZVT 700 interface (electronic cash registers)
GNU Lesser General Public License v3.0
34 stars 31 forks source link

Keine Antwort auf StatusEnquiry #2

Open pc-coholic opened 11 years ago

pc-coholic commented 11 years ago

Servus!

Ich bin in ein Problem reingelaufen, bei dem ich aktuell noch keinen Ansatz habe das erfolgreich zu umgehen.

Es wird das test_pt.py ausgeführt, bei der Aufforderung die Karte einzugeben allerdings am Terminal auf Abbrechen gedrückt.

Anscheinend liefert dann bei einem folgenden StatusEnquiry das Terminal (ein Ingenico i5310+LAN) keine Antwort zurück.

Gibt es denn eine einfache Möglichkeit wenn ein StatusEnquiry fehlschlägt das einfach zu ignorieren und nach einigen Sekunden es nochmals zu probieren?

StatusEnquiry{05 01} {'password': '123456'} *[] ['0x10', '0x2', '0x5', '0x1', '0x3', '0x12', '0x34', '0x56', '0x10', '0x3', '0xe0', '0x43'] < 'ACK' < ['0x6'] < PacketReceived{80 00} _[] < ['0x10', '0x2', '0x80', '0x0', '0x0', '0x10', '0x3', '0xf5', '0x1f'] 'ACK' ['0x6'] < Completion{06 0F} {'terminal-status': 0, 'sw-version': '061022a M IC Std'} *[] < ['0x10', '0x2', '0x6', '0xf', '0x15', '0xf0', '0xf1', '0xf7', '0x30', '0x36', '0x31', '0x30', '0x32', '0x32', '0x61', '0x20', '0x4d', '0x20', '0x49', '0x43', '0x5f', '0x20', '0x53', '0x74', '0x64', '0x0', '0x10', '0x3', '0xe4', '0x51'] 'ACK' ['0x6'] PacketReceived{80 00} _[] ['0x10', '0x2', '0x80', '0x0', '0x0', '0x10', '0x3', '0xf5', '0x1f'] < 'ACK' < ['0x6'] Registration{06 00} {'configbyte': 186, 'cc': [9, 120], 'password': '123456'} *[] ['0x10', '0x2', '0x6', '0x0', '0x6', '0x12', '0x34', '0x56', '0xba', '0x9', '0x78', '0x10', '0x3', '0x24', '0xc3'] < 'ACK' < ['0x6'] < PacketReceived{80 00} _[] < ['0x10', '0x2', '0x80', '0x0', '0x0', '0x10', '0x3', '0xf5', '0x1f'] 'ACK' ['0x6'] < Completion{06 0F} _[{'tid': '61246407'}, {'currencycode': '0978'}] < ['0x10', '0x2', '0x6', '0xf', '0x8', '0x29', '0x61', '0x24', '0x64', '0x7', '0x49', '0x9', '0x78', '0x10', '0x3', '0x79', '0x31'] 'ACK' ['0x6'] PacketReceived{80 00} *[] ['0x10', '0x2', '0x80', '0x0', '0x0', '0x10', '0x3', '0xf5', '0x1f'] < 'ACK' < ['0x6'] StatusEnquiry{05 01} {'password': '123456'} [] ['0x10', '0x2', '0x5', '0x1', '0x3', '0x12', '0x34', '0x56', '0x10', '0x3', '0xe0', '0x43'] < 'ACK' < ['0x6'] < PacketReceived{80 00} *[] < ['0x10', '0x2', '0x80', '0x0', '0x0', '0x10', '0x3', '0xf5', '0x1f'] 'ACK' ['0x6'] < Completion{06 0F} {'terminal-status': 0, 'sw-version': '061022a M IC_ Std'} [] < ['0x10', '0x2', '0x6', '0xf', '0x15', '0xf0', '0xf1', '0xf7', '0x30', '0x36', '0x31', '0x30', '0x32', '0x32', '0x61', '0x20', '0x4d', '0x20', '0x49', '0x43', '0x5f', '0x20', '0x53', '0x74', '0x64', '0x0', '0x10', '0x3', '0xe4', '0x51'] 'ACK' ['0x6'] PacketReceived{80 00} *[] ['0x10', '0x2', '0x80', '0x0', '0x0', '0x10', '0x3', '0xf5', '0x1f'] < 'ACK' < ['0x6'] Authorisation{06 01} _[{'amount': '000000000050'}, {'currency_code': '0978'}] ['0x10', '0x2', '0x6', '0x1', '0xa', '0x4', '0x0', '0x0', '0x0', '0x0', '0x0', '0x50', '0x49', '0x9', '0x78', '0x10', '0x3', '0xf5', '0x57'] < 'ACK' < ['0x6'] < PacketReceived{80 00} [] < ['0x10', '0x2', '0x80', '0x0', '0x0', '0x10', '0x3', '0xf5', '0x1f'] 'ACK' ['0x6'] < IntermediateStatus{04 FF}: insert card < ['0x10', '0x2', '0x4', '0xff', '0x1', '0xa', '0x10', '0x3', '0xf5', '0x7d'] 'ACK' ['0x6'] PacketReceived{80 00} *[] ['0x10', '0x2', '0x80', '0x0', '0x0', '0x10', '0x3', '0xf5', '0x1f'] < 'ACK' < ['0x6'] < IntermediateStatus{04 FF}: processing error < ['0x10', '0x2', '0x4', '0xff', '0x1', '0xd', '0x10', '0x3', '0xfd', '0x30'] 'ACK' ['0x6'] PacketReceived{80 00} _[] ['0x10', '0x2', '0x80', '0x0', '0x0', '0x10', '0x3', '0xf5', '0x1f'] < 'ACK' < ['0x6'] < Abort{06 1E} [] < ['0x10', '0x2', '0x6', '0x1e', '0x1', '0x6c', '0x10', '0x3', '0xc9', '0xf2'] 'ACK' ['0x6'] PacketReceived{80 00} *[] ['0x10', '0x2', '0x80', '0x0', '0x0', '0x10', '0x3', '0xf5', '0x1f'] < 'ACK' < ['0x6'] StatusEnquiry{05 01} {'password': '123456'} _[] ['0x10', '0x2', '0x5', '0x1', '0x3', '0x12', '0x34', '0x56', '0x10', '0x3', '0xe0', '0x43'] DEBUG: Cannot be represented: [] list index out of range < < [] Traceback (most recent call last): File "test_pt.py", line 40, in e.wait_for_status() File "/home/martin/Desktop/ecrterm/ecr.py", line 316, in wait_for_status status = self.status() File "/home/martin/Desktop/ecrterm/ecr.py", line 282, in status errors = self.transmit(StatusEnquiry()) File "/home/martin/Desktop/ecrterm/ecr.py", line 303, in transmit transmission = self.transmitter.transmit(packet) File "/home/martin/Desktop/ecrterm/transmission/_transmission.py", line 61, in transmit ret = self._transmit(packet, self.last_history) File "/home/martin/Desktop/ecrterm/transmission/_transmission.py", line 79, in _transmit success, response = self.transport.send(packet) File "/home/martin/Desktop/ecrterm/transmission/transport_serial.py", line 267, in send return self.send_message(SerialMessage(apdu), tries, no_wait) File "/home/martin/Desktop/ecrterm/transmission/transport_serial.py", line 261, in send_message raise common.TransportLayerException, "Unknown Acknowledgmenet Byte %s" % conv.bs2hl(acknowledge) ecrterm.common.TransportLayerException: Unknown Acknowledgmenet Byte []

g4borg commented 11 years ago

mhm, bevor ich was zu der frage selbst was sagen kann, die transport-layer-exception (unknown ack-byte) tritt dann genau in diesem falle auf? oder ist das einfach wegen dem time-out?

g4borg commented 11 years ago

man kann den fehler zumindest probieren abzufangen, und dann transmission.is_master auf True setzen, sowie is_waiting auf False - das wäre zumindest die hardcore variante. Ob das Terminal darauf reagiert weiss ich nicht.

Ich wundere mich jedoch, was eigentlich hier schief läuft.

g4borg commented 11 years ago

Ich sehe gerade, das is_master wird auch vor dem re-raise des Fehlers gemacht. ein auskommentieren des wait_for_status() in zeile 40 sollte das senden des StatusEnquirys jedoch komplett überspringen, sobald man abbrechen drückt.