Merge branch 'master' of c-leuse:cerebrum
[cerebrum.git] / PROTOCOL
blob89e3acbfe706459639e5b95e982f00a7cc12e74f
2 [2 bytes preamble: "\\#"] [2 bytes node address] [2 bytes function id] [2 bytes length] [n bytes args] [device: 2 bytes length] [device: n byte payload]
3 [2 bytes preamble: "\\#"] [discovery address: 0xFFFF] [2 bytes node address to be assigned] [2 bytes MAC mask length] [8 bytes node MAC pattern] [device: 1 byte ack (0xFF)]
5 The function id 0x0000 always returns the device descriptor in (possibly LZMA-ed) JSON
7 The node address 0xFFFF is used for autodiscovery. A packet sent to it looks like described above. If the lower n device MAC bits (n is the MAC mask length) match the given MAC pattern, the device responds with 0xFF to tell the host that there is a matching device (otherwise it just remains silent). Depending on the physical layer used (e.g. RS485), this might be replaced by manually pulling the normally idle line to an active state. If the MAC address matches, the device takes the node address given in the discovery packet.