Emulator
The emulator is a tool that allows you to simulate the behavior of a vending machine. It is a useful tool for testing and debugging the software that interacts with the vending machine.
Enable the Emulator
Section titled “Enable the Emulator”By default, the emulator is disabled. To enable it, you need to set the enable property to true in the configuration
import {Emulator} from '@danidoble/webserial';
Emulator.enable = true;You need at least one class instance
import {Jofemar} from '@danidoble/webserial';
const machine = new Jofemar();Set connection instance
Section titled “Set connection instance”As I said before, you need to set the instance of the class that is using the emulator.
But of course sending every time sounds like a lot of work, so you can set the connection instance. And then you can use the emulator methods without sending the instance.
emulator.setConnection(machine);Status
Section titled “Status”Simulate the status of the vending machine.
Emulator.status(machine)Dispensed
Section titled “Dispensed”Simulate the dispensing of a product.
Emulator.dispensed(machine)Not Dispensed
Section titled “Not Dispensed”Simulate the product not being dispensed.
Emulator.notDispensed(machine)Gate inactive
Section titled “Gate inactive”Simulate the gate being inactive.
Emulator.gateInactive(machine)Gate configured
Section titled “Gate configured”Simulate the gate being configured.
Emulator.gateConfigured(machine)Keyboard pressed
Section titled “Keyboard pressed”Simulate a key being pressed on the vending machine.
Emulator.keyboardPressed(machine)Door opened
Section titled “Door opened”Simulate the door being opened.
emulator.doorOpened(machine);Door closed
Section titled “Door closed”Simulate the door being closed.
emulator.doorClosed(machine);Channel disconnected
Section titled “Channel disconnected”Simulate a channel disconnected.
emulator.channelDisconnected(machine);Channel connected
Section titled “Channel connected”Simulate a channel connected.
emulator.channelConnected(machine);Channel empty
Section titled “Channel empty”Simulate a channel being empty.
emulator.channelEmpty(machine);Working temperature
Section titled “Working temperature”Simulate the working temperature of the vending machine.
emulator.workingTemperature(machine);Current temperature
Section titled “Current temperature”Simulate the current temperature of the vending machine.
emulator.currentTemperature(machine);Simulate the Machine is ready
emulator.ready(machine);Simulate the Machine is busy
emulator.busy(machine);Invalid tray
Section titled “Invalid tray”Simulate an invalid tray.
emulator.invalidTray(machine);Invalid channel
Section titled “Invalid channel”Simulate an invalid channel.
emulator.invalidChannel(machine);Empty channel
Section titled “Empty channel”Simulate an empty channel.
emulator.emptyChannel(machine);Elevator jam
Section titled “Elevator jam”Simulate an elevator jam.
emulator.elevatorJam(machine);Elevator malfunction
Section titled “Elevator malfunction”Simulate an elevator malfunction.
emulator.elevatorMalfunction(machine);Photo transistor failure
Section titled “Photo transistor failure”Simulate a photo transistor failure.
emulator.phototransistorFailure(machine);All channels empty
Section titled “All channels empty”Simulate all channels being empty.
emulator.allChannelsEmpty(machine);Product detector failure
Section titled “Product detector failure”Simulate a product detector failure.
emulator.productDetectorFailure(machine);Display disconnected
Section titled “Display disconnected”Simulate the display is disconnected.
emulator.displayDisconnected(machine);Product under elevator
Section titled “Product under elevator”Simulate a product being under the elevator.
emulator.productUnderElevator(machine);Elevator setting alarm
Section titled “Elevator setting alarm”Simulate the elevator setting an alarm.
emulator.elevatorSettingAlarm(machine);Button panel failure
Section titled “Button panel failure”Simulate a button panel failure.
emulator.buttonPanelFailure(machine);Error Writing EEPROM
Section titled “Error Writing EEPROM”Simulate an error writing to the EEPROM.
emulator.errorWritingEeprom(machine);Error in control temperature
Section titled “Error in control temperature”Simulate an error in the control temperature.
emulator.errorControlTemperature(machine);Thermometer disconnected
Section titled “Thermometer disconnected”Simulate the thermometer being disconnected.
emulator.thermometerDisconnected(machine);Thermometer misconfigured
Section titled “Thermometer misconfigured”Simulate the thermometer being misconfigured.
emulator.thermometerMisconfigured(machine);Thermometer failure
Section titled “Thermometer failure”Simulate the thermometer failing.
emulator.thermometerFailure(machine);Error extractor consumption
Section titled “Error extractor consumption”Simulate an error in the extractor consumption.
emulator.errorExtractorConsumption(machine);Channel search error
Section titled “Channel search error”Simulate a channel search error.
emulator.channelSearchError(machine);Product exit mouth search error
Section titled “Product exit mouth search error”Simulate a product exit mouth search error.
emulator.productExitMouthSearchError(machine);Interior elevator blocked
Section titled “Interior elevator blocked”Simulate the interior elevator being blocked.
emulator.elevatorInteriorLocked(machine);Product detector verifier error
Section titled “Product detector verifier error”Simulate a product detector verifier error.
emulator.productDetectorVerifierError(machine);Waiting for product recall
Section titled “Waiting for product recall”Simulate waiting for a product recall.
emulator.waitingForProductRecall(machine);Product expired by temperature
Section titled “Product expired by temperature”Simulate a product expiring due to temperature.
emulator.productExpiredByTemperature(machine);Faulty automatic door
Section titled “Faulty automatic door”Simulate a faulty automatic door.
emulator.faultyAutomaticDoor(machine);Reject lever
Section titled “Reject lever”Simulate the reject lever was pressed.
emulator.rejectLever(machine);Reset coin purse
Section titled “Reset coin purse”Simulate the coin purse being reset.
emulator.resetCoinPurse(machine);Coin inserted box
Section titled “Coin inserted box”Simulate a coin being inserted into the box.
emulator.coinInsertedBox(machine);Coin inserted tube
Section titled “Coin inserted tube”Simulate a coin being inserted into the tube.
emulator.coinInsertedTube(machine);Banknote inserted stacker
Section titled “Banknote inserted stacker”Simulate a banknote being inserted into the stacker.
emulator.banknoteInsertedStacker(machine);Banknote inserted escrow
Section titled “Banknote inserted escrow”Simulate a banknote being inserted into the escrow.
emulator.banknoteInsertedEscrow(machine);Banknote ejected
Section titled “Banknote ejected”Simulate a banknote being ejected.
emulator.banknoteEjected(machine);Banknote inserted recycler
Section titled “Banknote inserted recycler”Simulate a banknote being inserted into the recycler.
emulator.banknoteInsertedRecycler(machine);Banknote taken
Section titled “Banknote taken”Simulate a banknote being taken.
emulator.banknoteTaken(machine);Coin purse enabled
Section titled “Coin purse enabled”Simulate the coin purse being enabled.
emulator.coinPurseEnabled(machine);Coin purse disabled
Section titled “Coin purse disabled”Simulate the coin purse being disabled.
emulator.coinPurseDisabled(machine);Banknote purse disabled
Section titled “Banknote purse disabled”Simulate the banknote purse being disabled.
emulator.billPurseDisabled(machine);banknote purse enabled
Section titled “banknote purse enabled”Simulate the banknote purse being enabled.
emulator.billPurseEnabled(machine);Read tubes
Section titled “Read tubes”Simulate reading the tubes.
emulator.readTubes(machine);Reading banknote purse
Section titled “Reading banknote purse”Simulate reading the banknote purse.
emulator.readBillPurse(machine);Banknote accepted
Section titled “Banknote accepted”Simulate a banknote being accepted.
emulator.banknoteAccepted(machine);Banknote rejected
Section titled “Banknote rejected”Simulate a banknote being rejected.
emulator.banknoteRejected(machine);Banknotes dispensed
Section titled “Banknotes dispensed”Simulate banknotes being dispensed.
emulator.banknotesDispensed(machine);Coins dispensed
Section titled “Coins dispensed”Simulate coins being dispensed.
emulator.coinsDispensed(machine);Relay on
Section titled “Relay on”Simulate the relay being turned on.
emulator.relayOn(machine);Relay off
Section titled “Relay off”Simulate the relay being turned off.
emulator.relayOff(machine);Nayax enabled
Section titled “Nayax enabled”Simulate the Nayax being enabled.
emulator.nayaxEnabled(machine);Nayax disabled
Section titled “Nayax disabled”Simulate the Nayax being disabled.
emulator.nayaxDisabled(machine);Nayax pre-credit authorized
Section titled “Nayax pre-credit authorized”Simulate the Nayax pre-credit being authorized.
emulator.nayaxPreCreditAuthorized(machine);Nayax cancel request
Section titled “Nayax cancel request”Simulate the Nayax cancel request.
emulator.nayaxCancelRequest(machine);Nayax sell approved
Section titled “Nayax sell approved”Simulate the Nayax sell being approved.
emulator.nayaxSellApproved(machine);Nayax sell denied
Section titled “Nayax sell denied”Simulate the Nayax sell being denied.
emulator.nayaxSellDenied(machine);Nayax end session
Section titled “Nayax end session”Simulate the Nayax session ending.
emulator.nayaxEndSession(machine);Nayax cancelled
Section titled “Nayax cancelled”Simulate the Nayax being cancelled.
emulator.nayaxCancelled(machine);Nayax dispensed
Section titled “Nayax dispensed”Simulate the Nayax dispensing.
emulator.nayaxDispensed(machine);Nayax not dispensed
Section titled “Nayax not dispensed”Simulate the Nayax not dispensing.
emulator.nayaxNotDispensed(machine);Full tray
Section titled “Full tray”Simulate a full tray.
emulator.fullTray(machine);