![]() | ![]() | ![]() | BLib Reference Manual | ![]() |
---|
BSender — sends Blinkenlights packets
struct BSender; BSender* b_sender_new (void); gboolean b_sender_add_recipient (BSender *sender, gint src_port, const gchar *dest_host, gint dest_port, GError **error); gboolean b_sender_remove_recipient (BSender *sender, const gchar *dest_host, gint dest_port, GError **error); GList* b_sender_list_recipients (BSender *sender); gboolean b_sender_configure (BSender *sender, gint width, gint height, gint channels, gint maxval); gboolean b_sender_send_frame (BSender *sender, const guchar *data); gboolean b_sender_send_heartbeat (BSender *sender); void b_sender_set_verbose (BSender *sender, gboolean verbose);
The BSender object sends Blinkenlights UDP packets to a number of recipients. Recipients can be added and removed at run-time.
BSender* b_sender_new (void);
Creates a new BSender object.
Returns : | a newly allocated BSender object |
gboolean b_sender_add_recipient (BSender *sender, gint src_port, const gchar *dest_host, gint dest_port, GError **error);
Tries to resolve host and adds it to the sender's list of recipients.
sender : | a BSender object |
src_port : | originating UDP port (-1 to leave unspecified) |
dest_host : | destination hostname or IP address |
dest_port : | destination UDP port |
error : | location to store the error occuring, or NULL to ignore errors |
Returns : | TRUE if the recipient was successfully added, FALSE otherwise |
gboolean b_sender_remove_recipient (BSender *sender, const gchar *dest_host, gint dest_port, GError **error);
Removes all recipients with matching host and port from the sender's list of recipients.
sender : | a BSender object |
dest_host : | destination hostname or IP address |
dest_port : | destination UDP port |
error : | location to store the error occuring, or NULL to ignore errors |
Returns : | TRUE if at least one matching recipient was found and removed, FALSE otherwise |
GList* b_sender_list_recipients (BSender *sender);
Creates a list of strings that describe the senders recipients. You should free the strings as well as the list when it is no longer needed.
sender : | a BSender object |
Returns : | a newly allocated GList of newly allocated strings |
gboolean b_sender_configure (BSender *sender, gint width, gint height, gint channels, gint maxval);
Prepares sender to send Blinkenlights UDP packets with the given parameters.
sender : | a BSender object |
width : | number of pixels per row |
height : | number of pixels per column |
channels : | number of channels per pixel |
maxval : | the maximum value |
Returns : | TRUE if sender was successfully reconfigured, FALSE otherwise |
gboolean b_sender_send_frame (BSender *sender, const guchar *data);
Sends Blinkenlights packets to all recipients registered with sender. The data should match the values of the last call to b_sender_configure() for sender.
sender : | a Bsender object |
data : | the frame data to send |
Returns : | FALSE in case of a fatal error, TRUE otherwise |
gboolean b_sender_send_heartbeat (BSender *sender);
b_sender_send_heartbeat is deprecated and should not be used in newly-written code.
This function is deprecated and might be removed in the future. If you need the heartbeat functionality, use BProxyClient instead.
sender : | a Bsender object |
Returns : | TRUE always |
void b_sender_set_verbose (BSender *sender, gboolean verbose);
In earlier BLib versions BSender used to print a message to stderr when send() failed. This message is now suppressed by default, but you can get the old behaviour back using this function.
sender : | a Bsender object |
verbose : | whether the sender should do verbose error reporting or not |
<< BReceiver | bsocket >> |