API References
Here you will find the methods that you can use to interact with the Jofemar device.
Setters
Section titled “Setters”listenOnPort
Section titled “listenOnPort”Each device can have different configurations, for jofemar port is the address from 1 to 31
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",}startChannelVerification
Section titled “startChannelVerification”Say the channel to start verification of presence when run assignChannels
machine.startChannelVerification = 1;endChannelVerification
Section titled “endChannelVerification”Say the channel to end verification of presence when run assignChannels
machine.endChannelVerification = 80;deviceType
Section titled “deviceType”Type of machine, i.e. iceplus,esplus, vision, etc.
machine.deviceType = 'esplus';supportCart
Section titled “supportCart”If the machine support cart, i.e. true or false
machine.supportCart = true;Getters
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 jofemar
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)Methods
Section titled “Methods”To almost all methods you need listen to the event, because the methods take a while to execute
assignChannels
Section titled “assignChannels”Start the verification presence of the channels
await machine.assignChannels();collect
Section titled “collect”Elevator go to exit product position
await machine.collect();connect
Section titled “connect”Connect to the machine
function tryConnect() { machine.connect().then(() => { }).catch(console.warn);}disconnect
Section titled “disconnect”Disconnect from the machine
await machine.disconnect();dispense
Section titled “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
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
Section titled “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
Section titled “eventDisable”Disable events of the machine
await machine.eventDisable({event: '41'});eventEnable
Section titled “eventEnable”Enable events of the machine
await machine.eventEnable({event: '41'});getBeeper
Section titled “getBeeper”Get the beeper status
await machine.getBeeper();getChannelPresence
Section titled “getChannelPresence”Get the presence of the channel
await machine.getChannelPresence({selection: 1});getChannelRunningAfterDispense
Section titled “getChannelRunningAfterDispense”Get the time that the channel is running after dispense
await machine.getChannelRunningAfterDispense({selection: 1});getClockRegisters
Section titled “getClockRegisters”Get the clock registers
await machine.getClockRegisters();getCurrentTemperature
Section titled “getCurrentTemperature”Get the current temperature of machine
await machine.getCurrentTemperature();getDisplayLanguage
Section titled “getDisplayLanguage”Get the display language spanish english or french
await machine.getDisplayLanguage();getElevatorSpeed
Section titled “getElevatorSpeed”Get the elevator speed low or high
await machine.getElevatorSpeed();getFaults
Section titled “getFaults”Get the faults of the machine
await machine.getFaults();getIsolationTray
Section titled “getIsolationTray”Get the isolation tray
await machine.getIsolationTray();getMachineActivity
Section titled “getMachineActivity”Get the machine activity
await machine.getMachineActivity();getMachineId
Section titled “getMachineId”Get the machine id
await machine.getMachineId();getProgramVersion
Section titled “getProgramVersion”Get the program version
await machine.getProgramVersion();getPushOverProducts
Section titled “getPushOverProducts”Get the push over products are enabled
await machine.getPushOverProducts({selection: 1});getTemperatureBeforeExpiration
Section titled “getTemperatureBeforeExpiration”Get the temperature before expiration
await machine.getTemperatureBeforeExpiration();getTemperatureExpiration
Section titled “getTemperatureExpiration”Get the temperature expiration enabled or disabled
await machine.getTemperatureExpiration();getTemperatureScale
Section titled “getTemperatureScale”Get the temperature scale celsius or fahrenheit
await machine.getTemperatureScale();getTimeBeforeExpirationByTemperature
Section titled “getTimeBeforeExpirationByTemperature”Get the time before expiration by temperature
await machine.getTimeBeforeExpirationByTemperature();getTimeToStandbyAfterCollect
Section titled “getTimeToStandbyAfterCollect”Get the time to standby after collect
await machine.getTimeToStandbyAfterCollect();getTimeToStandbyWithoutCollect
Section titled “getTimeToStandbyWithoutCollect”Get the time to standby without collect
await machine.getTimeToStandbyWithoutCollect();getVoltageEngine
Section titled “getVoltageEngine”Get the voltage engine 5 to 9.5
await machine.getVoltageEngine({selection: 1});getWorkingTemperature
Section titled “getWorkingTemperature”Get the working temperature
await machine.getWorkingTemperature();productRemovedContinueDispensing
Section titled “productRemovedContinueDispensing”Product removed continue dispensing,
await machine.productRemovedContinueDispensing();lightsOff
Section titled “lightsOff”Turn off the lights
await machine.lightsOff();lightsOn
Section titled “lightsOn”Turn on the lights
await machine.lightsOn();programBeeper
Section titled “programBeeper”Program the beeper
await machine.programBeeper({enable: true});programChannelRunningAfterDispense
Section titled “programChannelRunningAfterDispense”Program the time that the channel is running after dispense
await machine.programChannelRunningAfterDispense({selection: 1, seconds: 0});programClock
Section titled “programClock”Program the clock
await machine.programClock({date: new Date()});programDisableTemperatureExpiration
Section titled “programDisableTemperatureExpiration”Program disable temperature expiration
await machine.programDisableTemperatureExpiration();programDisableThermometer
Section titled “programDisableThermometer”Program disable thermometer
await machine.programDisableThermometer();programDisableWorkingTemperature
Section titled “programDisableWorkingTemperature”Program disable working temperature
await machine.programDisableWorkingTemperature();programDisplayLanguage
Section titled “programDisplayLanguage”Program the display language spanish english or french
await machine.programDisplayLanguage({language: 'spanish'});programElevatorSpeed
Section titled “programElevatorSpeed”Program the elevator speed low or high
await machine.programElevatorSpeed({speed: 'high'});programEnableTemperatureExpiration
Section titled “programEnableTemperatureExpiration”Program enable temperature expiration
await machine.programEnableTemperatureExpiration();programIsolationTray
Section titled “programIsolationTray”Program the isolation tray
await machine.programIsolationTray({tray: 0});programMachineAddress
Section titled “programMachineAddress”Program the machine address
await machine.programMachineAddress({address: 1});programPushOverProducts
Section titled “programPushOverProducts”Program the push over products
await machine.programPushOverProducts({selection: 1, enable: true});programTemperatureBeforeExpiration
Section titled “programTemperatureBeforeExpiration”Program the temperature before expiration
await machine.programTemperatureBeforeExpiration({degrees: 0.5});programTemperatureExpiration
Section titled “programTemperatureExpiration”Program the temperature expiration
await machine.programTemperatureExpiration({enable: true});programTemperatureScale
Section titled “programTemperatureScale”Program the temperature scale c for Celsius, or f for Fahrenheit
await machine.programTemperatureScale({scale: 'c'});programTimeBeforeExpirationByTemperature
Section titled “programTimeBeforeExpirationByTemperature”Program the time before expiration by temperature
await machine.programTimeBeforeExpirationByTemperature({minutes: 1});programTimeToStandbyAfterCollect
Section titled “programTimeToStandbyAfterCollect”Program the time to standby after collect
await machine.programTimeToStandbyAfterCollect({seconds: 15});programTimeToStandbyWithoutCollect
Section titled “programTimeToStandbyWithoutCollect”Program the time to standby without collect
await machine.programTimeToStandbyWithoutCollect({minutes: 1});programVoltageEngine
Section titled “programVoltageEngine”Program the voltage engine 5 to 9.5
await machine.programVoltageEngine({selection: 1, voltage: 5});programWorkingTemperature
Section titled “programWorkingTemperature”Program the working temperature
await machine.programWorkingTemperature({degrees: 0.5});resetAllErrors
Section titled “resetAllErrors”Reset all errors of machine
await machine.resetAllErrors();resetMachineErrors
Section titled “resetMachineErrors”Reset machine errors
await machine.resetMachineErrors();resetSoldOutErrors
Section titled “resetSoldOutErrors”Reset sold out errors
await machine.resetSoldOutErrors();resetWaitingProductRemovedError
Section titled “resetWaitingProductRemovedError”Reset waiting product removed error
await machine.resetWaitingProductRemovedError();sendConnect
Section titled “sendConnect”Send connect to the machine
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']});setDisplayMessageTemporarily
Section titled “setDisplayMessageTemporarily”Set the display message temporarily
await machine.setDisplayMessageTemporarily({message: 'Hello world', seconds: 15});setDisplayMessageUnlimited
Section titled “setDisplayMessageUnlimited”Set the display message unlimited
await machine.setDisplayMessageUnlimited({message: 'Hello world'});setDisplayStandbyMessage
Section titled “setDisplayStandbyMessage”Set the display standby message
await machine.setDisplayStandbyMessage({message: 'Hello world'});softReload
Section titled “softReload”Soft reload the machine
await machine.softReload();status
Section titled “status”Get the status of the machine
await machine.status();