Skip to main content

API

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

Setters

listenOnPort

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

machine.listenOnPort = 1;

serialFilters

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

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

serialConfigPort

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",
}

price

Set the price of the product or cart

machine.price = 100;

hasRecycler

Set if the machine has a recycler

machine.hasRecycler = true;

hasICT

Set if machine has an ICT recycler

machine.hasICT = true;

banknoteICT

Set the banknote of the ICT recycler

Info

Only accept 20, 50, 100, 200, 500

machine.banknoteICT = 50;

Getters

listenOnPort

Address of the machine

console.log(machine.listenOnPort);

serialFilters

get the filters that apply when require a serial device

console.log(machine.serialFilters);

serialConfigPort

get the configuration of the serial port

console.log(machine.serialConfigPort);

isConnected

Check if the machine is connected

console.log(machine.isConnected);

isDisconnected

Check if the machine is disconnected

console.log(machine.isDisconnected);

deviceNumber

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);

uuid

Get the uuid of the connection

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

console.log(machine.uuid);

typeDevice

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

console.log(machine.typeDevice);

queue

Get the queue of commands that are waiting to be executed

console.log(machine.queue);

isDispensing

Check if the machine is dispensing

console.log(machine.isDispensing);

totalInTubes

Total in tubes

console.log(machine.totalInTubes);

totalInRecycler

Total in recycler

console.log(machine.totalInRecycler);

hasRecycler

Check if the machine has a recycler

console.log(machine.hasRecycler);

hasCoinPurse

Check if the machine has a coin purse

console.log(machine.hasCoinPurse);

price

Get the price assigned to purchase

console.log(machine.price);

change

Get the change of a purchase

console.log(machine.change);

hasICT

Check if the machine has an ICT recycler

banknoteICT

Get the configured banknote on ICT recycler

console.log(machine.hasICT);

Methods

softReload

Soft reload the machine

Note

Listen event serial:soft-reload

await machine.softReload();

sendConnect

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

await machine.sendConnect();

sendCustomCode

Send custom code to the machine

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

banknotePurseAcceptInScrow

Accept banknote in scrow

Note

Listen event banknote-purse:banknote-scrow-status

await machine.banknotePurseAcceptInScrow();

banknotePurseConfigure

Configure banknote purse

Note

Listen event banknote-purse:config

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

banknotePurseDisable

Disable banknote purse

Note

Listen event banknote-purse:config

await machine.banknotePurseDisable();

banknotePurseDispense

Dispense money from banknote purse

Note

Listen event banknote-purse:event-banknote

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

banknotePurseEnable

Enable banknote purse

Note

Listen event banknote-purse:config

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

banknotePurseReadRecycler

Read recycler

Note

Listen event banknote-purse:recycler

await machine.banknotePurseReadRecycler();

banknotePurseRejectInScrow

Reject banknote in scrow

Note

Listen event banknote-purse:banknote-scrow-status

await machine.banknotePurseRejectInScrow();

banknotePurseSaveMemory

Save memory

Note

Listen event banknote-purse:save-memory

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

cardReaderDisable

Disable card reader

Note

Listen event card-reader:event

await machine.cardReaderDisable();

cardReaderDispense

Dispense throw card payment

Note

Listen event card-reader:event

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

coinPurseConfigure

Configure coin purse

Note

Listen event coin-purse:config

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

coinPurseDisable

Disable coin purse

Note

Listen event coin-purse:config

await machine.coinPurseDisable();

coinPurseDispense

Dispense money from coin purse

Note
  • Listen event coin-purse:coin-event
  • Listen event coin-purse:tubes
await machine.coinPurseDispense({$_1: 1});
// or
await machine.coinPurseDispense({$_50c: 1, $_1: 1, $_2: 1, $_5: 0, $_10: 0});

coinPurseEnable

Enable coin purse

Note

Listen event coin-purse:config

await machine.coinPurseEnable();

coinPurseReadTubes

Read tubes

Note

Listen event coin-purse:tubes

await machine.coinPurseReadTubes();

coolingRelayConfigure

Configure cooling relay

Note

Listen event status:relay

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

coolingRelayDisable

Disable cooling relay

Note

Listen event status:relay

await machine.coolingRelayDisable();

coolingRelayEnable

Enable cooling relay

Note

Listen event status:relay

await machine.coolingRelayEnable();

dispense

Dispense product

dispense product only one product

Note

This is not necessary to use, but it's possible

  • Listen event dispensed
  • Listen event dispensing
  • Listen event not-dispensed
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,
});

Dispense cart

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
}

paymentPursesDisable

Disable payment methods

Note
  • Listen event coin-purse:config
  • Listen event banknote-purse:config
  • Listen event card-reader:event
// only include those connected
await machine.paymentPursesDisable({coin: true, banknote: true, cardReader: false});

paymentPursesEnable

Enable payment methods

Note
  • Listen event coin-purse:config
  • Listen event banknote-purse:config
  • Listen event card-reader:event
// only include those connected
await machine.paymentPursesEnable({coin: true, banknote: true, cardReader: false});

readTemperature

Read temperature

Note
  • Listen event status:temperature
await machine.readTemperature();

returnChange

Return change

Note
  • Listen event session:money-dispensed
  • Listen event coin-purse:coin-event
  • Listen event coin-purse:tubes
  • Listen event banknote-purse:event-banknote
await machine.returnChange();

returnInsertedMoney

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

Note
  • Listen event session:money-dispensed
  • Listen event coin-purse:coin-event
  • Listen event coin-purse:tubes
  • Listen event banknote-purse:event-banknote
await machine.returnInsertedMoney();

testEngines

Make a test of the engines

Tip

By default, the test is made with two engines at the same time to accelerate the process, if you want to test only one engine, you can use the singleEngine option

Note
  • Listen event percentage:test
await machine.testEngines();
// or
await machine.testEngines({singleEngine: true});