I’ve written a little program to help with the analysis of API packets, and I wonder whether anyone else might be interested in using it. The program runs in a terminal window and prompts for a packet. You then enter the hex bytes of the packet (eg by pasting the packet from some other window) and the program delivers the analysis and exits.
Here’s a sample run:
[john@eccles packet-check]$ ./packet-check.tcl
API Packet analyzer for Series 1 XBee (version 0.1)
Enter packet: 7e 00 11 97 01 00 13 a2 00 40 4a 17 7e 23 45 56 52 00 10 c8 ab
Packet: 7E 00 11 97 01 00 13 A2 00 40 4A 17 7E 23 45 56 52 00 10 C8 AB
7E // Correct packet header byte
00 11 // payload length (decimal 17)
97 // Packet type: remote AT response with 64-bit source address
01 // frame id
00 13 A2 00 40 4A 17 7E // 64-bit source address
23 45 // 16-bit source address
56 52 // AT command “VR”
00 // status: OK
10 C8 // parameter value (decimal 4296)
AB // checksum - correct
[john@eccles packet-check]$
Packets can be entered on multiple lines, and the program ignores anything it thinks is a comment, so the multi-line display style with added comments as seen in this forum (and as used in the program’s output) is acceptable to it. Any character except a hex digit or space will be taken as a comment delimuiter. Hex bytes may be prefixed with 0x or 0X - the prefix will be ignored.
When a packet’s entered, the program keeps prompting for more bytes until it decides that the packet is complete. If you think the packet is complete but the program disagrees, hit return at the secondary prompt and it will deliver a verdict on what it has.
The program is written as a Tcl script, so it ought to run on any machine to which the Tcl interpreter has been ported. That’s pretty much anything from a Cray to a palmtop, with Unix/Linux, Mac and Windows included. I should also be able to produce it as a stand-alone application but I won’t do that unless there’s demand.
Linux installation instructions (similar for other platforms): save the script packet-check.tcl somehwere. For convenience, make sure it’s somewhere on your $PATH.
Make sure you have Tcl installed: type tclsh at a shell prompt, and if you get a % prompt it’s there. You can run the script as
tclsh packet-check.tcl
or if you give the script execute permission with
chmod +x packet-check.tcl
you can just give the name of the script at the shell prompt.
If you don’t have tclsh, you can get it as ActiveTcl from www.activestate.com. It’s free.
It’s very difficult to do an exhaustive test on something like this, so don’t be too surprised if it fails to cope in some cases. This is very much beta software.
So: would anyone be interested, and if so is there anyone who’d be willing to help test it by feeding it with captured packets?
The script is attached at the top of this message.