Closed kolucciy closed 1 week ago
@kolucciy please provide code example, also device model and protocl varsion you use
this.eSSP = new SSP({
id: 0x00,
debug: true,
fixedKey: "0123456701234567",
});
this.serialPortConfig = {
baudRate: 9600, // default: 9600
dataBits: 8, // default: 8
stopBits: 2, // default: 2
parity: 'none', // default: 'none'
};
this.device = 'COM1';
async open() {
await this.eSSP.open(this.device, this.serialPortConfig);
await this.eSSP.command('SYNC');
await this.eSSP.command('HOST_PROTOCOL_VERSION', { version: 6 });
await this.eSSP.initEncryption();
const serialNumberResult = await this.eSSP.command('GET_SERIAL_NUMBER');
//console.log('ESSP SERIAL NUMBER:', serialNumberResult.info.serial_number);
await this.eSSP.command('UNIT_DATA');
const setupResult = await this.eSSP.command('SETUP_REQUEST');
for (let i = 0; i < setupResult.info.channel_value.length; i++) {
this.channels[i + 1] = {
value: setupResult.info.expanded_channel_value[i],
country_code: setupResult.info.expanded_channel_country_code[i],
};
}
//console.log('ESSP channels', this.channels);
const ch = Array(this.channels.length).fill(1);
await this.eSSP.command('SET_CHANNEL_INHIBITS', { channels: ch });
await this.eSSP.enable();
this.emit('connected');
this._startPolling();
}
async _startPolling () {
this.eSSP.state.enabled = true
if (!this.eSSP.state.polling) return this.eSSP.poll(true);
}
this.eSSP.on('READ_NOTE', (result) => {
const denomination = this.channels[result.channel].value;
if (denomination > 0) {
console.log('ESSP READING NOTE', denomination)
}
});
this.eSSP.on('NOTE_STACKED', () => {
console.log('ESSP NOTE_STACKED');
});
this.eSSP.on('NOTE_STORED_IN_PAYOUT', () => {
console.log('ESSP NOTE_STORED_IN_PAYOUT');
});
this.eSSP.on('ERROR', (err) => console.error(`ESSP Error: ${JSON.stringify(err)}`));
// Open the connection to the device
this.open();
Its NV9 Spectral dispenser
@kolucciy and what error do you get?
That's what I have in the log:
...
ESSP READING NOTE 20
ESSP Error: {}
it should be:
...
ESSP READING NOTE 20
ESSP NOTE_STACKED
or
...
ESSP READING NOTE 20
ESSP NOTE_STORED_IN_PAYOUT
depending on the note insterted.
In order to help i need more infromation
set DEBUG=ssp
env varibale)@kolucciy also try viewing error without JSON.stringify
as error might not have toString
method
The issue can be closed, it was not related to the library, it was my code issue, sorry.
Hi, for some reason straight after READ_NOTE event I get ERROR with empty object. Any idea what it might be? If I test using ITL Validator Manager v 5.1.exe everything seems to be working as expected.