From e1f883778b1a51241a018a7f0c5918f91026aae7 Mon Sep 17 00:00:00 2001
From: wu_xinjun <bent20140204@outlook.com>
Date: 星期一, 07 三月 2022 17:19:24 +0800
Subject: [PATCH] read change log and readme.md

---
 src/protos/aerial.proto      |  195 +++++++++++++++++++++-----------------
 src/engine/MessageThreads.py |   35 ++++---
 src/engine/devices.py        |    1 
 README.md                    |   20 +---
 4 files changed, 134 insertions(+), 117 deletions(-)

diff --git a/README.md b/README.md
index ff25d9a..b12bded 100644
--- a/README.md
+++ b/README.md
@@ -1,18 +1,8 @@
 # 鍗庤兘鐓ゅ爢瀹炴椂涓夌淮閲嶅缓閲囬泦绔拰鏈嶅姟绔�
 
-## 杩愯鐜
+## TODO
 
-1. Python鐗堟湰锛�3.9
-2. 绗笁鏂瑰寘锛歠lask pika protobuf
-
-## 鍒涘缓鐜
-
-Just click ```JustDoubleClickMe.bat``` file to auto setiing the env, which is located in the ```env``` folder.
-
-## 杩愯閲囬泦绔�  
-
-Double click to run  ```startClient.bat```
-
-## 杩愯鏈嶅姟绔�
-
-Double click to run  ```startServer.bat```
+1. 鏍规嵁proto鏁版嵁缁撴瀯锛岄噸鏂颁紭鍖杝rc\engine\MessageThreads.py鐨勭浉鍏冲唴瀹癸紱
+2. 閲囬泦绔細淇敼src\engine\devices.py鍐呯殑鐩告満鐨勬暟鎹噰闆嗙嚎绋嬶紱
+3. 鏈嶅姟绔細澧炲姞鍥惧儚鏁版嵁鐨勬秷鎭В鏋愶紱
+4. src\engine\MessageThreads.py鍐呮坊鍔犳暟鎹彂閫佸拰鎺ユ敹绾跨▼銆�
\ No newline at end of file
diff --git a/src/engine/MessageThreads.py b/src/engine/MessageThreads.py
index 1e0da3f..903dea8 100644
--- a/src/engine/MessageThreads.py
+++ b/src/engine/MessageThreads.py
@@ -13,13 +13,13 @@
 
 
 
-class Message(object):
-    def __init__(self,sender_id,sender_key,body,routing_key):
-        self.sender_id = sender_id
-        self.sender_key = sender_key
-        self.body = body
-        self.routing_key = routing_key
-
+# class Message(object):
+#     def __init__(self,sender_id,sender_key,body,routing_key):
+#         self.sender_id = sender_id
+#         self.sender_key = sender_key
+#         self.body = body
+#         self.routing_key = routing_key
+# 鏍规嵁鏂扮殑鏁版嵁缁撴瀯鏀瑰啓run
 class senderThread(threading.Thread):
     def __init__(self, MQparameters,input_msg_queue,sender_id,exchangeName,exchangeType):
         super(senderThread,self).__init__()
@@ -48,7 +48,6 @@
                         data= self.queue.get()
                         if isinstance(data, pb.CapturedData):
                             msg = pb.DataMessage()
-                            msg.
                         else:
                             body = msg.body
                             routing_key = msg.routing_key
@@ -64,6 +63,7 @@
                     print(e)
                     break
 
+# 鏍规嵁鏂扮殑鏁版嵁缁撴瀯鏀瑰啓run
 class receiverThread(threading.Thread):
     def __init__(self, MQparameters,received_msg_queue,output_response_queue,exchangeName,exchangeType,receiver_id):
         super(receiverThread,self).__init__()
@@ -103,6 +103,7 @@
         raise NotImplementedError(
             "Need to implement the callback function")
 
+# 鏍规嵁rabbitmq閲嶆柊璁剧疆娑堟伅鍙傛暟
 class device_state_senderThread(senderThread):
     def __init__(self, 
         MQparameters,
@@ -116,7 +117,7 @@
                     "device_state",
                     "fanout"
                    )
-
+# 鏍规嵁rabbitmq閲嶆柊璁剧疆娑堟伅鍙傛暟
 class device_state_receiverThread(receiverThread):
     def __init__(self, 
         MQparameters,
@@ -135,7 +136,7 @@
         response_tag = f"{time.asctime()} received: {body}."
         print(response_tag)
         ch.basic_ack(delivery_tag = method.delivery_tag)
-
+# 鏍规嵁rabbitmq閲嶆柊璁剧疆娑堟伅鍙傛暟
 class alarm_state_senderThread(senderThread):
     def __init__(self, 
         MQparameters,
@@ -149,7 +150,7 @@
                     "alarm_state",
                     "fanout"
                    )
-    
+    # 鏍规嵁rabbitmq閲嶆柊璁剧疆娑堟伅鍙傛暟
 class alarm_state_receiverThread(receiverThread):
     def __init__(self, 
         MQparameters,
@@ -168,7 +169,7 @@
         response_tag = f"{time.asctime()} received: {body}."
         print(response_tag)
         ch.basic_ack(delivery_tag = method.delivery_tag)
-
+# 鏍规嵁rabbitmq閲嶆柊璁剧疆娑堟伅鍙傛暟
 class command_request_senderThread(senderThread):
     def __init__(self, 
         MQparameters,
@@ -182,7 +183,7 @@
                     "command_request",
                     "topic"
                    )
-
+# 鏍规嵁rabbitmq閲嶆柊璁剧疆娑堟伅鍙傛暟
 class command_request_receiverThread(receiverThread):
     def __init__(self, 
         MQparameters,
@@ -206,7 +207,7 @@
         print(response_tag)
         self.response_queue.put(Message(self.receiver_id,self.receiver_id,response_tag,''))
         ch.basic_ack(delivery_tag = method.delivery_tag)
-
+# 鏍规嵁rabbitmq閲嶆柊璁剧疆娑堟伅鍙傛暟
 class command_response_senderThread(senderThread):
     def __init__(self, 
         MQparameters,
@@ -220,7 +221,7 @@
                     "command_response",
                     "fanout"
                    )
-
+# 鏍规嵁rabbitmq閲嶆柊璁剧疆娑堟伅鍙傛暟
 class command_response_receiverThread(receiverThread):
     def __init__(self, 
         MQparameters,
@@ -240,6 +241,7 @@
         ch.basic_ack(delivery_tag = method.delivery_tag)
 
 
+# TODO
 class image_data_senderThread(senderThread):
     def __init__(self, 
         MQparameters,
@@ -254,6 +256,9 @@
                     "fanout"
                    )
 
+class image_data_receiverThread(receiverThread):
+    pass
+
 
 
 
diff --git a/src/engine/devices.py b/src/engine/devices.py
index a61b5bf..cb1b5e2 100644
--- a/src/engine/devices.py
+++ b/src/engine/devices.py
@@ -94,6 +94,7 @@
         """stop the thread"""
         self.is_stop = True
 
+# TODO鏍规嵁鏂扮殑鏁版嵁缁撴瀯淇敼闃熸秷鎭槦鍒椼��
     def run(self):
         print("CaptureThread started")
         encode_param = [int(cv2.IMWRITE_JPEG_QUALITY), self.image_quality]
diff --git a/src/protos/aerial.proto b/src/protos/aerial.proto
index 4ed8048..6929336 100644
--- a/src/protos/aerial.proto
+++ b/src/protos/aerial.proto
@@ -81,8 +81,7 @@
   string capture_device =2;                   // 閲囬泦璁惧
   int32 capture_port = 3;                     // 閲囬泦璁惧搴忓彿
   DataField DataField = 4;
-  string data_type = 5;                         // 閲囬泦鏁版嵁
-
+  string data_type = 5;                         // 鏁版嵁绫诲瀷 image udp
 }
 
 message DataMessage{
@@ -90,105 +89,127 @@
   string sending_device = 2;
   string target_device = 3;
   CapturedData CapturedData = 5;
-  
+}
+
+message StateData {
+ int64 state_time = 1;
+ string state_device = 2;
+ DataField DataField = 4;
+}
+
+message StateMessage {
+  int64 sending_time = 1;
+  string sending_device = 2;
+  string target_device = 3;
+  CapturedData StatedData = 5;
+}
+
+message CommandData {
+  SysCommand SysCommand = 1;
+  SubCommand SubCommand = 2;
 }
 
 message CommandMessage {
-
-}
-
-
-
-message ImagesMessage
-{
-  bytes image1  = 1;
-  bytes image2  = 2;
-  bytes image3  = 3;
-  bytes image4  = 4;
-  bytes image5  = 5;
-}
-
-message MicroWaveMessage
-{
-  int32 length = 1;                           // 鏁版嵁闀垮害
-  bytes data = 2;                            // 鏁版嵁鍐呭
-}
-
-message CommandRequest{
-
-}
-
-message StateMessage{
-  string message_type = 1;
-  int64 generate_time = 2;
-  string generate_device = 3;
-  string target_device = 4;
-  string message_uuid = 5;
-  string str_body = 6;
+  int64 sending_time = 1;
+  string sending_device = 2;
+  string target_device = 3;
+  CommandData CommandData =4;
 }
 
 
 
 
 
+// message ImagesMessage
+// {
+//   bytes image1  = 1;
+//   bytes image2  = 2;
+//   bytes image3  = 3;
+//   bytes image4  = 4;
+//   bytes image5  = 5;
+// }
 
-message RequestCommand {
-  int32 sync_word = 1;              // 鍚屾瀛�
-  string device_id = 2;             // 璁惧ID
-  SysCommand sys_command = 3;       // 鍛戒护1
-  SubCommand sub_command = 4;       // 鍛戒护2
-  DataField data1 = 5;              // 鏁版嵁1
-  DataField data2 = 6;              // 鏁版嵁2
-  int32 checksum = 7;               // 鏍¢獙鐮�
-}
+// message MicroWaveMessage
+// {
+//   int32 length = 1;                           // 鏁版嵁闀垮害
+//   bytes data = 2;                            // 鏁版嵁鍐呭
+// }
 
-enum ResponseState
-{
-  SUCCESS = 0;                  // 鎴愬姛
-  FAILURE = 1;                  // 澶辫触
-  ABNORMAL = 2;                 // 寮傚父
-  INFICIENT_POWER = 3;          // 鐢甸噺涓嶈冻
-  OTHER = 4;                    // 鍏朵粬
-}
+// message CommandRequest{
 
-message ResponseCommand
-{
-    string device_id = 1;        // 璁惧ID
-    SysCommand sys_command = 2;  // 鍛戒护1
-    SubCommand sub_command = 3;  // 鍛戒护2
-    ResponseState state = 4;     // 鍝嶅簲鐘舵��
-    int32 data_length = 5;       // 鏁版嵁闀垮害
-    bytes data = 6;              // 鏁版嵁
-    int32 checksum = 7;          // 鏍¢獙鐮�
-}
+// }
+
+// message StateMessage{
+//   string message_type = 1;
+//   int64 generate_time = 2;
+//   string generate_device = 3;
+//   string target_device = 4;
+//   string message_uuid = 5;
+//   string str_body = 6;
+// }
 
 
-// 鏈嶅姟绔悜閲囬泦绔彂閫佺殑涓绘寚浠�
-enum ControlSysCommand {
-  DUST_CLEANER_COMMAND = 0;
-}
 
-// 鏈嶅姟绔悜閲囬泦绔彂閫佺殑瀛愬懡浠�
-enum ControlSubCommand {
-  // dust cleaner sub commands
-  DUST_CLEANER_ONETIME_CLEAN_SELF         = 0;
-  DUST_CLEANER_ONETIME_CLEAN_CAMERA       = 1;
-  DUST_CLEANER_CLOSE_PERIOD_CLEAN_SELF    = 2;
-  DUST_CLEANER_CLOSE_PERIOD_CLEAN_CAMERA  = 3;
-  DUST_CLEANER_PERIOD_CLEAN_SELF          = 4;
-  DUST_CLEANER_PERIOD_CLEAN_CAMERA        = 5;
-}
 
-// dust cleaner command message
-message DustCleanerMessage  {
-  uint32 period = 1;
-}
 
-// 鎺у埗涓婁綅鏈烘秷鎭�
-message ControllMessage {
-  int32 sync_word = 1;                // 鍚屾瀛�
-  ControlSysCommand sys_command = 3;  // 涓诲懡浠�
-  ControlSubCommand sub_command = 4;  // 瀛愬懡浠�
-  DataField data = 5;                 // 鏁版嵁
-  int32 checksum = 7;                 // 鏍¢獙鐮�
-}
+
+// message RequestCommand {
+//   int32 sync_word = 1;              // 鍚屾瀛�
+//   string device_id = 2;             // 璁惧ID
+//   SysCommand sys_command = 3;       // 鍛戒护1
+//   SubCommand sub_command = 4;       // 鍛戒护2
+//   DataField data1 = 5;              // 鏁版嵁1
+//   DataField data2 = 6;              // 鏁版嵁2
+//   int32 checksum = 7;               // 鏍¢獙鐮�
+// }
+
+// enum ResponseState
+// {
+//   SUCCESS = 0;                  // 鎴愬姛
+//   FAILURE = 1;                  // 澶辫触
+//   ABNORMAL = 2;                 // 寮傚父
+//   INFICIENT_POWER = 3;          // 鐢甸噺涓嶈冻
+//   OTHER = 4;                    // 鍏朵粬
+// }
+
+// message ResponseCommand
+// {
+//     string device_id = 1;        // 璁惧ID
+//     SysCommand sys_command = 2;  // 鍛戒护1
+//     SubCommand sub_command = 3;  // 鍛戒护2
+//     ResponseState state = 4;     // 鍝嶅簲鐘舵��
+//     int32 data_length = 5;       // 鏁版嵁闀垮害
+//     bytes data = 6;              // 鏁版嵁
+//     int32 checksum = 7;          // 鏍¢獙鐮�
+// }
+
+
+// // 鏈嶅姟绔悜閲囬泦绔彂閫佺殑涓绘寚浠�
+// enum ControlSysCommand {
+//   DUST_CLEANER_COMMAND = 0;
+// }
+
+// // 鏈嶅姟绔悜閲囬泦绔彂閫佺殑瀛愬懡浠�
+// enum ControlSubCommand {
+//   // dust cleaner sub commands
+//   DUST_CLEANER_ONETIME_CLEAN_SELF         = 0;
+//   DUST_CLEANER_ONETIME_CLEAN_CAMERA       = 1;
+//   DUST_CLEANER_CLOSE_PERIOD_CLEAN_SELF    = 2;
+//   DUST_CLEANER_CLOSE_PERIOD_CLEAN_CAMERA  = 3;
+//   DUST_CLEANER_PERIOD_CLEAN_SELF          = 4;
+//   DUST_CLEANER_PERIOD_CLEAN_CAMERA        = 5;
+// }
+
+// // dust cleaner command message
+// message DustCleanerMessage  {
+//   uint32 period = 1;
+// }
+
+// // 鎺у埗涓婁綅鏈烘秷鎭�
+// message ControllMessage {
+//   int32 sync_word = 1;                // 鍚屾瀛�
+//   ControlSysCommand sys_command = 3;  // 涓诲懡浠�
+//   ControlSubCommand sub_command = 4;  // 瀛愬懡浠�
+//   DataField data = 5;                 // 鏁版嵁
+//   int32 checksum = 7;                 // 鏍¢獙鐮�
+// }

--
Gitblit v1.9.1