示例#1
0
 def start(self, mqttc, trigger_thread_reload_cb=None, **kwargs):
     """Start the bus
     """
     if hasattr(self, "get_graph"):
         delattr(self, "get_graph")
     self._fsm = self.create_fsm()
     JNTBus.start(self, mqttc, trigger_thread_reload_cb, **kwargs)
     try:
         self._fsm_slow_start = self.nodeman.slow_start * len(self.get_components())
     except Exception:
         self._fsm_slow_start = self.nodeman.slow_start
         logger.info("[%s] - Can't set slow_start. Using default value %s", self.__class__.__name__, self._fsm_slow_start, exc_info=True)
     try:
         self._fsm_timer_delay = self.options.get_option(self.oid, 'fsm_timer_delay', default=self._fsm_timer_delay)
     except Exception:
         logger.info("[%s] - Can't set fsm_timer_delay from configuration file. Using default value %s", self.__class__.__name__, self._fsm_timer_delay, exc_info=True)
     try:
         self._fsm_max_retries = self.options.get_option(self.oid,'fsm_max_retries', default=self._fsm_max_retries)
     except Exception:
         logger.info("[%s] - Can't set fsm_max_retries from configuration file. Using default value %s", self.__class__.__name__, self._fsm_max_retries, exc_info=True)
     
     self._fsm_boot_lock.acquire()
     try:
         self.stop_boot_timer()
         logger.debug("[%s] - Will boot fsm in %s seconds", self.__class__.__name__, self._fsm_timer_delay + self._fsm_slow_start)
         self._fsm_boot_timer = threading.Timer(self._fsm_timer_delay + self._fsm_slow_start, self.on_boot_timer)
         self._fsm_boot_timer.start()
     except Exception:
         logger.exception("[%s] - Error when trying to boot fsm at try %s", self.__class__.__name__, self._fsm_retry)
     finally:
         self._fsm_boot_lock.release()
示例#2
0
 def start(self, mqttc, trigger_thread_reload_cb=None):
     """Start the bus
     """
     for bus in self.buses:
         self.buses[bus].start(mqttc, trigger_thread_reload_cb=None)
     JNTBus.start(self, mqttc, trigger_thread_reload_cb)
     self.on_check()
示例#3
0
 def start(self, mqttc, trigger_thread_reload_cb=None):
     """Start the bus
     """
     for bus in self.buses:
         self.buses[bus].start(mqttc, trigger_thread_reload_cb=None)
     JNTBus.start(self, mqttc, trigger_thread_reload_cb)
     self._statemachine = self.create_fsm()
示例#4
0
 def start(self, mqttc, trigger_thread_reload_cb=None):
     JNTBus.start(self, mqttc, trigger_thread_reload_cb)
     self.store = RrdStoreThread("datarrd_store", self.options.data)
     self.store.config_thread(cache_rrd_ttl=self.values["cache_rrd_ttl"].data,
             cache_pickle_ttl=self.values["cache_pickle_ttl"].data,
             cache_dead_ttl=self.values["cache_dead_ttl"].data)
     self.store.start()
示例#5
0
 def start(self, mqttc, trigger_thread_reload_cb=None):
     """Start the bus
     """
     for bus in self.buses:
         self.buses[bus].start(mqttc, trigger_thread_reload_cb=None)
     JNTBus.start(self, mqttc, trigger_thread_reload_cb)
     self.on_check()
示例#6
0
 def start(self, mqttc, trigger_thread_reload_cb=None):
     """Start the bus
     """
     JNTBus.start(self, mqttc, trigger_thread_reload_cb)
     try:
         self.mifare = nxppy.Mifare()
     except:
         logger.exception("Exception when starting NXP bus")
示例#7
0
 def start(self, mqttc, trigger_thread_reload_cb=None):
     """Start the bus
     """
     JNTBus.start(self, mqttc, trigger_thread_reload_cb)
     try:
         self.gpio = GPIO.get_platform_gpio()
     except Exception:
         logger.exception("[%s] - Exception when starting GPIO bus", self.__class__.__name__)
     self.update_attrs('gpio', self.gpio)
 def start(self, mqttc, trigger_thread_reload_cb=None):
     """Start the bus
     """
     directory = self.get_public_directory()
     for didir in CAMERA_DIR:
         ndir = os.path.join(directory, didir)
         if not os.path.exists(ndir):
             os.makedirs(ndir)
     JNTBus.start(self, mqttc, trigger_thread_reload_cb)
     try:
         if self.camera_acquire():
             self.camera = picamera.PiCamera()
             self.update_attrs("camera", self.camera)
         else:
             raise RuntimeError("Can't lock camera")
     except Exception:
         logger.exception("[%s] - Can't start component camera", self.__class__.__name__)
     finally:
         self.camera_release()
示例#9
0
 def start(self, mqttc, trigger_thread_reload_cb=None):
     JNTBus.start(self, mqttc, trigger_thread_reload_cb)
     self._server = HttpServerThread("http_server", self.options.data)
     self._server.config(host=self.values["host"].data, port=self.values["port"].data)
     self._server.start()
示例#10
0
 def start(self, mqttc, trigger_thread_reload_cb=None):
     JNTBus.start(self, mqttc, trigger_thread_reload_cb)
示例#11
0
 def start(self, mqttc, trigger_thread_reload_cb=None):
     JNTBus.start(self, mqttc, trigger_thread_reload_cb)
示例#12
0
 def start(self, mqttc, trigger_thread_reload_cb=None):
     """Start the bus
     """
     JNTBus.start(self, mqttc, trigger_thread_reload_cb)