Skip to content

API Reference

Here you will find the methods that you can use to interact with the Boardroid device.

Each device can have different configurations, for boardroid port accepted is only 1 (for now)

machine.listenOnPort = 1;

usbVendorId usbProductId are the filters that you can use to connect to the device

machine.serialFilters = [{
usbVendorId: 0x04d8,
usbProductId: 0x0053
}];

Warning

This is better don’t use once constructor was called

machine.serialConfigPort = {
baudRate: 9600,
dataBits: 8,
stopBits: 1,
parity: "none",
bufferSize: 32768,
flowControl: "none",
}

Set the price of the product or cart

machine.price = 100;

Set if the machine has a recycler

machine.hasRecycler = true;

Set if machine has an ICT recycler

machine.hasICT = true;

Set the banknote of the ICT recycler

machine.banknoteICT = 50;

Set if the machine has a coin purse or not

machine.hasCoinPurse = true; // false

Address of the machine

console.log(machine.listenOnPort);

get the filters that apply when require a serial device

console.log(machine.serialFilters);

get the configuration of the serial port

console.log(machine.serialConfigPort);

Check if the machine is connected

console.log(machine.isConnected);

Check if the machine is disconnected

console.log(machine.isDisconnected);

Get the number of device, isn’t the same of the address.

Warning

Number of device is util if you have more than one machine in the same pc

console.log(machine.deviceNumber);

Get the uuid of the connection

When you create a new instance of the class, the uuid is generated

console.log(machine.uuid);

Get the type of the device each class has a different type, in this case is boardroid

console.log(machine.typeDevice);

Get the queue of commands that are waiting to be executed

console.log(machine.queue);

Check if the machine is dispensing

console.log(machine.isDispensing);

Total in tubes

console.log(machine.totalInTubes);

Total in recycler

console.log(machine.totalInRecycler);

Check if the machine has a recycler

console.log(machine.hasRecycler);

Check if the machine has a coin purse

console.log(machine.hasCoinPurse);

Get the price assigned to purchase

console.log(machine.price);

Get the change of a purchase

console.log(machine.change);

Check if the machine has an ICT recycler

Get the configured banknote on ICT recycler

console.log(machine.hasICT);

Soft reload the machine

await machine.softReload();

Send connect to the machine, useful when you need know if the machine still connected

await machine.sendConnect();

Send custom code to the machine

await machine.sendCustomCode({code: ['00', '00', '00', '00', '00', '00', '00', '00', '00', '00']});

Accept banknote in scrow

await machine.banknotePurseAcceptInScrow();

Configure banknote purse

await machine.banknotePurseConfigure({
enable: true,
scrow: false,
});

Disable banknote purse

await machine.banknotePurseDisable();

Dispense money from banknote purse

await machine.banknotePurseDispense({$_50: 1});
// or
await machine.banknotePurseDispense({$_20: 1, $_50: 1, $_100: 0, $_200: 0, $_500: 0, $_1000: 0});

Enable banknote purse

await machine.banknotePurseEnable({scrow: false});

Read recycler

await machine.banknotePurseReadRecycler();

Reject banknote in scrow

await machine.banknotePurseRejectInScrow();

Save memory

await machine.banknotePurseSaveMemory({
channel: null,
$_20: null,
$_50: null,
$_100: null,
$_200: null,
$_500: null,
$_1000: null
});

Disable card reader

await machine.cardReaderDisable();

Dispense throw card payment

await machine.cardReaderDispense({channel: 1, second_channel: null, sensor: true, seconds: null, price: 10});

Configure coin purse

await machine.coinPurseConfigure({
enable: true,
high: 'FF',
low: 'FF',
});

Disable coin purse

await machine.coinPurseDisable();

Dispense money from coin purse

await machine.coinPurseDispense({$_1: 1});
// or
await machine.coinPurseDispense({$_50c: 1, $_1: 1, $_2: 1, $_5: 0, $_10: 0});

Enable coin purse

await machine.coinPurseEnable();

Read tubes

await machine.coinPurseReadTubes();

Configure cooling relay

await machine.coolingRelayConfigure({
enable: false
});

Disable cooling relay

await machine.coolingRelayDisable();

Enable cooling relay

await machine.coolingRelayEnable();

dispense product only one product

await machine.dispense({selection: 1});

Or if you want to customise the dispensation

await machine.dispense({
selection: 1,
second_selection: null,
sensor: true,
retry: true,
});

By default, boardroid doesn’t have support for a cart, but you emulate it with a loop

for (let i = 0; i < cart.length; i++) {
const dispense = await machine.dispense({selection: cart[i].selection});
if (dispense.status) {
console.log('Dispensed');
} else {
console.log('Error');
}
// show screen to collect product, from the exit product collector
await wait(10e3); // time to collect product
// (you can add here a function that return a promise when product was collected)
// the timer is a supposition, you need to change it
}

Disable payment methods

// only include those connected
await machine.paymentPursesDisable({coin: true, banknote: true, cardReader: false});

Enable payment methods

// only include those connected
await machine.paymentPursesEnable({coin: true, banknote: true, cardReader: false});

Read temperature

await machine.readTemperature();

Return change

await machine.returnChange();

Return inserted money, i.e: when cancel a purchase

await machine.returnInsertedMoney();

Make a test of the engines

await machine.testEngines();
// or
await machine.testEngines({singleEngine: true});