Blinkenlights Ethernet packet format
From OpenBeacon
MULTIFRAME packets
#define MAGIC_MCU_MULTIFRAME 0x23542668 /* MCU MultiFrame packet */ /* * MCU Multi Frame packet * * * - One Multi Frame packet may contain multiple frames, but does not need to * - If the number and ids of the subframes vary in consecutive multi frame packets * then nothing is assumed about the missing subframes. This allows for incremental * updates for only the screens that did change. * */ typedef struct mcu_subframe_header mcu_subframe_header_t; struct mcu_subframe_header { unsigned char screen_id; /* screen id */ unsigned char bpp; /* bits per pixel, supported values: (4,8) */ /* 4 means nibbles 8 means bytes */ unsigned short height; /* number of rows */ unsigned short width; /* width in pixels of row */ /* * followed by * nibbles in [rows][columns]; * if width is uneven one nibble is used as padding * or bytes[] * * the bytesize of this can be calculated using height * width in the byte case * and height * ((width + 1)/2) in case of nibbles (integer divison) */ unsigned char data[0]; } PACKED; typedef struct mcu_multiframe_header mcu_multiframe_header_t; struct mcu_multiframe_header { unsigned int magic; /* == MAGIC_MCU_MULTIFRAME */ unsigned int timestamp_h, timestamp_l; /* milliseconds since epoch - e.g. gettimeofday(&tv); timeStamp = tv->tv_sec * 1000 + tv->tv_usec / 1000.; */ /* * followed by multiple subframe headers */ mcu_subframe_header_t subframe[0]; } PACKED;
DEVCTRL packets
#define MAGIC_MCU_DEVCTRL 0x23542667 /* MCU Device Control packet */ #define MAGIC_MCU_RESPONSE 0xFEEDBACC /* MCU response packet */ #define MAGIC_WDIM_RESPONSE 0xFEEDBACD /* WDIM response packet */ /* * MCU Device Control packet */ #define MCU_DEVCTRL_COMMAND_SET_MCU_ID 0 /* set MCU's ID */ #define MCU_DEVCTRL_COMMAND_SET_LAMP_ID 1 /* set the ID of a lamp (MAC in *param) */ #define MCU_DEVCTRL_COMMAND_SET_GAMMA 2 /* set the gamma curve of a lamp */ #define MCU_DEVCTRL_COMMAND_WRITE_CONFIG 3 /* tell the MCU to write the gamma curve */ #define MCU_DEVCTRL_COMMAND_SET_JITTER 4 /* set the jitter for a lamp */ #define MCU_DEVCTRL_COMMAND_SET_ASSIGNED_LAMPS 5 /* set lamps assigned to this MCU */ #define MCU_DEVCTRL_COMMAND_SEND_WDIM_STATS 6 /* check WDIM statistics */ #define MCU_DEVCTRL_COMMAND_SET_DIMMER_DELAY 8 /* set dimmer delay */ #define MCU_DEVCTRL_COMMAND_SET_DIMMER_CONTROL 9 /* set dimmer control (force off) */ #define MCU_DEVCTRL_COMMAND_SET_RF_POWER 10 /* set RF power level */ #define MCU_DEVCTRL_COMMAND_SET_JAM_DENSITY 11 /* set JAM density (pkt / ms) */ #define MCU_DEVCTRL_COMMAND_SEND_WMCU_STATS 12 /* check WMCU stats */ #define MCU_DEVCTRL_COMMAND_RESET_MCU 13 /* reset WMCU */ #define MCU_DEVCTRL_COMMAND_RESET_WDIM 14 /* reset WMCU */ #define MCU_DEVCTRL_COMMAND_OUTPUT_RAW 0xff /* DEBUG: output raw RF packet */ typedef struct mcu_devctrl_header mcu_devctrl_header_t; struct mcu_devctrl_header { unsigned int magic; /* == MAGIC_MCU_DEVCTRL */ unsigned int command; /* MCU_DEVCTRL_COMMAND_* */ unsigned int mac; /* LAMP MAC address (if needed) */ unsigned int value; /* params consume the rest of the packet, up to MTU */ unsigned int param[0]; } PACKED;