xbee_err xbee_conTx(struct xbee_con *con, unsigned char *retVal, const char *format, ...);
xbee_err xbee_convTx(struct xbee_con *con, unsigned char *retVal, const char *format, va_list args);
xbee_err xbee_connTx(struct xbee_con *con, unsigned char *retVal, const unsigned char *buf, int len);
xbee_err xbee_conxTx(struct xbee_con *con, unsigned char *retVal, unsigned char *frameId, const char *format, ...);
xbee_err xbee_convxTx(struct xbee_con *con, unsigned char *retVal, unsigned char *frameId, const char *format, va_list args);
xbee_err xbee_connxTx(struct xbee_con *con, unsigned char *retVal, unsigned char *frameId, const unsigned char *buf, int len);
When calling xbee_conTx(), you may use a printf(3) style format string and parameters. Similarly, xbee_convTx() makes use of vprintf(3). When using these two functions, the length of the message is determined from the return value of vprintf(3). This means that by using '%c' conversion specifiers within the format string, you may achieve zero value - 0x00 - bytes before the end of your message. Do not use '\\ ' as this will terminate the format string early
xbee_connTx() accepts a buffer and a length instead, allowing you to build the message yourself.
The 'x' variants namely xbee_conxTx(), xbee_convxTx() and xbee_connxTx can be used if you want to know what frame ID was used for the transmission.
If the connection type supports ACKs, and they are not disabled for the connection, and if retVal is non-NULL, it will be updated with the return value. E.g: 0x04 - No response for a Remote AT connection. You should consult the manual for the remote device for information on the values that this may return.
NOTE: not all connection types are able to transmit. For example the 'Modem Status', 'Transmit Status' and 'I/O' connections.
#include <xbee.h> struct xbee *xbee; struct xbee_con *con; xbee_err ret; unsigned char retVal; /* initialize xbee, using xbee_setup() */ /* initialize con, using xbee_conNew() */ if ((ret = xbee_conTx(con, &retVal, "Hello World! it is %d!", 2012)) != XBEE_ENONE) { if (ret == XBEE_ETX) { fprintf(stderr, "a transmission error occured... (0x%02X)\n", retVal); } else { fprintf(stderr, "an error occured... %s\n", xbee_errorToStr(ret)); } return ret; }