.\" 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 . .TH XBEE_PKT 3 2009-11-01 "GNU" "Linux Programmer's Manual" .SH NAME xbee_pkt .SH SYNOPSIS .B #include .ad b .SH DESCRIPTION This is the packet structure. If you want to get more advanced information from connections (such as RSSI) then this is where it lives. .sp .in +4n .nf struct xbee_pkt { unsigned char frameID; /* AT Status */ unsigned char atCmd[2]; /* AT */ unsigned char status; /* AT Data Status */ /* status / options */ unsigned char Addr64[8]; /* AT Data */ unsigned char Addr16[2]; /* AT Data */ unsigned char data[128]; /* AT Data */ unsigned char RSSI; /* Data */ unsigned int datalen; /* X A5 A4 A3 A2 A1 A0 D8 D7 D6 D5 D4 D3 D2 D1 D0 */ unsigned short IOmask; /* IO */ /* X X X X X X X D8 D7 D6 D5 D4 D3 D2 D1 D0 */ unsigned short IOdata; /* IO */ /* X X X X X D D D D D D D D D D D */ unsigned short IOanalog[6]; /* IO */ }; typedef struct xbee_pkt xbee_pkt; .fi .in .sp Most of these fields are fairly self explanatory, however some need attention brought to them and others need explaining. I will touch on the most important here: .TP .B atCmd This is the 2 character identifier for the AT command response you just recieved. Of course if you didnt setup an AT connection, you should never see, or try to see data here. .TP .BR Addr64 " and " Addr16 These contain the address of the XBee that you recieved the packet from. You should really know this because you setup the connection. However remote AT packets will contain both 16 and 64 bit addresses. .TP .B data This is the data you just recieved. Either the AT reponse, or the data from the remote XBee node. .TP .B datalen Would you be suprised if I told you this is how much data there is?... Dont try and .BR printf () the .B data as it isn't null terminated. Use this for processing instead. .fi .in .SH AUTHOR Attie Grande .SH "SEE ALSO" .BR libxbee (3), .BR xbee_getpacket (3)