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();Get the status of the machine
await machine.status();