encrypted-smiley-secure-protocol
encrypted-smiley-secure-protocol copied to clipboard
Dont open comunications on device BV20
Ubuntu 22 node 19.9.0
Hello, sorry to bother you, but I'm really racking my brain, I'm using your code to try to read banknotes from a BV20 bill acceptor, I configure the correct port to which a USB TTL adapter with Tx + RX + GNT correct cables and bill acceptor configured for SSP however I can't make it work, it gives me the timeout message: Port opened! WITH <- 7f0001116608 null 0 TIMEOUT SYNC my code .. :
const { SerialPort } = require('serialport'); const sspLib = require('encrypted-smiley-secure-protocol'); //const sspLib = require('./src/index');
letport; let eSSP;
async function findDevice(vendorId = '067b') { console.log(" LOG SerialManager Find VENDORID",vendorId);
const ports = await SerialPort.list();
const device = ports.find(port => port.vendorId === vendorId);
console.log(" LOG SerialManager DEVICE",JSON.stringify(device));
return device ? device.path: null;
}
async function setupSSP(devicePath) { devicePath = '/dev/ttyUSB1'; console.log('LOG SERIAL MANAGER SETUP-SSP DEVICE = .' , devicePath);
if (eSSP) {
console.log('SSP already configured.');
return;
}
eSSP = new sspLib({
id: 0x00,
debug: true,
timeout: 3000,
fixedKey: '0123456701234567',
});
eSSP.on('OPEN', () => {
console.log('SSP open');
});
eSSP.on('NOTE_READ', result => {
console.log('Note read:', result);
// Here you add the read note processing logic
});
eSSP.on('NOTE_REJECTED', result => {
console.log('Note rejected:', result);
});
try {
console.log(">>>>>>>> >>>
THE SYSTEM STOP HERE HERE IS A PROBLEM >>>>>>>>>>>>>>>>>>>>>> >>"); await eSSP.open(devicePath); console.log("SERIAL MANAGER >> TRY >> THEN OPEN >>");
await eSSP.initEncryption();
console.log("SERIAL MANAGER >> TRY >> BEFORE ENABLE >>");
await eSSP.enable();
} catch (error) {
console.error('Error configuring SSP:', error);
}
}
function closeSSP() { if (eSSP) { eSSP.close(); eSSP = null; } }
module.exports = { findDevice, setupSSP, closeSSP }; Please help me!