def ping():
            while True:
                if self.interlocking:
                    self.logger.debug("Pinging back interlocking server")
                    try:
                        self.interlocking.remotePing()
                    except Pyro4.errors.CommunicationError:
                        self.interlocking = None
                else:
                    # Try to reestablish connection to interlocking server
                    self.logger.debug("Trying to reestablish connection to interlocking server...")
                    try:
                        self.interlocking = Pyro4.Proxy(self.interlocking_pyroname)
                        self.interlocking.remotePing()
                        self.interlocking.registerSwitchboard(self)
                    except Pyro4.errors.PyroError:
                        self.logger.debug("Unsuccessfully tried to reestablish connection to interlocking server.")
                        self.interlocking = None

                if self.interlocking:
                    tpub.sendMessage("InterlockingCom.connection.established")
                else:
                    tpub.sendMessage("InterlockingCom.connection.error")

                time.sleep(self.pingInterval)
示例#2
0
    def readConfig(self):
        logger.info("Opening config file {}".format(CONFIG_FILE))

        # Load the configuration file
        if len(self.configParser.read(CONFIG_FILE)) == 0:
            tpub.sendMessage('model.config.file.error')
            logger.critical("Could NOT open config file {}".format(CONFIG_FILE))
            return

        try:
            for name in self.options:
                self.options[name] = self.configParser.get('projector', name)
                logger.debug('config:  %-15s = %r' % (name, self.options[name]))
        except ConfigParser.Error as e:
            tpub.sendMessage('model.config.file.error')
            logger.critical("Error while parsing config file {}: {}".format(CONFIG_FILE, e))
            self.configured = False
            return

        self.configured = True
        tpub.sendMessage('model.config.file.ok')
        logger.info("config file {} parsed sucessfully".format(CONFIG_FILE))
 def callback(self, topic, **kwargs):
     tpub.sendMessage(topic, **kwargs)
示例#4
0
 def announce_cooling(self):
     tpub.sendMessage('model.cooling.inprogress')
     logger.debug("Announcing: Cooling")
示例#5
0
 def announce_coolingFinished(self):
     tpub.sendMessage('model.cooling.finished')
     logger.debug("Announcing: Cooling finished")
示例#6
0
 def announce_shutterClosed(self):
     tpub.sendMessage('model.shutter.closed')
     logger.debug("Announcing: Shutter closed")
示例#7
0
 def announce_shutterOpen(self):
     tpub.sendMessage('model.shutter.open')
     logger.debug("Announcing: Shutter open")
示例#8
0
 def announce_unpowered(self):
     tpub.sendMessage('model.power.off')
     logger.debug("Announcing: Power OFF")
示例#9
0
 def announce_powered(self):
     tpub.sendMessage('model.power.on')
     logger.debug("Announcing: Power ON")
示例#10
0
 def announce_erroneousResponse(self):
     tpub.sendMessage('model.response.error')
     logger.debug("Announcing: Error in projector response")
示例#11
0
 def announce_connection(self):
     tpub.sendMessage('model.connection.ok')
     logger.debug("Announcing: connection established")
示例#12
0
 def announce_noConnection(self):
     tpub.sendMessage('model.connection.error')
     logger.debug("Announcing: no connection established")