feat(lstv2 move): moved lstv2 into this app to keep them combined and easier to maintain
This commit is contained in:
29
lstV2/server/services/rfid/controller/noRead.ts
Normal file
29
lstV2/server/services/rfid/controller/noRead.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user