BlinkenlightsProtocolEnglish
The Blinkenlights protocol is used to transmit black/white Blinkenlights streams using UDP packets. Simply, a UDP packet is sent for every new frame:
+-----------------------+ | magic | | 0xDE 0xAD 0xBE 0xEF | +-----------------------+ | frame number | | 0x00 0x00 0x00 0x00 | +-----------+-----------+ | width | height | | 0x00 0x12 | 0x00 0x08 | +-----------+-----------+ | pixels | | 0x01 0x01 0x00 0x00 | | 0x00 0x00 0x01 0x00 | | ... | | 0x00 0x00 0x00 0x00 | +-----------------------+
- magic: fixed value
- frame number: number of the frame, incremented with every frame, use is optional
- width: the width of the image in pixels
- height: the height of the image in pixels
- pixels: the value of the width * height pixels
- 0x00 for off, 0x01 for on, no other values allowed
- from left to right, then from top to bottom (i.e. top left pixel first, pixel right to it next, ...)
- all values are in network byte order - big endian - highbyte first
The dynamic extension can be used to request a BLP stream dynamically. A request packet is sent periodically (e.g. every 10s) to the UDP port of the server. The server then replys with a BLP stream sent from this port to the source port of the request packet. After no request packet has been received for a longer time (e.g. 30s), the stream is no longer sent.
The format of the request packet is as follows:
+-----------------------+ | magic | | 0xDE 0xAD 0xBE 0xCD | +-----------------------+ | command | | 'R' 'E' 'F' 'R' | | 'E' 'S' 'H' | +-----------------------+
- magic: fixed value
- command: fixed value
It is also possible to tell the server that the stream is no longer needed. This happens by sending a close packet instead of a request packet:
+-----------------------+ | magic | | 0xDE 0xAD 0xBE 0xCD | +-----------------------+ | command | | 'C' 'L' 'O' 'S' | | 'E' | +-----------------------+
- magic: fixed value
- command: fixed value
The UDP port should be configurable at server and client side. The standard port is UDP 2323.