xbee_senddata.3 2.45 KB
Newer Older
Franz's avatar
Franz committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
.\" libxbee - a C library to aid the use of Digi's Series 1 XBee modules
.\"           running in API mode (AP=2).
.\" 
.\" Copyright (C) 2009  Attie Grande (attie@attie.co.uk)
.\" 
.\" This program is free software: you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation, either version 3 of the License, or
.\" (at your option) any later version.
.\" 
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
.\" GNU General Public License for more details.
.\" 
.\" You should have received a copy of the GNU General Public License
.\" along with this program.  If not, see <http://www.gnu.org/licenses/>.
.TH XBEE_SENDDATA 3  2009-11-01 "GNU" "Linux Programmer's Manual"
.SH NAME
xbee_senddata, xbee_nsenddata, xbee_vsenddata
.SH SYNOPSIS
.B #include <xbee.h>
.sp
.BI "int xbee_senddata(xbee_con *" con ", char *" format ", ...);"
.sp
.BI "int xbee_nsenddata(xbee_con *" con ", char *" data ", int " length ");"
.sp
.B #include <stdarg.h>
.sp
.BI "int xbee_vsenddata(xbee_con *" con ", char *" format ", va_list " ap ");
.ad b
.SH DESCRIPTION
The
.BR xbee_senddata ()
function will send data via a provided connection.
It takes at least 2 arguments, and possibly more depending on the format string.
.sp
The argument
.I con
points to a connection made previously with
.BR xbee_newcon ().
.sp
The
.I format
string and any following parameters are passed to
.BR snprintf ()
within these functions.
Please see the
.BR printf (3)
man page for more information.
.sp
If you are using
.BR xbee_nsenddata ()
you must provide a character array of the data, and the data's length.
.sp
If you are using
.BR xbee_vsenddata ()
you must provide a va_list. See
.BR stdarg (3).
.SH "RETURN VALUE"
Upon successful completion, these functions return 0.
.sp
If an invalid packet or connection was provided, -1 is returned.
.sp
If an unknown error occured, -2 is returned.
.sp
If
.I con
has
.I waitforACK
enabled, then these functions return 1 when an ACK was not recieved within 1 second.
.SH EXAMPLE
To send the string "Hello World!" through a previously made connection:
.in +4n
.nf
#include <xbee.h>
xbee_senddata(con,"Hello World!");
.fi
.in
.SH AUTHOR
Attie Grande <attie@attie.co.uk> 
.SH "SEE ALSO"
.BR libxbee (3),
.BR xbee_setup (3),
.BR xbee_newcon (3),
.BR xbee_getpacket (3)