Skip to main content

API

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

Setters

listenOnPort

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

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

startChannelVerification

Say the channel to start verification of presence when run assignChannels

Info

Valid range is from 1 to 126

machine.startChannelVerification = 1;

endChannelVerification

Say the channel to end verification of presence when run assignChannels

Info

Valid range is from 1 to 126

machine.endChannelVerification = 80;

deviceType

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

Note

By default is esplus

machine.deviceType = 'esplus';

supportCart

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

machine.supportCart = true;

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 jofemar

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)

Methods

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

assignChannels

Start the verification presence of the channels

Note

You will need to listen event channels for the response

await machine.assignChannels();

collect

Elevator go to exit product position

await machine.collect();

connect

Connect to the machine

Note

Remember that you need execute connect with then and catch, not with await, unless you don't have any code after connect

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

disconnect

Disconnect from the machine

await machine.disconnect();

dispense

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

Info

Only works if the machine support cart i.e: esplus support cart, otherwise run for with cart in false, and without endDispense

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
}

endDispense

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

eventDisable

Disable events of the machine

Info

Confirmed supported events are '41'

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

eventEnable

Enable events of the machine

Info

Confirmed supported events are '41'

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

getBeeper

Get the beeper status

Note

Listen event check:beeper

await machine.getBeeper();

getChannelPresence

Get the presence of the channel

Note

Listen event channel:status

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

getChannelRunningAfterDispense

Get the time that the channel is running after dispense

Note

Listen event check:extractor-after-dispense

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

getClockRegisters

Get the clock registers

Note

Listen event clock:registers

await machine.getClockRegisters();

getCurrentTemperature

Get the current temperature of machine

Note

Listen event temperature:current

await machine.getCurrentTemperature();

getDisplayLanguage

Get the display language spanish english or french

Note

Listen event check:language

await machine.getDisplayLanguage();

getElevatorSpeed

Get the elevator speed low or high

Note

Listen event check:elevator-speed

await machine.getElevatorSpeed();

getFaults

Get the faults of the machine

Note

Listen event machine:faults

await machine.getFaults();

getIsolationTray

Get the isolation tray

Note

Listen event check:isolation-tray

await machine.getIsolationTray();

getMachineActivity

Get the machine activity

Note

Note: Listen event machine:activity

await machine.getMachineActivity();

getMachineId

Get the machine id

Note

Listen event check:machine-id

await machine.getMachineId();

getProgramVersion

Get the program version

Note

Listen event program:version

await machine.getProgramVersion();

getPushOverProducts

Get the push over products are enabled

Note

Listen event check:push-over

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

getTemperatureBeforeExpiration

Get the temperature before expiration

Note

Listen event check:temperature-before-expiration

await machine.getTemperatureBeforeExpiration();

getTemperatureExpiration

Get the temperature expiration enabled or disabled

Note

Listen event check:expiration-by-temperature

await machine.getTemperatureExpiration();

getTemperatureScale

Get the temperature scale celsius or fahrenheit

Note

Listen event check:temperature-scale

await machine.getTemperatureScale();

getTimeBeforeExpirationByTemperature

Get the time before expiration by temperature

Note

Listen event check:expiration-after

await machine.getTimeBeforeExpirationByTemperature();

getTimeToStandbyAfterCollect

Get the time to standby after collect

Note

Listen event check:standby-after-collect

await machine.getTimeToStandbyAfterCollect();

getTimeToStandbyWithoutCollect

Get the time to standby without collect

Note

Listen event check:standby-without-collect

await machine.getTimeToStandbyWithoutCollect();

getVoltageEngine

Get the voltage engine 5 to 9.5

Note

Listen event check:engine-voltage

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

getWorkingTemperature

Get the working temperature

Note

Listen event temperature:working

await machine.getWorkingTemperature();

productRemovedContinueDispensing

Product removed continue dispensing,

Tip

When you remove a product, the machine will continue dispensing the product, you can use this method to continue the dispensing without wait the time to finish the dispensing

await machine.productRemovedContinueDispensing();

lightsOff

Turn off the lights

await machine.lightsOff();

lightsOn

Turn on the lights

await machine.lightsOn();

programBeeper

Program the beeper

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

programChannelRunningAfterDispense

Program the time that the channel is running after dispense

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

programClock

Program the clock

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

programDisableTemperatureExpiration

Program disable temperature expiration

await machine.programDisableTemperatureExpiration();

programDisableThermometer

Program disable thermometer

await machine.programDisableThermometer();

programDisableWorkingTemperature

Program disable working temperature

await machine.programDisableWorkingTemperature();

programDisplayLanguage

Program the display language spanish english or french

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

programElevatorSpeed

Program the elevator speed low or high

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

programEnableTemperatureExpiration

Program enable temperature expiration

await machine.programEnableTemperatureExpiration();

programIsolationTray

Program the isolation tray

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

programMachineAddress

Program the machine address

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

programPushOverProducts

Program the push over products

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

programTemperatureBeforeExpiration

Program the temperature before expiration

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

programTemperatureExpiration

Program the temperature expiration

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

programTemperatureScale

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

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

programTimeBeforeExpirationByTemperature

Program the time before expiration by temperature

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

programTimeToStandbyAfterCollect

Program the time to standby after collect

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

programTimeToStandbyWithoutCollect

Program the time to standby without collect

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

programVoltageEngine

Program the voltage engine 5 to 9.5

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

programWorkingTemperature

Program the working temperature

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

resetAllErrors

Reset all errors of machine

await machine.resetAllErrors();

resetMachineErrors

Reset machine errors

await machine.resetMachineErrors();

resetSoldOutErrors

Reset sold out errors

await machine.resetSoldOutErrors();

resetWaitingProductRemovedError

Reset waiting product removed error

await machine.resetWaitingProductRemovedError();

sendConnect

Send connect to the machine

await machine.sendConnect();

sendCustomCode

Send custom code to the machine

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

setDisplayMessageTemporarily

Set the display message temporarily

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

setDisplayMessageUnlimited

Set the display message unlimited

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

setDisplayStandbyMessage

Set the display standby message

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

softReload

Soft reload the machine

await machine.softReload();

status

Get the status of the machine

Note

Listen event machine:status

await machine.status();