-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·42 lines (37 loc) · 1.29 KB
/
test.py
File metadata and controls
executable file
·42 lines (37 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
import leelen
msgs = [
(
0x0501,
b"\xd1\xd2\xd5\x02\x03\x01\x05\x0f\x00\x00\x00\x00\x00\x1e\x00\x00" \
b"\x00\xff\x02\x00\x63\x63\xff\x01\x00\x63\x63\xff\xff\xc5"
),
(
0x0501,
b"\xd1\xd2\xd5\x02\x03\x01\x05\x0f\x00\x00\x00\x01\x00\x57\x00\x00" \
b"\x00\xff\x01\x00\x63\x63\xff\x02\x00\x63\x63\x01\xb0\x04\x35\x55" \
b"\x44\x50\x33\x2e\x30\x33\x5f\x54\x43\x50\x32\x2e\x30\x2d\x41\x32" \
b"\x30\x4c\x2d\x56\x31\x2e\x36\x32\x5f\x32\x30\x31\x37\x30\x38\x32" \
b"\x32\x2d\x56\x33\x2e\x34\x2d\x31\x38\x5f\x32\x5f\x33\x38\x36\x31" \
b"\x5f\x31\x35\x35\xff\xff\x59"
),
(
0x0502,
b"\xd1\xd2\xd5\x01\x03\x02\x05\x0e\x00\x00\x00\x00\x00\x1e\x00\x00" \
b"\x00\xff\x02\x00\x63\x63\xff\x01\x00\x63\x63\x00\x00\xc4"
),
(
0x0502,
b"\xd1\xd2\xd5\x01\x03\x02\x05\x0e\x00\x00\x00\x01\x00\x26\x00\x00" \
b"\x00\xff\x01\x00\x63\x63\xff\x02\x00\x63\x63\x01\x14\x15\x08\x08" \
b"\x05\x17\x04\xff\xff\x63"
),
]
for [command, buffer] in msgs:
obj = leelen.ControlMessage.unpack(buffer)
new = obj.pack(buffer[-3:-1])
if new != buffer:
print(obj)
print(new)
exit(1)
a = leelen.ControlMessage.unpack(msgs[-1][1])