From 6b37ae2b15eca92b3cacac0e113290eb28ccfa8b Mon Sep 17 00:00:00 2001
From: wu_xinjun <bent20140204@outlook.com>
Date: 星期一, 20 六月 2022 15:49:50 +0800
Subject: [PATCH] get pointclouds from client

---
 src/engine/devices.py |   36 ++++++++++++++++++++++++++++++++----
 1 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/src/engine/devices.py b/src/engine/devices.py
index 07f5d32..eb34a80 100644
--- a/src/engine/devices.py
+++ b/src/engine/devices.py
@@ -4,7 +4,7 @@
 import threading
 import numpy as np
 import os, sys
-from typing import List
+from typing import List, Union
 import queue
 from datetime import datetime
 
@@ -15,7 +15,8 @@
 
 from ..protos import aerial_pb2 as pb
 from .DustCleaner import DustCleaner
-from .MessageThreads import send_logs_tool, send_images_tool
+from .Microwave import micorwaveMannager
+from .MessageThreads import send_logs_tool, send_images_tool, send_pointcloud_tool
 
 
 ######################################### CAMERAS ############################################
@@ -144,9 +145,36 @@
 
 
 ######################################## MICROWAVE ###########################################
-class microwaveController(object):
-    pass
+class microwaveController(micorwaveMannager):
+    def __init__(self, 
+            MicrowaveHost: str, 
+            MicrowavePort: int, 
+            init_packet_threshold: Union[int, None], 
+            init_timeusage_threshold: Union[int, None],
+            device_id:str,
+            logs_queue:queue.Queue,
+            plys_queue:queue.Queue,
+            routing_key:str,
+            ):
+        super().__init__(MicrowaveHost, MicrowavePort)
+        self.device_id = device_id
+        self.plys_queue = plys_queue
+        self.routing_key = routing_key
+        # testing the device when instance the class
+        self._get_pointcloud(init_packet_threshold,init_timeusage_threshold)
 
+    def _get_pointcloud(self, 
+                    packet_threshold:Union[int, None],
+                    timeusage_threshold:Union[int, None]):
+        self._udp_get_thread_launcher(packet_threshold,timeusage_threshold)
+        self._udp2pointcloud_thread_launcher()
+        self._generate_msg()
+
+    def _generate_msg(self):
+        send_pointcloud_tool(pointclouds=self.pointcloud_queue,
+                            plys_queue=self.plys_queue,
+                            source=self.device_id,
+                            routing_key=self.routing_key+".plys.test0")
 
 ####################################### DUST CLEANER #########################################
 class dustCleanerController(DustCleaner):

--
Gitblit v1.9.1