Emulation
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.
In every method used is recommended send the instance of the class that is using the emulator.
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();
API
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.
Only if the instance is the same for all methods that you are going to use.
emulator.setConnection(machine);
Status
Simulate the status of the vending machine.
Emulator.status(machine)
Dispensed
Simulate the dispensing of a product.
Emulator.dispensed(machine)
Not Dispensed
Simulate the product not being dispensed.
Emulator.notDispensed(machine)
Gate inactive
Simulate the gate being inactive.
Only works with Locker
Emulator.gateInactive(machine)
Gate configured
Simulate the gate being configured.
Only works with Locker
Emulator.gateConfigured(machine)
Keyboard pressed
Simulate a key being pressed on the vending machine.
Only works with Jofemar
Emulator.keyboardPressed(machine)
Door opened
Simulate the door being opened.
Only works with Jofemar
and Boardroid
emulator.doorOpened(machine);
Door closed
Simulate the door being closed.
Only works with Jofemar
and Boardroid
emulator.doorClosed(machine);
Channel disconnected
Simulate a channel disconnected.
Only works with Jofemar
emulator.channelDisconnected(machine);
Channel connected
Simulate a channel connected.
Only works with Jofemar
emulator.channelConnected(machine);
Channel empty
Simulate a channel being empty.
Only works with Jofemar
emulator.channelEmpty(machine);
Working temperature
Simulate the working temperature of the vending machine.
Only works with Jofemar
emulator.workingTemperature(machine);
Current temperature
Simulate the current temperature of the vending machine.
Only works with Jofemar
and Boardroid
emulator.currentTemperature(machine);
Ready
Simulate the Machine is ready
Only works with Jofemar
emulator.ready(machine);
Busy
Simulate the Machine is busy
Only works with Jofemar
emulator.busy(machine);
Invalid tray
Simulate an invalid tray.
Only works with Jofemar
emulator.invalidTray(machine);
Invalid channel
Simulate an invalid channel.
Only works with Jofemar
emulator.invalidChannel(machine);
Empty channel
Simulate an empty channel.
Only works with Jofemar
emulator.emptyChannel(machine);
Elevator jam
Simulate an elevator jam.
Only works with Jofemar
emulator.elevatorJam(machine);
Elevator malfunction
Simulate an elevator malfunction.
Only works with Jofemar
emulator.elevatorMalfunction(machine);
Photo transistor failure
Simulate a photo transistor failure.
Only works with Jofemar
emulator.phototransistorFailure(machine);
All channels empty
Simulate all channels being empty.
Only works with Jofemar
emulator.allChannelsEmpty(machine);
Product detector failure
Simulate a product detector failure.
Only works with Jofemar
emulator.productDetectorFailure(machine);
Display disconnected
Simulate the display is disconnected.
Only works with Jofemar
emulator.displayDisconnected(machine);
Product under elevator
Simulate a product being under the elevator.
Only works with Jofemar
emulator.productUnderElevator(machine);
Elevator setting alarm
Simulate the elevator setting an alarm.
Only works with Jofemar
emulator.elevatorSettingAlarm(machine);
Button panel failure
Simulate a button panel failure.
Only works with Jofemar
emulator.buttonPanelFailure(machine);
Error Writing EEPROM
Simulate an error writing to the EEPROM.
Only works with Jofemar
emulator.errorWritingEeprom(machine);
Error in control temperature
Simulate an error in the control temperature.
Only works with Jofemar
emulator.errorControlTemperature(machine);
Thermometer disconnected
Simulate the thermometer being disconnected.
Only works with Jofemar
emulator.thermometerDisconnected(machine);
Thermometer misconfigured
Simulate the thermometer being misconfigured.
Only works with Jofemar
emulator.thermometerMisconfigured(machine);
Thermometer failure
Simulate the thermometer failing.
Only works with Jofemar
emulator.thermometerFailure(machine);
Error extractor consumption
Simulate an error in the extractor consumption.
Only works with Jofemar
emulator.errorExtractorConsumption(machine);
Channel search error
Simulate a channel search error.
Only works with Jofemar
emulator.channelSearchError(machine);
Product exit mouth search error
Simulate a product exit mouth search error.
Only works with Jofemar
emulator.productExitMouthSearchError(machine);
Interior elevator blocked
Simulate the interior elevator being blocked.
Only works with Jofemar
emulator.elevatorInteriorLocked(machine);
Product detector verifier error
Simulate a product detector verifier error.
Only works with Jofemar
emulator.productDetectorVerifierError(machine);
Waiting for product recall
Simulate waiting for a product recall.
Only works with Jofemar
emulator.waitingForProductRecall(machine);
Product expired by temperature
Simulate a product expiring due to temperature.
Only works with Jofemar
emulator.productExpiredByTemperature(machine);
Faulty automatic door
Simulate a faulty automatic door.
Only works with Jofemar
emulator.faultyAutomaticDoor(machine);
Reject lever
Simulate the reject lever was pressed.
Only works with Boardroid
emulator.rejectLever(machine);
Reset coin purse
Simulate the coin purse being reset.
Only works with Boardroid
emulator.resetCoinPurse(machine);
Coin inserted box
Simulate a coin being inserted into the box.
Only works with Boardroid
emulator.coinInsertedBox(machine);
Coin inserted tube
Simulate a coin being inserted into the tube.
Only works with Boardroid
emulator.coinInsertedTube(machine);
Banknote inserted stacker
Simulate a banknote being inserted into the stacker.
Only works with Boardroid
emulator.banknoteInsertedStacker(machine);
Banknote inserted escrow
Simulate a banknote being inserted into the escrow.
Only works with Boardroid
emulator.banknoteInsertedEscrow(machine);
Banknote ejected
Simulate a banknote being ejected.
Only works with Boardroid
emulator.banknoteEjected(machine);
Banknote inserted recycler
Simulate a banknote being inserted into the recycler.
Only works with Boardroid
emulator.banknoteInsertedRecycler(machine);
Banknote taken
Simulate a banknote being taken.
Only works with Boardroid
emulator.banknoteTaken(machine);
Coin purse enabled
Simulate the coin purse being enabled.
Only works with Boardroid
emulator.coinPurseEnabled(machine);
Coin purse disabled
Simulate the coin purse being disabled.
Only works with Boardroid
emulator.coinPurseDisabled(machine);
Banknote purse disabled
Simulate the banknote purse being disabled.
Only works with Boardroid
emulator.billPurseDisabled(machine);
banknote purse enabled
Simulate the banknote purse being enabled.
Only works with Boardroid
emulator.billPurseEnabled(machine);
Read tubes
Simulate reading the tubes.
Only works with Boardroid
emulator.readTubes(machine);
Reading banknote purse
Simulate reading the banknote purse.
Only works with Boardroid
emulator.readBillPurse(machine);
Banknote accepted
Simulate a banknote being accepted.
Only works with Boardroid
emulator.banknoteAccepted(machine);
Banknote rejected
Simulate a banknote being rejected.
Only works with Boardroid
emulator.banknoteRejected(machine);
Banknotes dispensed
Simulate banknotes being dispensed.
Only works with Boardroid
emulator.banknotesDispensed(machine);
Coins dispensed
Simulate coins being dispensed.
Only works with Boardroid
emulator.coinsDispensed(machine);
Relay on
Simulate the relay being turned on.
Only works with Boardroid
emulator.relayOn(machine);
Relay off
Simulate the relay being turned off.
Only works with Boardroid
emulator.relayOff(machine);
Nayax enabled
Simulate the Nayax being enabled.
Only works with Boardroid
emulator.nayaxEnabled(machine);
Nayax disabled
Simulate the Nayax being disabled.
Only works with Boardroid
emulator.nayaxDisabled(machine);
Nayax pre-credit authorized
Simulate the Nayax pre-credit being authorized.
Only works with Boardroid
emulator.nayaxPreCreditAuthorized(machine);
Nayax cancel request
Simulate the Nayax cancel request.
Only works with Boardroid
emulator.nayaxCancelRequest(machine);
Nayax sell approved
Simulate the Nayax sell being approved.
Only works with Boardroid
emulator.nayaxSellApproved(machine);
Nayax sell denied
Simulate the Nayax sell being denied.
Only works with Boardroid
emulator.nayaxSellDenied(machine);
Nayax end session
Simulate the Nayax session ending.
Only works with Boardroid
emulator.nayaxEndSession(machine);
Nayax cancelled
Simulate the Nayax being cancelled.
Only works with Boardroid
emulator.nayaxCancelled(machine);
Nayax dispensed
Simulate the Nayax dispensing.
Only works with Boardroid
emulator.nayaxDispensed(machine);
Nayax not dispensed
Simulate the Nayax not dispensing.
Only works with Boardroid
emulator.nayaxNotDispensed(machine);
Full tray
Simulate a full tray.
Only works with Jofemar
emulator.fullTray(machine);