Parking Garage Control System
ESP32 Parking Garage – ESP-IDF/FreeRTOS
Loading...
Searching...
No Matches
ParkingGarageSystem.h
Go to the documentation of this file.
1#pragma once
2
5#include "FreeRtosEventBus.h"
6#include "TicketService.h"
8#include "Gate.h"
9#include <memory>
10
24 public:
29 explicit ParkingGarageSystem(const ParkingGarageConfig& config);
31
32 // Prevent copying
35
39 void initialize();
40
44 IEventBus& getEventBus() { return *m_eventBus; }
45
49 ITicketService& getTicketService() { return *m_ticketService; }
50
54 EntryGateController& getEntryGate() { return *m_entryGate; }
55
59 ExitGateController& getExitGate() { return *m_exitGate; }
60
64 Gate& getEntryGateHardware() { return *m_entryGateHw; }
65
69 Gate& getExitGateHardware() { return *m_exitGateHw; }
70
74 void getStatus(char* buffer, size_t bufferSize) const;
75
80 void reset();
81
82 private:
83 // Event bus (must be first - other components depend on it)
84 std::unique_ptr<FreeRtosEventBus> m_eventBus;
85
86 // Services
87 std::unique_ptr<TicketService> m_ticketService;
88
89 // Hardware (owned by ParkingGarageSystem, injected into controllers)
90 std::unique_ptr<Gate> m_entryGateHw;
91 std::unique_ptr<Gate> m_exitGateHw;
92
93 // Controllers (receive injected dependencies)
94 std::unique_ptr<EntryGateController> m_entryGate;
95 std::unique_ptr<ExitGateController> m_exitGate;
96
97 ParkingGarageConfig m_config;
98};
Entry gate controller with state machine.
Definition EntryGateController.h:37
Exit gate controller with state machine.
Definition ExitGateController.h:35
Concrete gate implementation using GPIO.
Definition Gate.h:15
Interface for event bus.
Definition IEventBus.h:12
Interface for ticket service.
Definition ITicketService.h:13
Configuration for the parking garage system.
Definition ParkingGarageConfig.h:12
Main parking garage system orchestrator.
Definition ParkingGarageSystem.h:23
Gate & getExitGateHardware()
Get exit gate hardware reference (for console commands)
Definition ParkingGarageSystem.h:69
EntryGateController & getEntryGate()
Get entry gate controller reference.
Definition ParkingGarageSystem.h:54
void reset()
Reset system to initial state Resets all controllers and ticket service to clean state.
Definition ParkingGarageSystem.cpp:100
void getStatus(char *buffer, size_t bufferSize) const
Get system status string.
Definition ParkingGarageSystem.cpp:82
ExitGateController & getExitGate()
Get exit gate controller reference.
Definition ParkingGarageSystem.h:59
~ParkingGarageSystem()=default
ParkingGarageSystem & operator=(const ParkingGarageSystem &)=delete
ITicketService & getTicketService()
Get ticket service reference.
Definition ParkingGarageSystem.h:49
void initialize()
Initialize system and start event processing.
Definition ParkingGarageSystem.cpp:55
Gate & getEntryGateHardware()
Get entry gate hardware reference (for console commands)
Definition ParkingGarageSystem.h:64
IEventBus & getEventBus()
Get event bus reference.
Definition ParkingGarageSystem.h:44
ParkingGarageSystem(const ParkingGarageSystem &)=delete
Coverage