Wifi QR code app
Moderators: marcelr, TheHogNL, Toonz
Wifi QR code app
Just giving this a bump.
I created a QR code to connect to my wifi. It would be nice to have this on my Toon. Only one image, the QR code. I'm not familiar with coding or whatsoever. Is there a way to get this QR code on the Toon?
<edit by TheHogNL: created a new topic for this>
I created a QR code to connect to my wifi. It would be nice to have this on my Toon. Only one image, the QR code. I'm not familiar with coding or whatsoever. Is there a way to get this QR code on the Toon?
<edit by TheHogNL: created a new topic for this>
Wifi QR tile
Nice idea! I just made a simple app that will show such a QR code on a tile. Unpack it in /HCBv2/qml/apps and store your QR image as /HCBv2/qml/images/wifi.png.
I created the QR image on a linux machine with the qrencode command, using the default of 3 pixels per dot.
This app assumes firmware 5.0.4 or higher and the tile is not expected to be on the main screen, so it doesn't deal with dim state.
Edit: Updated version. This now creates the QR code on the fly from the wifi configuration stored on the Toon.
I created the QR image on a linux machine with the qrencode command, using the default of 3 pixels per dot.
This app assumes firmware 5.0.4 or higher and the tile is not expected to be on the main screen, so it doesn't deal with dim state.
Edit: Updated version. This now creates the QR code on the fly from the wifi configuration stored on the Toon.
- Attachments
-
- wifi.zip
- Version 4 - Added a configuration screen for manually specifying a wifi network.
- (4.23 KiB) Downloaded 434 times
Last edited by hvxl on Sun Mar 17, 2019 11:06 pm, edited 3 times in total.
Schelte
Re: Wifi QR code app
Just an idea: you can also generate the qr code on the fly with a bit of javascript: https://davidshimjs.github.io/qrcodejs/
Then you could just use the already configured wifi on the toon (the password is stored readable) to generate the qr code for each toon.
Then you could just use the already configured wifi on the toon (the password is stored readable) to generate the qr code for each toon.
Member of the Toon Software Collective
Re: Wifi QR code app
I thought about that, but it requires quite a bit of code to generate a QR code. Resources already aren't abundant on the Toon and the QR code only needs to be generated once. Also, the user may want to provide credentials for a guest network with limited access, while Toon is on the main wifi network.
Schelte
Re: Wifi QR code app
True, but generation can be done only once when the app starts or on user request. An option to change the default wifi (from which the toon is using) to another one (a guest network) can also be part of the app.
Member of the Toon Software Collective
Re: Wifi QR code app
I found a nice small javascript library that can produce QR images as an svg string, instead of wanting to draw on an HTML5 canvas or svg item: https://www.cssscript.com/flexible-clie ... generator/
It compiles fine on the Toon (I get a qrcodegen.jsc file), but I can't figure out how to call any of its methods from a qml file. I think I need something along the lines of:
But that aborts with an error: "Cannot read property 'QrCode' of undefined".
Can anyone better versed in javascript/qml than me provide a hint on how to invoke this library?
It compiles fine on the Toon (I get a qrcodegen.jsc file), but I can't figure out how to call any of its methods from a qml file. I think I need something along the lines of:
Code: Select all
import "qrcodegen.js" as QRCodegenJS
function hello() {
var QRC = QRCodegenJS.qrcodegen.QrCode
var qr0 = QRC.encodeText("Hello, world!", QRC.Ecc.MEDIUM);
svg = qr0.toSvgString(4);
}
Can anyone better versed in javascript/qml than me provide a hint on how to invoke this library?
Schelte
Re: Wifi QR code app
Just rememberd that there is already QrCode generation native in the Toon (at least in 5.0.4)
Look at this from the security panel:
So you only set the content to the string you want.. haven't tested it myself but it seems to work. Only these are imported, not sure which one is needed for QrCode
Look at this from the security panel:
Code: Select all
QrCode {
id: qrCode
anchors.centerIn: parent
width: Math.round(160 * 1.28)
height: width
content: p.verificationUrlComplete ? p.verificationUrlComplete : (p.errorState ? "error" : "")
color: p.errorState ? "#A8A8A8" : "#000000"
}
Code: Select all
import QtQuick 2.1
import qb.components 1.0
import qb.base 1.0
import BasicUIControls 1.0
import BxtClient 1.0
Member of the Toon Software Collective
Re: Wifi QR code app
Ok this works:
Code: Select all
import QtQuick 2.1
import qb.components 1.0
import BasicUIControls 1.0
Tile {
id: qrcodeTile
function init() {}
QrCode {
id: qrCode
anchors.centerIn: parent
width: Math.round(160 * 1.28)
height: width
content: "https://www.domoticaforum.eu/viewtopic.php?f=99&t=12379"
color: p.errorState ? "#A8A8A8" : "#000000"
}
}
Member of the Toon Software Collective
Re: Wifi QR code app
Yes, that works! Very nice. (Although I still would like to learn how to use methods from a js file).
Now on to extract the wifi data from /HCBv2/config/config_hcb_netcon.xml ...
Now on to extract the wifi data from /HCBv2/config/config_hcb_netcon.xml ...
Schelte
Re: Wifi QR code app
I have updated the zip file on the 2nd post in this topic. The new version now creates the QR code on the fly from the wifi configuration stored on the Toon.
Schelte
Re: Wifi QR code app
let me know if you want to have it published in the ToonStore .
Kind regardz,
Toonz
Kind regardz,
Toonz
member of the Toon Software Collective
Re: Wifi QR code app
This is a very nice idea. I noticed you try to show the Wifi info from the connection info of the Toon itself. It would be very appreciated to have the possibility to enter a guest wifi SSID and password aswell.
Re: Wifi QR code app
If you want just change the code and add to the project Learning QML (javascript syntax) is not really hard.
Member of the Toon Software Collective
Re: Wifi QR code app
What do you mean "try"? Does it not work?marcog wrote:This is a very nice idea. I noticed you try to show the Wifi info from the connection info of the Toon itself. It would be very appreciated to have the possibility to enter a guest wifi SSID and password aswell.
I mentioned the desire for alternative wifi settings myself a few posts ago. But it requires quite some additional functionality: A configuration screen to enter the information, reading and saving a configuration file, and picking the data from 2 different sources.
Schelte
Re: Wifi QR code app
Hey,
Nice job !!!
But just testing it and there's missing something in wifi.zip
WifiApp.qml is calling WifiScreen.qml but it's not there.
Could you fix that or even better if it ready enough put it in the ToonStore
Greetz,
Jos
Nice job !!!
But just testing it and there's missing something in wifi.zip
WifiApp.qml is calling WifiScreen.qml but it's not there.
Could you fix that or even better if it ready enough put it in the ToonStore
Greetz,
Jos