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

Exit gate controller with state machine. More...

#include <ExitGateController.h>

Public Member Functions

 ExitGateController (IEventBus &eventBus, IGate &gate, ITicketService &ticketService, uint32_t barrierTimeoutMs=2000, uint32_t validationTimeMs=500)
 Construct exit gate controller with injected dependencies.
 
 ~ExitGateController ()
 
 ExitGateController (const ExitGateController &)=delete
 
ExitGateController & operator= (const ExitGateController &)=delete
 
ExitGateState getState () const
 Get current state.
 
const char * getStateString () const
 Get state as string.
 
IGate & getGate ()
 Get gate reference (for debugging/console commands)
 
bool validateTicketManually (uint32_t ticketId)
 Manually validate ticket (for 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

Exit gate controller with state machine.

Handles exit sequence:

  1. Car arrives (detected via IGate)
  2. Validate ticket (simulated - assumes paid)
  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

◆ ExitGateController() [1/2]

ExitGateController::ExitGateController ( IEventBus &  eventBus,
IGate &  gate,
ITicketService &  ticketService,
uint32_t  barrierTimeoutMs = 2000,
uint32_t  validationTimeMs = 500 
)

Construct exit gate controller with injected dependencies.

Parameters
eventBusEvent bus for publishing/subscribing
gateGate abstraction (barrier + light barrier)
ticketServiceTicket service
barrierTimeoutMsBarrier open/close timeout in ms
validationTimeMsTicket validation simulation time in ms

◆ ~ExitGateController()

ExitGateController::~ExitGateController ( )

◆ ExitGateController() [2/2]

ExitGateController::ExitGateController ( const ExitGateController &  )
delete

Member Function Documentation

◆ getGate()

IGate & ExitGateController::getGate ( )
inline

Get gate reference (for debugging/console commands)

◆ getState()

ExitGateState ExitGateController::getState ( ) const
inline

Get current state.

◆ getStateString()

const char * ExitGateController::getStateString ( ) const

Get state as string.

◆ operator=()

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

◆ reset()

void ExitGateController::reset ( )

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

◆ setupGpioInterrupts()

void ExitGateController::setupGpioInterrupts ( )

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

◆ validateTicketManually()

bool ExitGateController::validateTicketManually ( uint32_t  ticketId)

Manually validate ticket (for console commands)

Parameters
ticketIdTicket ID to validate
Returns
true if validation successful

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