Listeners
Here is the angular stone of Webserial, the listeners. With them, you can listen to the events that the device emits.
How to listen to an event
Section titled “How to listen to an event”When you create a new instance of the JSD class, you can listen to the events that the device emits.
machine.on("serial:message", (data) => { console.log(data);});Each event has a different data structure, so you need to check the data structure for each event.

Get all available listeners
Section titled “Get all available listeners”For JSD class there events that you can listen to, of course only listen to the events that you need.
Object
Section titled “Object”To get all the available listeners, you can use the availableListeners property.
console.log(machine.availableListeners);The result will be an object with the available listeners, and if you are listen each event
[ { "type": "debug", "listening": false }, { "type": "licensing:feature-status", "listening": false }, { "type": "licensing:identification", "listening": false }, { "type": "licensing:report", "listening": false }, { "type": "licensing:seed", "listening": true }, { "type": "licensing:temporary-license-status", "listening": false }, { "type": "licensing:wrong-cmd", "listening": false }, { "type": "manifest:block", "listening": false }, { "type": "manifest:completed", "listening": false }, { "type": "manifest:log", "listening": false }, { "type": "manifest:wrong-cmd", "listening": false }, { "type": "mdbCardHolder:authorization", "listening": false }, { "type": "mdbCardHolder:balance-statement", "listening": false }, { "type": "mdbCardHolder:condition-status", "listening": false }, { "type": "mdbCardHolder:configuration-data", "listening": false }, { "type": "mdbCardHolder:display-message", "listening": false }, { "type": "mdbCardHolder:end-session", "listening": false }, { "type": "mdbCardHolder:feature-configuration", "listening": false }, { "type": "mdbCardHolder:identification", "listening": false }, { "type": "mdbCardHolder:jsd-license-error", "listening": false }, { "type": "mdbCardHolder:revalue", "listening": false }, { "type": "mdbCardHolder:sale-approval", "listening": false }, { "type": "mdbCardHolder:sale-cancellation", "listening": false }, { "type": "mdbCardHolder:sale-failure-confirmation", "listening": false }, { "type": "mdbCardHolder:sale-success-confirmation", "listening": false }, { "type": "mdbCardHolder:selection-request", "listening": false }, { "type": "mdbCardHolder:wrong-cmd", "listening": false }, { "type": "serial:connected", "listening": true }, { "type": "serial:connecting", "listening": false }, { "type": "serial:corrupt-message", "listening": false }, { "type": "serial:disconnected", "listening": false }, { "type": "serial:error", "listening": false }, { "type": "serial:jsd-ack", "listening": false }, { "type": "serial:jsd-data", "listening": false }, { "type": "serial:jsd-error", "listening": false }, { "type": "serial:jsd-nack", "listening": false }, { "type": "serial:lost", "listening": false }, { "type": "serial:message", "listening": true }, { "type": "serial:need-permission", "listening": false }, { "type": "serial:reconnect", "listening": false }, { "type": "serial:sent", "listening": false }, { "type": "serial:soft-reload", "listening": false }, { "type": "serial:timeout", "listening": false }, { "type": "serial:unsupported", "listening": false }, { "type": "unknown", "listening": false }, { "type": "vision:active-faults", "listening": false }, { "type": "vision:active-faults-list", "listening": false }, { "type": "vision:alarm-faults-events", "listening": false }, { "type": "vision:channel-status", "listening": false }, { "type": "vision:channels", "listening": false }, { "type": "vision:channels-linked-to-selection", "listening": false }, { "type": "vision:channels-progress", "listening": false }, { "type": "vision:collect", "listening": false }, { "type": "vision:connection", "listening": false }, { "type": "vision:current-temperature", "listening": false }, { "type": "vision:dispense-status", "listening": false }, { "type": "vision:door", "listening": false }, { "type": "vision:extended-dispense-status-data", "listening": false }, { "type": "vision:jsd-dispensing-queue", "listening": false }, { "type": "vision:jsd-license-error", "listening": false }, { "type": "vision:jsd-status-reset", "listening": false }, { "type": "vision:jsd-version", "listening": false }, { "type": "vision:machine-id", "listening": false }, { "type": "vision:machine-status", "listening": false }, { "type": "vision:perishable-products-config", "listening": false }, { "type": "vision:reset-sold-out-channels", "listening": false }, { "type": "vision:selection-dispense-config", "listening": false }, { "type": "vision:special-characteristics-selection", "listening": false }, { "type": "vision:status-selection", "listening": false }, { "type": "vision:time-waiting-after-product-collection", "listening": false }, { "type": "vision:time-waiting-for-product-collection", "listening": false }, { "type": "vision:trays-positioning-phototransistors-status", "listening": false }, { "type": "vision:waiting-collection", "listening": false }, { "type": "vision:wrong-cmd", "listening": false }]But sometimes you don’t want the object you want only an array with the available listeners, you can do this:
machine.availableListeners.map((el) => el.type);And one more time here is the result
[ "debug", "licensing:feature-status", "licensing:identification", "licensing:report", "licensing:seed", "licensing:temporary-license-status", "licensing:wrong-cmd", "manifest:block", "manifest:completed", "manifest:log", "manifest:wrong-cmd", "mdbCardHolder:authorization", "mdbCardHolder:balance-statement", "mdbCardHolder:condition-status", "mdbCardHolder:configuration-data", "mdbCardHolder:display-message", "mdbCardHolder:end-session", "mdbCardHolder:feature-configuration", "mdbCardHolder:identification", "mdbCardHolder:jsd-license-error", "mdbCardHolder:revalue", "mdbCardHolder:sale-approval", "mdbCardHolder:sale-cancellation", "mdbCardHolder:sale-failure-confirmation", "mdbCardHolder:sale-success-confirmation", "mdbCardHolder:selection-request", "mdbCardHolder:wrong-cmd", "serial:connected", "serial:connecting", "serial:corrupt-message", "serial:disconnected", "serial:error", "serial:jsd-ack", "serial:jsd-data", "serial:jsd-error", "serial:jsd-nack", "serial:lost", "serial:message", "serial:need-permission", "serial:reconnect", "serial:sent", "serial:soft-reload", "serial:timeout", "serial:unsupported", "unknown", "vision:active-faults", "vision:active-faults-list", "vision:alarm-faults-events", "vision:channel-status", "vision:channels", "vision:channels-linked-to-selection", "vision:channels-progress", "vision:collect", "vision:connection", "vision:current-temperature", "vision:dispense-status", "vision:door", "vision:extended-dispense-status-data", "vision:jsd-dispensing-queue", "vision:jsd-license-error", "vision:jsd-status-reset", "vision:jsd-version", "vision:machine-id", "vision:machine-status", "vision:perishable-products-config", "vision:reset-sold-out-channels", "vision:selection-dispense-config", "vision:special-characteristics-selection", "vision:status-selection", "vision:time-waiting-after-product-collection", "vision:time-waiting-for-product-collection", "vision:trays-positioning-phototransistors-status", "vision:waiting-collection", "vision:wrong-cmd"]Warning
Don’t use this event in production, only for debug. The amount of data can be huge and slow down the application.
If you want to know all events dispatched, you need to enable the debug mode.
machine.__debug__ = true; // enable debug modeSo then you can listen to the debug event.
machine.on("debug", (event) => { // event.detail = { // type: 'event', // data: 'data of event' // } console.log(event.detail);});Serial connected
Section titled “Serial connected”When the serial is connected, this event is dispatched.
machine.on("serial:connected", (event) => { console.log(event.detail);});Serial connecting
Section titled “Serial connecting”When the serial is trying to connect, this event is dispatched.
machine.on("serial:connecting", (event) => { if (event.detail.active) { console.log("Connecting to serial..."); } else { console.log("Connecting finished."); }});Serial disconnected
Section titled “Serial disconnected”When the serial is disconnected, this event is dispatched.
machine.on("serial:disconnected", (event) => { console.log(event.detail);});Serial error
Section titled “Serial error”When the serial has an error, this event is dispatched.
machine.on("serial:error", (event) => { console.log(event.detail);});Serial lost
Section titled “Serial lost”When the serial is lost, this event is dispatched.
machine.on("serial:lost", (event) => { console.log(event.detail);});Serial message
Section titled “Serial message”When the serial receives a message, this event is dispatched.
machine.on("serial:message", (event) => { console.log(event.detail);});Serial need permission
Section titled “Serial need permission”When the serial needs permission, this event is dispatched. This occurs because user interaction is needed to request the serial.
Recommendation: Use a button or a screen to show what is happening.
machine.on("serial:need-permission", (event) => { console.log(event.detail);});Serial reconnect
Section titled “Serial reconnect”When the serial is trying to reconnect, this event is dispatched.
machine.on("serial:reconnect", (event) => { // without data});Serial sent
Section titled “Serial sent”When the serial sends a message to machine, this event is dispatched.
machine.on("serial:sent", (event) => { console.log(event.detail);});{ "event": "string", "bytes": []}Serial soft reload
Section titled “Serial soft reload”When the serial is trying to soft reload, this event is dispatched.
machine.on("serial:soft-reload", (event) => { // without data});Serial timeout
Section titled “Serial timeout”When the serial has a timeout, this event is dispatched.
machine.on("serial:timeout", (event) => { console.log(event.detail);});Serial unsupported
Section titled “Serial unsupported”When the serial is unsupported, this event is dispatched.
machine.on("serial:unsupported", (event) => { console.log(event.detail);});Licensing section
Section titled “Licensing section”Wrong command
Section titled “Wrong command”When receives a wrong command, this event is dispatched.
machine.on("licensing:wrong-cmd", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "opcodeName": "string", "opcode": 0, "params": ["string"]}Feature status
Section titled “Feature status”When request feature status, this event is dispatched.
machine.on("licensing:feature-status", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "feature": "string", "active": true}Identification
Section titled “Identification”When request identification of JSD
machine.on('licensing:identification', (event) => { console.log(event.detail)});Structure of event detail
Section titled “Structure of event detail”{ "idJSuite": "string", "uid": "string",}Report
Section titled “Report”When success/fail upload license of JSD this message is emitted
machine.on('licensing:report', (event) => { console.log(event.detail)});Structure of event detail
Section titled “Structure of event detail”{ "isSuccess": true, "status": "string", "reason": "string",}When request seed, this event is dispatched.
machine.on("licensing:seed", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "seed": "string", "hex": "string"}Temporary license status
Section titled “Temporary license status”When request temporary license status, this event is dispatched.
machine.on("licensing:temporary-license-status", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "status": "string", "remainingDays": 0, "daysSinceExpiration": 0, "isPermanent": true, "active": true, "expired": false,}JSD section
Section titled “JSD section”JSD error
Section titled “JSD error”When receives a JSD error, this event is dispatched.
machine.on("serial:jsd-error", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "parsed": "string"}JSD ACK, NACK and DATA
Section titled “JSD ACK, NACK and DATA”When receives a JSD ACK, NACK or DATA, this event is dispatched.
machine.on("serial:jsd-ack", (event) => { console.log(event.detail);});
machine.on("serial:jsd-nack", (event) => { console.log(event.detail);});
machine.on("serial:jsd-data", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ type: 'ACK' | 'NACK' | 'DATA'; id: number; opcode?: number; appId?: number; noBytes?: number; params?: string[]; rawAscii?: string;}Manifest section
Section titled “Manifest section”Wrong command
Section titled “Wrong command”When receives a wrong command, this event is dispatched.
machine.on("manifest:wrong-cmd", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "opcodeName": "string", "opcode": 0, "params": ["string"]}When receives a log, this event is dispatched.
machine.on("manifest:log", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "type": "log" | "end", "log": ["string"]}When receives a block, this event is dispatched.
machine.on("manifest:block", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "blockId": 0, "indexFile": 0, "quantity": 0}Completed
Section titled “Completed”When receives a completed, this event is dispatched.
machine.on("manifest:completed", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "result": "string", "resultKey": 0}Vision section
Section titled “Vision section”Wrong command
Section titled “Wrong command”When receives a wrong command, this event is dispatched.
machine.on("vision:wrong-cmd", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "opcodeName": "string", "opcode": 0, "params": ["string"]}Machine status
Section titled “Machine status”When receives a machine status, this event is dispatched.
machine.on("vision:machine-status", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "machine": 1, "status": "string", "machineInService": true, "doorOpen": true, "availabilityToDispense": 0, "hasLightsOn": true, "temperature": "string"}Door event
Section titled “Door event”When receives a door event, this event is dispatched.
machine.on("vision:door", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "machine": 1, "open": true}Machine connection
Section titled “Machine connection”When receives a machine event related to connection, this event is dispatched.
machine.on("vision:connection", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "machine": 1, "connected": true,}Waiting collection
Section titled “Waiting collection”When receives a waiting collection, this event is dispatched.
machine.on("vision:waiting-collection", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "machine": 1, // or null if something went wrong}Channels progress
Section titled “Channels progress”When receives a channels progress, this event is dispatched.
machine.on("vision:channels-progress", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "progress": 0, "current": 0, "verified": 0}Channels
Section titled “Channels”When receives a channels, this event is dispatched.
machine.on("vision:channels", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ [ { "selection": 0, "active": true, "machine": 1 // 1|2|3|4 } ] /// ...[...]}Channel status
Section titled “Channel status”When receives a channel status, this event is dispatched.
machine.on("vision:channel-status", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "machine": 1, // 1|2|3|4 "selection": 0, "active": true}Status selection
Section titled “Status selection”When receives a status selection, this event is dispatched.
machine.on("vision:status-selection", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "selection": 0, "status": "string"}Dispense status
Section titled “Dispense status”When receives a dispense status, this event is dispatched.
machine.on("vision:dispense-status", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "token": "string", "status": "string", "machine": 1, // 1|2|3|4 "tray": 0, "channel": 0, "extendedStatus": "string"}Selection dispense config
Section titled “Selection dispense config”When receives a selection dispense config, this event is dispatched.
machine.on("vision:selection-dispense-config", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "selection": 0, "speed": 0, "timePostRun": 1}Channels linked to selection
Section titled “Channels linked to selection”When receives a channels linked to selection, this event is dispatched.
machine.on("vision:channels-linked-to-selection", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "selection": 0, "linkedChannels": [ { "machine": 1, // 1|2|3|4 "tray": 0, "channel": 0 } ], "status": "string"}Machine ID
Section titled “Machine ID”When receives a machine ID, this event is dispatched.
machine.on("vision:machine-id", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "machine": 1, // 1|2|3|4 "model": "string", "serialNumber": "string", "firmwareVersion": "string"}Current temperature
Section titled “Current temperature”When receives a current temperature, this event is dispatched.
machine.on("vision:current-temperature", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "machine": 1, // 1|2|3|4 "workingTemperature": "string", "currentTemperatureInsideMachine": "string", "currentTemperatureAir": "string", "coolUnitStatus": "ON" | "OFF"}Alarm faults events
Section titled “Alarm faults events”When receives a alarm faults events, this event is dispatched.
machine.on("vision:alarm-faults-events", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "machine": 1, // 1|2|3|4 "event": "string", "status": "ACTIVE" | "CLEARED"}Time waiting for product collection
Section titled “Time waiting for product collection”When receives a time waiting for product collection, this event is dispatched.
machine.on("vision:time-waiting-for-product-collection", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "minutesProductCollection": 0, "secondsTimeBetweenDispenseManoeuvres": 0, "secondsBetweenCollectAndStartNextDispense": 0}Collect
Section titled “Collect”When receives a collect, this event is dispatched.
machine.on("vision:collect", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "machine": 1, // 1|2|3|4 "status": "string"}Reset sold out channels
Section titled “Reset sold out channels”When receives a reset sold out channels, this event is dispatched.
machine.on("vision:reset-sold-out-channels", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "machine": 1, // 1|2|3|4 "status": "string"}Time waiting after product collection
Section titled “Time waiting after product collection”When receives a time waiting after product collection, this event is dispatched.
machine.on("vision:time-waiting-after-product-collection", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "secondsBetweenCollectAndStartNextDispense": 0}JSD version
Section titled “JSD version”When receives a JSD version, this event is dispatched.
machine.on("vision:jsd-version", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "name": "string", "compileNumber": "string", "compileDate": "string", "description": "string"}Active faults
Section titled “Active faults”When receives a active faults, this event is dispatched.
machine.on("vision:active-faults", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "machine": 1, // 1|2|3|4 "status": "string", "fault": 0, "appearancesNumber": 0, "partialNumberActivated": 0, "minutesActive": 0, "date": "string"}JSD dispensing queue
Section titled “JSD dispensing queue”When receives a JSD dispensing queue, this event is dispatched.
machine.on("vision:jsd-dispensing-queue", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "free": 0, "processed": 0, "notProcessed": 0}Special characteristics selection
Section titled “Special characteristics selection”When receives a special characteristics selection, this event is dispatched.
machine.on("vision:special-characteristics-selection", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "selection": 0, "perishable": true, "fragileOrHeavy": true, "typeAdjustElevator": "lower" | "upper", "timeAdjustElevator": 0}Perishable products config
Section titled “Perishable products config”When receives a perishable products config, this event is dispatched.
machine.on("vision:perishable-products-config", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "machine": 1, // 1|2|3|4 "perishableActive": true, "alarmPerisableTriggered": true, "maxTemperature": "string", "minutesBeforeExpire": 0}Active faults list
Section titled “Active faults list”When receives a active faults list, this event is dispatched.
machine.on("vision:active-faults-list", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "machine": 1, // 1|2|3|4 "faults": [ { "code": 0, "description": "string" } ], "ok": true}JSD status reset
Section titled “JSD status reset”When receives a JSD status reset, this event is dispatched.
machine.on("vision:jsd-status-reset", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "type": "string"}Extended dispense status data
Section titled “Extended dispense status data”When receives a extended dispense status data, this event is dispatched.
machine.on("vision:extended-dispense-status-data", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "enabled": true}Trays positioning phototransistors status
Section titled “Trays positioning phototransistors status”When receives a trays positioning phototransistors status, this event is dispatched.
machine.on("vision:trays-positioning-phototransistors-status", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "machine": 1, // 1|2|3|4 "trays": { "0": "string", "1": "string", "2": "string", "3": "string" }}JSD license error
Section titled “JSD license error”When receives a JSD license error, this event is dispatched.
machine.on("vision:jsd-license-error", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "type": "unknown" | "expired-license" | "app-number-not-licensed" | "price-control-active-direct-dispense-not-allowed", "opcode": 0, "actionName": "string", "params": ["string"]}MDB Card Holder Section
Section titled “MDB Card Holder Section”Authorization
Section titled “Authorization”When receives card holder authorization.
machine.on("mdbCardHolder:authorization", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "deviceNumber": "1|2|3|4", "success": "boolean", "reason": "string|null",}Balance Statement
Section titled “Balance Statement”When request balance statement of card holder.
machine.on("mdbCardHolder:balance-statement", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "deviceNumber": "1|2|3|4", "tokenBalanceStatus": "idle|active", "customerBalance": "number", "maxCardRecharge": "number", "paymentMethod": { "isKnown": "boolean", "id": "string|null" }, "groupWhichCardBelongs": "string"}Condition Status
Section titled “Condition Status”Card holder condition status.
machine.on("mdbCardHolder:condition-status", (event) => { console.log(event.detail);});Structure of event detail
Section titled “Structure of event detail”{ "deviceNumber": "1|2|3|4", "connectionStatus": "disconnected|connected|loss of communication", "cardHolderStatus": "inactive|disabled|enabled|on hold|selling|reevaluate",}Configuration Data
Section titled “Configuration Data”response of configuration data requestConfiguration
machine.on("mdbCardHolder:configuration-data", (event) => { console.log(event.detail);})Structure of event detail
Section titled “Structure of event detail”{ "deviceNumber": "1|2|3|4", "countryCurrencyCode": "string", "canReloadFunds": "boolean", "canRestoreFunds": "boolean", "canMakeMultipleSales": "boolean", "hasDisplay": "boolean", "canRecorCashSales": "boolean",}Display message
Section titled “Display message”Current message in display
machine.on("mdbCardHolder:display-message", (event) => { console.log(event.detail);})Structure of event detail
Section titled “Structure of event detail”{ "deviceNumber": "1|2|3|4", "displayTimeSeconds": "number", "message": { "line1": "string", "line2": "string", };}End Session
Section titled “End Session”Response to Request to end session of the MDB Card Holder device
machine.on("mdbCardHolder:end-session", (event) => { console.log(event.detail);})Structure of event detail
Section titled “Structure of event detail”{ "deviceNumber": "1|2|3|4", "status": "unable to execute | petition initiated", "currentCardHolderStatus": "'inactive' | 'disabled' | 'enabled' | 'on hold' | 'selling' | 'reevaluate' | null",}Feature configuration
Section titled “Feature configuration”Response to request functionalities configuration
machine.on("mdbCardHolder:feature-configuration", (event) => { console.log(event.detail);})Structure of event detail
Section titled “Structure of event detail”{ "deviceNumber": "1|2|3|4", "alwaysIdle": { "available": "boolean", "enabled": "boolean", }, "remoteVend": { "available": "boolean", "enabled": "boolean", },}Identification
Section titled “Identification”Response to request for identification of the MDB Card Holder device.
machine.on("mdbCardHolder:identification", (event) => { console.log(event.detail);})Structure of event detail
Section titled “Structure of event detail”{ "deviceNumber": "1|2|3|4", "manufacturerCode": "string", "serialNumber": "string", "model": "string", "softwareVersion": "string",}JSD license error
Section titled “JSD license error”When receives a JSD license error, this event is dispatched.
machine.on("mdbCardHolder:jsd-license-error", (event) => { console.log(event.detail);})Structure of event detail
Section titled “Structure of event detail”{ "type": "unknown" | "expired-license" | "app-number-not-licensed" | "price-control-active-direct-dispense-not-allowed", "opcode": "number", "actionName": "string", "params": ["string"]}Revalue
Section titled “Revalue”Response to Request for revalue of the MDB Card Holder device
machine.on("mdbCardHolder:revalue", (event) => { console.log(event.detail);})Structure of event detail
Section titled “Structure of event detail”{ "deviceNumber": "1|2|3|4", "status": "'revalue denied' | 'revalue approved' | 'unable to execute' | 'petition initiated'", "currentCardHolderStatus": "undefined | null | 'inactive' | 'disabled' | 'enabled' | 'on hold' | 'selling' | 'reevaluate'",}Sale approval
Section titled “Sale approval”Response to request for sale approval of the MDB Card Holder device.
machine.on("mdbCardHolder:sale-approval", (event) => { console.log(event.detail);})Structure of event detail
Section titled “Structure of event detail”{ "deviceNumber": "1|2|3|4", "status": "'sale denied' | 'sale approved' | 'unable to execute' | 'petition initiated'", "currentCardHolderStatus": "undefined | null | 'inactive' | 'disabled' | 'enabled' | 'on hold' | 'selling' | 'reevaluate'", "amountCharged": "undefined | number",}Sale Cancellation
Section titled “Sale Cancellation”Response to request for sale cancellation of the MDB Card Holder device.
machine.on("mdbCardHolder:sale-cancellation", (event) => { console.log(event.detail);})Structure of event detail
Section titled “Structure of event detail”{ "deviceNumber": "1|2|3|4", "status": "success | failure", "currentCardHolderStatus": "undefined | null | 'inactive' | 'disabled' | 'enabled' | 'on hold' | 'selling' | 'reevaluate'",}Sale Failure Confirmation
Section titled “Sale Failure Confirmation”Response to Request for sale failure confirmation of the MDB Card Holder device.
machine.on("mdbCardHolder:sale-failure-confirmation", (event) => { console.log(event.detail);})Structure of event detail
Section titled “Structure of event detail”{ "deviceNumber": "1|2|3|4", "status": "'refund error' | 'refund made' | 'unable to execute' | 'petition initiated'", "currentCardHolderStatus": "undefined | null | 'inactive' | 'disabled' | 'enabled' | 'on hold' | 'selling' | 'reevaluate'",}Sale Success Confirmation
Section titled “Sale Success Confirmation”Response to Request for sale success confirmation of the MDB Card Holder device.
machine.on("mdbCardHolder:sale-success-confirmation", (event) => { console.log(event.detail);})Structure of event detail
Section titled “Structure of event detail”{ "deviceNumber": "1|2|3|4", "status": "'the card has been updated' | 'unable to execute' | 'petition initiated'", "currentCardHolderStatus": "undefined | null | 'inactive' | 'disabled' | 'enabled' | 'on hold' | 'selling' | 'reevaluate'",}Selection request
Section titled “Selection request”Response to selection dispense or requestSelectionRequestDenied
machine.on("mdbCardHolder:selection-request", (event) => { console.log(event.detail);})Structure of event detail
Section titled “Structure of event detail”{ "deviceNumber": "1|2|3|4", "tokenBalanceStatus": "'idle' | 'active'", "customerBalance": "number", "paymentMethod": { "isKnown": "boolean", "id": "string | null", }, "product": { "id": "number | null", "withLid": "boolean", "sugarLevel": "'default' | 'sugar-free' | 'intermediate' | 'sugar-max'", }}Wrong command
Section titled “Wrong command”When receives a wrong command, this event is dispatched.
machine.on("mdbCardHolder:wrong-cmd", (event) => { console.log(event.detail);})Structure of event detail
Section titled “Structure of event detail”{ "opcodeName": "string", "opcode": "number", "params": ["string"]}Unknown
Section titled “Unknown”This event is dispatched?.
machine.on("unknown", (event) => { console.log(event.detail);});Corrupt message
Section titled “Corrupt message”This event is dispatched when the machine receives a corrupt message.
machine.on("corrupt:message", (event) => { console.log(event.detail);});