At this point the ID length comes from the uuidTime() function added with the name of the object.
The fixed ID length comes from an early stage, where it made sense combining the name and the ID in to one string to make the UDP ping format easier. This is obsolet now.
The goal for an object ID should be to generate a number that is “impossible” to be generated twice somewhere else in the world, since the objects should eventually be able to be referenced globally.
It might be more clean, to make the human readable name its own attribute and use any kind of length for the ID.
Reflecting on the idea to give each object a public key for the use with Blockchain technology, it might would make sense to define up to 36 characters for the ID.
uuidTime() seems fine for now. My question about length was related to these lines in server.js:
TODO - mark object functional only if: if(thisId in objectExp && thisId.length>12)
...
if (thisId in objectExp && thisId.length > 12) {
...
if (objectIDXML.length > 13) {
I had wanted to better understand those conditions, and potentially set a “const MIN_ID_LENGTH = 12” or similar, after understanding how it would be possible to have something smaller than that, and why 12 was used in one place and 13 in another.
Ahh ok.
So the UUID is defined to be 12 (I don’t remember why exactly 12), however the overall ID is combined with the name of the object.
The object name should be at least one character. This makes a minimum of 13 characters.
This way the ID can easily be handled by arduino, c++ and javascript.
You just need to cut off the last 12 characters to get the human readable name of the object.
Additional the UDP ping can be in a simple small format: <name+UUID>:<ip>