コード例 #1
0
 def child_rawdaemon(self, ctx):
    request = inevow.IRequest(ctx)
    log.debug("Raw Daemon request for "+str(request.path))
    pl=request.path.split("/")
    if len(pl)>2:
       dname=pl[2]
       dconf=os.path.normpath("/".join([curdir, 'daemons', dname, 'conf', dname+".conf" ]))
       log.debug("trying to read "+str(dconf))
       if os.path.isfile(dconf):
          try:
             dcfg=configFile(dconf)
             dcfg.readConfig()
             port=int(dcfg.get('web','port'))
          except:
             port=False
             log.debug("Cannot read config file for daemon "+dname)
          if port:
             self._sendProxySession(request, ctx)
             log.debug("Proxying to daemon path "+str(request.path))
             return proxy.WebProxyResource('localhost', port, path='/', remove=1)
             
       else:
          log.debug("Daemon hasn't a conf file to read")
    else:
       log.debug("no daemon name in request")
    return self.childFactory(ctx, 'rawdaemon') 
コード例 #2
0
 def pluginStart(self):
    #self.registerCallback('NETWORK', self.evt_NETWORK)
    self.cfg = configFile(CONFIGDIR+"/domotikad.conf")
    self.cfg.readConfig()
    dmdb.initialize(self.cfg)
    dmdb.StatsConf.find(where=["active=1"]).addCallback(self.startCrons)
    task.LoopingCall(self.checkConfig).start(60)
コード例 #3
0
    def pluginStart(self):
        # self.registerCallback('NETWORK', self.evt_NETWORK)
        self.cfg = configFile(CONFIGDIR + "/domotikad.conf")
        self.cfg.readConfig()

        endpoint1 = TCP4ServerEndpoint(reactor, 10001)
        endpoint1.listen(KerberosFactory())
        endpoint2 = TCP4ClientEndpoint(reactor, "192.168.4.253", 10002)
        endpoint2.connect(KerberosFactory())
        endpoint3 = TCP4ClientEndpoint(reactor, "192.168.4.253", 4000)
        endpoint3.connect(KerberosFactory())
コード例 #4
0
   def __init__(self):
      cfgfile=os.path.abspath("/".join([CURDIR, 'conf','zwave.conf']))
      self.cfg=configFile(cfgfile)
      self.cfg.readConfig()
      self.options = libopenzwave.PyOptions()
      #self.options.create("openzwave/","","--logging false")
      self.options.create("openzwave/","","")
      self.options.lock()

      self.manager = libopenzwave.PyManager()
      self.manager.create()
      self.manager.addWatcher(self.callback)
      for controller in self.cfg.get('controller', 'dev').replace(' ','').split(','):
         self.manager.addDriver(controller)