Begin documenting PixelHub Procotol

This commit is contained in:
Starbeamrainbowlabs 2017-02-12 21:32:33 +00:00
parent d6a82dafd8
commit 0b95857a60

38
PixelHub Protocol.md Normal file
View file

@ -0,0 +1,38 @@
# PixelHub Protocol Documentation
> Version 0.1
The _PixelHub Protocol_ is a communication protocol for WiFi-capable [Hull PixelBots](http://hullpixelbot.com/hullpixelbot/2017/02/01/welcome-to-hullpixelbot.html) to communicate with and be controlled by a remote server. While the protocol is binary, it is designed to be fairly easy to parse and implement.
## Basic Information
The PixelHub Protocol is conducted over a single TCP connection. Obtaining these details can be done automatically by listening to the UDP multicast beacon set up by the server.
In this specification document, when referring to bytes, The C++ notation will be used. Examples: `0b00000000`, `0b01010101`.
Each PixelHub message is terminated by a null byte (`0b00000000`).
## Conversation Flow
- [ Hub -> Bot ]: Send instruction
- [ Bot -> Hub ]: Acknowledge instruction
- [ Bot ]: Execute command
- [ Bot -> Hub ]: Notify about instruction completion
## Message Struture
### Basic Message
```
+--------+--------+--------+--------+
| Byte 1 | Byte 2 | Byte 3 | Byte 4 |
+--------+--------+--------+--------+
| Message Type |
+--------+--------+--------+--------+
| Message Id |
+--------+--------+--------+--------+
| Message Contents |
+--------+--------+--------+--------+
| Null |
| Byte |
+--------+
```