Skip to content

API References

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

Each device can have different configurations, for jofemar port is the address from 1 to 31

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

Say the channel to start verification of presence when run assignChannels

machine.startChannelVerification = 1;

Say the channel to end verification of presence when run assignChannels

machine.endChannelVerification = 80;

Type of machine, i.e. iceplus,esplus, vision, etc.

machine.deviceType = 'esplus';

If the machine support cart, i.e. true or false

machine.supportCart = true;

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 jofemar

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)

To almost all methods you need listen to the event, because the methods take a while to execute

Start the verification presence of the channels

await machine.assignChannels();

Elevator go to exit product position

await machine.collect();

Connect to the machine

function tryConnect() {
machine.connect().then(() => {
}).catch(console.warn);
}

Disconnect from the machine

await machine.disconnect();

Dispense a product

const dispense = await machine.dispense({
selection: 1,
cart: false,
});
if (dispense.status) { // dispensed
// do something ...
} else {
// do other thing ...
}

Or if you want to dispense an entire cart

for (let i = 0; i < cart.length; i++) {
const dispense = await machine.dispense({
selection: cart[i].selection,
cart: true,
});
if (dispense.status) { // dispensed
// do something ...
} else {
// do other thing ...
}
}
await machine.endDispense();

If the machine doesn’t support cart, you can use the following code:

for (let i = 0; i < cart.length; i++) {
const dispense = await machine.dispense({
selection: cart[i].selection,
});
if (dispense.status) { // dispensed
// do something ...
} else {
// do other thing ...
}
// 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
}

End dispense of the cart, it’s important to call this method after dispense all products in cart mode, otherwise the elevator never go to the exit position

await machine.endDispense();

Disable events of the machine

await machine.eventDisable({event: '41'});

Enable events of the machine

await machine.eventEnable({event: '41'});

Get the beeper status

await machine.getBeeper();

Get the presence of the channel

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

Get the time that the channel is running after dispense

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

Get the clock registers

await machine.getClockRegisters();

Get the current temperature of machine

await machine.getCurrentTemperature();

Get the display language spanish english or french

await machine.getDisplayLanguage();

Get the elevator speed low or high

await machine.getElevatorSpeed();

Get the faults of the machine

await machine.getFaults();

Get the isolation tray

await machine.getIsolationTray();

Get the machine activity

await machine.getMachineActivity();

Get the machine id

await machine.getMachineId();

Get the program version

await machine.getProgramVersion();

Get the push over products are enabled

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

Get the temperature before expiration

await machine.getTemperatureBeforeExpiration();

Get the temperature expiration enabled or disabled

await machine.getTemperatureExpiration();

Get the temperature scale celsius or fahrenheit

await machine.getTemperatureScale();

Get the time before expiration by temperature

await machine.getTimeBeforeExpirationByTemperature();

Get the time to standby after collect

await machine.getTimeToStandbyAfterCollect();

Get the time to standby without collect

await machine.getTimeToStandbyWithoutCollect();

Get the voltage engine 5 to 9.5

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

Get the working temperature

await machine.getWorkingTemperature();

Product removed continue dispensing,

await machine.productRemovedContinueDispensing();

Turn off the lights

await machine.lightsOff();

Turn on the lights

await machine.lightsOn();

Program the beeper

await machine.programBeeper({enable: true});

Program the time that the channel is running after dispense

await machine.programChannelRunningAfterDispense({selection: 1, seconds: 0});

Program the clock

await machine.programClock({date: new Date()});

Program disable temperature expiration

await machine.programDisableTemperatureExpiration();

Program disable thermometer

await machine.programDisableThermometer();

Program disable working temperature

await machine.programDisableWorkingTemperature();

Program the display language spanish english or french

await machine.programDisplayLanguage({language: 'spanish'});

Program the elevator speed low or high

await machine.programElevatorSpeed({speed: 'high'});

Program enable temperature expiration

await machine.programEnableTemperatureExpiration();

Program the isolation tray

await machine.programIsolationTray({tray: 0});

Program the machine address

await machine.programMachineAddress({address: 1});

Program the push over products

await machine.programPushOverProducts({selection: 1, enable: true});

Program the temperature before expiration

await machine.programTemperatureBeforeExpiration({degrees: 0.5});

Program the temperature expiration

await machine.programTemperatureExpiration({enable: true});

Program the temperature scale c for Celsius, or f for Fahrenheit

await machine.programTemperatureScale({scale: 'c'});

Program the time before expiration by temperature

await machine.programTimeBeforeExpirationByTemperature({minutes: 1});

Program the time to standby after collect

await machine.programTimeToStandbyAfterCollect({seconds: 15});

Program the time to standby without collect

await machine.programTimeToStandbyWithoutCollect({minutes: 1});

Program the voltage engine 5 to 9.5

await machine.programVoltageEngine({selection: 1, voltage: 5});

Program the working temperature

await machine.programWorkingTemperature({degrees: 0.5});

Reset all errors of machine

await machine.resetAllErrors();

Reset machine errors

await machine.resetMachineErrors();

Reset sold out errors

await machine.resetSoldOutErrors();

Reset waiting product removed error

await machine.resetWaitingProductRemovedError();

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']});

Set the display message temporarily

await machine.setDisplayMessageTemporarily({message: 'Hello world', seconds: 15});

Set the display message unlimited

await machine.setDisplayMessageUnlimited({message: 'Hello world'});

Set the display standby message

await machine.setDisplayStandbyMessage({message: 'Hello world'});

Soft reload the machine

await machine.softReload();

Get the status of the machine

await machine.status();