You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
2.5 KiB
91 lines
2.5 KiB
.\" 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_GETPACKET 3 2009-11-01 "GNU" "Linux Programmer's Manual" |
|
.SH NAME |
|
xbee_hasdigital, xbee_getdigital |
|
.SH SYNOPSIS |
|
.B #include <xbee.h> |
|
.sp |
|
.BI "int xbee_hasdigital(xbee_pkt *" pkt ", int " sample ", int " input ");" |
|
.sp |
|
.BI "int xbee_getdigital(xbee_pkt *" pkt ", int " sample ", int " input ");" |
|
.ad b |
|
.SH DESCRIPTION |
|
The |
|
.BR xbee_hasdigital () |
|
function will check the packet for the presence of a given sample on the specified input. |
|
.sp |
|
The |
|
.BR xbee_getdigital () |
|
function will read the packet and return the sample value for the specified input. |
|
.sp |
|
They both take 3 arguments, with the same purposes. |
|
.sp |
|
The argument |
|
.I pkt |
|
points to a packet that was previously retrieved with |
|
.BR xbee_getpacket () |
|
.sp |
|
The argument |
|
.I sample |
|
selects the sample within the packet to use. |
|
.sp |
|
The argument |
|
.I input |
|
specifies which input you are interested in testing. |
|
.SH "RETURN VALUE" |
|
The |
|
.BR xbee_hasdigital () |
|
function will return |
|
.B 1 |
|
if the provided packet has sample data for the specified input, otherwise |
|
.BR 0 . |
|
.sp |
|
The |
|
.BR xbee_getdigital () |
|
function will return |
|
.B 1 |
|
if the provided packet has sample data for the specified input and the sample was HIGH. |
|
A |
|
.B 0 |
|
will be returned if the sample was LOW, or the packet does not contain sample data. |
|
.sp |
|
.SH EXAMPLE |
|
To read sample data from previously made connection: |
|
.in +4n |
|
.nf |
|
#include <xbee.h> |
|
xbee_pkt *pkt; |
|
if ((pkt = xbee_getpacket(con)) != NULL) { |
|
if (xbee_hasdigital(pkt,0,0)) { |
|
printf("D0 read %d\n",xbee_getdigital(pkt,0)); |
|
} else { |
|
printf("No D0 data\n"); |
|
} |
|
free(pkt); |
|
} |
|
.fi |
|
.in |
|
.SH AUTHOR |
|
Attie Grande <attie@attie.co.uk> |
|
.SH "SEE ALSO" |
|
.BR libxbee (3), |
|
.BR xbee_pkt (3), |
|
.BR xbee_getpacket (3), |
|
.BR xbee_hasanalog (3), |
|
.BR xbee_getanalog (3)
|
|
|