Example #1
0
class NFCDaemon(Daemon):
  def __init__(self, pidfile):
    super( NFCDaemon, self ).__init__(pidfile)

    # Logging 
    self.logger = logging.getLogger(__name__)
    self.logger.setLevel(logging.INFO)
    # handler = logging.FileHandler('hello.log')
    # handler.setLevel(logging.INFO)
    # self.logger.addHandler(handler)

    self.nfc = NFCInterface(self.logger)
    self.nfcsocket = NFCSocket('/tmp/nfcdaemon', self.nfc, self.logger)

  def socket_thread(self):
    self.nfcsocket.start()

  def nfc_thread(self):
    self.nfc.start()

  def run(self):
    # Please don't ask why I have to have whole
    # separate class functions for these object calls,
    # but it don't work if I don't do it like this.
    ta = threading.Thread( target=self.nfc_thread )
    tb = threading.Thread( target=self.socket_thread )

    ta.start()
    tb.start()
Example #2
0
  def __init__(self, pidfile):
    super( NFCDaemon, self ).__init__(pidfile)

    # Logging 
    self.logger = logging.getLogger(__name__)
    self.logger.setLevel(logging.INFO)
    # handler = logging.FileHandler('hello.log')
    # handler.setLevel(logging.INFO)
    # self.logger.addHandler(handler)

    self.nfc = NFCInterface(self.logger)
    self.nfcsocket = NFCSocket('/tmp/nfcdaemon', self.nfc, self.logger)