Refactor data transmission example: comment out sleep and data sending, extend simulation duration to 1000 seconds for improved testing.

This commit is contained in:
不求圣剑
2025-10-14 15:12:02 +08:00
parent 0ed60db853
commit 01848881d5

View File

@@ -39,9 +39,9 @@ class DataTransmissionExample:
if msg.topic == "device/data-get":
print(f"📨 收到数据请求: {msg.payload.decode()}")
# 模拟处理时间
time.sleep(0.1)
# time.sleep(0.1)
# 发送模拟数据
self.send_device_data()
# self.send_device_data()
def generate_sample_data(self):
"""生成模拟的设备数据"""
@@ -166,7 +166,7 @@ def main():
example.setup_mqtt()
# 启动模拟运行60秒
example.start_simulation(duration=60)
example.start_simulation(duration=1000)
if __name__ == "__main__":
main()