XBEE_PKTDATAGET

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

NAME

xbee_pktDataGet, xbee_pktAnalogGet, xbee_pktDigitalGet  

SYNOPSIS

#include <xbee.h>

xbee_err xbee_pktDataGet(struct xbee_pkt *pkt, const char *key, int id, int index, void **retData);

xbee_err xbee_pktAnalogGet(struct xbee_pkt *pkt, int channel, int index, int *retVal);

xbee_err xbee_pktDigitalGet(struct xbee_pkt *pkt, int channel, int index, int *retVal);  

DESCRIPTION

These functions provide access to data that has been parsed out of the packet's body by libxbee. In general, the raw data is still accessible though the packet, but this creates a more friendly interface.

xbee_pktDataGet() will search the packet's dataItems (see xbee_pkt(3) for more) for a named key. The id and index are used to give a 2D-esque layout to the key. However if id is given as -1, then it is ignored, and the first 'column' is used. This allows for similar data - e.g: analog samples - to be stored using a single key, with differing channel numbers (id's).

xbee_pktAnalogGet(w,x,y,&z) is nearly synonymous with xbee_pktDataGet(w,analog,x,y,&z), though due to internal magic, it is strongly recommended that you use xbee_pktAnalogGet().

Similarly, xbee_pktDigitalGet(w,x,y,&z) is nearly synonymous with xbee_pktDataGet(w,digital,x,y,&z).  

Keys

Below is a list of keys that libxbee uses, 'analog' and 'digital' are not included, because you should use the relative functions instead.

The list is keyed - <xbee mode>:<connection type>

xbee2:Identify
"Address (16-bit)" - the raw 16-bit address

"Address (64-bit)" - the raw 64-bit address

"Address" - a struct xbee_conAddress containing the full address information. This is not stored within the packet's data field

"NI" - the node identifier

 

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;
struct xbee_pkt *pkt;
int value;

/* initialize xbee, using xbee_setup() */

/* initialize con, using xbee_conNew() to an I/O connection */

/* receive a packet with analog I/O data, using xbee_conRx() */

if (xbee_pktAnalogGet(pkt, 3, 0, &value) != XBEE_ENONE) return;

/* 'value' now contains the ADC value from the A3 pin */
 

AUTHOR

Attie Grande <attie@attie.co.uk>  

SEE ALSO

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


 

Index

NAME
SYNOPSIS
DESCRIPTION
Keys
Return Value
EXAMPLE
AUTHOR
SEE ALSO

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