Пример #1
0
class StatusGeneratorThread(BaseThread):

    def __init__(self, statuses_queue: queue.Queue):
        BaseThread.__init__(self)
        self._statuses_queue = statuses_queue
        self._generator = StatusGenerator(sensors.get_sensors())
        self._sampling_frequence = configmanager.config.getfloat('general', 'data_sampling_interval')

    def run(self):
        while self._continue:
            try:
                current_status = self._generator.get_current_status()
                self._statuses_queue.put(current_status)
                sleep(self._sampling_frequence)
            except:
                print("Unexpected error - Main")
                print(traceback.format_exc())
                break

        print("Status generator thread stopped!")
Пример #2
0
 def __init__(self, statuses_queue: queue.Queue):
     BaseThread.__init__(self)
     self._statuses_queue = statuses_queue
     self._generator = StatusGenerator(sensors.get_sensors())
     self._sampling_frequence = configmanager.config.getfloat('general', 'data_sampling_interval')