XBEE_ATTACHEOFCALLBACK(3)

NAME
xbee_attachEOFCallback

SYNOPSIS
#include <xbee.h>

xbee_err xbee_attachEOFCallback(struct xbee *xbee, void (*eofCallback)(struct xbee *xbee, void *rxInfo));

DESCRIPTION

xbee_attachEOFCallback() allows you to be notified if an EOF occurs on the device. An EOF can occur if a USB Serial Adaptor is unplugged, or if the network server closes the connection. It is useful to know that an EOF has occured so that you can take action (e.g: warn the user).

  Return Value
On success this function will return XBEE_ENONE, otherwise an error number from enum xbee_errors (as specified in <xbee.h>)

EXAMPLE
To configure an EOF callback:

#include <xbee.h>
void eek_eof(struct xbee *xbee, void *rxInfo) {
	printf("device failed - EOF\n");
	xbee_shutdown(xbee);
}
struct xbee *xbee;
/* initialize xbee, using xbee_setup() */
if (xbee_attachEOFCallback(xbee, eek_eof) != XBEE_ENONE) {
	/* alert of error */
}

AUTHOR
Attie Grande <attie@attie.co.uk>

SEE ALSO
libxbee(3), xbee_setup(3), xbee_shutdown(3)