| BLib Reference Manual |
|---|
BPacket — the UDP packet used to transport a single frame
struct BPacket; union BPacketHeader; BPacket* b_packet_new (gint width, gint height, gint channels, gint maxval, gint *data_size); gsize b_packet_size (BPacket *packet); void b_packet_hton (BPacket *packet); void b_packet_ntoh (BPacket *packet);
A BPacket consists of a mcu_frame_header struct followed by the actual frame data. It corresponds to a single animation frame.
struct BPacket {
BPacketHeader header;
guchar data[0];
};
The BPacket struct has a variable size which is determined by the values passed to b_packet_new().
| BPacketHeader header | the Blinkenlights frame header |
| guchar data[0] | the frame data |
union BPacketHeader
{
mcu_frame_header_t mcu_frame_h;
heartbeat_header_t heartbeat_h;
};
BPacket* b_packet_new (gint width, gint height, gint channels, gint maxval, gint *data_size);
Allocates a new BPacket structure and initializes it with the given values. If data_size is non-NULL the size of the data area (in bytes) is returned via this variable.
The packet should be freed with g_free() when it is not needed any longer.
| width : | the number of pixels per row |
| height : | the number of pixels per column |
| channels : | the number of channels per pixels |
| maxval : | the maximum value |
| data_size : | returns the size of the packet data |
| Returns : | a newly allocated BPacket. |
void b_packet_hton (BPacket *packet);
Converts all members of packet from host to network byteorder.
| packet : | pointer to a BPacket |
| << BProtocol | BProxyClient >> |