-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1dab083
commit 0dfdae4
Showing
3 changed files
with
72 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// qrtest.js Tests qrscanner.js | ||
|
||
import * as QRS from './qrscanner.js' // *todo* './qrscanner.min.js' | ||
|
||
function terminal(txt){ | ||
document.getElementById("vout").innerText += `\nQR: ${txt}` | ||
} | ||
|
||
// Returns (siehe qrscanner.js): -1:Ignored, 0:AcceptedUndEnde, 1:AcceptedAberNochMehrErlaubt undefined:diesenScanignorieren | ||
function scanFoundAddDevice(scanresult) { | ||
terminal(`SCAN: '${scanresult}'`) | ||
return 1 // MORE | ||
} | ||
|
||
document.getElementById("scanButton").addEventListener('click', async () => { | ||
QRS.setQrLogPrint(terminal) // Scanner-printf via Terminal-printf | ||
QRS.setScanCallback(scanFoundAddDevice) | ||
QRS.clearScannedResults() | ||
const sres = await QRS.openSelectedCamera() // Implizit initCameras falls noetig, nicht aber beide! | ||
if (typeof sres == 'string') { | ||
alert(sres) | ||
return | ||
} | ||
await QRS.scannerBusy() | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
Tests: | ||
http://localhost/wrk/joemdash/app/qrstest.html | ||
https://joembedded.github.io/JoEm-Dashboard/app/qrstest.html | ||
Mobile: 7*Tap auf "Buildnummer" im Setup-SW->Softwareinformationen, | ||
dann Entwickleroptionen: USB-Debugging ON | ||
Dann load auf Mobile via localhost | ||
dann chrome://inspect/#devices | ||
Evtl. auf Mobile "Debugging Zulassen" aktivieren, damit erkannt wird | ||
Debuggen startet via "inspect" | ||
(Gute Anleitung: https://www.till.net/technologie/html-javascript/remote-web-debugging-unter-android-und-chrome ) | ||
--> | ||
|
||
<html lang="en"> | ||
|
||
<head> | ||
|
||
<script> | ||
window.jdDebug = 2 // <=1:NoQRScannerPolyfill, >1:Debug,ScannerPolyfill | ||
console.log(`Debuglevel ${window.jdDebug}`) | ||
</script> | ||
|
||
<link rel="stylesheet" href="./css/qrscanner.css"> | ||
|
||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
|
||
<title>QR Scanner Test</title> | ||
|
||
</head> | ||
|
||
<body> | ||
<button id="scanButton"> SCAN </button> | ||
<hr><div id="vout">--- Info: ---</div><hr> | ||
</body> | ||
|
||
<script src="./js/qrstest.js" type="module"></script> | ||
|
||
|
||
</html> |