Answer the question
In order to leave comments, you need to log in
Does usb rfid reader work in keyboard emulation mode in a web application?
Hello, I'm interested in a conceptual approach to solving the problem of usb-rfid reader operation in keyboard emulation mode in a web application, the bottom line is that the data from touching a card with an rfid reader enters any active text field in the format of a set of simple numbers in an amount of 10.
Task: in that, regardless of the focus on any text field, select the card id code data and send it for further processing.
Also, the task is not to interfere with user input in any field.
Note that the information received from the reader has several distinctive properties from user input: the data output time between 1 and the next digit takes no more than 18 milliseconds. i.e. a person will not be able to dial faster.
Thank you.
Answer the question
In order to leave comments, you need to log in
If we take into account only the input speed (no more than 20 ms), then something like this:
var RFIDTime = false;
var RFIDInput = '';
$(document).keyup(function(e){
if(!RFIDTime) RFIDInput += String.fromCharCode(e.which); RFIDTime = e.timeStamp;
if(RFIDTime){
if(e.timeStamp - RFIDTime < 20){
RFIDInput += String.fromCharCode(e.which);
RFIDTime = e.timeStamp;
if(RFIDInput.length == 10){
console.log('RFID detected, value: ' + RFIDInput);
}
} else {
RFIDInput = '';
RFIDTime = false;
}
}
});
Марат, добрый день! Подскажите, пожалуйста, как решили данный вопрос, что из этого вышло?
Сейчас тоже встрял на этом моменте, но решений пока не вижу...
Буду очень рад, если сможете ответить мне..
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question