Add checks for RFID error codes

This commit is contained in:
Annika Backstrom 2017-04-09 22:45:21 -04:00
parent beacdf98e7
commit 9fb3b6bc1c
2 changed files with 20 additions and 0 deletions

View File

@ -10,6 +10,12 @@ var html = `
<link rel="stylesheet" href="https://unpkg.com/purecss@0.6.2/build/pure-min.css" integrity="sha384-UQiGfs9ICog+LwheBSRCt1o5cbyKIHbwjWscjemyBMT9YCUMZffs6UqUTd0hObXD" crossorigin="anonymous">
<style>
form { margin: 1em 0; }
.button-error {
color: white;
border-radius: 4px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
background: rgb(202, 60, 60);
}
</style>
</head>
<body>
@ -18,9 +24,11 @@ var html = `
<h1>tag-reader-dummy</h1>
<form method="post" class="pure-form">
<input class="pure-button pure-button-primary" type="submit" name="uid" value="12121212">
OK Then.mp3
</form>
<form method="post" class="pure-form">
<input class="pure-button pure-button-primary" type="submit" name="uid" value="BADC0FFEE">
Brazil Theme.mp3
</form>
<div>
<form method="post" class="pure-form" style="display: inline-block;">
@ -30,6 +38,14 @@ var html = `
<input class="pure-button pure-button-primary" type="submit" name="uid" value="PAUSEPAUSE">
</form>
</div>
<div>
<form method="post" class="pure-form" style="display: inline-block;">
<input class="pure-button button-error" type="submit" name="uid" value="E1">
</form>
<form method="post" class="pure-form" style="display: inline-block;">
<input class="pure-button button-error" type="submit" name="uid" value="E2">
</form>
</div>
<form method="post" class="pure-form">
<input type="text" name="uid" value="0123456789"> <input class="pure-button pure-button-primary" type="submit">
</form>

View File

@ -54,6 +54,10 @@ process.on('exit', exitHandler.bind(null));
process.on('SIGINT', exitHandler.bind(null, {exit:true}));
TagReader.on('message', tag => {
if (tag == 'E1' || tag == 'E2') {
logger.debug("tagreader had rfid read error", { tag: tag });
return;
}
logger.debug("got tag from tagreader", { tag: tag });
MediaLibrary.find(tag);
});