コード例 #1
0
ファイル: listener.py プロジェクト: bibi21000/janitoo_flask
 def run(self):
     """The running method
     """
     #~ print "*"*25, "start the listener"
     logger.info("Start listener")
     self.boot()
     self.network.boot(self.hadds)
     Controller.start_controller(self, self.section, self.options, cmd_classes=[COMMAND_DHCPD], hadd=self.hadds[0], name="Webapp Server",
         product_name="Webapp Server", product_type="Webapp Server")
     self._stopevent.wait(1.0)
     Controller.start_controller_timer(self)
     while not self._stopevent.isSet():
         self._stopevent.wait(self.loop_sleep)
     if self.network is not None:
         self.network.stop()
コード例 #2
0
ファイル: listener.py プロジェクト: bibi21000/janitoo_flask
 def stop(self):
     """Stop the tread
     """
     #~ print("*"*25, "stop the listener")
     Controller.stop_controller_timer(self)
     Controller.stop_controller(self)
     logger.info("Stop listener")
     self._stopevent.set()
     if self.network is not None:
         #~ print("*"*25, "stop the network")
         self.network.stop()
     for i in range(100):
         if self.network.is_stopped:
             break
         else:
             self._stopevent.wait(0.1)
     self.network = None
コード例 #3
0
ファイル: listener.py プロジェクト: bibi21000/janitoo_flask
 def __init__(self, _app, options):
     """The constructor"""
     #~ print "*"*25, "init the listener"
     threading.Thread.__init__(self)
     self._stopevent = threading.Event( )
     self.app = _app
     self.section="webapp"
     self.mqttc = None
     self.options = JNTOptions(options)
     self.hadds = {}
     self.network = None
     self.create_network()
     Controller.__init__(self, self.network)
     self.loop_sleep = 0.25
     loop_sleep = self.options.get_option('system','loop_sleep', self.loop_sleep)
     if loop_sleep is not None:
         self.loop_sleep = loop_sleep
     else:
         logger.debug("[%s] - Can't retrieve value of loop_sleep. Use default value instead (%s)", self.__class__.__name__, self.loop_sleep)
     self.extend_from_entry_points('janitoo_flask')