-/*
- * 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(©, cmd, sizeof(copy));
- copy.name != NULL;
- cmd++, memcpy_P(©, 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(©, cmd, sizeof(copy));
- copy.name != NULL;
- cmd++, memcpy_P(©, cmd, sizeof(copy))) {
- if (!strcmp_P(desc, copy.desc))
- break;
- }
- if (copy.name == NULL) /* not found */
- return NULL;
-
- return cmd;
-}