| | |
| | | import queue |
| | | import requests |
| | | import time |
| | | import threading |
| | | |
| | | from .CaptureThread import CaptureThread |
| | | from .ControllThread import ControllThread |
| | |
| | | # connecting to camera via opencv |
| | | cc.open_cameras() |
| | | # capture the data, and wrap it to data queue |
| | | cc._start_captureThread() |
| | | pass |
| | | # cc._start_captureThread() |
| | | |
| | | |
| | | def connecting_microwave(self): |
| | | pass |
| | |
| | | |
| | | |
| | | def run_all(self): |
| | | |
| | | # connecting to MQ server,launching the message delivery queues |
| | | self.run_rabbitmq() |
| | | # connecting to devices and wrap data to the corressponding queue |
| | | self.run_device() |
| | | |
| | | def stop_all(self): |
| | | self._stop_alarm_state_up_msg_sender_thread() |
| | | self._stop_device_state_up_msg_sender_thread() |
| | | self._stop_command_request_receiver_thread() |
| | | self._start_command_response_sender_thread() |
| | | |
| | | |
| | | def start(self): |
| | | self.run_all() |
| | | try: |
| | | self.run_all() |
| | | self._device_state_sender_thread.join() |
| | | except Exception as e: |
| | | print("running error, stop all threads") |
| | | |
| | | self._stop_alarm_state_up_msg_sender_thread() |
| | | self.stop |
| | | print("main thread end.") |
| | | |
| | | |
| | | |
| | | |
| | | |