I made an xbee java library of my own, in part so that I could separate out xbee from non-xbee licensing issues; and in part because I wanted to have a library in maven with essentially zero external dependencies. It’s definitely a work in progress, but I’m moving fast and am open to collaboration.
https://github.com/wz2b/xbee-api-java/wiki
The manual I’m using right now is 9000976_V which I think is the most current. The documentation for these radios has always been pretty good, but there are definitely areas where I struggle. One of them is nework discovery.
Page 141 of this version of the manul describes the response body of an ND command as:
[ul]
SH
SL
NI (Variable length)
PARENT_NETWORK ADDRESS (2 Bytes)
DEVICE_TYPE (1 Byte: 0=Coord, 1=Router, 2=End Device)
STATUS (1 Byte: Reserved)
PROFILE_ID (2 Bytes)
MANUFACTURER_ID (2 Bytes)
[/ul]
I am in API v2 mode so there are no CRs but there are escapes and flags.
I launched a Remote ND command to a router 00 13 A2 00 40 8C 55 C0 and got this back:
Remote Command Response (API 2)
7E 00 36 97 01 00 7D 33 A2 00 40 47 5D 5D 00 00 4E 44 00 00 00 00 7D 33 A2 00 40 47 5D 5D 57 5A 32 42 2D 43 4F 4F 52 44 49 4E 41 54 4F 52 00 FF FE 00 00 C1 05 10 1E 00 00 00 FF 63
which he frame decoder interprets as:
Start delimiter: 7E
Length: 00 36 (54)
Frame type: 97 (Remote Command Response)
Frame ID: 01 (1)
64-bit source address: 00 13 A2 00 40 47 5D 5D
16-bit source address: 00 00
AT Command: 4E 44 (ND)
Status: 00 (Status OK)
Response: 00 00 00 13 A2 00 40 47 5D 5D 57 5A 32 42 2D 43 4F 4F 52 44 49 4E 41 54 4F 52 00 FF FE 00 00 C1 05 10 1E 00 00 00 FF
Checksum: 63
The actually interesting part is in the “Response” which the frame interpreter doesn’t decode (boo) leaving me to do it myself:
[ul]
00 00 - This doesn’t show up in the ND description above
00 13 A2 00 40 47 5D 5D - this is the Device ID I sent the command to
57 5A 32 42 2D 43 4F 4F 52 44 49 4E 41 54 4F 52 00 - the NI, WZ2B-COORDINATOR
FF FE - parent nework address. Shouldn’t this be 03C9, my network address?
00 - Device type. Coordinator. But this came from a router.
00 - status. Manual says “reserved” so I have little idea what this means.
C1 05 - it’s a digi.com profile (ok)
10 1E - using a digi.com manufacturer ID(ok)
00 00 - module type “unspecified”
00 FF - product type - not in table
[/ul]
The module type / product type are supposed to be here Digi Python Wiki Archive but as you can see that’s pretty unhelpful - in factg, that page says “You can never fully trust the DD value returned.”
So putting all of this together, I am left with a number of questions:
-
How do you from this message definitely determine what’s a router, coodinator, or end device?
-
I issued a remote ND command for a device whose name is WEATHER, but what got returned to me is a response with WEATHER’s device ID but the coordinator’s NI. Why is that? I’m OK with getting both back - I can discern that - but the way it phrased the response really appears like it’s mixing up two different things