]> git.droids-corp.org - protos/xbee-avr.git/commitdiff
use xbee module from aversive
authorOlivier Matz <zer0@droids-corp.org>
Thu, 7 Nov 2013 19:38:05 +0000 (20:38 +0100)
committerOlivier Matz <zer0@droids-corp.org>
Sun, 9 Mar 2014 21:13:02 +0000 (22:13 +0100)
21 files changed:
Makefile
commands.c
main.c
main.h
notes.txt
parse_atcmd.c
parse_neighbor.c
rc_proto.c
rc_proto.h
xbee.c [deleted file]
xbee.h [deleted file]
xbee_atcmd.c [deleted file]
xbee_atcmd.h [deleted file]
xbee_buf.c [deleted file]
xbee_buf.h [deleted file]
xbee_neighbor.c [deleted file]
xbee_neighbor.h [deleted file]
xbee_proto.c [deleted file]
xbee_proto.h [deleted file]
xbee_stats.c [deleted file]
xbee_stats.h [deleted file]

index 24f4f92e8ebc62a9075784b187f2a8fd3bebf741..e04989368e4d7a8601a166f121a207f68de79717 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,11 +8,6 @@ SRC += spi_servo.c
 SRC += commands.c
 SRC += commands_gen.c
 SRC += rc_proto.c
-SRC += xbee_atcmd.c
-SRC += xbee.c
-SRC += xbee_neighbor.c
-SRC += xbee_proto.c
-SRC += xbee_stats.c
 SRC += callout.c
 SRC += parse_neighbor.c
 SRC += parse_atcmd.c
index eff413db23e75f155eafadd024de5730259626c2..c9619ac2da48e3fdc284d0416dbf1f5a9d17be6c 100644 (file)
 #include <parse_string.h>
 #include <parse_num.h>
 #include <uart.h>
-
-#include "xbee_atcmd.h"
-#include "xbee_neighbor.h"
-#include "xbee_stats.h"
-#include "xbee_proto.h"
-#include "xbee.h"
+#include <xbee.h>
 
 #include "callout.h"
 #include "parse_atcmd.h"
@@ -71,7 +66,7 @@ struct monitor_reg *monitor_current;
 
 static int range_period_ms = 1000;
 static int range_powermask = 0x1F;
-static uint8_t range_power = 0;
+//static uint8_t range_power = 0;
 static int range_running = 0;
 static uint64_t range_dstaddr = 0xFFFF; /* broadcast by default */
 static struct callout range_event;
@@ -97,6 +92,10 @@ static void monitor_cb(struct callout_manager *cm,
 static void range_cb(struct callout_manager *cm,
                     struct callout *clt, void *dummy)
 {
+       (void)cm;
+       (void)clt;
+       (void)dummy;
+#if 0
        uint8_t i, mask;
        struct rc_proto_range rangepkt;
 
@@ -128,6 +127,7 @@ static void range_cb(struct callout_manager *cm,
        callout_reset(cm, &range_event,
                      range_period_ms,
                      SINGLE, range_cb, NULL);
+#endif
 }
 
 /* this structure is filled when cmd_help is parsed successfully */
diff --git a/main.c b/main.c
index 0d5cad65d3558c8456c7eab9d8bb35128a094730..c6f13e3715dee230db91032bf872529e68e1b394 100644 (file)
--- a/main.c
+++ b/main.c
@@ -237,6 +237,7 @@ int xbee_recv_data(struct xbee_recv_hdr *recvframe, unsigned len)
                return -1;
 
        switch (rch->type) {
+#if 0
                case RC_PROTO_TYPE_CHANNEL: {
                        struct rc_proto_channel *rcc =
                                (struct rc_proto_channel *) recvframe->data;
@@ -263,6 +264,7 @@ int xbee_recv_data(struct xbee_recv_hdr *recvframe, unsigned len)
 
                        break;
                }
+#endif
                default:
                        return -1;
        }
@@ -271,7 +273,7 @@ int xbee_recv_data(struct xbee_recv_hdr *recvframe, unsigned len)
 }
 
 /* socat /dev/ttyUSB0,raw,echo=0,b115200 /dev/ttyACM1,raw,echo=0,b115200 */
-void xbee_rx(struct xbee_dev *dev, int channel, int type,
+void xbeeapp_rx(struct xbee_dev *dev, int channel, int type,
             void *frame, unsigned len, void *opaque)
 {
        struct xbee_ctx *ctx = opaque;
@@ -377,7 +379,7 @@ static int xbeeapp_send(struct xbee_ctx *ctx, int type, void *buf, unsigned len,
 
        /* register a channel */
        channel = xbee_register_channel(xbee_dev, XBEE_CHANNEL_ANY,
-                                       xbee_rx, NULL);
+                                       xbeeapp_rx, NULL);
        if (channel < 0) {
                printf_P(PSTR("cannot send: no free channel\r\n"));
                return -1;
@@ -395,8 +397,7 @@ static int xbeeapp_send(struct xbee_ctx *ctx, int type, void *buf, unsigned len,
                hexdump("xmit frame", buf, len);
 
        /* transmit the frame on this channel */
-       ret = xbee_proto_xmit(xbee_dev, channel, type, buf,
-                             len);
+       ret = xbee_tx(xbee_dev, channel, type, buf, len);
        if (ret < 0) {
                printf_P(PSTR("cannot send\r\n"));
                xbee_unregister_channel(xbee_dev, channel);
@@ -574,7 +575,7 @@ void xbee_mainloop(void)
                else {
                        if (xbee_cmdline_input_enabled)
                                cmdline_poll();
-                       xbee_proto_rx(xbee_dev);
+                       xbee_rx(xbee_dev);
                }
        }
 }
@@ -657,7 +658,7 @@ int main(void)
 
        /* register default channel with a callback */
        if (xbee_register_channel(xbee_dev, XBEE_DEFAULT_CHANNEL,
-                                 xbee_rx, NULL) < 0) {
+                                 xbeeapp_rx, NULL) < 0) {
                fprintf(stderr, "cannot register default channel\n");
                return -1;
        }
diff --git a/main.h b/main.h
index 9ba70de77b9d7ee71171626507f49612d352c9de..d28a3662502b13cf51fd567cf46dcd9dfbebfc73 100644 (file)
--- a/main.h
+++ b/main.h
 #include <parse.h>
 #include <rdline.h>
 #include <timer.h>
+#include <xbee.h>
 
-#include "xbee_neighbor.h"
-#include "xbee_atcmd.h"
-#include "xbee_stats.h"
-#include "xbee_buf.h"
-#include "xbee_proto.h"
-#include "xbee.h"
 #include "cmdline.h"
 #include "callout.h"
 #include "rc_proto.h"
@@ -110,7 +105,7 @@ extern struct callout_manager cm;
 
 void bootloader(void);
 
-void xbee_rx(struct xbee_dev *dev, int channel, int type,
+void xbeeapp_rx(struct xbee_dev *dev, int channel, int type,
             void *frame, unsigned len, void *opaque);
 int xbeeapp_send_atcmd(const char *atcmd_str,
                       void *param, unsigned param_len, int foreground,
index f8c697a94e62679fbf9c116cfe138a64b2a120e2..260ad086e45513b2e1926cb5f2ee5f90fbfeb125 100644 (file)
--- a/notes.txt
+++ b/notes.txt
@@ -159,3 +159,20 @@ Rules
 
 Calling a xbee function needs to set prio to XBEE_PRIO only.
 Calling i2c_send_command must be done from a lower prio than I2C_PRIO.
+
+libxbee / xbee module
+=====================
+
+Library
+-------
+
+xbee_dev = structure describing an xbee device
+xbee_channel = structure describing a channel, used to associates a req
+  with its answer
+
+xbee.[ch]: main interface to libxbee, creation of dev, registeration of channels
+xbee_atcmd.[ch]: get an AT command from its name or small id string
+xbee_buf.[ch]: not used
+xbee_neighbor.[ch]: helper to add/delete neighbors, use malloc()/free()
+xbee_rxtx.[ch]: parse rx frames, provides xbee_proto_xmit()
+xbee_stats.[ch]: helper to maintain stats
index 2e6f4c03c7a8671853990a318a2b47e95535ae67..fbb0c6e89532968bebb2f2dc1bf5a4ebd814803d 100644 (file)
@@ -33,8 +33,8 @@
 #include <string.h>
 
 #include <parse.h>
+#include <xbee.h>
 
-#include "xbee_atcmd.h"
 #include "parse_atcmd.h"
 
 static int8_t
index 1b572e83d771d103d847e776ba647ec41614559e..d04092b84ecf809bc4f0acdfba5d6baa53cf9200 100644 (file)
 #include <string.h>
 
 #include <parse.h>
-
-#include "xbee_neighbor.h"
-#include "xbee_atcmd.h"
-#include "xbee_stats.h"
-#include "xbee_buf.h"
-#include "xbee_proto.h"
-#include "xbee.h"
+#include <xbee.h>
 
 #include "parse_neighbor.h"
 
index 9e057e36b6980425876aa07426f3c3b8e4c0142c..fe5c928bcc048ea45e2847e48b85a4d347a3b6c8 100644 (file)
 #include <parse.h>
 #include <rdline.h>
 #include <timer.h>
+#include <xbee.h>
 
-#include "xbee_proto.h"
 #include "callout.h"
 #include "rc_proto.h"
 #include "main.h"
 
-struct power_levels {
-       int ttl;
-       int power_db;
+/* */
+struct rc_proto_power_levels {
+       uint8_t ttl;
+       uint16_t power_db;
 };
+static struct rc_proto_power_levels power_levels[MAX_POWER_LEVEL];
 
-struct power_levels power_levels[MAX_POWER_LEVEL];
-
-static int set_power_level(void *frame, unsigned len, void *arg)
+/* update power level when we receive the answer from DB */
+static int update_power_level(void *frame, unsigned len, void *arg)
 {
        struct xbee_atresp_hdr *atresp = (struct xbee_atresp_hdr *)frame;
        int level = (intptr_t)arg;
        uint8_t db;
 
        /* XXX check if this test is correct */
-       if (len < sizeof(struct xbee_atresp_hdr) + sizeof(uint8_t))
+       if (len < sizeof(struct xbee_atresp_hdr) + sizeof(uint8_t)) {
+               /* XXX stats */
                return -1;
+       }
 
        db = atresp->data[0];
        power_levels[level].power_db = db;
@@ -66,11 +69,152 @@ static int set_power_level(void *frame, unsigned len, void *arg)
        return 0;
 }
 
-void rc_proto_rx_range(int power_level)
+/* when we receive a power probe, ask the DB value to the xbee */
+void rc_proto_rx_power_probe(int power_level)
+{
+       (void)power_level;
+       xbeeapp_send_atcmd("DB", NULL, 0, 0, update_power_level, NULL);
+}
+
+#if 0
+#define N_SERVO 6
+#define SERVO_NBITS 10
+uint16_t servos[N_SERVO] = { 0x123, 0x234, 0x321, 0x123, 0x234, 0x321 };
+
+int8_t servo2buf(uint8_t *buf, uint8_t len, uint8_t servo_mask,
+                 uint8_t pow, uint8_t seq)
 {
-       xbeeapp_send_atcmd("DB", NULL, 0, 0,
-                          set_power_level, (void *)(intptr_t)power_level);
+       uint8_t i = 0, num;
+       uint8_t remain_bits;
+       uint8_t servo_bits = 0;
+       uint16_t servo_val;
+       uint8_t tmp;
+
+       if (len < 2)
+               return -1;
+
+       memset(buf, 0, len);
+       buf[i++] = servo_mask;
+       buf[i++] = ((seq & 0x1f) << 3) | (pow & 0x7);
+       remain_bits = 8;
+
+       for (num = 0; num < N_SERVO; num++) {
+               if (!(servo_mask & (1 << num)))
+                       continue;
+               servo_val = servos[num];
+               servo_bits = SERVO_NBITS;
 
+               tmp = (servo_val >> (servo_bits - remain_bits));
+               tmp &= ((1 << remain_bits) - 1);
+               if (i >= len)
+                       return -1;
+               buf[i++] |= tmp;
+
+               servo_bits = 10 - remain_bits;
+               tmp = servo_val & ((1 << servo_bits) - 1);
+               tmp <<= (8 - servo_bits);
+               if (i >= len)
+                       return -1;
+               buf[i] = tmp;
+
+               if (servo_bits == 8) {
+                       i++;
+                       remain_bits = 8;
+               }
+               else
+                       remain_bits = 8 - servo_bits;
+       }
+
+       if (remain_bits != 8)
+               i++;
+
+       return i;
 }
 
+int8_t buf2servo(uint8_t *buf, uint8_t len)
+{
+       uint8_t mask, count = 0;
+       uint8_t num = 0;
+       uint8_t pow, seq;
+       uint16_t val;
+
+       if (len < 2)
+               return -1;
 
+       mask = buf[0];
+       if (mask > 0x3f)
+               return -1;
+       pow = buf[1] & 0x07;
+       seq = buf[1] >> 5;
+
+       for (num = 0; num < N_SERVO; num++) {
+               if ((1<<num) & mask)
+                       count++;
+       }
+       switch (count) {
+               case 1: if (len != 4) return -1; break;
+               case 2: if (len != 5) return -1; break;
+               case 3: if (len != 6) return -1; break;
+               case 4: if (len != 7) return -1; break;
+               case 5: if (len != 9) return -1; break;
+               case 6: if (len != 10) return -1; break;
+               default: return -1;
+       }
+
+       for (num = 0; ((1<<num) & mask) == 0; num++) {
+               if (num >= N_SERVO)
+                       return 0;
+       }
+
+       val = buf[2];
+       val <<= 2;
+       val |= (buf[3] >> 6);
+
+       for (num++; ((1<<num) & mask) == 0; num++) {
+               if (num >= N_SERVO)
+                       return 0;
+       }
+
+       val = buf[3] & 0x3f;
+       val <<= 4;
+       val |= (buf[4] >> 4);
+
+       for (num++; ((1<<num) & mask) == 0; num++) {
+               if (num >= N_SERVO)
+                       return 0;
+       }
+
+       val = buf[4] & 0xf;
+       val <<= 6;
+       val |= (buf[5] >> 2);
+
+       for (num++; ((1<<num) & mask) == 0; num++) {
+               if (num >= N_SERVO)
+                       return 0;
+       }
+
+       val = buf[5] & 0x3;
+       val <<= 8;
+       val |= (buf[6]);
+
+       for (num++; ((1<<num) & mask) == 0; num++) {
+               if (num >= N_SERVO)
+                       return 0;
+       }
+
+       val = buf[7];
+       val <<= 2;
+       val |= (buf[8] >> 6);
+
+       for (num++; ((1<<num) & mask) == 0; num++) {
+               if (num >= N_SERVO)
+                       return 0;
+       }
+
+       val = buf[8];
+       val <<= 4;
+       val |= (buf[9] >> 4);
+
+       return 0;
+}
+#endif
index fea6c51c955da11b78e4c540f0307a6093f202f3..217bb96667c00cc1be22e429316ea38e8381d133 100644 (file)
@@ -1,28 +1,56 @@
 #ifndef RC_PROTO_H
 #define RC_PROTO_H
 
-#define AXIS_NUMBER 4
-
-#define RC_PROTO_TYPE_CHANNEL 0
-#define RC_PROTO_TYPE_RANGE   1
-
+/* generic header */
+struct rc_proto_hdr {
+       uint8_t type;
+} __attribute__((packed));
 
-/* TODO: Authenticate packet!! */
+/* send a hello message, no answer is expected from the peer */
+#define RC_PROTO_HELLO 0
+struct rc_proto_hello {
+       uint8_t type;
+       uint8_t datalen;
+       uint8_t data[];
+} __attribute__((packed));
 
-struct rc_proto_hdr {
+/* send an echo request, expect an echo reply from the peer */
+#define RC_PROTO_ECHO_REQ 1
+struct rc_proto_echo_req {
        uint8_t type;
+       uint8_t datalen;
+       uint8_t data[];
 } __attribute__((packed));
 
-struct rc_proto_channel {
+/* reply to an echo request */
+#define RC_PROTO_ECHO_ANS 2
+struct rc_proto_echo_ans {
        uint8_t type;
-       int16_t axis[AXIS_NUMBER];
+       uint8_t datalen;
+       uint8_t data[];
 } __attribute__((packed));
 
-struct rc_proto_range {
+/* send a power level probe to the peer */
+#define RC_PROTO_POWER_PROBE 3
+struct rc_proto_power_probe {
        uint8_t type;
        uint8_t power_level;
 } __attribute__((packed));
 
+/* send a servo command */
+#define RC_PROTO_SERVO 4
+struct rc_proto_servo {
+       uint8_t type;
+       uint8_t mask;
+       uint8_t seq_and_pow; /* bitfield: pow are the 3 lsb, seq the 5 msb */
+};
+
+/* acknowledge a servo command */
+#define RC_PROTO_ACK 5
+struct rc_proto_ack {
+       uint8_t type;
+       uint8_t seq;
+} __attribute__((packed));
 
 void rc_proto_rx_range(int power_level);
 
diff --git a/xbee.c b/xbee.c
deleted file mode 100644 (file)
index 3aead5e..0000000
--- a/xbee.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2011, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the University of California, Berkeley nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <aversive.h>
-#include <aversive/queue.h>
-
-
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include "xbee_neighbor.h"
-#include "xbee_stats.h"
-#include "xbee_buf.h"
-#include "xbee_proto.h"
-#include "xbee.h"
-
-int xbee_init(void)
-{
-       return 0;
-}
-
-int xbee_register_channel(struct xbee_dev *dev, int channel,
-                         xbee_rx_cb_t *rx_cb, void *opaque)
-{
-       /* user asked for any channel */
-       if (channel == XBEE_CHANNEL_ANY) {
-               int ch;
-
-               /* skip XBEE_DEFAULT_CHANNEL == 0 */
-               for (ch = 1; ch < XBEE_MAX_CHANNEL; ch++) {
-                       if (dev->channel[ch].registered == 0) {
-                               channel = ch;
-                               break;
-                       }
-               }
-               /* no available channels */
-               if (channel == XBEE_CHANNEL_ANY)
-                       return -1;
-       }
-       /* user requested a specific channel */
-       else if (channel < 0 || channel >= XBEE_MAX_CHANNEL ||
-                dev->channel[channel].registered == 1)
-               return -1; /* not available */
-
-       dev->channel[channel].registered = 1;
-       dev->channel[channel].rx_cb = rx_cb;
-       dev->channel[channel].arg = opaque;
-       return channel;
-}
-
-int xbee_unregister_channel(struct xbee_dev *dev, int channel)
-{
-       if (channel < 0 || channel >= XBEE_MAX_CHANNEL ||
-           dev->channel[channel].registered == 0)
-               return -1;
-       dev->channel[channel].registered = 0;
-       dev->channel[channel].rx_cb = NULL;
-       dev->channel[channel].arg = NULL;
-       return 0;
-}
-
-int xbee_set_opaque(struct xbee_dev *dev, int channel, void *opaque)
-{
-       if (channel < 0 || channel >= XBEE_MAX_CHANNEL ||
-           dev->channel[channel].registered == 0)
-               return -1;
-
-       dev->channel[channel].arg = opaque;
-       return 0;
-}
-
-int xbee_open(struct xbee_dev *dev, FILE *xbee_file)
-{
-       memset(dev, 0, sizeof(*dev));
-       dev->file = xbee_file;
-       xbee_neigh_init(dev);
-       return 0;
-}
diff --git a/xbee.h b/xbee.h
deleted file mode 100644 (file)
index 81097cf..0000000
--- a/xbee.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2011, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the University of California, Berkeley nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _XBEE_H_
-#define _XBEE_H_
-
-/* Callback when receiving data on a specific channel. The arguments
- * of the function are the xbee device, the channel ID, the type of
- * the frame (example: XBEE_TYPE_ATRESP), the pointer to the frame,
- * the length of the frame, and an opaque pointer (reserved for user) */
-typedef void (xbee_rx_cb_t)(struct xbee_dev *, int, int, void *,
-                           unsigned, void *);
-
-/* an xbee queue */
-struct xbee_channel {
-       int registered;
-       xbee_rx_cb_t *rx_cb;
-       void *arg;
-};
-
-#define XBEE_DEFAULT_CHANNEL 0
-#define XBEE_MAX_CHANNEL 16
-#define XBEE_CHANNEL_ANY XBEE_MAX_CHANNEL
-
-/* structure identifying a xbee device */
-struct xbee_dev {
-       FILE *file;
-       struct xbee_channel channel[XBEE_MAX_CHANNEL];
-       uint8_t frame_len;
-       char frame[XBEE_MAX_FRAME_LEN];
-       struct xbee_stats stats;
-       struct xbee_neigh_list neigh_list;
-};
-
-/* initialize xbee library */
-int xbee_init(void);
-
-/* open an xbee device */
-int xbee_open(struct xbee_dev *dev, FILE *xbee_file);
-
-/* closes an xbee device */
-int xbee_close(struct xbee_dev *dev);
-
-/* Register a channel, return the ID of the channel or a negative
- * value on error. The rx_cb is a pointer to a function that will be
- * called by xbee_read() when a frame is received for this channel. If
- * rx_cb is NULL, no callback will occur. The "channel" argument can
- * be XBEE_CHANNEL_ANY to let the library choose the channel, or a
- * channel number to request a specific one. */
-int xbee_register_channel(struct xbee_dev *dev, int channel,
-                         xbee_rx_cb_t *rx_cb, void *opaque);
-
-/* This function (re)sets the opaque pointer on a registered
- * channel. The function returns 0 on success and -1 on error (channel
- * not registered). As the opaque pointer can already be set after a
- * call to xbee_register_channel(), this function is only useful if
- * the opaque pointer has to be modified. */
-int xbee_set_opaque(struct xbee_dev *dev, int channel, void *opaque);
-
-/* Unregister a channel, return 0 on success */
-int xbee_unregister_channel(struct xbee_dev *dev, int channel_id);
-
-/* read data from device fd and put it in queue */
-int xbee_read(struct xbee_dev *dev);
-
-/* process all data in queue */
-int xbee_process_queue(struct xbee_dev *dev);
-
-#endif /* _XBEE_H_ */
diff --git a/xbee_atcmd.c b/xbee_atcmd.c
deleted file mode 100644 (file)
index 426a808..0000000
+++ /dev/null
@@ -1,1168 +0,0 @@
-/*
- * Copyright (c) 2011, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the University of California, Berkeley nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <aversive/pgmspace.h>
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "xbee_atcmd.h"
-
-static const char PROGMEM atcmd0_name[] = "WR";
-static const char PROGMEM atcmd0_desc[] = "write-param";
-static const char PROGMEM atcmd0_help[] =
-       "Write parameter values to non-volatile memory.";
-
-static const char PROGMEM atcmd1_name[] = "RE";
-static const char PROGMEM atcmd1_desc[] = "restore-defaults";
-static const char PROGMEM atcmd1_help[] =
-       "Restore module parameters to factory defaults.";
-
-static const char PROGMEM atcmd2_name[] = "FR";
-static const char PROGMEM atcmd2_desc[] = "soft-reset";
-static const char PROGMEM atcmd2_help[] =
-       "Software Reset. Responds with 'OK' then performs a "
-       "reset 100ms later.";
-
-static const char PROGMEM atcmd3_name[] = "AC";
-static const char PROGMEM atcmd3_desc[] = "apply-changes";
-static const char PROGMEM atcmd3_help[] =
-       "Apply Changes without exiting command mode.";
-
-static const char PROGMEM atcmd4_name[] = "R1";
-static const char PROGMEM atcmd4_desc[] = "restore-compiled";
-static const char PROGMEM atcmd4_help[] =
-       "Restore module parameters to compiled defaults.";
-
-static const char PROGMEM atcmd5_name[] = "VL";
-static const char PROGMEM atcmd5_desc[] = "version-long";
-static const char PROGMEM atcmd5_help[] =
-       "Shows detailed version information including"
-       "application build date and time.";
-
-static const char PROGMEM atcmd6_name[] = "DH";
-static const char PROGMEM atcmd6_desc[] = "dst-addr-high";
-static const char PROGMEM atcmd6_help[] =
-       "Upper 32 bits of the 64-bit destination address (0 "
-       "to 0xFFFFFFFF, default is 0x0000FFFF).";
-
-static const char PROGMEM atcmd7_name[] = "DL";
-static const char PROGMEM atcmd7_desc[] = "dst-addr-low";
-static const char PROGMEM atcmd7_help[] =
-       "Lower 32 bits of the 64-bit destination address (0 "
-       "to 0xFFFFFFFF, default is 0x0000FFFF).";
-
-static const char PROGMEM atcmd8_name[] = "DD";
-static const char PROGMEM atcmd8_desc[] = "device-type-id";
-static const char PROGMEM atcmd8_help[] =
-       "Device Type Identifier, it can be used to differentiate "
-       "multiple XBee-based products (0 to 0xFFFFFFFF, read-only, "
-       "default is 0x40000).";
-
-static const char PROGMEM atcmd9_name[] = "SH";
-static const char PROGMEM atcmd9_desc[] = "src-addr-high";
-static const char PROGMEM atcmd9_help[] =
-       "Upper 32 bits of the 64-bit source address (read-only).";
-
-static const char PROGMEM atcmd10_name[] = "SL";
-static const char PROGMEM atcmd10_desc[] = "src-addr-low";
-static const char PROGMEM atcmd10_help[] =
-       "Lower 32 bits of the 64-bit source address (read-only).";
-
-static const char PROGMEM atcmd11_name[] = "SE";
-static const char PROGMEM atcmd11_desc[] = "src-endpoint";
-static const char PROGMEM atcmd11_help[] =
-       "The application source endpoint for all data transmissions "
-       "(0 to 0xFF, default is 0xE8).";
-
-static const char PROGMEM atcmd12_name[] = "DE";
-static const char PROGMEM atcmd12_desc[] = "dst-endpoint";
-static const char PROGMEM atcmd12_help[] =
-       "The application destination endpoint for all data "
-       "transmissions (0 to 0xFF, default is 0xE8).";
-
-static const char PROGMEM atcmd13_name[] = "CI";
-static const char PROGMEM atcmd13_desc[] = "cluster-id";
-static const char PROGMEM atcmd13_help[] =
-       "Cluster Identifier for all data transmissions (0 to 0xFFFF, "
-       "default is 0x11).";
-
-static const char PROGMEM atcmd14_name[] = "NP";
-static const char PROGMEM atcmd14_desc[] = "max-rf-payload";
-static const char PROGMEM atcmd14_help[] =
-       "Maximum RF Payload Bytes that can be sent in a unicast "
-       "transmission based on the current configuration (0 to "
-       "0xFFFF).";
-
-static const char PROGMEM atcmd15_name[] = "CE";
-static const char PROGMEM atcmd15_desc[] = "coord-end-device";
-static const char PROGMEM atcmd15_help[] =
-       "Coordinator/End Device, messaging mode of the module "
-       "(0 - Normal, 1 - Indirect coordinator, 2 - Polling, default "
-       "is 0).";
-
-static const char PROGMEM atcmd16_name[] = "AP";
-static const char PROGMEM atcmd16_desc[] = "api-mode";
-static const char PROGMEM atcmd16_help[] =
-       "API mode (0 - off, 1 - on, 2 - on with escape sequences).";
-
-static const char PROGMEM atcmd17_name[] = "AO";
-static const char PROGMEM atcmd17_desc[] = "api-output-format";
-static const char PROGMEM atcmd17_help[] =
-       "API Output Format (0 - standard [0x90 for RX], 1 - explicit "
-       "addressing [0x91 for RX]).";
-
-static const char PROGMEM atcmd18_name[] = "BD";
-static const char PROGMEM atcmd18_desc[] = "baud-rate";
-static const char PROGMEM atcmd18_help[] =
-       "Baud rate of serial interface (0-8 select preset standard "
-       "rates, and 0x39 to 0x1c9c38 select baud rate).";
-
-static const char PROGMEM atcmd19_name[] = "RO";
-static const char PROGMEM atcmd19_desc[] = "packetization-timeout";
-static const char PROGMEM atcmd19_help[] =
-       "Packetization Timeout: the inter-character silence required "
-       "before packetization specified in character times (0 to 0xFF, "
-       "default is 3).";
-
-static const char PROGMEM atcmd20_name[] = "FT";
-static const char PROGMEM atcmd20_desc[] = "flow-control-thres";
-static const char PROGMEM atcmd20_help[] =
-       "Flow Control Threshhold. De-assert CTS and/or send XOFF when "
-       "FT bytes are in the UART receive buffer. Re-assert CTS when "
-       "less than FT - 16 bytes are in the UART receive buffer (0x11 "
-       "to 0xEE, default is 0xBE).";
-
-static const char PROGMEM atcmd21_name[] = "NB";
-static const char PROGMEM atcmd21_desc[] = "parity";
-static const char PROGMEM atcmd21_help[] =
-       "Parity (0 - no parity, 1 - even parity, 2 - odd parity, 3 - "
-       "forced high parity, 4 - forced low parity). Default is 0.";
-
-static const char PROGMEM atcmd22_name[] = "D7";
-static const char PROGMEM atcmd22_desc[] = "dio7";
-static const char PROGMEM atcmd22_help[] =
-       "DIO7 Configuration (0 - unmonitored input, 1 - CTS, 3 - "
-       "digital input, 4 - digital output low, 5 - digital output "
-       "high, 6 - RS-485 low Tx, 7 - RS-485 high Tx). Default is "
-       "0.";
-
-static const char PROGMEM atcmd23_name[] = "D6";
-static const char PROGMEM atcmd23_desc[] = "dio6";
-static const char PROGMEM atcmd23_help[] =
-       "DIO6 Configuration (0 - unmonitored input, 1 - RTS, 3 - "
-       "digital input, 4 - digital output low, 5 - digital output "
-       "high). Default is 0.";
-
-static const char PROGMEM atcmd24_name[] = "P0";
-static const char PROGMEM atcmd24_desc[] = "dio10-pwm0";
-static const char PROGMEM atcmd24_help[] =
-       "DIO10/PWM0 Configuration. (0 - unmonitored input, 1 - RSSI, 2 "
-       "- PWM0, 3 - digital input, 4 - digital output low, 5 - "
-       "digital output high). Default is 1.";
-
-static const char PROGMEM atcmd25_name[] = "P1";
-static const char PROGMEM atcmd25_desc[] = "dio11-pwm1";
-static const char PROGMEM atcmd25_help[] =
-       "DIO11/PWM1 Configuration. (0 - unmonitored input, 2 "
-       "- PWM1, 3 - digital input, 4 - digital output low, 5 - "
-       "digital output high). Default is 0.";
-
-static const char PROGMEM atcmd26_name[] = "P2";
-static const char PROGMEM atcmd26_desc[] = "dio12";
-static const char PROGMEM atcmd26_help[] =
-       "DIO12 Configuration. (0 - unmonitored input, "
-       "3 - digital input, 4 - digital output low, 5 - "
-       "digital output high). Default is 0.";
-
-static const char PROGMEM atcmd27_name[] = "RP";
-static const char PROGMEM atcmd27_desc[] = "rssi-pwm";
-static const char PROGMEM atcmd27_help[] =
-       "Time RSSI signal will be output after last transmission. "
-       "When RP[] = 0xFF, output will always be on (0 - 0xFF, default "
-       "is 0x28[] = 4 seconds).";
-
-static const char PROGMEM atcmd28_name[] = "1S";
-static const char PROGMEM atcmd28_desc[] = "sensor-sample";
-static const char PROGMEM atcmd28_help[] =
-       "Forces a sample to be taken on an XBee Sensor device.";
-
-static const char PROGMEM atcmd29_name[] = "D0";
-static const char PROGMEM atcmd29_desc[] = "dio0-ad0";
-static const char PROGMEM atcmd29_help[] =
-       "AD0/DIO0 Configuration. (0 - unmonitored input, 1 - "
-       "commission button enabled, 2 - analog input, 3 - digital "
-       "input, 4 - digital output low, 5 - digital output high). "
-       "Default is 1.";
-
-static const char PROGMEM atcmd30_name[] = "D1";
-static const char PROGMEM atcmd30_desc[] = "dio1-ad1";
-static const char PROGMEM atcmd30_help[] =
-       "AD1/DIO1 Configuration. (0 - unmonitored input, "
-       "2 - analog input, 3 - digital input, 4 - digital output "
-       "low, 5 - digital output high). Default is 0.";
-
-static const char PROGMEM atcmd31_name[] = "D2";
-static const char PROGMEM atcmd31_desc[] = "dio2-ad2";
-static const char PROGMEM atcmd31_help[] =
-       "AD2/DIO2 Configuration. (0 - unmonitored input, "
-       "2 - analog input, 3 - digital input, 4 - digital output "
-       "low, 5 - digital output high). Default is 0.";
-
-static const char PROGMEM atcmd32_name[] = "D3";
-static const char PROGMEM atcmd32_desc[] = "dio3-ad3";
-static const char PROGMEM atcmd32_help[] =
-       "AD3/DIO3 Configuration. (0 - unmonitored input, "
-       "2 - analog input, 3 - digital input, 4 - digital output "
-       "low, 5 - digital output high). Default is 0.";
-
-static const char PROGMEM atcmd33_name[] = "D4";
-static const char PROGMEM atcmd33_desc[] = "dio4-ad4";
-static const char PROGMEM atcmd33_help[] =
-       "AD4/DIO4 Configuration. (0 - unmonitored input, "
-       "2 - analog input, 3 - digital input, 4 - digital output "
-       "low, 5 - digital output high). Default is 0.";
-
-static const char PROGMEM atcmd34_name[] = "D5";
-static const char PROGMEM atcmd34_desc[] = "dio5-ad5";
-static const char PROGMEM atcmd34_help[] =
-       "AD4/DIO4 Configuration. (0 - unmonitored input, 1 - LED, "
-       "2 - analog input, 3 - digital input, 4 - digital output "
-       "low, 5 - digital output high). Default is 1.";
-
-static const char PROGMEM atcmd35_name[] = "D8";
-static const char PROGMEM atcmd35_desc[] = "dio8-sleep-rq";
-static const char PROGMEM atcmd35_help[] =
-       "DIO8/SLEEP_RQ Configuration. (0 - unmonitored input, 1 - LED, "
-       "2 - analog input, 3 - digital input, 4 - digital output "
-       "low, 5 - digital output high). Default is 0. When used as "
-       "SLEEP_RQ, the D8 parameter should be configured in mode 0 "
-       "or 3.";
-
-static const char PROGMEM atcmd36_name[] = "D9";
-static const char PROGMEM atcmd36_desc[] = "dio9-on-sleep";
-static const char PROGMEM atcmd36_help[] =
-       "DIO9/ON_SLEEP Configuration. (0 - unmonitored input, 1 - "
-       "ON/SLEEP, 2 - analog input, 3 - digital input, 4 - digital "
-       "output low, 5 - digital output high). Default is ?.";
-
-static const char PROGMEM atcmd37_name[] = "PR";
-static const char PROGMEM atcmd37_desc[] = "pull-up-resistor";
-static const char PROGMEM atcmd37_help[] =
-       "Pull-up Resistor. Bit field that configures the internal "
-       "pull-up resistors for the I/O lines (bit set = pull-up "
-       "enabled). Range is from 0 to 0x1FFF, default is 0x1FFF.";
-
-static const char PROGMEM atcmd38_name[] = "M0";
-static const char PROGMEM atcmd38_desc[] = "pwm0-out-level";
-static const char PROGMEM atcmd38_help[] =
-       "PWM0 Output Level. The line should be configured as a PWM "
-       "output using the P0 command (0 to 0x3FF, default is 0).";
-
-static const char PROGMEM atcmd39_name[] = "M1";
-static const char PROGMEM atcmd39_desc[] = "pwm1-out-level";
-static const char PROGMEM atcmd39_help[] =
-       "PWM1 Output Level. The line should be configured as a PWM "
-       "output using the P1 command (0 to 0x3FF, default is 0).";
-
-static const char PROGMEM atcmd40_name[] = "LT";
-static const char PROGMEM atcmd40_desc[] = "led-blink-time";
-static const char PROGMEM atcmd40_help[] =
-       "Associate LED Blink Time (should be enabled through D5 ";
-
-static const char PROGMEM atcmd41_name[] = "IS";
-static const char PROGMEM atcmd41_desc[] = "force-sample";
-static const char PROGMEM atcmd41_help[] =
-       "Forces a read of all enabled digital and "
-       "analog input lines.";
-
-static const char PROGMEM atcmd42_name[] = "IC";
-static const char PROGMEM atcmd42_desc[] = "digital-change-detect";
-static const char PROGMEM atcmd42_help[] =
-       "I/O Digital Change Detection. If a pin is enabled as a "
-       "digital input/output, the IC command can be used to "
-       "force an immediate I/O sample transmission when the DIO "
-       "state changes. IC is a bitmask, range is 0 to 0xFFFF, "
-       "default is 0";
-
-static const char PROGMEM atcmd43_name[] = "IR";
-static const char PROGMEM atcmd43_desc[] = "io-sample-rate";
-static const char PROGMEM atcmd43_help[] =
-       "IO Sample Rate for periodic sampling. If zero, periodic "
-       "sampling is disabled. Else the value is in milliseconds "
-       "(range 0 to 0xFFFF, default is 0).";
-
-static const char PROGMEM atcmd44_name[] = "CB";
-static const char PROGMEM atcmd44_desc[] = "comissioning-button";
-static const char PROGMEM atcmd44_help[] =
-       "Commissioning Pushbutton, simulate commissioning button "
-       "in software. The parameter value should be set to the number "
-       "of button presses to be simulated (range is 0 to 4).";
-
-static const char PROGMEM atcmd45_name[] = "VR";
-static const char PROGMEM atcmd45_desc[] = "firmware-version";
-static const char PROGMEM atcmd45_help[] =
-       "Firmware version of the module (read only).";
-
-static const char PROGMEM atcmd46_name[] = "HV";
-static const char PROGMEM atcmd46_desc[] = "hardware-version";
-static const char PROGMEM atcmd46_help[] =
-       "Hardware version of the module (read only).";
-
-static const char PROGMEM atcmd47_name[] = "CK";
-static const char PROGMEM atcmd47_desc[] = "config-code";
-static const char PROGMEM atcmd47_help[] =
-       "Configuration Code, that can be used as a quick "
-       "check to determine if a node has been configured as "
-       "desired (read-only, 0-0xFFFFFFFF).";
-
-static const char PROGMEM atcmd48_name[] = "ER";
-static const char PROGMEM atcmd48_desc[] = "rf-errors";
-static const char PROGMEM atcmd48_help[] =
-       "Number of times a packet was received which contained errors "
-       "of some sort. Read-only, saturate at 0xFFFF.";
-
-static const char PROGMEM atcmd49_name[] = "GD";
-static const char PROGMEM atcmd49_desc[] = "good-packets";
-static const char PROGMEM atcmd49_help[] =
-       "Number of good received frames. Read-only, saturate at "
-       "0xFFFF.";
-
-static const char PROGMEM atcmd50_name[] = "RP";
-static const char PROGMEM atcmd50_desc[] = "rssi-pwm-timer";
-static const char PROGMEM atcmd50_help[] =
-       "RSSI PWM timer, the time in tenth of seconds that the RSSI "
-       "output indicating signal strength will remain active after "
-       "the last reception (1 to 0xff, default is 0x20 = 3.2 secs).";
-
-static const char PROGMEM atcmd51_name[] = "TR";
-static const char PROGMEM atcmd51_desc[] = "tx-errors";
-static const char PROGMEM atcmd51_help[] =
-       "Transmission Errors, the number of MAC frames that "
-       "exhaust MAC retries without ever receiving a MAC "
-       "acknowledgement message. Read-only, saturate at 0xFFFF.";
-
-static const char PROGMEM atcmd52_name[] = "TP";
-static const char PROGMEM atcmd52_desc[] = "temperature";
-static const char PROGMEM atcmd52_help[] =
-       "Temperature. Read module temperature in (tenths of ?) "
-       "Celsius. Negatives temperatures can be returned (read-only, "
-       "from 0xff74 [-140] to 0x0258 [600]).";
-
-static const char PROGMEM atcmd53_name[] = "DB";
-static const char PROGMEM atcmd53_desc[] = "rx-signal-strength";
-static const char PROGMEM atcmd53_help[] =
-       "Received Signal Strength of the last received RF data "
-       "packet measured in -dBm. For example if DB returns 0x60, "
-       "then the RSSI of the last packet received was -96dBm "
-       "(read-only).";
-
-static const char PROGMEM atcmd54_name[] = "DC";
-static const char PROGMEM atcmd54_desc[] = "duty-cycle";
-static const char PROGMEM atcmd54_help[] =
-       "Duty Cycle. Returns a current usage percentage of the "
-       "10% duty cycle measured over the period of 1 hour "
-       "(read-only, from 0 to 0x64).";
-
-static const char PROGMEM atcmd55_name[] = "RC";
-static const char PROGMEM atcmd55_desc[] = "rssi-for-channel";
-static const char PROGMEM atcmd55_help[] =
-       "Reads the dBm level (RSSI) of the designated "
-       "channel.";
-
-static const char PROGMEM atcmd56_name[] = "R#";
-static const char PROGMEM atcmd56_desc[] = "reset-number";
-static const char PROGMEM atcmd56_help[] =
-       "Tells the reason for the last module reset (0 - Power up "
-       "reset, 2 - Watchdog reset, 3 - Software reset, 4 - Reset "
-       "line reset, 5 - Brownout reset). Read-only.";
-
-static const char PROGMEM atcmd57_name[] = "TA";
-static const char PROGMEM atcmd57_desc[] = "tx-ack-errors";
-static const char PROGMEM atcmd57_help[] =
-       "Transmit Acknowlegement Errors. Incremented once for "
-       "each failed ack retry (read-only, from 0 to 0xFFFF).";
-
-static const char PROGMEM atcmd58_name[] = "%V";
-static const char PROGMEM atcmd58_desc[] = "supply-voltage";
-static const char PROGMEM atcmd58_help[] =
-       "Voltage on the Vcc pin in mV (read-only, from 0 to 0xF00).";
-
-static const char PROGMEM atcmd59_name[] = "CT";
-static const char PROGMEM atcmd59_desc[] = "cmd-mode-timeout";
-static const char PROGMEM atcmd59_help[] =
-       "Command Mode Timeout: the period of inactivity (no valid "
-       "commands received) after which the RF module automatically "
-       "exits AT Command Mode and returns to Idle Mode (2 to 0x1770, "
-       "default is 0x64).";
-
-static const char PROGMEM atcmd60_name[] = "CN";
-static const char PROGMEM atcmd60_desc[] = "exit-cmd-mode";
-static const char PROGMEM atcmd60_help[] =
-       "Exit Command Mode.";
-
-static const char PROGMEM atcmd61_name[] = "GT";
-static const char PROGMEM atcmd61_desc[] = "guard-times";
-static const char PROGMEM atcmd61_help[] =
-       "Guard Times: period of silence in ms before and after the "
-       "Command Sequence Characters of the AT Command Mode Sequence, "
-       "used to prevent inadvertent entrance into AT Command Mode "
-       "(0 to 0xFFFF, default is 0x3E8).";
-
-static const char PROGMEM atcmd62_name[] = "CC";
-static const char PROGMEM atcmd62_desc[] = "command-chars";
-static const char PROGMEM atcmd62_help[] =
-       "Command Character used between guard times of the AT Command "
-       "Mode Sequence (0 to 0xFF, default is 0x2B).";
-
-static const char PROGMEM atcmd63_name[] = "ID";
-static const char PROGMEM atcmd63_desc[] = "network-id";
-static const char PROGMEM atcmd63_help[] =
-       "Network ID. Nodes must have the same network identifier "
-       "to communicate (0 to 0x7FFF, default is 0x7FFF).";
-
-static const char PROGMEM atcmd64_name[] = "NT";
-static const char PROGMEM atcmd64_desc[] = "ndisc-timeout";
-static const char PROGMEM atcmd64_help[] =
-       "Node Discover Timeout, time in tenth of secs a node will "
-       "spend discovering other nodes when ND or DN is issued (0 "
-       "to 0xFC, default is 0x82).";
-
-static const char PROGMEM atcmd65_name[] = "NI";
-static const char PROGMEM atcmd65_desc[] = "node-id";
-static const char PROGMEM atcmd65_help[] =
-       "Node Identifier in printable ASCII characters. This string is "
-       "returned as part of the ATND (Network Discover) command. This "
-       "identifier is also used with the ATDN (Destination Node) "
-       "command. The string contains up to 20 byte ASCII string, "
-       "default is a space character.";
-
-static const char PROGMEM atcmd66_name[] = "DN";
-static const char PROGMEM atcmd66_desc[] = "disc-node";
-static const char PROGMEM atcmd66_help[] = /* XXX */
-       "Resolves a Node Identifier string to a physical address "
-       "(case sensitive). 0xFFFE and the 64bits extended address are "
-       "returned.";
-
-static const char PROGMEM atcmd67_name[] = "ND";
-static const char PROGMEM atcmd67_desc[] = "network-discover";
-static const char PROGMEM atcmd67_help[] = "Network Discovery, see doc"; /* XXX */
-
-static const char PROGMEM atcmd68_name[] = "NO";
-static const char PROGMEM atcmd68_desc[] = "ndisc-options";
-static const char PROGMEM atcmd68_help[] =
-       "Network Discovery Options, a bitfield value that changes the "
-       "behavior of the ND command (bit0 - Append DD value, bit1 - "
-       "Local device sends ND response frame when ND is issued). "
-       "Default is 0.";
-
-static const char PROGMEM atcmd69_name[] = "EE";
-static const char PROGMEM atcmd69_desc[] = "security enable";
-static const char PROGMEM atcmd69_help[] =
-       "Enable or disable 128-bit AES encryption (0 or 1, 0 is the "
-       "default).";
-
-static const char PROGMEM atcmd70_name[] = "KY"; /* XXX */;
-static const char PROGMEM atcmd70_desc[] = "security-key";
-static const char PROGMEM atcmd70_help[] =
-       "The 128bits security key (the command is write-only).";
-
-static const char PROGMEM atcmd71_name[] = "MT";
-static const char PROGMEM atcmd71_desc[] = "bcast-multi-xmit";
-static const char PROGMEM atcmd71_help[] =
-       "Number of additional MAC-level broadcast transmissions. All "
-       "broadcast packets are transmitted MT+1 times to ensure "
-       "it is received (0 to 0xF, default is 3).";
-
-static const char PROGMEM atcmd72_name[] = "RR";
-static const char PROGMEM atcmd72_desc[] = "unicast-retries";
-static const char PROGMEM atcmd72_help[] =
-       "Number of additional MAC-level packet delivery attempts for "
-       "unicast transactions. If RR is non-zero, packets sent from "
-       "the radio will request an acknowledgement, and can be resent "
-       "up to RR times if no acknowledgement is received. (0 to 0xF, "
-       "default is 10).";
-
-static const char PROGMEM atcmd73_name[] = "PL";
-static const char PROGMEM atcmd73_desc[] = "power-level";
-static const char PROGMEM atcmd73_help[] =
-       "Power Level of RF transmitter (0 - 1mW, 1 - 23mW, 2 - 100mW, "
-       "3 - 158 mW, 4 - 316 mW). Default is 4.";
-
-static const char PROGMEM atcmd74_name[] = "SM";
-static const char PROGMEM atcmd74_desc[] = "sleep-mode";
-static const char PROGMEM atcmd74_help[] =
-       "Sleep Mode (0 - disabled, 1 - pin sleep, 4 - async cyclic "
-       "sleep, 5 - async cyclic sleep with pin wakeup). Default "
-       "is 0.";
-
-static const char PROGMEM atcmd75_name[] = "SO";
-static const char PROGMEM atcmd75_desc[] = "sleep-options";
-static const char PROGMEM atcmd75_help[] =
-       "Sleep Options bitmask (bit8 - always wake for ST time). "
-       "Default is 0.";
-
-static const char PROGMEM atcmd76_name[] = "ST";
-static const char PROGMEM atcmd76_desc[] = "wake-time";
-static const char PROGMEM atcmd76_help[] =
-       "Wake Time: the amount of time in ms that the module will stay "
-       "awake after receiving RF or serial data (from 0x45 to "
-       "0x36EE80, default is 0x7D0 = 2 secs).";
-
-static const char PROGMEM atcmd77_name[] = "SP";
-static const char PROGMEM atcmd77_desc[] = "sleep-period";
-static const char PROGMEM atcmd77_help[] =
-       "Sleep Period: the amount of time in 10ms unit the module will "
-       "sleep per cycle. For a node operating as an Indirect "
-       "Messaging Coordinator, this command defines the amount of "
-       "time that it will hold an indirect message for an end device. "
-       "The coordinator will hold the message for (2.5 * SP). Range "
-       "is from 1 to 1440000, default is 200 (2 secs).";
-
-static const char PROGMEM atcmd78_name[] = "SN";
-static const char PROGMEM atcmd78_desc[] = "num-sleep-periods";
-static const char PROGMEM atcmd78_help[] =
-       "Number of Sleep Periods that must elapse between assertions "
-       "of the ON_SLEEP line during the wake time of asynchronous "
-       "cyclic sleep (1 to 0xFFFF, default is 1).";
-
-static const char PROGMEM atcmd79_name[] = "WH";
-static const char PROGMEM atcmd79_desc[] = "wake-host";
-static const char PROGMEM atcmd79_help[] = "Wake Host time. If it is set to a non-zero value, it "
-       "specifies the time in ms that the device should allow after "
-       "waking from sleep before sending data out the UART or "
-       "transmitting an I/O sample. If serial characters are "
-       "received, the WH timer is stopped immediately. Range is "
-       "from 0 to 0xFFFF, default is 0.";
-
-const struct xbee_atcmd PROGMEM xbee_atcmd_list[] = {
-       {
-               /* "WR" */
-               atcmd0_name,
-               atcmd0_desc,
-               XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
-               atcmd0_help,
-       },
-       {
-               /* "RE" */
-               atcmd1_name,
-               atcmd1_desc,
-               XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
-               atcmd1_help,
-       },
-       {
-               /* "FR" */
-               atcmd2_name,
-               atcmd2_desc,
-               XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
-               atcmd2_help,
-       },
-       {
-               /* "AC" */
-               atcmd3_name,
-               atcmd3_desc,
-               XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
-               atcmd3_help,
-       },
-       {
-               /* "R1" */
-               atcmd4_name,
-               atcmd4_desc,
-               XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
-               atcmd4_help,
-       },
-       {
-               /* "VL" */
-               atcmd5_name,
-               atcmd5_desc,
-               XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
-               atcmd5_help,
-       },
-       {
-               /* "DH" */
-               atcmd6_name,
-               atcmd6_desc,
-               XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd6_help,
-       },
-       {
-               /* "DL" */
-               atcmd7_name,
-               atcmd7_desc,
-               XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd7_help,
-       },
-       {
-               /* "DD" */
-               atcmd8_name,
-               atcmd8_desc,
-               XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ,
-               atcmd8_help,
-       },
-       {
-               /* "SH" */
-               atcmd9_name,
-               atcmd9_desc,
-               XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ,
-               atcmd9_help,
-       },
-       {
-               /* "SL" */
-               atcmd10_name,
-               atcmd10_desc,
-               XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ,
-               atcmd10_help,
-       },
-       {
-               /* "SE" */
-               atcmd11_name,
-               atcmd11_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd11_help,
-       },
-       {
-               /* "DE" */
-               atcmd12_name,
-               atcmd12_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd12_help,
-       },
-       {
-               /* "CI" */
-               atcmd13_name,
-               atcmd13_desc,
-               XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd13_help,
-       },
-       {
-               /* "NP" */
-               atcmd14_name,
-               atcmd14_desc,
-               XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ,
-               atcmd14_help,
-       },
-       {
-               /* "CE" */
-               atcmd15_name,
-               atcmd15_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd15_help,
-       },
-       {
-               /* "AP" */
-               atcmd16_name,
-               atcmd16_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd16_help,
-       },
-       {
-               /* "AO" */
-               atcmd17_name,
-               atcmd17_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd17_help,
-       },
-       {
-               /* "BD" */
-               atcmd18_name,
-               atcmd18_desc,
-               XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd18_help,
-       },
-       {
-               /* "RO" */
-               atcmd19_name,
-               atcmd19_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd19_help,
-       },
-       {
-               /* "FT" */
-               atcmd20_name,
-               atcmd20_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd20_help,
-       },
-       {
-               /* "NB" */
-               atcmd21_name,
-               atcmd21_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd21_help,
-       },
-       {
-               /* "D7" */
-               atcmd22_name,
-               atcmd22_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd22_help,
-       },
-       {
-               /* "D6" */
-               atcmd23_name,
-               atcmd23_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd23_help,
-       },
-       {
-               /* "P0" */
-               atcmd24_name,
-               atcmd24_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd24_help,
-       },
-       {
-               /* "P1" */
-               atcmd25_name,
-               atcmd25_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd25_help,
-       },
-       {
-               /* "P2" */
-               atcmd26_name,
-               atcmd26_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd26_help,
-       },
-       {
-               /* "RP" */
-               atcmd27_name,
-               atcmd27_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd27_help,
-       },
-       {
-               /* "1S" */
-               atcmd28_name,
-               atcmd28_desc,
-               XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
-               atcmd28_help,
-       },
-       {
-               /* "D0" */
-               atcmd29_name,
-               atcmd29_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd29_help,
-       },
-       {
-               /* "D1" */
-               atcmd30_name,
-               atcmd30_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd30_help,
-       },
-       {
-               /* "D2" */
-               atcmd31_name,
-               atcmd31_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd31_help,
-       },
-       {
-               /* "D3" */
-               atcmd32_name,
-               atcmd32_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd32_help,
-       },
-       {
-               /* "D4" */
-               atcmd33_name,
-               atcmd33_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd33_help,
-       },
-       {
-               /* "D5" */
-               atcmd34_name,
-               atcmd34_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd34_help,
-       },
-       {
-               /* "D8" */
-               atcmd35_name,
-               atcmd35_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd35_help,
-       },
-       {
-               /* "D9" */
-               atcmd36_name,
-               atcmd36_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd36_help,
-       },
-       {
-               /* "PR" */
-               atcmd37_name,
-               atcmd37_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd37_help,
-       },
-       {
-               /* "M0" */
-               atcmd38_name,
-               atcmd38_desc,
-               XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd38_help,
-       },
-       {
-               /* "M1" */
-               atcmd39_name,
-               atcmd39_desc,
-               XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd39_help,
-       },
-       {
-               /* "LT" */
-               atcmd40_name,
-               atcmd40_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd40_help,
-       },
-       {
-               /* "IS" */
-               atcmd41_name,
-               atcmd41_desc,
-               XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
-               atcmd41_help,
-       },
-       {
-               /* "IC" */
-               atcmd42_name,
-               atcmd42_desc,
-               XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd42_help,
-       },
-       {
-               /* "IR" */
-               atcmd43_name,
-               atcmd43_desc,
-               XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd43_help,
-       },
-       {
-               /* "CB" */
-               atcmd44_name,
-               atcmd44_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd44_help,
-       },
-       {
-               /* "VR" */
-               atcmd45_name,
-               atcmd45_desc,
-               XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ,
-               atcmd45_help,
-       },
-       {
-               /* "HV" */
-               atcmd46_name,
-               atcmd46_desc,
-               XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ,
-               atcmd46_help,
-       },
-       {
-               /* "CK" */
-               atcmd47_name,
-               atcmd47_desc,
-               XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ,
-               atcmd47_help,
-       },
-       {
-               /* "ER" */
-               atcmd48_name,
-               atcmd48_desc,
-               XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ,
-               atcmd48_help,
-       },
-       {
-               /* "GD" */
-               atcmd49_name,
-               atcmd49_desc,
-               XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ,
-               atcmd49_help,
-       },
-       {
-               /* "RP" */
-               atcmd50_name,
-               atcmd50_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd50_help,
-       },
-       {
-               /* "TR" */
-               atcmd51_name,
-               atcmd51_desc,
-               XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ,
-               atcmd51_help,
-       },
-       {
-               /* "TP" */
-               atcmd52_name,
-               atcmd52_desc,
-               XBEE_ATCMD_F_PARAM_S16 | XBEE_ATCMD_F_READ,
-               atcmd52_help,
-       },
-       {
-               /* "DB" */
-               atcmd53_name,
-               atcmd53_desc,
-               XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ,
-               atcmd53_help,
-       },
-       {
-               /* "DC" */
-               atcmd54_name,
-               atcmd54_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ,
-               atcmd54_help,
-       },
-       {
-               /* "RC" */
-               atcmd55_name,
-               atcmd55_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ,
-               atcmd55_help,
-       },
-       {
-               /* "R#" */
-               atcmd56_name,
-               atcmd56_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ,
-               atcmd56_help,
-       },
-       {
-               /* "TA" */
-               atcmd57_name,
-               atcmd57_desc,
-               XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ,
-               atcmd57_help,
-       },
-       {
-               /* "%V" */
-               atcmd58_name,
-               atcmd58_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ,
-               atcmd58_help,
-       },
-       {
-               /* "CT" */
-               atcmd59_name,
-               atcmd59_desc,
-               XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd59_help,
-       },
-       {
-               /* "CN" */
-               atcmd60_name,
-               atcmd60_desc,
-               XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
-               atcmd60_help,
-       },
-       {
-               /* "GT" */
-               atcmd61_name,
-               atcmd61_desc,
-               XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd61_help,
-       },
-       {
-               /* "CC" */
-               atcmd62_name,
-               atcmd62_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd62_help,
-       },
-       {
-               /* "ID" */
-               atcmd63_name,
-               atcmd63_desc,
-               XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd63_help,
-       },
-       {
-               /* "NT" */
-               atcmd64_name,
-               atcmd64_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd64_help,
-       },
-       {
-               /* "NI" */
-               atcmd65_name,
-               atcmd65_desc,
-               XBEE_ATCMD_F_PARAM_STRING_20B | XBEE_ATCMD_F_READ |
-               XBEE_ATCMD_F_WRITE,
-               atcmd65_help,
-       },
-       {
-               /* "DN" */
-               atcmd66_name,
-               atcmd66_desc,
-               XBEE_ATCMD_F_PARAM_STRING_20B | XBEE_ATCMD_F_READ |
-               XBEE_ATCMD_F_WRITE,
-               atcmd66_help,
-       },
-       {
-               /* "ND" */
-               atcmd67_name,
-               atcmd67_desc,
-               XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
-               atcmd67_help,
-       },
-       {
-               /* "NO" */
-               atcmd68_name,
-               atcmd68_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd68_help,
-       },
-       {
-               /* "EE" */
-               atcmd69_name,
-               atcmd69_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd69_help,
-       },
-       {
-               /* "KY"  XXX */
-               atcmd70_name,
-               atcmd70_desc,
-               XBEE_ATCMD_F_PARAM_HEXBUF_16B | XBEE_ATCMD_F_WRITE,
-               atcmd70_help,
-       },
-       {
-               /* "MT" */
-               atcmd71_name,
-               atcmd71_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd71_help,
-       },
-       {
-               /* "RR" */
-               atcmd72_name,
-               atcmd72_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd72_help,
-       },
-       {
-               /* "PL" */
-               atcmd73_name,
-               atcmd73_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd73_help,
-       },
-       {
-               /* "SM" */
-               atcmd74_name,
-               atcmd74_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd74_help,
-       },
-       {
-               /* "SO" */
-               atcmd75_name,
-               atcmd75_desc,
-               XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd75_help,
-       },
-       {
-               /* "ST" */
-               atcmd76_name,
-               atcmd76_desc,
-               XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd76_help,
-       },
-       {
-               /* "SP" */
-               atcmd77_name,
-               atcmd77_desc,
-               XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd77_help,
-       },
-       {
-               /* "SN" */
-               atcmd78_name,
-               atcmd78_desc,
-               XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd78_help,
-       },
-       {
-               /* "WH" */
-               atcmd79_name,
-               atcmd79_desc,
-               XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
-               atcmd79_help,
-       },
-       {
-               NULL,
-               NULL,
-               0,
-               NULL,
-       },
-};
-
-const struct xbee_atcmd *xbee_atcmd_lookup_name(const char *atcmd_str)
-{
-       const struct xbee_atcmd *cmd;
-       struct xbee_atcmd copy;
-
-       for (cmd = &xbee_atcmd_list[0], memcpy_P(&copy, cmd, sizeof(copy));
-            copy.name != NULL;
-            cmd++, memcpy_P(&copy, cmd, sizeof(copy))) {
-
-               if (!strcmp_P(atcmd_str, copy.name))
-                       break;
-       }
-
-       if (copy.name == NULL) /* not found */
-               return NULL;
-
-       return cmd;
-}
-
-const struct xbee_atcmd *xbee_atcmd_lookup_desc(const char *desc)
-{
-       const struct xbee_atcmd *cmd;
-       struct xbee_atcmd copy;
-
-       for (cmd = &xbee_atcmd_list[0], memcpy_P(&copy, cmd, sizeof(copy));
-            copy.name != NULL;
-            cmd++, memcpy_P(&copy, cmd, sizeof(copy))) {
-               if (!strcmp_P(desc, copy.desc))
-                       break;
-       }
-       if (copy.name == NULL) /* not found */
-               return NULL;
-
-       return cmd;
-}
diff --git a/xbee_atcmd.h b/xbee_atcmd.h
deleted file mode 100644 (file)
index 84f2223..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2011, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the University of California, Berkeley nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _XBEE_ATCMD_H_
-#define _XBEE_ATCMD_H_
-
-#define XBEE_ATCMD_F_READ              0x001
-#define XBEE_ATCMD_F_WRITE             0x002
-#define XBEE_ATCMD_F_PARAM_NONE        0x004
-#define XBEE_ATCMD_F_PARAM_U8          0x008
-#define XBEE_ATCMD_F_PARAM_U16         0x010
-#define XBEE_ATCMD_F_PARAM_S16         0x020
-#define XBEE_ATCMD_F_PARAM_U32         0x040
-#define XBEE_ATCMD_F_PARAM_STRING_20B  0x080
-#define XBEE_ATCMD_F_PARAM_HEXBUF_16B  0x100
-
-/* list of xbee at commands */
-struct xbee_atcmd {
-       PGM_P name;
-       PGM_P desc;
-       unsigned int flags;
-       PGM_P help;
-};
-
-extern const struct xbee_atcmd PROGMEM xbee_atcmd_list[];
-
-const struct xbee_atcmd *xbee_atcmd_lookup_name(const char *atcmd_str);
-const struct xbee_atcmd *xbee_atcmd_lookup_desc(const char *desc);
-
-#endif /* _xBEE_ATCMD_H_ */
diff --git a/xbee_buf.c b/xbee_buf.c
deleted file mode 100644 (file)
index 1306b2c..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 2011, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the University of California, Berkeley nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <sys/queue.h>
-
-#include "xbee_neighbor.h"
-#include "xbee_stats.h"
-#include "xbee_buf.h"
-#include "xbee.h"
-
-struct xbee_buf *xbee_buf_alloc(void)
-{
-       struct xbee_buf *xbuf;
-
-       xbuf = malloc(sizeof(*xbuf));
-       if (xbuf == NULL)
-               return NULL;
-       memset(xbuf, 0, sizeof(*xbuf));
-       xbuf->offset = 0;
-       xbuf->len = 0;
-       return xbuf;
-}
-
-int xbee_buf_tailroom(struct xbee_buf *xbuf)
-{
-       return XBEE_BUF_SIZE - xbuf->len - xbuf->offset;
-}
-
-char *xbee_buf_data(struct xbee_buf *xbuf, unsigned off)
-{
-       if (off >= xbuf->len)
-               return NULL;
-       return xbuf->buf + xbuf->offset + off;
-}
-
-char *xbee_buf_head(struct xbee_buf *xbuf)
-{
-       return xbuf->buf + xbuf->offset;
-}
-
-char *xbee_buf_tail(struct xbee_buf *xbuf)
-{
-       return xbuf->buf + xbuf->offset + xbuf->len;
-}
-
-void xbee_buf_enqueue(struct xbee_bufq *q, struct xbee_buf *xbuf)
-{
-       CIRCLEQ_INSERT_TAIL(&q->xbq, xbuf, next);
-       q->len += xbuf->len;
-       q->nseg++;
-}
-
-struct xbee_buf *xbee_bufq_last(struct xbee_bufq *q)
-{
-       if (CIRCLEQ_EMPTY(&q->xbq))
-               return NULL;
-       return CIRCLEQ_LAST(&q->xbq);
-}
-
-void xbee_bufq_init(struct xbee_bufq *q)
-{
-       CIRCLEQ_INIT(&q->xbq);
-       q->len = 0;
-       q->nseg = 0;
-}
-
-void xbee_bufq_append(struct xbee_bufq *q, unsigned len)
-{
-       struct xbee_buf *xbuf;
-
-       q->len += len;
-       xbuf = CIRCLEQ_LAST(&q->xbq);
-       xbuf->len += len;
-}
-
-void xbee_bufq_flush(struct xbee_bufq *q)
-{
-       struct xbee_buf *xbuf;
-
-       while (!CIRCLEQ_EMPTY(&q->xbq)) {
-               xbuf = CIRCLEQ_FIRST(&q->xbq);
-               CIRCLEQ_REMOVE(&q->xbq, xbuf, next);
-               q->nseg --;
-               q->len -= xbuf->len;
-               free(xbuf);
-       }
-}
-
-char *xbee_bufq_data(struct xbee_bufq *q, unsigned off)
-{
-       struct xbee_buf *xbuf;
-       char *data = NULL;
-
-       if (off >= q->len)
-               return NULL;
-
-       CIRCLEQ_FOREACH(xbuf, &q->xbq, next) {
-               data = xbee_buf_data(xbuf, off);
-               if (data != NULL)
-                       return data;
-               off -= xbuf->len;
-       }
-
-       return data;
-}
-
-/* drop data in front of queue */
-int xbee_bufq_drop(struct xbee_bufq *q, unsigned len)
-{
-       struct xbee_buf *xbuf;
-
-       if (len > q->len)
-               return -1;
-
-       while (!CIRCLEQ_EMPTY(&q->xbq)) {
-               xbuf = CIRCLEQ_FIRST(&q->xbq);
-               if (xbuf->len > len)
-                       break;
-               CIRCLEQ_REMOVE(&q->xbq, xbuf, next);
-               len -= xbuf->len;
-               q->nseg --;
-               q->len -= xbuf->len;
-               free(xbuf);
-               xbuf = NULL;
-       }
-
-       if (xbuf != NULL) {
-               xbuf->len -= len;
-               xbuf->offset += len;
-               q->len -= len;
-       }
-
-       return 0;
-}
-
-int xbee_bufq_copy(struct xbee_bufq *q, void *buf, unsigned len)
-{
-       struct xbee_buf *xbuf;
-       unsigned dstoff = 0, copylen;
-
-       if (len > q->len)
-               return -1;
-
-       CIRCLEQ_FOREACH(xbuf, &q->xbq, next) {
-               copylen = len;
-               if (xbuf->len < len)
-                       copylen = xbuf->len;
-               memcpy(buf + dstoff, xbuf->buf + xbuf->offset, copylen);
-               len -= copylen;
-               if (len == 0)
-                       break;
-               dstoff += copylen;
-       }
-
-       return 0;
-}
-
diff --git a/xbee_buf.h b/xbee_buf.h
deleted file mode 100644 (file)
index cecddcf..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2011, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the University of California, Berkeley nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define XBEE_BUF_SIZE 0x200
-
-/* a xbee data buffer */
-struct xbee_buf {
-       CIRCLEQ_ENTRY(xbee_buf) next;
-       unsigned offset;
-       unsigned len;
-       char buf[XBEE_BUF_SIZE];
-};
-
-/* queue of xbee_buf */
-CIRCLEQ_HEAD(xbufq, xbee_buf);
-
-struct xbee_bufq {
-       struct xbufq xbq;
-       unsigned len;
-       unsigned nseg;
-};
-
-/* allocate a new xbee_buf */
-struct xbee_buf *xbee_buf_alloc(void);
-
-/* return the number of remaining bytes in xbee_buf */
-int xbee_buf_tailroom(struct xbee_buf *xbuf);
-
-/* return the pointer to data at offset 'off', or NULL if off > xbuf->len */
-char *xbee_buf_data(struct xbee_buf *xbuf, unsigned off);
-
-/* return the first data of a xbuf (also works if len is 0) */
-char *xbee_buf_head(struct xbee_buf *xbuf);
-
-/* return the pointer just after data of a xbuf (also works if len is 0) */
-char *xbee_buf_tail(struct xbee_buf *xbuf);
-
-/* enqueue a xbuf in a xbufq */
-void xbee_buf_enqueue(struct xbee_bufq *q, struct xbee_buf *xbuf);
-
-
-
-/* return the last xbuf of a queue, or NULL if the queue is empty */
-struct xbee_buf *xbee_bufq_last(struct xbee_bufq *q);
-
-/* initialize a xbuf queue */
-void xbee_bufq_init(struct xbee_bufq *q);
-
-/* flush a xbuf queue */
-void xbee_bufq_flush(struct xbee_bufq *q);
-
-/* append data in queue (just update lens), user should memcpy first */
-void xbee_bufq_append(struct xbee_bufq *q, unsigned len);
-
-/* return the pointer to data at offset 'off', or NULL if off > q->len */
-char *xbee_bufq_data(struct xbee_bufq *q, unsigned off);
-
-/* drop data in front of queue */
-int xbee_bufq_drop(struct xbee_bufq *q, unsigned len);
-
-/* copy data in front of queue in a linear buffer */
-int xbee_bufq_copy(struct xbee_bufq *q, void *buf, unsigned len);
diff --git a/xbee_neighbor.c b/xbee_neighbor.c
deleted file mode 100644 (file)
index 22daa02..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2011, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the University of California, Berkeley nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <aversive.h>
-#include <aversive/queue.h>
-#include <aversive/pgmspace.h>
-
-#include <string.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "xbee_neighbor.h"
-#include "xbee_atcmd.h"
-#include "xbee_stats.h"
-#include "xbee_buf.h"
-#include "xbee_proto.h"
-#include "xbee.h"
-
-void xbee_neigh_init(struct xbee_dev *dev)
-{
-       LIST_INIT(&dev->neigh_list);
-}
-
-struct xbee_neigh *xbee_neigh_lookup(struct xbee_dev *dev, const char *name)
-{
-       struct xbee_neigh *neigh;
-
-       LIST_FOREACH(neigh, &dev->neigh_list, next) {
-               if (!strcmp(name, neigh->name))
-                       break;
-       }
-
-       return neigh;
-}
-
-struct xbee_neigh *xbee_neigh_rlookup(struct xbee_dev *dev, uint64_t addr)
-{
-       struct xbee_neigh *neigh;
-
-       LIST_FOREACH(neigh, &dev->neigh_list, next) {
-               if (addr == neigh->addr)
-                       break;
-       }
-
-       return neigh;
-}
-
-struct xbee_neigh *xbee_neigh_add(struct xbee_dev *dev, const char *name,
-                                 uint64_t addr)
-{
-       struct xbee_neigh *neigh;
-
-       if (xbee_neigh_rlookup(dev, addr) != NULL)
-               return NULL;
-
-       if (xbee_neigh_lookup(dev, name) != NULL)
-               return NULL;
-
-       neigh = malloc(sizeof(*neigh));
-       if (neigh == NULL)
-               return NULL;
-
-       neigh->addr = addr;
-       snprintf_P(neigh->name, sizeof(neigh->name), PSTR("%s"), name);
-       LIST_INSERT_HEAD(&dev->neigh_list, neigh, next);
-
-       return neigh;
-}
-
-void xbee_neigh_del(struct xbee_dev *dev, struct xbee_neigh *neigh)
-{
-       dev = dev; /* silent compiler */
-       LIST_REMOVE(neigh, next);
-       free(neigh);
-}
diff --git a/xbee_neighbor.h b/xbee_neighbor.h
deleted file mode 100644 (file)
index 0939a24..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2011, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the University of California, Berkeley nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _XBEE_NEIGHBOR_H_
-#define _XBEE_NEIGHBOR_H_
-
-struct xbee_neigh {
-       LIST_ENTRY(xbee_neigh) next;
-       char name[21];
-       uint64_t addr;
-};
-
-struct xbee_dev;
-
-/* define struct xbee_neigh_list */
-LIST_HEAD(xbee_neigh_list, xbee_neigh);
-
-/* init neighbor list of an xbee device */
-void xbee_neigh_init(struct xbee_dev *dev);
-
-/* return a neighbor from its name */
-struct xbee_neigh *xbee_neigh_lookup(struct xbee_dev *dev, const char *name);
-
-/* return a neighbor from its address (in host order) */
-struct xbee_neigh *xbee_neigh_rlookup(struct xbee_dev *dev, uint64_t addr);
-
-/* add a neighbor */
-struct xbee_neigh *xbee_neigh_add(struct xbee_dev *dev, const char *name,
-                                 uint64_t addr);
-
-/* del a neighbor from list */
-void xbee_neigh_del(struct xbee_dev *dev, struct xbee_neigh *neigh);
-
-#endif /* _XBEE_NEIGHBOR_H_ */
diff --git a/xbee_proto.c b/xbee_proto.c
deleted file mode 100644 (file)
index 409d9a9..0000000
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * Copyright (c) 2011, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the University of California, Berkeley nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <aversive.h>
-#include <aversive/pgmspace.h>
-#include <aversive/queue.h>
-#include <aversive/endian.h>
-
-#include <uart.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "xbee_neighbor.h"
-#include "xbee_stats.h"
-#include "xbee_buf.h"
-#include "xbee_proto.h"
-#include "xbee.h"
-
-/* return -1 if the frame is invalid */
-static int xbee_proto_parse_atresp(struct xbee_dev *dev, void *buf,
-                                  unsigned len)
-{
-       struct xbee_atresp_hdr *atresp_hdr;
-
-       dev->stats.rx_atresp++;
-
-       if (len < sizeof(struct xbee_hdr) + sizeof(struct xbee_atresp_hdr)) {
-               dev->stats.rx_frame_too_small++;
-               return -1;
-       }
-
-       atresp_hdr = buf + sizeof(struct xbee_hdr);
-
-       /* bad status, but let the frame continue */
-       if (atresp_hdr->status != 0)
-               dev->stats.rx_atresp_error++;
-
-       return 0;
-}
-
-/* return -1 if the frame is invalid */
-static int xbee_proto_parse_rmt_atresp(struct xbee_dev *dev, void *buf,
-                                  unsigned len)
-{
-       struct xbee_rmt_atresp_hdr *rmt_atresp_hdr;
-
-       dev->stats.rx_rmt_atresp++;
-
-       if (len < sizeof(struct xbee_hdr) + sizeof(struct xbee_rmt_atresp_hdr)) {
-               dev->stats.rx_frame_too_small++;
-               return -1;
-       }
-
-       rmt_atresp_hdr = buf + sizeof(struct xbee_hdr);
-
-       /* bad status, but let the frame continue */
-       if (rmt_atresp_hdr->status != 0)
-               dev->stats.rx_rmt_atresp_error++;
-
-       return 0;
-}
-
-/* return -1 if the frame is invalid */
-static int xbee_proto_parse_xmit_status(struct xbee_dev *dev, void *buf,
-                                       unsigned len)
-{
-       struct xbee_xmit_status_hdr *xmit_status_hdr;
-
-       dev->stats.rx_xmit_status++;
-
-       if (len < sizeof(struct xbee_hdr) + sizeof(struct xbee_xmit_status_hdr)) {
-               dev->stats.rx_frame_too_small++;
-               return -1;
-       }
-
-       xmit_status_hdr = buf + sizeof(struct xbee_hdr);
-       dev->stats.tx_xmit_retries += xmit_status_hdr->xmit_retry_cnt;
-
-       /* bad status, but let the frame continue */
-       if (xmit_status_hdr->delivery_status != 0)
-               dev->stats.rx_xmit_status_error++;
-
-       return 0;
-}
-
-/* parse the frame stored in the device: return 0 if the frame is
- * valid, else a negative value */
-static int xbee_proto_parse_frame(struct xbee_dev *dev)
-{
-       void *buf = dev->frame;
-       uint8_t len = dev->frame_len;
-       uint8_t hdrlen;
-       struct xbee_hdr *hdr = buf;
-       int i;
-       uint8_t cksum = 0;
-       int channel = XBEE_DEFAULT_CHANNEL;
-
-       dev->stats.rx_frame++;
-
-       switch (hdr->type) {
-               case XBEE_TYPE_MODEM_STATUS:
-               case XBEE_TYPE_RECV:
-               case XBEE_TYPE_EXPL_RECV:
-                       hdrlen = sizeof(struct xbee_hdr) - 1; /* no frame ID */
-                       break;
-               default:
-                       hdrlen = sizeof(struct xbee_hdr);
-                       break;
-       }
-
-       /* check frame len */
-       if (len < (hdrlen + 1)) {
-               dev->stats.rx_frame_too_small++;
-               fprintf_P(stderr, PSTR("Frame too small\r\n"));
-               return -1;
-       }
-
-       /* validate the cksum */
-       for (i = 3; i < (len - 1); i++)
-               cksum += ((uint8_t *)buf)[i];
-       cksum = 0xff - cksum;
-       if (cksum != ((uint8_t *)buf)[len-1]) {
-               fprintf_P(stderr, PSTR("Invalid cksum\r\n"));
-               dev->stats.rx_invalid_cksum++;
-               return -1;
-       }
-
-       /* dispatch */
-       switch (hdr->type) {
-               case XBEE_TYPE_MODEM_STATUS:
-                       dev->stats.rx_modem_status++;
-                       channel = XBEE_DEFAULT_CHANNEL;
-                       break;
-               case XBEE_TYPE_ATRESP:
-                       if (xbee_proto_parse_atresp(dev, buf, len) < 0)
-                               return -1;
-                       channel = hdr->id;
-                       break;
-               case XBEE_TYPE_RMT_ATRESP:
-                       if (xbee_proto_parse_rmt_atresp(dev, buf, len) < 0)
-                               return -1;
-                       channel = hdr->id;
-                       break;
-               case XBEE_TYPE_XMIT_STATUS:
-                       if (xbee_proto_parse_xmit_status(dev, buf, len) < 0)
-                               return -1;
-                       channel = hdr->id;
-                       break;
-               case XBEE_TYPE_RECV:
-                       dev->stats.rx_data++;
-                       channel = XBEE_DEFAULT_CHANNEL;
-                       break;
-               case XBEE_TYPE_EXPL_RECV:
-                       dev->stats.rx_expl_data++;
-                       channel = XBEE_DEFAULT_CHANNEL;
-                       break;
-               case XBEE_TYPE_NODE_ID:
-                       dev->stats.rx_node_id++;
-                       channel = hdr->id; //XXX
-                       break;
-                       /* invalid commands */
-               case XBEE_TYPE_ATCMD:
-               case XBEE_TYPE_ATCMD_Q:
-               case XBEE_TYPE_XMIT:
-               case XBEE_TYPE_EXPL_XMIT:
-               case XBEE_TYPE_RMT_ATCMD:
-               default:
-                       dev->stats.rx_invalid_type++;
-                       break;
-       }
-
-       /* fallback to default channel if not registered */
-       if (channel < 0 || channel >= XBEE_MAX_CHANNEL ||
-           dev->channel[channel].registered == 0)
-               channel = XBEE_DEFAULT_CHANNEL;
-
-       /* execute the callback if any */
-       if (dev->channel[channel].rx_cb != NULL)
-               dev->channel[channel].rx_cb(dev, channel, hdr->type,
-                                           buf + hdrlen,
-                                           len - hdrlen - 1,
-                                           dev->channel[channel].arg);
-
-       return 0;
-}
-
-int xbee_proto_xmit(struct xbee_dev *dev, uint8_t channel_id, uint8_t type,
-                   void *buf, unsigned len)
-{
-       struct xbee_hdr hdr;
-       unsigned i;
-       uint8_t cksum = 0;
-
-       /* there is no empty message, so return an error */
-       if (len == 0)
-               return -1;
-
-       /* prepare an iovec to avoid a copy: prepend a header to the
-        * buffer and append a checksum */
-       hdr.delimiter = XBEE_DELIMITER;
-       hdr.len = htons(len + 2);
-       hdr.type = type;
-       hdr.id = channel_id;
-
-       if (channel_id >= XBEE_MAX_CHANNEL ||
-           dev->channel[channel_id].registered == 0) {
-               dev->stats.tx_invalid_channel ++;
-               return -1;
-       }
-
-       /* calculate the cksum */
-       cksum = hdr.type;
-       cksum += hdr.id;
-       for (i = 0; i < len; i++)
-               cksum += ((uint8_t *)buf)[i];
-       cksum = 0xff - cksum;
-       dev->stats.tx_frame ++;
-
-       /* some additional checks before sending */
-       switch (hdr.type) {
-
-               case XBEE_TYPE_ATCMD:
-                       // XXX some checks ?
-                       dev->stats.tx_atcmd ++;
-                       break;
-               case XBEE_TYPE_ATCMD_Q:
-                       dev->stats.tx_atcmd_q ++;
-                       break;
-               case XBEE_TYPE_XMIT:
-                       dev->stats.tx_data ++;
-                       break;
-               case XBEE_TYPE_EXPL_XMIT:
-                       dev->stats.tx_expl_data ++;
-                       break;
-               case XBEE_TYPE_RMT_ATCMD:
-                       dev->stats.tx_rmt_atcmd ++;
-                       break;
-
-               /* invalid commands */
-               case XBEE_TYPE_XMIT_STATUS:
-               case XBEE_TYPE_MODEM_STATUS:
-               case XBEE_TYPE_ATRESP:
-               case XBEE_TYPE_RECV:
-               case XBEE_TYPE_EXPL_RECV:
-               case XBEE_TYPE_NODE_ID:
-               case XBEE_TYPE_RMT_ATRESP:
-               default:
-                       dev->stats.tx_invalid_type ++;
-                       fprintf_P(stderr, PSTR("unhandled xmit type=%x\r\n"),
-                                 hdr.type);
-                       return -1;
-       }
-
-       /* send the frame on the wire */
-       fwrite((uint8_t *)&hdr, 1, sizeof(hdr), dev->file);
-       fwrite((uint8_t *)buf, 1, len, dev->file);
-       fwrite(&cksum, 1, 1, dev->file);
-
-       return 0;
-}
-
-void xbee_proto_rx(struct xbee_dev *dev)
-{
-       uint8_t framelen;
-       struct xbee_hdr *hdr = (struct xbee_hdr *)dev->frame;
-       int c;
-
-       while (1) {
-
-               /* read from UART */
-               c = fgetc(dev->file);
-               if (c == EOF)
-                       break;
-
-               /* frame too long XXX stats */
-               if (dev->frame_len >= XBEE_MAX_FRAME_LEN) {
-                       dev->frame_len = 0;
-                       continue;
-               }
-
-               if (dev->frame_len == 0 && c != XBEE_DELIMITER)
-                       continue;
-
-               dev->frame[dev->frame_len++] = c;
-
-               /* not enough data to read len */
-               if (dev->frame_len < sizeof(*hdr))
-                       continue;
-
-               framelen = ntohs(hdr->len);
-               framelen += 4; /* 1 for delimiter, 2 for len, 1 for cksum */
-
-               /* frame too long XXX stats */
-               if (framelen >= XBEE_MAX_FRAME_LEN) {
-                       dev->frame_len = 0;
-                       continue;
-               }
-
-               /* not enough data */
-               if (dev->frame_len < framelen)
-                       continue;
-               if (xbee_proto_parse_frame(dev) < 0) {
-                       ;//XXX stats
-               }
-               dev->frame_len = 0;
-       }
-}
diff --git a/xbee_proto.h b/xbee_proto.h
deleted file mode 100644 (file)
index 7608379..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2011, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the University of California, Berkeley nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _XBEE_PROTO_H_
-#define _XBEE_PROTO_H_
-
-/* protocol headers */
-
-#define XBEE_DELIMITER 0x7E
-#define XBEE_MAX_FRAME_LEN 0x40
-
-struct xbee_hdr {
-       uint8_t delimiter;
-       uint16_t len;
-       uint8_t type;
-       uint8_t id;
-} __attribute__((packed));
-
-#define XBEE_TYPE_ATCMD 0x08
-struct xbee_atcmd_hdr {
-       uint16_t cmd;
-       uint8_t params[];
-} __attribute__((packed));
-
-#define XBEE_TYPE_ATCMD_Q 0x09
-struct xbee_atcmd_q_hdr {
-       uint16_t cmd;
-       uint8_t params[];
-} __attribute__((packed));
-
-#define XBEE_TYPE_XMIT 0x10
-struct xbee_xmit_hdr {
-       uint64_t dstaddr;
-       uint16_t reserved;
-       uint8_t bcast_radius;
-       uint8_t opts;
-       uint8_t data[];
-} __attribute__((packed));
-
-#define XBEE_TYPE_EXPL_XMIT 0x11
-struct xbee_expl_xmit_hdr {
-       uint64_t dstaddr;
-       uint16_t reserved;
-       uint8_t src_endpoint;
-       uint8_t dst_endpoint;
-       uint16_t cluster_id;
-       uint16_t profile_id;
-       uint8_t bcast_radius;
-       uint8_t opts;
-       uint8_t data[];
-} __attribute__((packed));
-
-#define XBEE_TYPE_RMT_ATCMD 0x17
-struct xbee_rmt_atcmd_hdr {
-       uint64_t dstaddr;
-       uint16_t reserved;
-       uint8_t opts;
-       uint16_t cmd;
-       uint8_t params[];
-} __attribute__((packed));
-
-#define XBEE_TYPE_ATRESP 0x88
-struct xbee_atresp_hdr {
-       uint16_t cmd;
-       uint8_t status;
-       uint8_t data[];
-} __attribute__((packed));
-
-#define XBEE_TYPE_MODEM_STATUS 0x8A
-struct xbee_modem_status_hdr {
-       /* empty */
-} __attribute__((packed));
-
-#define XBEE_TYPE_XMIT_STATUS 0x8B
-struct xbee_xmit_status_hdr {
-       uint16_t reserved;
-       uint8_t xmit_retry_cnt;
-       uint8_t delivery_status;
-       uint8_t discovery_status;
-} __attribute__((packed));
-
-#define XBEE_TYPE_RECV 0x90
-struct xbee_recv_hdr {
-       uint64_t srcaddr;
-       uint16_t reserved;
-       uint8_t opts;
-       uint8_t data[];
-} __attribute__((packed));
-
-#define XBEE_TYPE_EXPL_RECV 0x91
-struct xbee_expl_recv_hdr {
-       uint64_t srcaddr;
-       uint16_t reserved;
-       uint8_t src_endpoint;
-       uint8_t dst_endpoint;
-       uint16_t cluster_id;
-       uint16_t profile_id;
-       uint8_t opts;
-       uint8_t data[];
-} __attribute__((packed));
-
-#define XBEE_TYPE_NODE_ID 0x95
-struct xbee_node_id_hdr {
-       uint64_t srcaddr;
-       uint16_t srcnetwork;
-       uint8_t opts;
-       uint16_t dstnetwork;
-       uint64_t dstaddr;
-       uint8_t ni_string[];
-       /* uint16_t parentaddr; after variable field */
-} __attribute__((packed));
-
-#define XBEE_TYPE_RMT_ATRESP 0x97
-struct xbee_rmt_atresp_hdr {
-       uint64_t srcaddr;
-       uint16_t reserved;
-       uint16_t cmd;
-       uint8_t status;
-       uint8_t data[];
-} __attribute__((packed));
-
-struct xbee_dev;
-
-/* return negative on error, 0 if there is not frame, or framelen */
-int xbee_proto_get_frame(struct xbee_dev *dev, void *buf, unsigned len);
-
-/* send a frame */
-int xbee_proto_xmit(struct xbee_dev *dev, uint8_t id, uint8_t type,
-                   void *buf, unsigned len);
-
-void xbee_proto_rx(struct xbee_dev *dev);
-
-#endif /* _XBEE_PROTO_H_ */
diff --git a/xbee_stats.c b/xbee_stats.c
deleted file mode 100644 (file)
index cadc9f6..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2011, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the University of California, Berkeley nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <aversive.h>
-#include <aversive/pgmspace.h>
-#include <aversive/queue.h>
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-
-#include "xbee_neighbor.h"
-#include "xbee_stats.h"
-#include "xbee_proto.h"
-#include "xbee_buf.h"
-#include "xbee.h"
-
-struct xbee_stats *xbee_get_stats(struct xbee_dev *dev)
-{
-       return &dev->stats;
-}
-
-void xbee_reset_stats(struct xbee_dev *dev)
-{
-       memset(&dev->stats, 0, sizeof(dev->stats));
-}
-
-void xbee_dump_stats(struct xbee_dev *dev)
-{
-       printf_P(PSTR("statistics on xbee_dev %p:\r\n"), dev);
-       printf_P(PSTR(" rx_frame: %"PRIu32"\r\n"), dev->stats.rx_frame);
-       printf_P(PSTR(" rx_atresp: %"PRIu32"\r\n"), dev->stats.rx_atresp);
-       printf_P(PSTR(" rx_atresp_error: %"PRIu32"\r\n"), dev->stats.rx_atresp_error);
-       printf_P(PSTR(" rx_modem_status: %"PRIu32"\r\n"), dev->stats.rx_modem_status);
-       printf_P(PSTR(" rx_xmit_status: %"PRIu32"\r\n"), dev->stats.rx_xmit_status);
-       printf_P(PSTR(" rx_xmit_status_error: %"PRIu32"\r\n"), dev->stats.rx_xmit_status_error);
-       printf_P(PSTR(" rx_data: %"PRIu32"\r\n"), dev->stats.rx_data);
-       printf_P(PSTR(" rx_expl_data: %"PRIu32"\r\n"), dev->stats.rx_expl_data);
-       printf_P(PSTR(" rx_node_id: %"PRIu32"\r\n"), dev->stats.rx_node_id);
-       printf_P(PSTR(" rx_rmt_atresp: %"PRIu32"\r\n"), dev->stats.rx_rmt_atresp);
-       printf_P(PSTR(" rx_rmt_atresp_error: %"PRIu32"\r\n"), dev->stats.rx_rmt_atresp_error);
-       printf_P(PSTR(" rx_frame_too_small: %"PRIu32"\r\n"), dev->stats.rx_frame_too_small);
-       printf_P(PSTR(" rx_frame_too_large: %"PRIu32"\r\n"), dev->stats.rx_frame_too_large);
-       printf_P(PSTR(" rx_invalid_cksum: %"PRIu32"\r\n"), dev->stats.rx_invalid_cksum);
-       printf_P(PSTR(" rx_invalid_type: %"PRIu32"\r\n"), dev->stats.rx_invalid_type);
-       printf_P(PSTR(" rx_no_delim: %"PRIu32"\r\n"), dev->stats.rx_no_delim);
-       printf_P(PSTR(" tx_frame: %"PRIu32"\r\n"), dev->stats.tx_frame);
-       printf_P(PSTR(" tx_atcmd: %"PRIu32"\r\n"), dev->stats.tx_atcmd);
-       printf_P(PSTR(" tx_atcmd_q: %"PRIu32"\r\n"), dev->stats.tx_atcmd_q);
-       printf_P(PSTR(" tx_data: %"PRIu32"\r\n"), dev->stats.tx_data);
-       printf_P(PSTR(" tx_expl_data: %"PRIu32"\r\n"), dev->stats.tx_expl_data);
-       printf_P(PSTR(" tx_xmit_retries: %"PRIu32"\r\n"), dev->stats.tx_xmit_retries);
-       printf_P(PSTR(" tx_rmt_atcmd: %"PRIu32"\r\n"), dev->stats.tx_rmt_atcmd);
-       printf_P(PSTR(" tx_invalid_type: %"PRIu32"\r\n"), dev->stats.tx_invalid_type);
-       printf_P(PSTR(" tx_invalid_channel: %"PRIu32"\r\n"), dev->stats.tx_invalid_channel);
-}
diff --git a/xbee_stats.h b/xbee_stats.h
deleted file mode 100644 (file)
index 257aeb5..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2011, Olivier MATZ <zer0@droids-corp.org>
- * All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in the
- *       documentation and/or other materials provided with the distribution.
- *     * Neither the name of the University of California, Berkeley nor the
- *       names of its contributors may be used to endorse or promote products
- *       derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _XBEE_STATS_H_
-#define _XBEE_STATS_H_
-
-/* per-device statistics */
-struct xbee_stats {
-       uint32_t rx_frame;
-       uint32_t rx_atresp;
-       uint32_t rx_atresp_error;
-       uint32_t rx_modem_status;
-       uint32_t rx_xmit_status;
-       uint32_t rx_xmit_status_error;
-       uint32_t rx_data;
-       uint32_t rx_expl_data;
-       uint32_t rx_node_id;
-       uint32_t rx_rmt_atresp;
-       uint32_t rx_rmt_atresp_error;
-       uint32_t rx_frame_too_small;
-       uint32_t rx_frame_too_large;
-       uint32_t rx_invalid_cksum;
-       uint32_t rx_invalid_type;
-       uint32_t rx_no_delim;
-
-       uint32_t tx_frame;
-       uint32_t tx_atcmd;
-       uint32_t tx_atcmd_q;
-       uint32_t tx_data;
-       uint32_t tx_expl_data;
-       uint32_t tx_xmit_retries;
-       uint32_t tx_rmt_atcmd;
-       uint32_t tx_invalid_type;
-       uint32_t tx_invalid_channel;
-};
-
-struct xbee_dev;
-
-/* return pointer to device stats */
-struct xbee_stats *xbee_get_stats(struct xbee_dev *dev);
-
-/* reset statistics of device */
-void xbee_reset_stats(struct xbee_dev *dev);
-
-/* dump statistics on stdout */
-void xbee_dump_stats(struct xbee_dev *dev);
-
-#endif /* _XBEE_STATS_H_ */