OrderButtonPoller (ElevatorProject v0.1.0)
Used to monitor the state of one order button, and signals
OrderAssigner
if the button is pressed. One poller is started
for each button in OrderButtonPoller.Supervisor
.
Uses the following modules:
- Driver
- Order
- OrderAssigner
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Retrieves the state of an order button. Uses OrderAssigner.assign_order/1
to signals assignment of the order if the button is pressed.
Link to this section Functions
child_spec(arg)
Returns a specification to start this module under a supervisor.
arg
is passed as the argument to Task.start_link/1
in the :start
field
of the spec.
For more information, see the Supervisor
module,
the Supervisor.child_spec/2
function and the Supervisor.child_spec/0
type.
poller(floor, button_type, prev_state)
Retrieves the state of an order button. Uses OrderAssigner.assign_order/1
to signals assignment of the order if the button is pressed.
Parameters
- floor: Floor of the order button :: integer()
- button_type: Button type of the order button. Can be :cab, :hall_up or :hall_down :: atom()
- prev_state: State of the order button. Can be 0 or 1 :: boolean()
Return
- no_return