def start_cashout(self): # Create a new object ( Validator Object ) and initialize it print("Start cashin lol") self.validator = eSSP(com_port=self._validator_port, ssp_address="0", nv11=False, debug=True)
def _start_cashin(self): # Create a new object ( Validator Object ) and initialize it print("Start cashin lol") validator = eSSP(com_port=self._validator_port, ssp_address="0", nv11=False, debug=True) global i EsspCashinDriver._setup_validator(validator) while not self._stop_cashin.is_set(): last_event = validator.get_last_event() if last_event is None: continue (note, currency, event) = last_event if event == Status.SSP_POLL_CREDIT: if note not in EsspCashinDriver._MAP_CHANNEL_NOTES.keys(): continue value = EsspCashinDriver._MAP_CHANNEL_NOTES[note] self._callback_message("CHF:{}".format(value)) EsspCashinDriver._close_validator(validator)
def __init__(self, device = '/dev/ttyACM0', inhibits_mask = [1, 1, 1, 0, 0, 0]): self._logger = logging.getLogger(__name__) self._eSSP = eSSP.eSSP(device) self._inhibits_mask = inhibits_mask self._inhibits = [0, 0, 0, 0, 0, 0] self._eSSP.sync() self._eSSP.enable_higher_protocol() self._channelvalues = self._eSSP.channel_values()[1] self._thread = threading.Thread(target = self._run) self._keep_running = True self._essp_lock = threading.RLock() self._poll_queue = Queue.Queue(5) self._thread.setDaemon(True) self._thread.start()
def __init__(self, device='/dev/ttyACM0', inhibits_mask=[1, 1, 1, 0, 0, 0]): self._logger = logging.getLogger(__name__) self._eSSP = eSSP.eSSP(device) self._inhibits_mask = inhibits_mask self._inhibits = [0, 0, 0, 0, 0, 0] self._eSSP.sync() self._eSSP.enable_higher_protocol() self._channelvalues = self._eSSP.channel_values()[1] self._thread = threading.Thread(target=self._run) self._keep_running = True self._essp_lock = threading.RLock() self._poll_queue = Queue.Queue(5) self._thread.setDaemon(True) self._thread.start()
import eSSP import time k = eSSP.eSSP('/dev/ttyACM1') #print k.sync() #print k.serial_number() #print k.enable() #print k.bulb_on() #print k.bulb_off() #print k.enable_higher_protocol() #print k.poll() #print k.set_inhibits('0xFF', '0xFF') #print k.set_inhibits(k.easy_inhibit([1, 0, 1]), '0x00') #print k.unit_data() #print k.setup_request(); #k.disable(); #k.reset(); #print k.channel_security(); #print k.channel_values(); #print k.channel_reteach(); print 'sync' print k.sync() print 'higher protocol' print k.enable_higher_protocol() print 'serial' print k.serial_number() print 'enable' print k.enable() print 'generator' print k.set_generator()
import eSSP import time k = eSSP.eSSP('/dev/ttyACM0') #print k.sync() #print k.serial_number() #print k.enable() #print k.bulb_on() #print k.bulb_off() #print k.enable_higher_protocol() #print k.poll() #print k.set_inhibits('0xFF', '0xFF') #print k.set_inhibits(k.easy_inhibit([1, 0, 1]), '0x00') #print k.unit_data() #print k.setup_request(); #k.disable(); #k.reset(); #print k.channel_security(); #print k.channel_values(); #print k.channel_reteach(); print k.sync() print k.enable_higher_protocol() print k.set_inhibits('0x3F', '0x00') print k.enable() var = 1 i = 0 while var == 1: poll = k.poll() print "Poll"
from datetime import datetime from daemon import Daemon import subprocess import eSSP import time # Figure out which /dev to listen to. sort_bv = os.path.expanduser('~/laundry_prog/find_bv.sh') usb = subprocess.check_output([sort_bv]) print "\nThis is USB:", usb[:-1] # k = eSSP.eSSP('/dev/tty.usbmodemfa131') k = eSSP.eSSP(usb[:-1]) # print k.sync() # print k.serial_number() # print k.enable() # print k.bulb_on() # print k.bulb_off() # print k.enable_higher_protocol() # print k.poll() # print k.set_inhibits('0xFF', '0xFF') # print k.set_inhibits(k.easy_inhibit([1, 0, 1]), '0x00') # print k.unit_data() # print k.setup_request(); # k.disable(); # k.reset(); # print k.channel_security(); # print k.channel_values();
import eSSP import time k = eSSP.eSSP('/dev/ttyACM0') #print k.sync() #print k.serial_number() #print k.enable() #print k.bulb_on() #print k.bulb_off() #print k.enable_higher_protocol() #print k.poll() #print k.set_inhibits('0xFF', '0xFF') #print k.set_inhibits(k.easy_inhibit([1, 0, 1]), '0x00') #print k.unit_data() #print k.setup_request(); #k.disable(); #k.reset(); #print k.channel_security(); #print k.channel_values(); #print k.channel_reteach(); print k.sync() print k.enable_higher_protocol() print k.set_inhibits(k.easy_inhibit([1, 0, 1]), '0x00') print k.enable() var = 1 i = 0 while var == 1: poll = k.poll() print "Poll"
def bv_port(looker): # Find the port for the BV find_bv = os.path.expanduser(looker) bv = subprocess.check_output([find_bv]) print "\nThis is the port for the Bill Validator:", bv[:-1] return eSSP.eSSP(bv[:-1])
usb = subprocess.check_output([arduino]) print "This is the port for the RFID antenna:", usb[:-1] return serial.Serial(usb[:-1], 115200, timeout = 0.1, bytesize=serial.EIGHTBITS) if sys.platform.startswith('darwin'): mpath = os.path.expanduser('~/raspy/find_bv.sh') k = bv_port(mpath) mpath = os.path.expanduser('~/raspy/find_arduino.sh') ser = arduino_port(mpath) # Find the port for the BV find_bv = os.path.expanduser('~/raspy/find_bv.sh') bv = subprocess.check_output([find_bv]) print "\nThis is the port for the Bill Validator:", bv[:-1] k = eSSP.eSSP(bv[:-1]) elif sys.platform.startswith('linux'): # Find the port for the BV k = bv_port("~/laundry_prog/find_bv.sh") # Find the port for the RFID returns Serial instance station_arduino = arduino_port("~/laundry_prog/find_arduino.sh") # Set screen width in characters SCREEN_WIDTH = 16 # Initialize serial connection disp = serial.Serial(port='/dev/ttyAMA0', baudrate=19200)
import threading from eSSP.constants import Status from eSSP import eSSP # Import the library from time import sleep # Create a new object ( Validator Object ) and initialize it ( In debug mode, so it will print debug infos ) validator = eSSP(com_port="/dev/ttyUSB0", ssp_address="0", nv11=False, debug=True) def event_loop(): while True: # ---- Example of interaction with events ---- # if validator.nv11: # If the model is an NV11, put every 100 note in the storage, and others in the stack(cashbox), but that's just for this example (note, currency,event) = validator.get_last_event() if note == 0 or currency == 0 or event == 0: pass # Operation that do not send money info, we don't do anything with it else: if note != 4 and event == Status.SSP_POLL_CREDIT: validator.print_debug("NOT A 100 NOTE") validator.nv11_stack_next_note() validator.enable_validator() elif note == 4 and event == Status.SSP_POLL_READ: validator.print_debug("100 NOTE") validator.set_route_storage(100) # Route to storage validator.do_actions() validator.set_route_cashbox(50) # Everything under or equal to 50 to cashbox ( NV11 ) sleep(0.5) t1 = threading.Thread(target=event_loop) # Create a new thread on the Validator System Loop ( needed for the signal ) t1.setDaemon(True) # Set the thread as daemon because it don't catch the KeyboardInterrupt, so it will stop when we cut the main thread t1.start() # Start the validator system loop thread ( Needed for starting sending action )