XBEE_GETPACKET

Section: Linux Programmer's Manual (3)
Updated: 2009-11-01
Index Return to Main Contents
 

NAME

xbee_hasdigital, xbee_getdigital  

SYNOPSIS

#include <xbee.h>

int xbee_hasdigital(xbee_pkt *pkt, int sample, int input);

int xbee_getdigital(xbee_pkt *pkt, int sample, int input);  

DESCRIPTION

The xbee_hasdigital() function will check the packet for the presence of a given sample on the specified input.

The xbee_getdigital() function will read the packet and return the sample value for the specified input.

They both take 3 arguments, with the same purposes.

The argument pkt points to a packet that was previously retrieved with xbee_getpacket()

The argument sample selects the sample within the packet to use.

The argument input specifies which input you are interested in testing.  

RETURN VALUE

The xbee_hasdigital() function will return 1 if the provided packet has sample data for the specified input, otherwise 0.

The xbee_getdigital() function will return 1 if the provided packet has sample data for the specified input and the sample was HIGH. A 0 will be returned if the sample was LOW, or the packet does not contain sample data.

 

EXAMPLE

To read sample data from previously made connection:
#include <xbee.h>
xbee_pkt *pkt;
if ((pkt = xbee_getpacket(con)) != NULL) {
  if (xbee_hasdigital(pkt,0,0)) {
    printf("D0 read %d,xbee_getdigital(pkt,0));
  } else {
    printf("No D0 data);
  }
  free(pkt);
}
 

AUTHOR

Attie Grande <attie@attie.co.uk>  

SEE ALSO

libxbee(3), xbee_pkt(3), xbee_getpacket(3), xbee_hasanalog(3), xbee_getanalog(3)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
EXAMPLE
AUTHOR
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 00:08:23 GMT, March 30, 2011