I created an initial port of JS version of qrcode-generator to BrightScript (used to write apps for Roku devices).
Would you be interested in merging this into main qrcode-generator repo? Or should it be a separate "fork" project?
I'll probably keep updating code with time (and use in my apps). I think i'll extract some parts to separate components or merge them into main QRCode component. ot sure yet :).
In any case, this works ok as is. To make a full test you'd have to have a Roku device at hand, but "core" functionality (generating QRCode data, plus turning it into ASCII-like render, same as with JS version) can be tested using brs.
I included test and package.json that will use @hulu/roca test runner - all you need is to have a node.js installed (or running in container or VM :)).
npm install
npm test
brs (used by roca) implements only parts of BrightScript and SceneGraph APIs. Generating QRCode with it is A LOT slower than when running it on Roku device, so don't be scared if test runs over 6 seconds. On device it generates data in less than 600ms and turns it into PNG image in another ~350ms (or prints to console as ASCII in ~45ms).
Here's output from npm test command:
bash-5.1$ npm test
> test-brightscript-qrcode-generator@1.0.0 test
> roca
QRBitBuffer
✓ can be created
✓ has `getBuffer` method
✓ has `getLengthInBits` method
✓ has `pushBit` method
✓ has `put` method
QRCode
QRCode
✓ should generate correct UTF8 text data
QRPrinter
✓ should generate correct UTF8 string from exsiting QRCode
✓ should return correct UTF8 string from exsiting QRCode
QRMath
✓ glog is working
✓ gexp is working
10 passing (5s)
Here's console output from Roku device running example channel:
Please not that the spacing between blocks depends on the font. In local Terminal i see no spacing, but in this PR's description i see some - depends on font config used on GitHub.
Hi,
I created an initial port of JS version of qrcode-generator to BrightScript (used to write apps for Roku devices).
Would you be interested in merging this into main qrcode-generator repo? Or should it be a separate "fork" project?
I'll probably keep updating code with time (and use in my apps). I think i'll extract some parts to separate components or merge them into main QRCode component. ot sure yet :).
In any case, this works ok as is. To make a full test you'd have to have a Roku device at hand, but "core" functionality (generating QRCode data, plus turning it into ASCII-like render, same as with JS version) can be tested using
brs
. I included test andpackage.json
that will use@hulu/roca
test runner - all you need is to have a node.js installed (or running in container or VM :)).brs
(used byroca
) implements only parts of BrightScript and SceneGraph APIs. Generating QRCode with it is A LOT slower than when running it on Roku device, so don't be scared if test runs over 6 seconds. On device it generates data in less than 600ms and turns it into PNG image in another ~350ms (or prints to console as ASCII in ~45ms).Here's output from
npm test
command:Here's console output from Roku device running example channel:
Please not that the spacing between blocks depends on the font. In local Terminal i see no spacing, but in this PR's description i see some - depends on font config used on GitHub.
And here's a screenshot from the same run: