Cha*_*ell 8 c# hex serial-port reverse-engineering x10
我需要做的是逆向工程串行命令,以便我可以弄清楚如何将人类可读值或二进制值序列化为原始串行命令.
IE:
if
66 = 'A1' or '0110 1'
6e = 'A2' or '0110 2'
e6 = 'B1' or '1110 1'
ee = 'B2' or '1110 2'
then
what is A3 or B3, etc.
Run Code Online (Sandbox Code Playgroud)
我正在开发一个开源自动化项目的包装器.
有一种发送raw命令的方法,理论上将多个命令串在一起.
我嗅了几个串行命令,这就是它们的样子.
[init] [HouseCode | DeviceCode] [ready] [HouseCode | FunctionCode]
04 66 06 62 // A1 ON
04 6e 06 62 // A2 ON
04 62 06 62 // A3 ON
04 6a 06 62 // A4 ON
04 61 06 62 // A5 ON
04 69 06 62 // A6 ON
04 65 06 62 // A7 ON
04 6d 06 62 // A8 ON
04 67 06 62 // A9 ON
04 6f 06 62 // A10 ON
04 63 06 62 // A11 ON
04 6b 06 62 // A12 ON
04 60 06 62 // A13 ON
04 68 06 62 // A14 ON
04 64 06 62 // A15 ON
04 6c 06 62 // A16 ON
04 e6 06 e2 // B1 ON
04 ee 06 e2 // B2 ON
04 e2 06 e2 // B3 ON
04 ea 06 e2 // B4 ON
....
04 ec 06 e2 // B16 ON
04 66 06 63 // A1 Off
04 e6 06 e3 // B1 Off
04 66 06 61 // All A lights On (using A1 as the starting point)
04 e6 06 e1 // All B lights On (using B1 as the starting point)
04 66 06 66 // All A lights Off (using A1 as the starting point)
04 e6 06 66 // All B lights Off (using A1 as the starting point)
04 66 06 64 2a // A1 Dim 20
04 66 06 64 2c // A1 Dim 21
04 66 06 64 2e // A1 Dim 22
04 66 06 65 2a // A1 Bright 20
04 66 06 65 69 // A1 Bright 50
Run Code Online (Sandbox Code Playgroud)
我需要能够做的是反向工程,这样我可以使串行编程调用,或者更好的是,弄清楚如何无论是人类可读的值或二进制值被序列化到原始串行命令.
是的,我可以嗅探所有命令并分别存储每个值,但我想知道这是怎么做的.
这是我目前的观察结果.
04 启动并告诉设备要查找的内容 **告诉系统哪个设备正在被控制[ HouseCode&DeviceCode]55返回十六进制告诉你它准备好了06 启动并告诉设备期望什么**告诉系统房屋代码和命令[ HouseCode&FunctionCode]
** 可选地发送并且是0和100之间的值以引用调暗级别55再次发送回来告诉你它已经准备好了HouseCode= A,B,C等),第二个字符是地址(DeviceCode= 1,2,3等)
6 必须直接对应 A e 必须直接对应 BHouseCode第二对相同的方式开始FunctionCode
最后,在文档中,每个命令都与二进制数据相关,因此它可能不是转换A1为hex,而是转换binary为hex.
HouseCode DeviceCode Binary Value
A 1 0110
B 2 1110
C 3 0010
D 4 1010
E 5 0001
F 6 1001
G 7 0101
H 8 1101
I 9 0111
J 10 1111
K 11 0011
L 12 1011
M 13 0000
N 14 1000
O 15 0100
P 16 1100
FunctionCode Binary Value
All Units Off 0000
All Lights On 0001
On 0010
Off 0011
Dim 0100
Bright 0101
All Lights Off 0110
Extended Code 0111
Hail Request 1000
Hail Acknowledge 1001
Pre-set Dim (1) 1010
Pre-set Dim (2) 1011
Extended Data Transfer 1100
Status On 1101
Status Off 1110
Status Request 1111
Run Code Online (Sandbox Code Playgroud)
有谁知道我可能会如何实现这一目标?
Heyu是一款出色的开源应用程序,适用于 X10 设备。他们基于 X10 的原始文档发布了非常全面的X10 协议规范。
这应该可以消除您工作中的猜测工作。重要的是,housecode 和unitcode 是静态映射,无法计算。协议规范准确地指定了比特流的形成方式。例如
PC Interface Description
0x04,0x66 Address A1
0x6a Checksum ((0x04 + 0x66)&0xff)
0x00 OK for transmission.
0x55 Interface ready.
0x86,0x64 Function: A Dim 16/22*100%
0xea Checksum ((0x86 + 0x64)&0xff)
0x00 OK for transmission.
0x55 Interface ready.
Run Code Online (Sandbox Code Playgroud)