def __init__ (self, model, device, timeout = 0.5):
		
		Service.__init__(self)
		try:
			self.__dispenser = DispenserAdapter(dispenser_model = model, port = device, timeout = timeout)
		except Exception, e:
			self.__dispenser = None
			self.io.error(1, e)
Example #2
0
    def __init__(self, device, baudrate, timeout=0):

        Service.__init__(self)

        self.timeout = timeout
        try:
            self.adapter = Cashcode_T1500(device, baudrate, .1)
            self.adapter.connect()
        except Exception as e:
            self.io.error(1, e)
            self.adapter = None
Example #3
0
	def __init__ (self, device, baudrate, timeout = 0):
		
		Service.__init__(self)
		
		self.timeout = timeout
		try:
			self.adapter = Cashcode_T1500(device, baudrate, .1)
			self.adapter.connect()
		except Exception as e:
			self.io.error(1, e)
			self.adapter = None
Example #4
0
def main(*args, **kwargs):

    connector = WiFiAutoConnector()

    while not connector.has_connectivity() and not connector.try_to_connect():
        logging.warning("Has no connectivity, will try again after 3s")
        time.sleep(3)

    tsd = TSD(intfops=[WiFiIntfOps()])

    web = Service(1, "Web", "Web", 8000, "tcp")
    ssh = Service(2, "SSH", "SSH", 22, "tcp")

    while tsd.start_service([web, ssh]) == False:
        #retry after 3s
        logging.warning("Fail to become hotspot, will try again after 3s")
        time.sleep(3)

    print raw_input("Press any key to stop service")
    tsd.stop_service()

    connector.disconnect()