|
@@ -5,6 +5,7 @@
|
|
|
import logging
|
|
import logging
|
|
|
import threading
|
|
import threading
|
|
|
import time
|
|
import time
|
|
|
|
|
+from typing import Tuple, List, Dict, Any
|
|
|
|
|
|
|
|
import serial
|
|
import serial
|
|
|
|
|
|
|
@@ -14,7 +15,7 @@ EVENT_HEADER = 0x65
|
|
|
TERMINATOR = b'\xFF\xFF\xFF'
|
|
TERMINATOR = b'\xFF\xFF\xFF'
|
|
|
|
|
|
|
|
|
|
|
|
|
-def parse_nextion_events(data: bytes) -> tuple[list[dict], bytes]:
|
|
|
|
|
|
|
+def parse_nextion_events(data: bytes) -> Tuple[List[Dict[str, Any]], bytes]:
|
|
|
"""从字节流中解析 Nextion 触控事件(0x65 事件头,7 字节一包)。
|
|
"""从字节流中解析 Nextion 触控事件(0x65 事件头,7 字节一包)。
|
|
|
|
|
|
|
|
返回 (events, remaining_bytes),其中 remaining_bytes 是未消费的字节,
|
|
返回 (events, remaining_bytes),其中 remaining_bytes 是未消费的字节,
|