This repository has been archived on 2019-06-21. You can view files and clone it, but cannot push or open issues or pull requests.
PixelHub/PixelHub Protocol.md

39 lines
1.3 KiB
Markdown
Raw Normal View History

2017-02-12 21:32:33 +00:00
# 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 |
+--------+
```