Security Level: Jimmy
With the current barcodescanner implementation, the widget will fire a onDetect event to the server immediately when receiving a detection event from the quagga reader.
With a number of camera factors (poor definition, insuficient lighting, poor focus, etc.) this may cause the reader to return false positives with incorrect values.
This is compounded if the reader uses multiple encoding at the same time, as slighly imprecise image may be parsed with a different encounding than intended. This is also more common on low-control encoding such as EAN based codes.
However, it is unlikely that the same false positive may be parsed multiple times in a row.
A good default feature to have would be to add a buffered consistency check to the scanner.
This consistency could have the following properties:
-scan events buffer size: the number of past events to buffer (first in, first out)
-scan events threshold : the number of buffered events with the same value necessary to fire an event to the server and clear the buffer.
Defaults values for the ZK codereader should be
consistency buffer size : 5
consistency buffer threshold : 3
(require at least 3 out of 5 scan events to be consistent before firing)
Scan consistency should be done with a small delay between frames (10 ms ? / configurable? ) to ensure that more than one capture image is used.