xbee: add a new module
[aversive.git] / modules / devices / radio / xbee / xbee_atcmd.c
1 /*
2  * Copyright (c) 2011, Olivier MATZ <zer0@droids-corp.org>
3  * All rights reserved.
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  *     * Redistributions of source code must retain the above copyright
8  *       notice, this list of conditions and the following disclaimer.
9  *     * Redistributions in binary form must reproduce the above copyright
10  *       notice, this list of conditions and the following disclaimer in the
11  *       documentation and/or other materials provided with the distribution.
12  *     * Neither the name of the University of California, Berkeley nor the
13  *       names of its contributors may be used to endorse or promote products
14  *       derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27
28 #include <aversive/pgmspace.h>
29
30 #include <string.h>
31 #include <stdlib.h>
32 #include <stdio.h>
33
34 #include "xbee_atcmd.h"
35
36 static const char PROGMEM atcmd0_name[] = "WR";
37 static const char PROGMEM atcmd0_desc[] = "write-param";
38 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
39 static const char PROGMEM atcmd0_help[] =
40         "Write parameter values to non-volatile memory.";
41 #endif
42
43 static const char PROGMEM atcmd1_name[] = "RE";
44 static const char PROGMEM atcmd1_desc[] = "restore-defaults";
45 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
46 static const char PROGMEM atcmd1_help[] =
47         "Restore module parameters to factory defaults.";
48 #endif
49
50 static const char PROGMEM atcmd2_name[] = "FR";
51 static const char PROGMEM atcmd2_desc[] = "soft-reset";
52 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
53 static const char PROGMEM atcmd2_help[] =
54         "Software Reset. Responds with 'OK' then performs a "
55         "reset 100ms later.";
56 #endif
57
58 static const char PROGMEM atcmd3_name[] = "AC";
59 static const char PROGMEM atcmd3_desc[] = "apply-changes";
60 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
61 static const char PROGMEM atcmd3_help[] =
62         "Apply Changes without exiting command mode.";
63 #endif
64
65 static const char PROGMEM atcmd4_name[] = "R1";
66 static const char PROGMEM atcmd4_desc[] = "restore-compiled";
67 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
68 static const char PROGMEM atcmd4_help[] =
69         "Restore module parameters to compiled defaults.";
70 #endif
71
72 static const char PROGMEM atcmd5_name[] = "VL";
73 static const char PROGMEM atcmd5_desc[] = "version-long";
74 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
75 static const char PROGMEM atcmd5_help[] =
76         "Shows detailed version information including"
77         "application build date and time.";
78 #endif
79
80 static const char PROGMEM atcmd6_name[] = "DH";
81 static const char PROGMEM atcmd6_desc[] = "dst-addr-high";
82 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
83 static const char PROGMEM atcmd6_help[] =
84         "Upper 32 bits of the 64-bit destination address (0 "
85         "to 0xFFFFFFFF, default is 0x0000FFFF).";
86 #endif
87
88 static const char PROGMEM atcmd7_name[] = "DL";
89 static const char PROGMEM atcmd7_desc[] = "dst-addr-low";
90 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
91 static const char PROGMEM atcmd7_help[] =
92         "Lower 32 bits of the 64-bit destination address (0 "
93         "to 0xFFFFFFFF, default is 0x0000FFFF).";
94 #endif
95
96 static const char PROGMEM atcmd8_name[] = "DD";
97 static const char PROGMEM atcmd8_desc[] = "device-type-id";
98 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
99 static const char PROGMEM atcmd8_help[] =
100         "Device Type Identifier, it can be used to differentiate "
101         "multiple XBee-based products (0 to 0xFFFFFFFF, read-only, "
102         "default is 0x40000).";
103 #endif
104
105 static const char PROGMEM atcmd9_name[] = "SH";
106 static const char PROGMEM atcmd9_desc[] = "src-addr-high";
107 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
108 static const char PROGMEM atcmd9_help[] =
109         "Upper 32 bits of the 64-bit source address (read-only).";
110 #endif
111
112 static const char PROGMEM atcmd10_name[] = "SL";
113 static const char PROGMEM atcmd10_desc[] = "src-addr-low";
114 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
115 static const char PROGMEM atcmd10_help[] =
116         "Lower 32 bits of the 64-bit source address (read-only).";
117 #endif
118
119 static const char PROGMEM atcmd11_name[] = "SE";
120 static const char PROGMEM atcmd11_desc[] = "src-endpoint";
121 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
122 static const char PROGMEM atcmd11_help[] =
123         "The application source endpoint for all data transmissions "
124         "(0 to 0xFF, default is 0xE8).";
125 #endif
126
127 static const char PROGMEM atcmd12_name[] = "DE";
128 static const char PROGMEM atcmd12_desc[] = "dst-endpoint";
129 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
130 static const char PROGMEM atcmd12_help[] =
131         "The application destination endpoint for all data "
132         "transmissions (0 to 0xFF, default is 0xE8).";
133 #endif
134
135 static const char PROGMEM atcmd13_name[] = "CI";
136 static const char PROGMEM atcmd13_desc[] = "cluster-id";
137 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
138 static const char PROGMEM atcmd13_help[] =
139         "Cluster Identifier for all data transmissions (0 to 0xFFFF, "
140         "default is 0x11).";
141 #endif
142
143 static const char PROGMEM atcmd14_name[] = "NP";
144 static const char PROGMEM atcmd14_desc[] = "max-rf-payload";
145 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
146 static const char PROGMEM atcmd14_help[] =
147         "Maximum RF Payload Bytes that can be sent in a unicast "
148         "transmission based on the current configuration (0 to "
149         "0xFFFF).";
150 #endif
151
152 static const char PROGMEM atcmd15_name[] = "CE";
153 static const char PROGMEM atcmd15_desc[] = "coord-end-device";
154 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
155 static const char PROGMEM atcmd15_help[] =
156         "Coordinator/End Device, messaging mode of the module "
157         "(0 - Normal, 1 - Indirect coordinator, 2 - Polling, default "
158         "is 0).";
159 #endif
160
161 static const char PROGMEM atcmd16_name[] = "AP";
162 static const char PROGMEM atcmd16_desc[] = "api-mode";
163 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
164 static const char PROGMEM atcmd16_help[] =
165         "API mode (0 - off, 1 - on, 2 - on with escape sequences).";
166 #endif
167
168 static const char PROGMEM atcmd17_name[] = "AO";
169 static const char PROGMEM atcmd17_desc[] = "api-output-format";
170 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
171 static const char PROGMEM atcmd17_help[] =
172         "API Output Format (0 - standard [0x90 for RX], 1 - explicit "
173         "addressing [0x91 for RX]).";
174 #endif
175
176 static const char PROGMEM atcmd18_name[] = "BD";
177 static const char PROGMEM atcmd18_desc[] = "baud-rate";
178 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
179 static const char PROGMEM atcmd18_help[] =
180         "Baud rate of serial interface (0-8 select preset standard "
181         "rates, and 0x39 to 0x1c9c38 select baud rate).";
182 #endif
183
184 static const char PROGMEM atcmd19_name[] = "RO";
185 static const char PROGMEM atcmd19_desc[] = "packetization-timeout";
186 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
187 static const char PROGMEM atcmd19_help[] =
188         "Packetization Timeout: the inter-character silence required "
189         "before packetization specified in character times (0 to 0xFF, "
190         "default is 3).";
191 #endif
192
193 static const char PROGMEM atcmd20_name[] = "FT";
194 static const char PROGMEM atcmd20_desc[] = "flow-control-thres";
195 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
196 static const char PROGMEM atcmd20_help[] =
197         "Flow Control Threshhold. De-assert CTS and/or send XOFF when "
198         "FT bytes are in the UART receive buffer. Re-assert CTS when "
199         "less than FT - 16 bytes are in the UART receive buffer (0x11 "
200         "to 0xEE, default is 0xBE).";
201 #endif
202
203 static const char PROGMEM atcmd21_name[] = "NB";
204 static const char PROGMEM atcmd21_desc[] = "parity";
205 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
206 static const char PROGMEM atcmd21_help[] =
207         "Parity (0 - no parity, 1 - even parity, 2 - odd parity, 3 - "
208         "forced high parity, 4 - forced low parity). Default is 0.";
209 #endif
210
211 static const char PROGMEM atcmd22_name[] = "D7";
212 static const char PROGMEM atcmd22_desc[] = "dio7";
213 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
214 static const char PROGMEM atcmd22_help[] =
215         "DIO7 Configuration (0 - unmonitored input, 1 - CTS, 3 - "
216         "digital input, 4 - digital output low, 5 - digital output "
217         "high, 6 - RS-485 low Tx, 7 - RS-485 high Tx). Default is "
218         "0.";
219 #endif
220
221 static const char PROGMEM atcmd23_name[] = "D6";
222 static const char PROGMEM atcmd23_desc[] = "dio6";
223 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
224 static const char PROGMEM atcmd23_help[] =
225         "DIO6 Configuration (0 - unmonitored input, 1 - RTS, 3 - "
226         "digital input, 4 - digital output low, 5 - digital output "
227         "high). Default is 0.";
228 #endif
229
230 static const char PROGMEM atcmd24_name[] = "P0";
231 static const char PROGMEM atcmd24_desc[] = "dio10-pwm0";
232 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
233 static const char PROGMEM atcmd24_help[] =
234         "DIO10/PWM0 Configuration. (0 - unmonitored input, 1 - RSSI, 2 "
235         "- PWM0, 3 - digital input, 4 - digital output low, 5 - "
236         "digital output high). Default is 1.";
237 #endif
238
239 static const char PROGMEM atcmd25_name[] = "P1";
240 static const char PROGMEM atcmd25_desc[] = "dio11-pwm1";
241 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
242 static const char PROGMEM atcmd25_help[] =
243         "DIO11/PWM1 Configuration. (0 - unmonitored input, 2 "
244         "- PWM1, 3 - digital input, 4 - digital output low, 5 - "
245         "digital output high). Default is 0.";
246 #endif
247
248 static const char PROGMEM atcmd26_name[] = "P2";
249 static const char PROGMEM atcmd26_desc[] = "dio12";
250 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
251 static const char PROGMEM atcmd26_help[] =
252         "DIO12 Configuration. (0 - unmonitored input, "
253         "3 - digital input, 4 - digital output low, 5 - "
254         "digital output high). Default is 0.";
255 #endif
256
257 static const char PROGMEM atcmd27_name[] = "RP";
258 static const char PROGMEM atcmd27_desc[] = "rssi-pwm";
259 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
260 static const char PROGMEM atcmd27_help[] =
261         "Time RSSI signal will be output after last transmission. "
262         "When RP[] = 0xFF, output will always be on (0 - 0xFF, default "
263         "is 0x28[] = 4 seconds).";
264 #endif
265
266 static const char PROGMEM atcmd28_name[] = "1S";
267 static const char PROGMEM atcmd28_desc[] = "sensor-sample";
268 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
269 static const char PROGMEM atcmd28_help[] =
270         "Forces a sample to be taken on an XBee Sensor device.";
271 #endif
272
273 static const char PROGMEM atcmd29_name[] = "D0";
274 static const char PROGMEM atcmd29_desc[] = "dio0-ad0";
275 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
276 static const char PROGMEM atcmd29_help[] =
277         "AD0/DIO0 Configuration. (0 - unmonitored input, 1 - "
278         "commission button enabled, 2 - analog input, 3 - digital "
279         "input, 4 - digital output low, 5 - digital output high). "
280         "Default is 1.";
281 #endif
282
283 static const char PROGMEM atcmd30_name[] = "D1";
284 static const char PROGMEM atcmd30_desc[] = "dio1-ad1";
285 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
286 static const char PROGMEM atcmd30_help[] =
287         "AD1/DIO1 Configuration. (0 - unmonitored input, "
288         "2 - analog input, 3 - digital input, 4 - digital output "
289         "low, 5 - digital output high). Default is 0.";
290 #endif
291
292 static const char PROGMEM atcmd31_name[] = "D2";
293 static const char PROGMEM atcmd31_desc[] = "dio2-ad2";
294 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
295 static const char PROGMEM atcmd31_help[] =
296         "AD2/DIO2 Configuration. (0 - unmonitored input, "
297         "2 - analog input, 3 - digital input, 4 - digital output "
298         "low, 5 - digital output high). Default is 0.";
299 #endif
300
301 static const char PROGMEM atcmd32_name[] = "D3";
302 static const char PROGMEM atcmd32_desc[] = "dio3-ad3";
303 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
304 static const char PROGMEM atcmd32_help[] =
305         "AD3/DIO3 Configuration. (0 - unmonitored input, "
306         "2 - analog input, 3 - digital input, 4 - digital output "
307         "low, 5 - digital output high). Default is 0.";
308 #endif
309
310 static const char PROGMEM atcmd33_name[] = "D4";
311 static const char PROGMEM atcmd33_desc[] = "dio4-ad4";
312 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
313 static const char PROGMEM atcmd33_help[] =
314         "AD4/DIO4 Configuration. (0 - unmonitored input, "
315         "2 - analog input, 3 - digital input, 4 - digital output "
316         "low, 5 - digital output high). Default is 0.";
317 #endif
318
319 static const char PROGMEM atcmd34_name[] = "D5";
320 static const char PROGMEM atcmd34_desc[] = "dio5-ad5";
321 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
322 static const char PROGMEM atcmd34_help[] =
323         "AD4/DIO4 Configuration. (0 - unmonitored input, 1 - LED, "
324         "2 - analog input, 3 - digital input, 4 - digital output "
325         "low, 5 - digital output high). Default is 1.";
326 #endif
327
328 static const char PROGMEM atcmd35_name[] = "D8";
329 static const char PROGMEM atcmd35_desc[] = "dio8-sleep-rq";
330 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
331 static const char PROGMEM atcmd35_help[] =
332         "DIO8/SLEEP_RQ Configuration. (0 - unmonitored input, 1 - LED, "
333         "2 - analog input, 3 - digital input, 4 - digital output "
334         "low, 5 - digital output high). Default is 0. When used as "
335         "SLEEP_RQ, the D8 parameter should be configured in mode 0 "
336         "or 3.";
337 #endif
338
339 static const char PROGMEM atcmd36_name[] = "D9";
340 static const char PROGMEM atcmd36_desc[] = "dio9-on-sleep";
341 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
342 static const char PROGMEM atcmd36_help[] =
343         "DIO9/ON_SLEEP Configuration. (0 - unmonitored input, 1 - "
344         "ON/SLEEP, 2 - analog input, 3 - digital input, 4 - digital "
345         "output low, 5 - digital output high). Default is ?.";
346 #endif
347
348 static const char PROGMEM atcmd37_name[] = "PR";
349 static const char PROGMEM atcmd37_desc[] = "pull-up-resistor";
350 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
351 static const char PROGMEM atcmd37_help[] =
352         "Pull-up Resistor. Bit field that configures the internal "
353         "pull-up resistors for the I/O lines (bit set = pull-up "
354         "enabled). Range is from 0 to 0x1FFF, default is 0x1FFF.";
355 #endif
356
357 static const char PROGMEM atcmd38_name[] = "M0";
358 static const char PROGMEM atcmd38_desc[] = "pwm0-out-level";
359 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
360 static const char PROGMEM atcmd38_help[] =
361         "PWM0 Output Level. The line should be configured as a PWM "
362         "output using the P0 command (0 to 0x3FF, default is 0).";
363 #endif
364
365 static const char PROGMEM atcmd39_name[] = "M1";
366 static const char PROGMEM atcmd39_desc[] = "pwm1-out-level";
367 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
368 static const char PROGMEM atcmd39_help[] =
369         "PWM1 Output Level. The line should be configured as a PWM "
370         "output using the P1 command (0 to 0x3FF, default is 0).";
371 #endif
372
373 static const char PROGMEM atcmd40_name[] = "LT";
374 static const char PROGMEM atcmd40_desc[] = "led-blink-time";
375 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
376 static const char PROGMEM atcmd40_help[] =
377         "Associate LED Blink Time (should be enabled through D5 ";
378 #endif
379
380 static const char PROGMEM atcmd41_name[] = "IS";
381 static const char PROGMEM atcmd41_desc[] = "force-sample";
382 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
383 static const char PROGMEM atcmd41_help[] =
384         "Forces a read of all enabled digital and "
385         "analog input lines.";
386 #endif
387
388 static const char PROGMEM atcmd42_name[] = "IC";
389 static const char PROGMEM atcmd42_desc[] = "digital-change-detect";
390 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
391 static const char PROGMEM atcmd42_help[] =
392         "I/O Digital Change Detection. If a pin is enabled as a "
393         "digital input/output, the IC command can be used to "
394         "force an immediate I/O sample transmission when the DIO "
395         "state changes. IC is a bitmask, range is 0 to 0xFFFF, "
396         "default is 0";
397 #endif
398
399 static const char PROGMEM atcmd43_name[] = "IR";
400 static const char PROGMEM atcmd43_desc[] = "io-sample-rate";
401 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
402 static const char PROGMEM atcmd43_help[] =
403         "IO Sample Rate for periodic sampling. If zero, periodic "
404         "sampling is disabled. Else the value is in milliseconds "
405         "(range 0 to 0xFFFF, default is 0).";
406 #endif
407
408 static const char PROGMEM atcmd44_name[] = "CB";
409 static const char PROGMEM atcmd44_desc[] = "comissioning-button";
410 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
411 static const char PROGMEM atcmd44_help[] =
412         "Commissioning Pushbutton, simulate commissioning button "
413         "in software. The parameter value should be set to the number "
414         "of button presses to be simulated (range is 0 to 4).";
415 #endif
416
417 static const char PROGMEM atcmd45_name[] = "VR";
418 static const char PROGMEM atcmd45_desc[] = "firmware-version";
419 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
420 static const char PROGMEM atcmd45_help[] =
421         "Firmware version of the module (read only).";
422 #endif
423
424 static const char PROGMEM atcmd46_name[] = "HV";
425 static const char PROGMEM atcmd46_desc[] = "hardware-version";
426 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
427 static const char PROGMEM atcmd46_help[] =
428         "Hardware version of the module (read only).";
429 #endif
430
431 static const char PROGMEM atcmd47_name[] = "CK";
432 static const char PROGMEM atcmd47_desc[] = "config-code";
433 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
434 static const char PROGMEM atcmd47_help[] =
435         "Configuration Code, that can be used as a quick "
436         "check to determine if a node has been configured as "
437         "desired (read-only, 0-0xFFFFFFFF).";
438 #endif
439
440 static const char PROGMEM atcmd48_name[] = "ER";
441 static const char PROGMEM atcmd48_desc[] = "rf-errors";
442 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
443 static const char PROGMEM atcmd48_help[] =
444         "Number of times a packet was received which contained errors "
445         "of some sort. Read-only, saturate at 0xFFFF.";
446 #endif
447
448 static const char PROGMEM atcmd49_name[] = "GD";
449 static const char PROGMEM atcmd49_desc[] = "good-packets";
450 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
451 static const char PROGMEM atcmd49_help[] =
452         "Number of good received frames. Read-only, saturate at "
453         "0xFFFF.";
454 #endif
455
456 static const char PROGMEM atcmd50_name[] = "RP";
457 static const char PROGMEM atcmd50_desc[] = "rssi-pwm-timer";
458 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
459 static const char PROGMEM atcmd50_help[] =
460         "RSSI PWM timer, the time in tenth of seconds that the RSSI "
461         "output indicating signal strength will remain active after "
462         "the last reception (1 to 0xff, default is 0x20 = 3.2 secs).";
463 #endif
464
465 static const char PROGMEM atcmd51_name[] = "TR";
466 static const char PROGMEM atcmd51_desc[] = "tx-errors";
467 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
468 static const char PROGMEM atcmd51_help[] =
469         "Transmission Errors, the number of MAC frames that "
470         "exhaust MAC retries without ever receiving a MAC "
471         "acknowledgement message. Read-only, saturate at 0xFFFF.";
472 #endif
473
474 static const char PROGMEM atcmd52_name[] = "TP";
475 static const char PROGMEM atcmd52_desc[] = "temperature";
476 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
477 static const char PROGMEM atcmd52_help[] =
478         "Temperature. Read module temperature in (tenths of ?) "
479         "Celsius. Negatives temperatures can be returned (read-only, "
480         "from 0xff74 [-140] to 0x0258 [600]).";
481 #endif
482
483 static const char PROGMEM atcmd53_name[] = "DB";
484 static const char PROGMEM atcmd53_desc[] = "rx-signal-strength";
485 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
486 static const char PROGMEM atcmd53_help[] =
487         "Received Signal Strength of the last received RF data "
488         "packet measured in -dBm. For example if DB returns 0x60, "
489         "then the RSSI of the last packet received was -96dBm "
490         "(read-only).";
491 #endif
492
493 static const char PROGMEM atcmd54_name[] = "DC";
494 static const char PROGMEM atcmd54_desc[] = "duty-cycle";
495 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
496 static const char PROGMEM atcmd54_help[] =
497         "Duty Cycle. Returns a current usage percentage of the "
498         "10% duty cycle measured over the period of 1 hour "
499         "(read-only, from 0 to 0x64).";
500 #endif
501
502 static const char PROGMEM atcmd55_name[] = "RC";
503 static const char PROGMEM atcmd55_desc[] = "rssi-for-channel";
504 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
505 static const char PROGMEM atcmd55_help[] =
506         "Reads the dBm level (RSSI) of the designated "
507         "channel.";
508 #endif
509
510 static const char PROGMEM atcmd56_name[] = "R#";
511 static const char PROGMEM atcmd56_desc[] = "reset-number";
512 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
513 static const char PROGMEM atcmd56_help[] =
514         "Tells the reason for the last module reset (0 - Power up "
515         "reset, 2 - Watchdog reset, 3 - Software reset, 4 - Reset "
516         "line reset, 5 - Brownout reset). Read-only.";
517 #endif
518
519 static const char PROGMEM atcmd57_name[] = "TA";
520 static const char PROGMEM atcmd57_desc[] = "tx-ack-errors";
521 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
522 static const char PROGMEM atcmd57_help[] =
523         "Transmit Acknowlegement Errors. Incremented once for "
524         "each failed ack retry (read-only, from 0 to 0xFFFF).";
525 #endif
526
527 static const char PROGMEM atcmd58_name[] = "%V";
528 static const char PROGMEM atcmd58_desc[] = "supply-voltage";
529 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
530 static const char PROGMEM atcmd58_help[] =
531         "Voltage on the Vcc pin in mV (read-only, from 0 to 0xF00).";
532 #endif
533
534 static const char PROGMEM atcmd59_name[] = "CT";
535 static const char PROGMEM atcmd59_desc[] = "cmd-mode-timeout";
536 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
537 static const char PROGMEM atcmd59_help[] =
538         "Command Mode Timeout: the period of inactivity (no valid "
539         "commands received) after which the RF module automatically "
540         "exits AT Command Mode and returns to Idle Mode (2 to 0x1770, "
541         "default is 0x64).";
542 #endif
543
544 static const char PROGMEM atcmd60_name[] = "CN";
545 static const char PROGMEM atcmd60_desc[] = "exit-cmd-mode";
546 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
547 static const char PROGMEM atcmd60_help[] =
548         "Exit Command Mode.";
549 #endif
550
551 static const char PROGMEM atcmd61_name[] = "GT";
552 static const char PROGMEM atcmd61_desc[] = "guard-times";
553 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
554 static const char PROGMEM atcmd61_help[] =
555         "Guard Times: period of silence in ms before and after the "
556         "Command Sequence Characters of the AT Command Mode Sequence, "
557         "used to prevent inadvertent entrance into AT Command Mode "
558         "(0 to 0xFFFF, default is 0x3E8).";
559 #endif
560
561 static const char PROGMEM atcmd62_name[] = "CC";
562 static const char PROGMEM atcmd62_desc[] = "command-chars";
563 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
564 static const char PROGMEM atcmd62_help[] =
565         "Command Character used between guard times of the AT Command "
566         "Mode Sequence (0 to 0xFF, default is 0x2B).";
567 #endif
568
569 static const char PROGMEM atcmd63_name[] = "ID";
570 static const char PROGMEM atcmd63_desc[] = "network-id";
571 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
572 static const char PROGMEM atcmd63_help[] =
573         "Network ID. Nodes must have the same network identifier "
574         "to communicate (0 to 0x7FFF, default is 0x7FFF).";
575 #endif
576
577 static const char PROGMEM atcmd64_name[] = "NT";
578 static const char PROGMEM atcmd64_desc[] = "ndisc-timeout";
579 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
580 static const char PROGMEM atcmd64_help[] =
581         "Node Discover Timeout, time in tenth of secs a node will "
582         "spend discovering other nodes when ND or DN is issued (0 "
583         "to 0xFC, default is 0x82).";
584 #endif
585
586 static const char PROGMEM atcmd65_name[] = "NI";
587 static const char PROGMEM atcmd65_desc[] = "node-id";
588 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
589 static const char PROGMEM atcmd65_help[] =
590         "Node Identifier in printable ASCII characters. This string is "
591         "returned as part of the ATND (Network Discover) command. This "
592         "identifier is also used with the ATDN (Destination Node) "
593         "command. The string contains up to 20 byte ASCII string, "
594         "default is a space character.";
595 #endif
596
597 static const char PROGMEM atcmd66_name[] = "DN";
598 static const char PROGMEM atcmd66_desc[] = "disc-node";
599 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
600 static const char PROGMEM atcmd66_help[] = /* XXX */
601         "Resolves a Node Identifier string to a physical address "
602         "(case sensitive). 0xFFFE and the 64bits extended address are "
603         "returned.";
604 #endif
605
606 static const char PROGMEM atcmd67_name[] = "ND";
607 static const char PROGMEM atcmd67_desc[] = "network-discover";
608 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
609 static const char PROGMEM atcmd67_help[] = "Network Discovery, see doc"; /* XXX */
610 #endif
611
612 static const char PROGMEM atcmd68_name[] = "NO";
613 static const char PROGMEM atcmd68_desc[] = "ndisc-options";
614 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
615 static const char PROGMEM atcmd68_help[] =
616         "Network Discovery Options, a bitfield value that changes the "
617         "behavior of the ND command (bit0 - Append DD value, bit1 - "
618         "Local device sends ND response frame when ND is issued). "
619         "Default is 0.";
620 #endif
621
622 static const char PROGMEM atcmd69_name[] = "EE";
623 static const char PROGMEM atcmd69_desc[] = "security enable";
624 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
625 static const char PROGMEM atcmd69_help[] =
626         "Enable or disable 128-bit AES encryption (0 or 1, 0 is the "
627         "default).";
628 #endif
629
630 static const char PROGMEM atcmd70_name[] = "KY"; /* XXX */;
631 static const char PROGMEM atcmd70_desc[] = "security-key";
632 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
633 static const char PROGMEM atcmd70_help[] =
634         "The 128bits security key (the command is write-only).";
635 #endif
636
637 static const char PROGMEM atcmd71_name[] = "MT";
638 static const char PROGMEM atcmd71_desc[] = "bcast-multi-xmit";
639 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
640 static const char PROGMEM atcmd71_help[] =
641         "Number of additional MAC-level broadcast transmissions. All "
642         "broadcast packets are transmitted MT+1 times to ensure "
643         "it is received (0 to 0xF, default is 3).";
644 #endif
645
646 static const char PROGMEM atcmd72_name[] = "RR";
647 static const char PROGMEM atcmd72_desc[] = "unicast-retries";
648 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
649 static const char PROGMEM atcmd72_help[] =
650         "Number of additional MAC-level packet delivery attempts for "
651         "unicast transactions. If RR is non-zero, packets sent from "
652         "the radio will request an acknowledgement, and can be resent "
653         "up to RR times if no acknowledgement is received. (0 to 0xF, "
654         "default is 10).";
655 #endif
656
657 static const char PROGMEM atcmd73_name[] = "PL";
658 static const char PROGMEM atcmd73_desc[] = "power-level";
659 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
660 static const char PROGMEM atcmd73_help[] =
661         "Power Level of RF transmitter (0 - 1mW, 1 - 23mW, 2 - 100mW, "
662         "3 - 158 mW, 4 - 316 mW). Default is 4.";
663 #endif
664
665 static const char PROGMEM atcmd74_name[] = "SM";
666 static const char PROGMEM atcmd74_desc[] = "sleep-mode";
667 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
668 static const char PROGMEM atcmd74_help[] =
669         "Sleep Mode (0 - disabled, 1 - pin sleep, 4 - async cyclic "
670         "sleep, 5 - async cyclic sleep with pin wakeup). Default "
671         "is 0.";
672 #endif
673
674 static const char PROGMEM atcmd75_name[] = "SO";
675 static const char PROGMEM atcmd75_desc[] = "sleep-options";
676 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
677 static const char PROGMEM atcmd75_help[] =
678         "Sleep Options bitmask (bit8 - always wake for ST time). "
679         "Default is 0.";
680 #endif
681
682 static const char PROGMEM atcmd76_name[] = "ST";
683 static const char PROGMEM atcmd76_desc[] = "wake-time";
684 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
685 static const char PROGMEM atcmd76_help[] =
686         "Wake Time: the amount of time in ms that the module will stay "
687         "awake after receiving RF or serial data (from 0x45 to "
688         "0x36EE80, default is 0x7D0 = 2 secs).";
689 #endif
690
691 static const char PROGMEM atcmd77_name[] = "SP";
692 static const char PROGMEM atcmd77_desc[] = "sleep-period";
693 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
694 static const char PROGMEM atcmd77_help[] =
695         "Sleep Period: the amount of time in 10ms unit the module will "
696         "sleep per cycle. For a node operating as an Indirect "
697         "Messaging Coordinator, this command defines the amount of "
698         "time that it will hold an indirect message for an end device. "
699         "The coordinator will hold the message for (2.5 * SP). Range "
700         "is from 1 to 1440000, default is 200 (2 secs).";
701 #endif
702
703 static const char PROGMEM atcmd78_name[] = "SN";
704 static const char PROGMEM atcmd78_desc[] = "num-sleep-periods";
705 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
706 static const char PROGMEM atcmd78_help[] =
707         "Number of Sleep Periods that must elapse between assertions "
708         "of the ON_SLEEP line during the wake time of asynchronous "
709         "cyclic sleep (1 to 0xFFFF, default is 1).";
710 #endif
711
712 static const char PROGMEM atcmd79_name[] = "WH";
713 static const char PROGMEM atcmd79_desc[] = "wake-host";
714 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
715 static const char PROGMEM atcmd79_help[] = "Wake Host time. If it is set to a non-zero value, it "
716         "specifies the time in ms that the device should allow after "
717         "waking from sleep before sending data out the UART or "
718         "transmitting an I/O sample. If serial characters are "
719         "received, the WH timer is stopped immediately. Range is "
720         "from 0 to 0xFFFF, default is 0.";
721 #endif
722
723 const struct xbee_atcmd PROGMEM xbee_atcmd_list[] = {
724         {
725                 /* "WR" */
726                 atcmd0_name,
727                 atcmd0_desc,
728                 XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
729 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
730                 atcmd0_help,
731 #endif
732         },
733         {
734                 /* "RE" */
735                 atcmd1_name,
736                 atcmd1_desc,
737                 XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
738 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
739                 atcmd1_help,
740 #endif
741         },
742         {
743                 /* "FR" */
744                 atcmd2_name,
745                 atcmd2_desc,
746                 XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
747 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
748                 atcmd2_help,
749 #endif
750         },
751         {
752                 /* "AC" */
753                 atcmd3_name,
754                 atcmd3_desc,
755                 XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
756 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
757                 atcmd3_help,
758 #endif
759         },
760         {
761                 /* "R1" */
762                 atcmd4_name,
763                 atcmd4_desc,
764                 XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
765 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
766                 atcmd4_help,
767 #endif
768         },
769         {
770                 /* "VL" */
771                 atcmd5_name,
772                 atcmd5_desc,
773                 XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
774 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
775                 atcmd5_help,
776 #endif
777         },
778         {
779                 /* "DH" */
780                 atcmd6_name,
781                 atcmd6_desc,
782                 XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
783 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
784                 atcmd6_help,
785 #endif
786         },
787         {
788                 /* "DL" */
789                 atcmd7_name,
790                 atcmd7_desc,
791                 XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
792 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
793                 atcmd7_help,
794 #endif
795         },
796         {
797                 /* "DD" */
798                 atcmd8_name,
799                 atcmd8_desc,
800                 XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ,
801 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
802                 atcmd8_help,
803 #endif
804         },
805         {
806                 /* "SH" */
807                 atcmd9_name,
808                 atcmd9_desc,
809                 XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ,
810 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
811                 atcmd9_help,
812 #endif
813         },
814         {
815                 /* "SL" */
816                 atcmd10_name,
817                 atcmd10_desc,
818                 XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ,
819 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
820                 atcmd10_help,
821 #endif
822         },
823         {
824                 /* "SE" */
825                 atcmd11_name,
826                 atcmd11_desc,
827                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
828 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
829                 atcmd11_help,
830 #endif
831         },
832         {
833                 /* "DE" */
834                 atcmd12_name,
835                 atcmd12_desc,
836                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
837 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
838                 atcmd12_help,
839 #endif
840         },
841         {
842                 /* "CI" */
843                 atcmd13_name,
844                 atcmd13_desc,
845                 XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
846 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
847                 atcmd13_help,
848 #endif
849         },
850         {
851                 /* "NP" */
852                 atcmd14_name,
853                 atcmd14_desc,
854                 XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ,
855 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
856                 atcmd14_help,
857 #endif
858         },
859         {
860                 /* "CE" */
861                 atcmd15_name,
862                 atcmd15_desc,
863                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
864 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
865                 atcmd15_help,
866 #endif
867         },
868         {
869                 /* "AP" */
870                 atcmd16_name,
871                 atcmd16_desc,
872                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
873 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
874                 atcmd16_help,
875 #endif
876         },
877         {
878                 /* "AO" */
879                 atcmd17_name,
880                 atcmd17_desc,
881                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
882 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
883                 atcmd17_help,
884 #endif
885         },
886         {
887                 /* "BD" */
888                 atcmd18_name,
889                 atcmd18_desc,
890                 XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
891 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
892                 atcmd18_help,
893 #endif
894         },
895         {
896                 /* "RO" */
897                 atcmd19_name,
898                 atcmd19_desc,
899                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
900 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
901                 atcmd19_help,
902 #endif
903         },
904         {
905                 /* "FT" */
906                 atcmd20_name,
907                 atcmd20_desc,
908                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
909 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
910                 atcmd20_help,
911 #endif
912         },
913         {
914                 /* "NB" */
915                 atcmd21_name,
916                 atcmd21_desc,
917                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
918 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
919                 atcmd21_help,
920 #endif
921         },
922         {
923                 /* "D7" */
924                 atcmd22_name,
925                 atcmd22_desc,
926                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
927 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
928                 atcmd22_help,
929 #endif
930         },
931         {
932                 /* "D6" */
933                 atcmd23_name,
934                 atcmd23_desc,
935                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
936 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
937                 atcmd23_help,
938 #endif
939         },
940         {
941                 /* "P0" */
942                 atcmd24_name,
943                 atcmd24_desc,
944                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
945 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
946                 atcmd24_help,
947 #endif
948         },
949         {
950                 /* "P1" */
951                 atcmd25_name,
952                 atcmd25_desc,
953                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
954 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
955                 atcmd25_help,
956 #endif
957         },
958         {
959                 /* "P2" */
960                 atcmd26_name,
961                 atcmd26_desc,
962                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
963 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
964                 atcmd26_help,
965 #endif
966         },
967         {
968                 /* "RP" */
969                 atcmd27_name,
970                 atcmd27_desc,
971                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
972 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
973                 atcmd27_help,
974 #endif
975         },
976         {
977                 /* "1S" */
978                 atcmd28_name,
979                 atcmd28_desc,
980                 XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
981 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
982                 atcmd28_help,
983 #endif
984         },
985         {
986                 /* "D0" */
987                 atcmd29_name,
988                 atcmd29_desc,
989                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
990 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
991                 atcmd29_help,
992 #endif
993         },
994         {
995                 /* "D1" */
996                 atcmd30_name,
997                 atcmd30_desc,
998                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
999 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1000                 atcmd30_help,
1001 #endif
1002         },
1003         {
1004                 /* "D2" */
1005                 atcmd31_name,
1006                 atcmd31_desc,
1007                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1008 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1009                 atcmd31_help,
1010 #endif
1011         },
1012         {
1013                 /* "D3" */
1014                 atcmd32_name,
1015                 atcmd32_desc,
1016                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1017 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1018                 atcmd32_help,
1019 #endif
1020         },
1021         {
1022                 /* "D4" */
1023                 atcmd33_name,
1024                 atcmd33_desc,
1025                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1026 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1027                 atcmd33_help,
1028 #endif
1029         },
1030         {
1031                 /* "D5" */
1032                 atcmd34_name,
1033                 atcmd34_desc,
1034                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1035 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1036                 atcmd34_help,
1037 #endif
1038         },
1039         {
1040                 /* "D8" */
1041                 atcmd35_name,
1042                 atcmd35_desc,
1043                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1044 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1045                 atcmd35_help,
1046 #endif
1047         },
1048         {
1049                 /* "D9" */
1050                 atcmd36_name,
1051                 atcmd36_desc,
1052                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1053 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1054                 atcmd36_help,
1055 #endif
1056         },
1057         {
1058                 /* "PR" */
1059                 atcmd37_name,
1060                 atcmd37_desc,
1061                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1062 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1063                 atcmd37_help,
1064 #endif
1065         },
1066         {
1067                 /* "M0" */
1068                 atcmd38_name,
1069                 atcmd38_desc,
1070                 XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1071 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1072                 atcmd38_help,
1073 #endif
1074         },
1075         {
1076                 /* "M1" */
1077                 atcmd39_name,
1078                 atcmd39_desc,
1079                 XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1080 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1081                 atcmd39_help,
1082 #endif
1083         },
1084         {
1085                 /* "LT" */
1086                 atcmd40_name,
1087                 atcmd40_desc,
1088                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1089 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1090                 atcmd40_help,
1091 #endif
1092         },
1093         {
1094                 /* "IS" */
1095                 atcmd41_name,
1096                 atcmd41_desc,
1097                 XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
1098 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1099                 atcmd41_help,
1100 #endif
1101         },
1102         {
1103                 /* "IC" */
1104                 atcmd42_name,
1105                 atcmd42_desc,
1106                 XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1107 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1108                 atcmd42_help,
1109 #endif
1110         },
1111         {
1112                 /* "IR" */
1113                 atcmd43_name,
1114                 atcmd43_desc,
1115                 XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1116 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1117                 atcmd43_help,
1118 #endif
1119         },
1120         {
1121                 /* "CB" */
1122                 atcmd44_name,
1123                 atcmd44_desc,
1124                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1125 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1126                 atcmd44_help,
1127 #endif
1128         },
1129         {
1130                 /* "VR" */
1131                 atcmd45_name,
1132                 atcmd45_desc,
1133                 XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ,
1134 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1135                 atcmd45_help,
1136 #endif
1137         },
1138         {
1139                 /* "HV" */
1140                 atcmd46_name,
1141                 atcmd46_desc,
1142                 XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ,
1143 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1144                 atcmd46_help,
1145 #endif
1146         },
1147         {
1148                 /* "CK" */
1149                 atcmd47_name,
1150                 atcmd47_desc,
1151                 XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ,
1152 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1153                 atcmd47_help,
1154 #endif
1155         },
1156         {
1157                 /* "ER" */
1158                 atcmd48_name,
1159                 atcmd48_desc,
1160                 XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ,
1161 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1162                 atcmd48_help,
1163 #endif
1164         },
1165         {
1166                 /* "GD" */
1167                 atcmd49_name,
1168                 atcmd49_desc,
1169                 XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ,
1170 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1171                 atcmd49_help,
1172 #endif
1173         },
1174         {
1175                 /* "RP" */
1176                 atcmd50_name,
1177                 atcmd50_desc,
1178                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1179 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1180                 atcmd50_help,
1181 #endif
1182         },
1183         {
1184                 /* "TR" */
1185                 atcmd51_name,
1186                 atcmd51_desc,
1187                 XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ,
1188 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1189                 atcmd51_help,
1190 #endif
1191         },
1192         {
1193                 /* "TP" */
1194                 atcmd52_name,
1195                 atcmd52_desc,
1196                 XBEE_ATCMD_F_PARAM_S16 | XBEE_ATCMD_F_READ,
1197 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1198                 atcmd52_help,
1199 #endif
1200         },
1201         {
1202                 /* "DB" */
1203                 atcmd53_name,
1204                 atcmd53_desc,
1205                 XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ,
1206 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1207                 atcmd53_help,
1208 #endif
1209         },
1210         {
1211                 /* "DC" */
1212                 atcmd54_name,
1213                 atcmd54_desc,
1214                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ,
1215 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1216                 atcmd54_help,
1217 #endif
1218         },
1219         {
1220                 /* "RC" */
1221                 atcmd55_name,
1222                 atcmd55_desc,
1223                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ,
1224 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1225                 atcmd55_help,
1226 #endif
1227         },
1228         {
1229                 /* "R#" */
1230                 atcmd56_name,
1231                 atcmd56_desc,
1232                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ,
1233 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1234                 atcmd56_help,
1235 #endif
1236         },
1237         {
1238                 /* "TA" */
1239                 atcmd57_name,
1240                 atcmd57_desc,
1241                 XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ,
1242 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1243                 atcmd57_help,
1244 #endif
1245         },
1246         {
1247                 /* "%V" */
1248                 atcmd58_name,
1249                 atcmd58_desc,
1250                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ,
1251 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1252                 atcmd58_help,
1253 #endif
1254         },
1255         {
1256                 /* "CT" */
1257                 atcmd59_name,
1258                 atcmd59_desc,
1259                 XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1260 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1261                 atcmd59_help,
1262 #endif
1263         },
1264         {
1265                 /* "CN" */
1266                 atcmd60_name,
1267                 atcmd60_desc,
1268                 XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
1269 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1270                 atcmd60_help,
1271 #endif
1272         },
1273         {
1274                 /* "GT" */
1275                 atcmd61_name,
1276                 atcmd61_desc,
1277                 XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1278 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1279                 atcmd61_help,
1280 #endif
1281         },
1282         {
1283                 /* "CC" */
1284                 atcmd62_name,
1285                 atcmd62_desc,
1286                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1287 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1288                 atcmd62_help,
1289 #endif
1290         },
1291         {
1292                 /* "ID" */
1293                 atcmd63_name,
1294                 atcmd63_desc,
1295                 XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1296 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1297                 atcmd63_help,
1298 #endif
1299         },
1300         {
1301                 /* "NT" */
1302                 atcmd64_name,
1303                 atcmd64_desc,
1304                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1305 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1306                 atcmd64_help,
1307 #endif
1308         },
1309         {
1310                 /* "NI" */
1311                 atcmd65_name,
1312                 atcmd65_desc,
1313                 XBEE_ATCMD_F_PARAM_STRING_20B | XBEE_ATCMD_F_READ |
1314                 XBEE_ATCMD_F_WRITE,
1315 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1316                 atcmd65_help,
1317 #endif
1318         },
1319         {
1320                 /* "DN" */
1321                 atcmd66_name,
1322                 atcmd66_desc,
1323                 XBEE_ATCMD_F_PARAM_STRING_20B | XBEE_ATCMD_F_READ |
1324                 XBEE_ATCMD_F_WRITE,
1325 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1326                 atcmd66_help,
1327 #endif
1328         },
1329         {
1330                 /* "ND" */
1331                 atcmd67_name,
1332                 atcmd67_desc,
1333                 XBEE_ATCMD_F_PARAM_NONE | XBEE_ATCMD_F_WRITE,
1334 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1335                 atcmd67_help,
1336 #endif
1337         },
1338         {
1339                 /* "NO" */
1340                 atcmd68_name,
1341                 atcmd68_desc,
1342                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1343 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1344                 atcmd68_help,
1345 #endif
1346         },
1347         {
1348                 /* "EE" */
1349                 atcmd69_name,
1350                 atcmd69_desc,
1351                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1352 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1353                 atcmd69_help,
1354 #endif
1355         },
1356         {
1357                 /* "KY"  XXX */
1358                 atcmd70_name,
1359                 atcmd70_desc,
1360                 XBEE_ATCMD_F_PARAM_HEXBUF_16B | XBEE_ATCMD_F_WRITE,
1361 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1362                 atcmd70_help,
1363 #endif
1364         },
1365         {
1366                 /* "MT" */
1367                 atcmd71_name,
1368                 atcmd71_desc,
1369                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1370 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1371                 atcmd71_help,
1372 #endif
1373         },
1374         {
1375                 /* "RR" */
1376                 atcmd72_name,
1377                 atcmd72_desc,
1378                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1379 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1380                 atcmd72_help,
1381 #endif
1382         },
1383         {
1384                 /* "PL" */
1385                 atcmd73_name,
1386                 atcmd73_desc,
1387                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1388 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1389                 atcmd73_help,
1390 #endif
1391         },
1392         {
1393                 /* "SM" */
1394                 atcmd74_name,
1395                 atcmd74_desc,
1396                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1397 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1398                 atcmd74_help,
1399 #endif
1400         },
1401         {
1402                 /* "SO" */
1403                 atcmd75_name,
1404                 atcmd75_desc,
1405                 XBEE_ATCMD_F_PARAM_U8 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1406 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1407                 atcmd75_help,
1408 #endif
1409         },
1410         {
1411                 /* "ST" */
1412                 atcmd76_name,
1413                 atcmd76_desc,
1414                 XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1415 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1416                 atcmd76_help,
1417 #endif
1418         },
1419         {
1420                 /* "SP" */
1421                 atcmd77_name,
1422                 atcmd77_desc,
1423                 XBEE_ATCMD_F_PARAM_U32 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1424 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1425                 atcmd77_help,
1426 #endif
1427         },
1428         {
1429                 /* "SN" */
1430                 atcmd78_name,
1431                 atcmd78_desc,
1432                 XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1433 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1434                 atcmd78_help,
1435 #endif
1436         },
1437         {
1438                 /* "WH" */
1439                 atcmd79_name,
1440                 atcmd79_desc,
1441                 XBEE_ATCMD_F_PARAM_U16 | XBEE_ATCMD_F_READ | XBEE_ATCMD_F_WRITE,
1442 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1443                 atcmd79_help,
1444 #endif
1445         },
1446         {
1447                 NULL,
1448                 NULL,
1449                 0,
1450 #ifdef CONFIG_MODULE_XBEE_ATCMD_HELP
1451                 NULL,
1452 #endif
1453         },
1454 };
1455
1456 const struct xbee_atcmd *xbee_atcmd_lookup_name(const char *atcmd_str)
1457 {
1458         const struct xbee_atcmd *cmd;
1459         struct xbee_atcmd copy;
1460
1461         for (cmd = &xbee_atcmd_list[0], memcpy_P(&copy, cmd, sizeof(copy));
1462              copy.name != NULL;
1463              cmd++, memcpy_P(&copy, cmd, sizeof(copy))) {
1464
1465                 if (!strcmp_P(atcmd_str, copy.name))
1466                         break;
1467         }
1468
1469         if (copy.name == NULL) /* not found */
1470                 return NULL;
1471
1472         return cmd;
1473 }
1474
1475 const struct xbee_atcmd *xbee_atcmd_lookup_desc(const char *desc)
1476 {
1477         const struct xbee_atcmd *cmd;
1478         struct xbee_atcmd copy;
1479
1480         for (cmd = &xbee_atcmd_list[0], memcpy_P(&copy, cmd, sizeof(copy));
1481              copy.name != NULL;
1482              cmd++, memcpy_P(&copy, cmd, sizeof(copy))) {
1483                 if (!strcmp_P(desc, copy.desc))
1484                         break;
1485         }
1486         if (copy.name == NULL) /* not found */
1487                 return NULL;
1488
1489         return cmd;
1490 }