What is the best way to link 64 bit MAC addresses with product IDs?
I have a system where a single data collector device(CO) is connected with 200 RTRs Now each RTR has a unique MAC address.So I need to build a lookup table of product ID against MAC address in the CO.For that I need to make a note of all the MAC addresses which are unique to each digi module and then assign my IDs to each device.That ID sticker will be pasted on each device.
Is there any way in which I can bypass manually jotting down of MAC addresses?
Which Product IDs are you referring to?
Product IDs are basically IDs which I assign to all devices to identify them.They are just normal IDs from 1 to 200.
I suppose you could use the ND command from your coordinator to get a list of all the devices in the network, but how you associate that to individual devices is a mystery.
Or, you could build a test fixture that would allow you to plug in a module, read the SH and SL parameters, assign your ID, then print a label to be placed on the device that shows both the MAC and your ID.
So, these product ID’s are all unique (1-1 association) and non-volatile (that is, one device could leave the associated network and come back, taking the same ID every time?) Will they be possibly joining different PANs, but using the same Product ID?
I’ve created a gateway component which has to do the same type of thing - assign “unique” product (“Device ID”) to each device.
What I currently do is not rocket science, but seems to work in my prototype stage. I have created a “manager” class which has a static variable called “last assigned” and a struct which maps the newly assigned Device ID (key) to the 64-bit extended address (value).
When the manager first starts, I simply call the Zigbee method to get all current nodes and build (assign) initial IDs to all nodes discovered in this step.
From then on, whenever I get an RF packet in, I first check this structure to see if the device has already been maped to a product ID. If not, I lock the variable (my component also spins several worker threads so it has to be thread safe), increment and assign it to the new device (record in dict struct). Since you don’t have to worry about reusing these product IDs, this type of assignment may be ok for you.
Keep in mind, in order to have a device always take the same ID, you could save this information in a file that would reside on the gateway(s). (If multiple gateways, you would have to worry about synchronization of files, of course). You could then easily load up this file in your component on start-up to build your initial list and go from there.
Hope this helps.