dispenseindex/home/perette/Projects/Skeezball/TestUtilities/dispense.py

Dispense tickets via our customized controller, which mediates dispensing for the DL-1275.

Modules

sys time

Classes

builtins.object
Dispenser
FakeDispenser

class Dispenser(builtins.object)

Dispenser(control_pin: int, ready_pin: int)

This class dispenses tickets and manages the state of the the DL-1275 ticket dispenser. Dispensing functions blocks until dispensing is complete, but dispensing is rapid and the caller is informed whether dispensing was successful.

Methods defined here:
__del__(self)
__init__(self, control_pin: int, ready_pin: int)

Create a ticket dispenser connected to a DL-1275 via the Devious Fish dispenser controller.
control_pin: The GPIO output pin # to which !DISPENSE is connected.
ready_pin: The GPIO input pin # to which READY is connected.

dispense(self, count: int) -> int

Dispense tickets.
count: The number of tickets to dispense.
Return value: Number of tickets actually dispensed.

empty(self) -> bool

Check if the dispenser was empty at last use.

jammed(self) -> bool

Check if the dispenser was jammed at last use.

ready(self) -> bool

Query the dispenser controller's READY pin.
Return value: True if the dispenser sees a notch.

start(self) -> None

Send a start pulse to the dispenser controller. The pulse is long enough to ensure the dispenser gets past the inter-ticket notch. Afterward, return to floating so we don't bias the circuit, so it can turn itself off.

stop(self) -> None

Send a stop pulse to the dispenser controller, then return the output to floating.


Static methods defined here:
fromConfig(config: dict[str, int] | None)

Create a ticket dispenser instance from config information. If config info is None, returns a fake ticket dispenser instance that will pretend it is dispensing successfully.

For a real dispenser, the config dictionary requires:
dispense: The !DISPENSE GPIO channel number
ready: The READY GPIO channel number


Data descriptors defined here:
__dict__

dictionary for instance variables (if defined)

__weakref__

list of weak references to the object (if defined)

class FakeDispenser(Dispenser)

A pretend ticket dispenser, for systems without one. Acts like it's dispensing.

Method resolution order:
FakeDispenser
Dispenser
builtins.object

Methods defined here:
__init__(self)

Create a ticket dispenser connected to a DL-1275 via the Devious Fish dispenser controller.
control_pin: The GPIO output pin # to which !DISPENSE is connected.
ready_pin: The GPIO input pin # to which READY is connected.

dispense(self, count: int) -> int

Simulates a dispensing delay, then returns success.

empty(self) -> bool

The fake dispenser is never empty.

jammed(self) -> bool

The fake dispenser never jams.

ready(self) -> bool

The fake dispenser is always ready.

start(self) -> None

A no-op for the fake dispenser.

stop(self) -> None

A no-op for the fake dispenser.


Methods inherited from Dispenser:
__del__(self)

Static methods inherited from Dispenser:
fromConfig(config: dict[str, int] | None)

Create a ticket dispenser instance from config information. If config info is None, returns a fake ticket dispenser instance that will pretend it is dispensing successfully.

For a real dispenser, the config dictionary requires:
dispense: The !DISPENSE GPIO channel number
ready: The READY GPIO channel number


Data descriptors inherited from Dispenser:
__dict__

dictionary for instance variables (if defined)

__weakref__

list of weak references to the object (if defined)

Data

__annotations__ = {}