-
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
DMS Host
committed
Jun 24, 2024
0 parents
commit 34196c2
Showing
4 changed files
with
81 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" style="margin:0; padding:0;"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" | ||
content="width=device-width, initial-scale=1.0, user-scalable=1.0, minimum-scale=1.0, maximum-scale=1.0"> | ||
<title>NFC reader example</title> | ||
<script src="static/main.js" defer></script> | ||
</head> | ||
|
||
<body style="margin: 0; padding:0;"> | ||
<h1>NFC Reader</h1> | ||
<div id="content"></div> | ||
</body> | ||
|
||
</html> |
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,10 @@ | ||
from flask import Flask, render_template | ||
|
||
app = Flask(__name__) | ||
|
||
@app.route('/') | ||
def index(): | ||
return render_template('index.html') | ||
|
||
if __name__ == '__main__': | ||
app.run(debug=True) |
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,37 @@ | ||
const ndef = new NDEFReader(); | ||
let ignoreRead = false; | ||
|
||
function read(data) { | ||
ignoreRead = true; | ||
return new Promise((resolve, reject) => { | ||
ndef.addEventListener( | ||
"reading", | ||
(event) => { | ||
console.log("reading"); | ||
}, | ||
{ once: false }, | ||
); | ||
}); | ||
} | ||
|
||
const content = document.getElementById("content"); | ||
let count = 0; | ||
|
||
async function runApplication() { | ||
while (true) { | ||
await ndef.scan(); | ||
|
||
count++; | ||
|
||
content.textContent = `Scanned items = ${count}`; | ||
const sleepTimer = new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve(); | ||
}, 500); | ||
}); | ||
|
||
await sleepTimer; | ||
} | ||
} | ||
|
||
runApplication(); |
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,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" style="margin:0; padding:0;"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" | ||
content="width=device-width, initial-scale=1.0, user-scalable=1.0, minimum-scale=1.0, maximum-scale=1.0"> | ||
<title>NFC reader example</title> | ||
<script src="static/main.js" defer></script> | ||
</head> | ||
|
||
<body style="margin: 0; padding:0;"> | ||
<h1>NFC Reader</h1> | ||
<div id="content"></div> | ||
</body> | ||
|
||
</html> |