To better support device claiming, we want to allow manufacturers to be able to print a QR Code on their boxes and have our FieldOps App be able to scan them or even a regular QR Scanner work to claim the dev
The QR Code will be generated in the following structure:
- Step #1 - Generate “Unique ID”
- Step #2 - Prepend Xyte Manufacturer Prefix
- Step #3 - Prepend Xyte base claiming URL
- Step # - Generate QR from the resulting string
The ID should be an alphanumeric string (case sensitive) of 20 characters and must be unique for each device created by the manufacturer.
There are two suggested methods, First, is the CloudID for manufacturers who can run code on an external server and later embed the result into each device’s firmware, and second, relying only on the MAC & Serial numbers of each device.
- Using CloudID
For manufacturers who can generate a Unique ID and imprint the ID on the device - the recommended method is the NanoID Library (https://github.com/ai/nanoid#other-programming-languages). An external server should generate the CloudID, imprint it and use it as the base for the QR Code.
- MAC & Serial number
Use each device’s MAC and Serial numbers to generate a Unique ID, the MAC, and Serial numbers should be combined as strings and use a digest algorithm (e.g. SHA 256) on the string to generate a unique alphanumeric and case-in-sensitive string of 20 characters.
- Xyte manufacturer prefix: abcd (Settings —> Hardware Keys —> SHORTCODE)
- QR Prefix: https://xyte.io/c/
Step #1 - Option 1 (CloudID-based Unique ID)
Nanoid.generate(size: 20) = Dl8z6CASzFpiojfwy9kk
Step #1 - Option 2 (MAC & Serial number based Unique ID)
**base** = MAC_address + Serial_number Digest::SHA256.hexdigest(**base**)[0...20] = 1685e896317aa9ed0828
**abcd** + Dl8z6CASzFpiojfwy9kk = **abcd**Dl8z6CASzFpiojfwy9kk
**https://xyte.io/c/** + abcdDl8z6CASzFpiojfwy9kk = **https://xyte.io/c/**abcdDl8z6CASzFpiojfwy9kk
When the device calls the Device Register API, it should provide the string from step #3 (Manufacturer prefix + NanoID) as the “claim_id” parameter.
The cloud_id parameter must be passed for QR claiming to function, even for Mac & SN based registration method.
- Open the App
- Login to the Organization where you want to claim the device
- Select the Space you are currently in
- Scan the device’s QR
We need to add a special page under https://xyte.io under /c/ that will redirect to the App Portal with the unique_id passed as a parameter. After the user logs in (or if already logged in) he will get a dialog presenting him with the information about the device and the ability to claim it.