-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement a QRCode payload generator #46
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR generates code covers stats for a bunch of headers in /usr/include
, not sure why. I'm not sure if it's expected.
Haha no no don't worry :) |
efc466f
to
29026a7
Compare
src/qrcode/SetupCodeUtils.cpp
Outdated
|
||
string base45EncodedString(uint64_t input, size_t minLength) | ||
{ | ||
static std::map<int, char> BS45_CHARS = base45CharacterMap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do all of our target environments support C++ static initializers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is the QR generation code. I would expect it to be running as a CL tool used by vendors on desktop class machines and not in the accessory themselves. So I would expect those to support it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Along with what Bhaskar said this might be consumed by the commissioner, so I don't necessarily see an issue there either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Devices with displays will likely also run this code. Generally, our policy with respect to OpenWeave is that C++ is fine but STL is generally prohibited unless it is strictly tooling or desktop, mobile, or server-class code only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is meant to run only on tooling / desktop class code.
I see the use case where the device may have to show the code on a UI. But since the payload is static, I would assume the better approach is to burn the code into the device vs. having logic in the device to generate it from the payload.
Build Mbed port with Mbed version of mbedtls
Pulling in @bhaskar-apple's work on a QRCode Setup Payload generator
This PR includes code to generate a base45 encoded string given a setup payload.
Here is a brief description of some of the classes / functions -
The encoding of the binary data to a base45 string is done as follows -
Every 2 bytes (16 bits) of binary source data are encoded to 3 characters of the Base-45 alphabet.
If an odd number of bytes are to be encoded, the remaining single byte is encoded to 2 characters of the Base-45 alphabet.