wu_xinjun
2022-06-20 6b37ae2b15eca92b3cacac0e113290eb28ccfa8b
src/engine/Microwave.py
@@ -3,9 +3,10 @@
import time
from datetime import datetime
from typing import Union
import threading
from .MessageThreads import send_logs_tool
from ..microwave.servers import MicroWaveUDPThread
from ..microwave.servers import MicroWaveUDPThread,UDP2PointcloudThread
class micorwaveMannager(object):
@@ -13,43 +14,47 @@
    def __init__(self,
            MicrowaveHost:str,
            MicrowavePort:int,
            packet_threshold:Union[int, None],
            timeusage_threshold:Union[int, None]
                ):
            ):
        # microwave
        self.MicrowaveHost = MicrowaveHost
        self.MicrowavePort = MicrowavePort
        # udp get
        self.packet_threshold = packet_threshold
        self.timeusage_threshold = timeusage_threshold
        self._udp_get_thread = None
        # self.packet_threshold = packet_threshold
        # self.timeusage_threshold = timeusage_threshold
        self.udp_queue = queue.Queue()
        self.udp_get_stop = {"value":False}
        self.udp_get_stop = threading.Event()
        self._udp_get_thread_name = "Thread-UDPGet"
        # udp to pointcloud
        self._udp2pointcloud_thread = None
        self.pointcloud_queue = queue.Queue()
        self._udp2pointcloud_thread_name = "Thread-UDP2PointCloud"
        
    def _udp_get_thread_launcher(self):
    def _udp_get_thread_launcher(self,
                    packet_threshold:Union[int, None],
                    timeusage_threshold:Union[int, None]):
        self.udp_get_stop.clear()
        self._udp_get_thread = MicroWaveUDPThread(MicrowaveHost=self.MicrowaveHost,
                            MicrowavePort=self.MicrowavePort,
                            udp_queue=self.udp_queue,
                            udp_get_stop=self.udp_get_stop,
                            packet_threshold=self.packetThreshold,
                            timeusage_threshold=self.timeusage_threshold)
                            packet_threshold=packet_threshold,
                            timeusage_threshold=timeusage_threshold)
        self._udp_get_thread.setDaemon(True)
        self._udp_get_thread.setName(self._udp_get_thread_name)
        self._udp_get_thread.start()
    def _udp2pointcloud_thread_launcher(self):
        pass
        self._udp2pointcloud_thread = UDP2PointcloudThread(
                                        udp_queue = self.udp_queue,
                                        pointcloud_queue=self.pointcloud_queue
                                        )
        self._udp2pointcloud_thread.setDaemon(True)
        self._udp2pointcloud_thread.setName(self._udp2pointcloud_thread_name)
        self._udp2pointcloud_thread.start()