How do I get an end device "deviceId" when using the Digi XBee ANSI C Library?

I’m using an XBee module as coordinator and I’m controlling it using the Digi XBee ANSI C Library. I would like to know how can I get a connected end-device deviceId number.

What do you mean by Device ID number? Do you mean its 64 bit MAC address? If so, you can simply do a Node Discovery.

Not the 64 bit MAC address, I can get that from the “ieee_address” element in the “wpan_envelope_t” structure in aps.h. I’m talking about the ZigBee Device ID 16-bit number.

The only Device ID number I’ve been able to find across all the library code is the device id of the device running the ansi-c library. I’m talking about the one you get on the “wpan_endpoint_table_entry_t” structure on line “252” here

I can see the ieee_address, network_address, profile_id, cluster_id, src_endpoint, and dst_endpoint in the wpan_envelope_t structure in aps.h as well but I haven’t find any structure that would indicate the actual device_id from a connected node which is what I need.

Sound like you are referring to the 16 bit Network address.

No, I’m not talking about the network address.

This is the definition of the device identifier according to the ZigBee specification: Application Device Identifier Field
The application device identifier field of the simple descriptor is sixteen bits in length and specifies the device description supported on this endpoint. Device description identifiers shall be obtained from the ZigBee Alliance.

For example, for the Home Automation Profile, the device id 0x0100 corresponds to an "On/Off Light, and the 0x0101 to a “Dimmable Light”. In my case, one of our devices has the Device ID 0xEC05 and another one has the Device ID 0xEC06 and that is the ID I’m trying to get.

You should be using the API explicit commands as described at

That will allow you to send the specific ZDO commands you wish to use. Note that some of these fields are part of the data packet and not the API frame.