XBEE_CONTX

Section: Linux Programmer's Manual (3)
Updated: 04-Mar-2012
Index Return to Main Contents
 

NAME

xbee_conTx, xbee_convTx, xbee_connTx, xbee_conxTx, xbee_convxTx, xbee_connxTx  

SYNOPSIS

#include <xbee.h>

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);  

DESCRIPTION

This collection of functions allow you to transmit data via an existing connection.

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.  

Return Value

On success these functions will return XBEE_ENONE, otherwise an error number from enum xbee_errors (as specified in <xbee.h>)  

EXAMPLE

#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;
}
 

AUTHOR

Attie Grande <attie@attie.co.uk>  

SEE ALSO

libxbee(3), xbee_setup(3), xbee_conNew(3)


 

Index

NAME
SYNOPSIS
DESCRIPTION
Return Value
EXAMPLE
AUTHOR
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 13:52:19 GMT, August 11, 2019