Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont open comunications on device BV20 #61

Open
unixunamed opened this issue Nov 22, 2023 · 0 comments
Open

Dont open comunications on device BV20 #61

unixunamed opened this issue Nov 22, 2023 · 0 comments

Comments

@unixunamed
Copy link

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(">>>>>>>> >>>

Captura de tela de 2023-11-22 14-45-41
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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant