30 lines
747 B
TypeScript
30 lines
747 B
TypeScript
/**
|
|
* For a no read we just want to put up a notification to the rfid dashboard stating this reader did not respond with any tag data.
|
|
*/
|
|
|
|
import { createLog } from "../../logger/logger.js";
|
|
|
|
export const noRead = async (reader: string) => {
|
|
createLog(
|
|
"error",
|
|
"rfid",
|
|
"rfid",
|
|
`${reader} just had a no read please check for a tag and manually trigger a read.`
|
|
);
|
|
};
|
|
|
|
// noReadTimer.js
|
|
let timeout: any = null;
|
|
|
|
export const startNoReadTimer = (onTimeout: any, ms = 10000) => {
|
|
clearNoReadTimer(); // Always clear any previous timer
|
|
timeout = setTimeout(onTimeout, ms);
|
|
};
|
|
|
|
export const clearNoReadTimer = () => {
|
|
if (timeout) {
|
|
clearTimeout(timeout);
|
|
timeout = null;
|
|
}
|
|
};
|