Allow to pass password via ECR class
This commit is contained in:
parent
b05e88f9d1
commit
b3e3ea6ef0
1 changed files with 6 additions and 5 deletions
11
ecr.py
11
ecr.py
|
@ -124,7 +124,7 @@ class ECR(object):
|
||||||
#!: Last is a short access for transmitter.last if possible.
|
#!: Last is a short access for transmitter.last if possible.
|
||||||
last = property(__get_last)
|
last = property(__get_last)
|
||||||
|
|
||||||
def __init__(self, device='/dev/ttyUSB0'):
|
def __init__(self, device='/dev/ttyUSB0', password='123456'):
|
||||||
"""
|
"""
|
||||||
Initializes an ECR object and connects to the serial device given
|
Initializes an ECR object and connects to the serial device given
|
||||||
Fails if Serial Device is not found.
|
Fails if Serial Device is not found.
|
||||||
|
@ -141,6 +141,7 @@ class ECR(object):
|
||||||
# we save some states here.
|
# we save some states here.
|
||||||
self._state_registered = False
|
self._state_registered = False
|
||||||
self._state_connected = False
|
self._state_connected = False
|
||||||
|
self.password = password
|
||||||
|
|
||||||
if self.transport.connect():
|
if self.transport.connect():
|
||||||
self.transmitter = transmission.Transmission(self.transport)
|
self.transmitter = transmission.Transmission(self.transport)
|
||||||
|
@ -153,7 +154,7 @@ class ECR(object):
|
||||||
registers this ECR at the PT, locking menus
|
registers this ECR at the PT, locking menus
|
||||||
for real world conditions.
|
for real world conditions.
|
||||||
"""
|
"""
|
||||||
ret = self.transmit(Registration())
|
ret = self.transmit(Registration(password=self.password))
|
||||||
|
|
||||||
if ret == TRANSMIT_OK:
|
if ret == TRANSMIT_OK:
|
||||||
# get the terminal-id if its there.
|
# get the terminal-id if its there.
|
||||||
|
@ -173,7 +174,7 @@ class ECR(object):
|
||||||
do not use in production environment.
|
do not use in production environment.
|
||||||
"""
|
"""
|
||||||
ret = self.transmit(
|
ret = self.transmit(
|
||||||
Registration(
|
Registration(password=self.password,
|
||||||
config_byte=Registration.generate_config(
|
config_byte=Registration.generate_config(
|
||||||
ecr_controls_admin=False),))
|
ecr_controls_admin=False),))
|
||||||
if ret == TRANSMIT_OK:
|
if ret == TRANSMIT_OK:
|
||||||
|
@ -209,7 +210,7 @@ class ECR(object):
|
||||||
#old_histoire = self.transmitter.history
|
#old_histoire = self.transmitter.history
|
||||||
#self.transmitter.history = []
|
#self.transmitter.history = []
|
||||||
# we send the packet
|
# we send the packet
|
||||||
result = self.transmit(EndOfDay())
|
result = self.transmit(EndOfDay(self.password))
|
||||||
# now save the log
|
# now save the log
|
||||||
self.daylog = self.last_printout()
|
self.daylog = self.last_printout()
|
||||||
|
|
||||||
|
@ -316,7 +317,7 @@ class ECR(object):
|
||||||
to check for the status code:
|
to check for the status code:
|
||||||
common.TERMINAL_STATUS_CODES.get( status, 'Unknown' )
|
common.TERMINAL_STATUS_CODES.get( status, 'Unknown' )
|
||||||
"""
|
"""
|
||||||
errors = self.transmit(StatusEnquiry())
|
errors = self.transmit(StatusEnquiry(self.password))
|
||||||
if not errors:
|
if not errors:
|
||||||
if isinstance(self.last.completion, Completion):
|
if isinstance(self.last.completion, Completion):
|
||||||
# try to get version
|
# try to get version
|
||||||
|
|
Loading…
Reference in a new issue