Snippet - DeviceID Mechanism

DeviceID Mechanism

This is a very simple DeviceID mechanism. It does unfortunately rely on an SD card and if the ID file is deleted or the card is changed then you will end up with a different ID, but as long as you use the same card and don’t delete it, you will always have the same device ID. Since it creates the DeviceID from a .NET GUID, according to Microsoft it should never accidentally get the same one as any other device does.

Tested only on the CerbuinoBee, but I think it will work on all of the 4.2 devices.

Hi PintSize.Me,
While working on my UPnP stack I had a need to create a unique Id per device/board so I created a function that does that based on the Mac address which is working great…
I’ll share the code later once it is clean…

Also why not make yours based on a const string instead of a file… This would make more permenant without relying on a file.

Thanks for sharing …

I would assume that using a const would mean that all the devices using that firmware would share a DeviceID…

Not throught firmware but throught managed code… One would call it serial number, where you would compile a build for each board with a different I’d…
And of course this is for single builds and not mass build that would go to multiple boards…
If that’s the case thenn the best one to use is what I have done in the UPnP stack by basing it on the Mac address…

This class can be dropped into every project I use and it will create a “serial number” for each device rather than for each program. Many of the things I build end up running on at least 2 devices but a lot of the time I need to tell them apart.