API Reference
Here you will find the methods that you can use to interact with the Boardroid device.
Setters
Section titled “Setters”listenOnPort
Section titled “listenOnPort”Each device can have different configurations, for boardroid port accepted is only 1 (for now)
machine.listenOnPort = 1;serialFilters
Section titled “serialFilters”usbVendorId usbProductId are the filters that you can use to connect to the device
machine.serialFilters = [{ usbVendorId: 0x04d8, usbProductId: 0x0053}];serialConfigPort
Section titled “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",}Set the price of the product or cart
machine.price = 100;hasRecycler
Section titled “hasRecycler”Set if the machine has a recycler
machine.hasRecycler = true;hasICT
Section titled “hasICT”Set if machine has an ICT recycler
machine.hasICT = true;banknoteICT
Section titled “banknoteICT”Set the banknote of the ICT recycler
machine.banknoteICT = 50;hasCoinPurse
Section titled “hasCoinPurse”Set if the machine has a coin purse or not
machine.hasCoinPurse = true; // falseGetters
Section titled “Getters”listenOnPort
Section titled “listenOnPort”Address of the machine
console.log(machine.listenOnPort);serialFilters
Section titled “serialFilters”get the filters that apply when require a serial device
console.log(machine.serialFilters);serialConfigPort
Section titled “serialConfigPort”get the configuration of the serial port
console.log(machine.serialConfigPort);isConnected
Section titled “isConnected”Check if the machine is connected
console.log(machine.isConnected);isDisconnected
Section titled “isDisconnected”Check if the machine is disconnected
console.log(machine.isDisconnected);deviceNumber
Section titled “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);Get the uuid of the connection
When you create a new instance of the class, the uuid is generated
console.log(machine.uuid);typeDevice
Section titled “typeDevice”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);isDispensing
Section titled “isDispensing”Check if the machine is dispensing
console.log(machine.isDispensing);totalInTubes
Section titled “totalInTubes”Total in tubes
console.log(machine.totalInTubes);totalInRecycler
Section titled “totalInRecycler”Total in recycler
console.log(machine.totalInRecycler);hasRecycler
Section titled “hasRecycler”Check if the machine has a recycler
console.log(machine.hasRecycler);hasCoinPurse
Section titled “hasCoinPurse”Check if the machine has a coin purse
console.log(machine.hasCoinPurse);Get the price assigned to purchase
console.log(machine.price);change
Section titled “change”Get the change of a purchase
console.log(machine.change);hasICT
Section titled “hasICT”Check if the machine has an ICT recycler
banknoteICT
Section titled “banknoteICT”Get the configured banknote on ICT recycler
console.log(machine.hasICT);Methods
Section titled “Methods”softReload
Section titled “softReload”Soft reload the machine
await machine.softReload();sendConnect
Section titled “sendConnect”Send connect to the machine, useful when you need know if the machine still connected
await machine.sendConnect();sendCustomCode
Section titled “sendCustomCode”Send custom code to the machine
await machine.sendCustomCode({code: ['00', '00', '00', '00', '00', '00', '00', '00', '00', '00']});banknotePurseAcceptInScrow
Section titled “banknotePurseAcceptInScrow”Accept banknote in scrow
await machine.banknotePurseAcceptInScrow();banknotePurseConfigure
Section titled “banknotePurseConfigure”Configure banknote purse
await machine.banknotePurseConfigure({ enable: true, scrow: false,});banknotePurseDisable
Section titled “banknotePurseDisable”Disable banknote purse
await machine.banknotePurseDisable();banknotePurseDispense
Section titled “banknotePurseDispense”Dispense money from banknote purse
await machine.banknotePurseDispense({$_50: 1});// orawait machine.banknotePurseDispense({$_20: 1, $_50: 1, $_100: 0, $_200: 0, $_500: 0, $_1000: 0});banknotePurseEnable
Section titled “banknotePurseEnable”Enable banknote purse
await machine.banknotePurseEnable({scrow: false});banknotePurseReadRecycler
Section titled “banknotePurseReadRecycler”Read recycler
await machine.banknotePurseReadRecycler();banknotePurseRejectInScrow
Section titled “banknotePurseRejectInScrow”Reject banknote in scrow
await machine.banknotePurseRejectInScrow();banknotePurseSaveMemory
Section titled “banknotePurseSaveMemory”Save memory
await machine.banknotePurseSaveMemory({ channel: null, $_20: null, $_50: null, $_100: null, $_200: null, $_500: null, $_1000: null});cardReaderDisable
Section titled “cardReaderDisable”Disable card reader
await machine.cardReaderDisable();cardReaderDispense
Section titled “cardReaderDispense”Dispense throw card payment
await machine.cardReaderDispense({channel: 1, second_channel: null, sensor: true, seconds: null, price: 10});coinPurseConfigure
Section titled “coinPurseConfigure”Configure coin purse
await machine.coinPurseConfigure({ enable: true, high: 'FF', low: 'FF',});coinPurseDisable
Section titled “coinPurseDisable”Disable coin purse
await machine.coinPurseDisable();coinPurseDispense
Section titled “coinPurseDispense”Dispense money from coin purse
await machine.coinPurseDispense({$_1: 1});// orawait machine.coinPurseDispense({$_50c: 1, $_1: 1, $_2: 1, $_5: 0, $_10: 0});coinPurseEnable
Section titled “coinPurseEnable”Enable coin purse
await machine.coinPurseEnable();coinPurseReadTubes
Section titled “coinPurseReadTubes”Read tubes
await machine.coinPurseReadTubes();coolingRelayConfigure
Section titled “coolingRelayConfigure”Configure cooling relay
await machine.coolingRelayConfigure({ enable: false});coolingRelayDisable
Section titled “coolingRelayDisable”Disable cooling relay
await machine.coolingRelayDisable();coolingRelayEnable
Section titled “coolingRelayEnable”Enable cooling relay
await machine.coolingRelayEnable();dispense
Section titled “dispense”Dispense product
Section titled “Dispense product”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,});Dispense cart
Section titled “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
Section titled “paymentPursesDisable”Disable payment methods
// only include those connectedawait machine.paymentPursesDisable({coin: true, banknote: true, cardReader: false});paymentPursesEnable
Section titled “paymentPursesEnable”Enable payment methods
// only include those connectedawait machine.paymentPursesEnable({coin: true, banknote: true, cardReader: false});readTemperature
Section titled “readTemperature”Read temperature
await machine.readTemperature();returnChange
Section titled “returnChange”Return change
await machine.returnChange();returnInsertedMoney
Section titled “returnInsertedMoney”Return inserted money, i.e: when cancel a purchase
await machine.returnInsertedMoney();testEngines
Section titled “testEngines”Make a test of the engines
await machine.testEngines();// orawait machine.testEngines({singleEngine: true});