Skip to content

API Reference

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

Each device can have different configurations, for lockers port is the address from 1 to 255

machine.listenOnPort = 3;

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

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 locker

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

Soft reload the machine

await machine.softReload();

Send connect to the machine

await machine.sendConnect();

Send custom code to the machine

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

Open a cell from the locker

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

Get status of cell from the locker

Warning

This command is experimental and may be incomplete

await machine.status({cell: 1});

Enable a cell from the locker

await machine.enable({cell: 1});

Disable a cell from the locker

await machine.disable({cell: 1});

Open all cells from the locker

await machine.openAll();

Enable all cells from the locker

await machine.enableAll();

Disable all cells from the locker

await machine.disableAll();