Parking Garage Control System
ESP32 Parking Garage – ESP-IDF/FreeRTOS
Loading...
Searching...
No Matches
EntryGateController Class Reference

Entry gate controller with state machine. More...

#include <EntryGateController.h>

Public Member Functions

 EntryGateController (IEventBus &eventBus, IGpioInput &button, IGate &gate, ITicketService &ticketService, uint32_t barrierTimeoutMs=2000)
 Construct entry gate controller with injected dependencies.
 
 ~EntryGateController ()
 
 EntryGateController (const EntryGateController &)=delete
 
EntryGateController & operator= (const EntryGateController &)=delete
 
EntryGateState getState () const
 Get current state.
 
const char * getStateString () const
 Get state as string.
 
IGate & getGate ()
 Get gate reference (for debugging/console commands)
 
IGpioInput & getButton ()
 Get button reference (for debugging/console commands)
 
void setupGpioInterrupts ()
 Setup GPIO interrupts Call this after construction to enable hardware interrupts.
 
void reset ()
 Reset controller to initial state Stops timers, resets state to Idle, clears current ticket, closes barrier.
 

Detailed Description

Entry gate controller with state machine.

Handles entry sequence:

  1. Button press triggers capacity check
  2. Issue ticket if capacity available
  3. Open barrier via IGate interface
  4. Wait for car to pass through
  5. Close barrier via IGate interface

Uses pure Dependency Injection - all dependencies are injected via constructor.

Constructor & Destructor Documentation

◆ EntryGateController() [1/2]

EntryGateController::EntryGateController ( IEventBus &  eventBus,
IGpioInput &  button,
IGate &  gate,
ITicketService &  ticketService,
uint32_t  barrierTimeoutMs = 2000 
)

Construct entry gate controller with injected dependencies.

Parameters
eventBusEvent bus for publishing/subscribing
buttonEntry button input
gateGate abstraction (barrier + light barrier)
ticketServiceTicket service
barrierTimeoutMsBarrier open/close timeout in ms

◆ ~EntryGateController()

EntryGateController::~EntryGateController ( )

◆ EntryGateController() [2/2]

EntryGateController::EntryGateController ( const EntryGateController &  )
delete

Member Function Documentation

◆ getButton()

IGpioInput & EntryGateController::getButton ( )
inline

Get button reference (for debugging/console commands)

◆ getGate()

IGate & EntryGateController::getGate ( )
inline

Get gate reference (for debugging/console commands)

◆ getState()

EntryGateState EntryGateController::getState ( ) const
inline

Get current state.

◆ getStateString()

const char * EntryGateController::getStateString ( ) const

Get state as string.

◆ operator=()

EntryGateController & EntryGateController::operator= ( const EntryGateController &  )
delete

◆ reset()

void EntryGateController::reset ( )

Reset controller to initial state Stops timers, resets state to Idle, clears current ticket, closes barrier.

◆ setupGpioInterrupts()

void EntryGateController::setupGpioInterrupts ( )

Setup GPIO interrupts Call this after construction to enable hardware interrupts.


The documentation for this class was generated from the following files:
Coverage