vn-rfid/util/debugStream.js

26 lines
985 B
JavaScript

export default (parsed, conf) => {
if (conf.env != 'dev') return;
// TOTAL
console.log('TOTAL BUFFER: ', parsed.codes.size);
// TOTAL READS BY ANTENNA
const totalRead = [0, 0, 0, 0];
for (let read of parsed.extended)
totalRead[read.antenna - 1]++;
console.log('TOTAL READ ANTENNA:', totalRead);
// UNIQUE READS BY ANTENNA
const uniqueRead = [new Set(), new Set(), new Set(), new Set()];
for (let read of parsed.extended)
uniqueRead[read.antenna - 1].add(read.code);
console.log('UNIQUE READ ANTENNA:', uniqueRead[0].size, uniqueRead[1].size, uniqueRead[2].size, uniqueRead[3].size);
// WARNING IF AN ANTENNA READS LESS THAN IT SHOULD
for (const [index, set] of uniqueRead.entries()) {
if (((set.size * 100) / parsed.codes.size) < 25)
console.logger.warn(`[ANTENNA]: ${index + 1} ONLY ${set.size}`);
}
console.log('----------------------------------------------------------------');
};