first commit

This commit is contained in:
2026-03-12 17:03:56 +08:00
commit aa4d4c7d7c
48 changed files with 10958 additions and 0 deletions

23
test/control.py Normal file
View File

@@ -0,0 +1,23 @@
import socket
from protocol import build_frame
SERVER_IP = '127.0.0.1'
SERVER_PORT = 9000
TARGET_DEVICE = 10000052
# 控制 2、3 开5 关
payload = bytes([
0x02, 0x01,
0x03, 0x01,
0x05, 0x00
])
frame = build_frame(0xA0, TARGET_DEVICE, payload)
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((SERVER_IP, SERVER_PORT))
# CTRL + device_id + frame
msg = b'CTRL' + TARGET_DEVICE.to_bytes(4, 'little') + frame
s.sendall(msg)
print("[CONTROL] send command")