diff --git a/src/rfidParser.js b/src/rfidParser.js index 1d12b16..b3a682f 100644 --- a/src/rfidParser.js +++ b/src/rfidParser.js @@ -1,10 +1,4 @@ -import con from '../db/connect.js'; - export default async data => { - const palletFkFinding = 0; - const attempt = 0; - const sensitivity = null; - data = data.toString(); const crudeRfids = data.split('\n'); @@ -21,7 +15,7 @@ export default async data => { epcHex = epcHex.replace(RFID_PREFIX, ''); epcHex = epcHex.substring(0, 1) == 0 ? epcHex.substring(1) : epcHex; - // console.log(jsonResult); + const rfidParsed = { code: parseInt(epcHex), created: jsonResult.timestamp, @@ -30,19 +24,7 @@ export default async data => { antenna: jsonResult.tagInventoryEvent.antennaPort, transmitPowerCdbm: jsonResult.tagInventoryEvent.transmitPowerCdbm }; - // await con.query(` - // INSERT INTO vn.rfidTest (palletFk, expeditionFk, peakRssi, antenna, attempt, power, sensitivity) - // VALUES(?, ?, ?, ?, ?, ?, ?); - // `, [ - // palletFkFinding, - // rfidParsed.code, - // rfidParsed.peakRssi, - // rfidParsed.antenna, - // attempt, - // jsonResult.tagInventoryEvent.transmitPowerCdbm, - // sensitivity - // ]); - // console.log(rfidParsed); + rfidsParsedExtended.push(rfidParsed); rfidsParsed.add(rfidParsed.code); } diff --git a/src/stream.js b/src/stream.js index 468752e..b655d86 100644 --- a/src/stream.js +++ b/src/stream.js @@ -39,8 +39,8 @@ export default async(conf, cb) => { function createPallet() { clearTimeout(interval); - // if (!conf.minimum || rfidbuffer.size > conf.minimum) - // newPallet(rfidbuffer, conf.arcId); + if (!conf.minimum || rfidbuffer.size > conf.minimum) + newPallet(rfidbuffer, conf.arcId); rfidbuffer = new Set(); rfidbufferExtend = []; }