BReceiver

BReceiver — receives Blinkenlights packets

Synopsis




struct      BReceiver;
gboolean    (*BReceiverCallback)            (BReceiver *receiver,
                                             BPacket *packet,
                                             gpointer callback_data);
BReceiver*  b_receiver_new                  (BReceiverCallback callback,
                                             gpointer callback_data);
gboolean    b_receiver_listen               (BReceiver *receiver,
                                             gint port);
void        b_receiver_stop                 (BReceiver *receiver);

Object Hierarchy


  GObject
   +----BReceiver

Description

The BReceiver object listens for Blinkenlights UDP packets. For each frame that matches the receiver configuration, a user-defined callback is called with the received packet.

Details

struct BReceiver

struct BReceiver;

The BReceiver struct is considered private.


BReceiverCallback ()

gboolean    (*BReceiverCallback)            (BReceiver *receiver,
                                             BPacket *packet,
                                             gpointer callback_data);

The function that gets called to dispatch incoming packets.

receiver :the BReceiver object that received the packet
packet :the received BPacket converted to host byteorder
callback_data :the data that was passed to b_receiver_new()
Returns :TRUE if you want to be called again

b_receiver_new ()

BReceiver*  b_receiver_new                  (BReceiverCallback callback,
                                             gpointer callback_data);

Creates a new BReceiver object.

callback : the function to call when a new frame arrives
callback_data : data to pass to the callback
Returns : a newly allocate BReceiver object

b_receiver_listen ()

gboolean    b_receiver_listen               (BReceiver *receiver,
                                             gint port);

Causes the receiver to start to listen to the specified UDP port. For each successfully received Blinkenlights packet, the packet will be converted to host byteorder and the callback that was specified on b_receiver_new() will be called.

receiver : a BReceiver object
port : the UDP port to listen to
Returns : TRUE if the receiver listens to port, FALSE otherwise

b_receiver_stop ()

void        b_receiver_stop                 (BReceiver *receiver);

Makes the receiver stop listening.

receiver : a BReceiver object

See Also

BSender, BPacket