CrossGuard
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CheckingSystem Class Reference

Manages and operates the monitoring system for both pedestrian and vehicle detection. More...

#include <CheckingSystem.h>

Public Member Functions

 CheckingSystem ()
 Constructor to initialize the system with default states and sensor configurations.
 
 ~CheckingSystem ()
 Destructor to clean up resources, ensuring all threads are joined if necessary.
 
void initialize ()
 Initialize sensors and system components.
 
void run ()
 Start the system's main operation loop.
 
void deactivate ()
 Safely deactivate and shutdown all system operations.
 
void onPedestriansButtonPress ()
 Handler for pedestrian button presses.
 
void registerCarsMotionCallback (const std::function< void()> &callback)
 Registers a callback function for car motion detection.
 
void registerPedestriansMotionCallback (const std::function< void()> &callback)
 Registers a callback function for pedestrian motion detection.
 
void registerPedestriansButtonCallback (const std::function< void()> &callback)
 Registers a callback function for pedestrian button press.
 
void enablePedestriansMotionDetection ()
 Enables the motion detection for pedestrians.
 
void disablePedestriansMotionDetection ()
 Disables the motion detection for pedestrians.
 
void enableCarsMotionDetection ()
 Enables the motion detection for cars.
 
void disableCarsMotionDetection ()
 Disables the motion detection for cars.
 
void enablePedestriansButton ()
 Enables the use of the pedestrian button.
 
void disablePedestriansButton ()
 Disables the pedestrian button to prevent its use.
 
void enableSensing ()
 Enable all sensors and detection mechanisms.
 
void disableSensing ()
 Disable all sensors and detection mechanisms.
 

Detailed Description

Manages and operates the monitoring system for both pedestrian and vehicle detection.

Integrates multiple sensors and provides functionalities to register callbacks, activate or deactivate detection, and manage system states through an interface designed for real-time traffic monitoring.

Constructor & Destructor Documentation

◆ CheckingSystem()

CheckingSystem::CheckingSystem ( )

Constructor to initialize the system with default states and sensor configurations.

Constructor for the CheckingSystem class. Initializes all member variables and configures sensors with the appropriate pins.

◆ ~CheckingSystem()

CheckingSystem::~CheckingSystem ( )

Destructor to clean up resources, ensuring all threads are joined if necessary.

Destructor for the CheckingSystem class. Ensures all components are properly deactivated and threads are joined before destruction.

Member Function Documentation

◆ deactivate()

void CheckingSystem::deactivate ( )

Safely deactivate and shutdown all system operations.

Deactivates the system and ensures a clean shutdown. Sets isActive to false and waits for a brief period to allow threads to finish gracefully.

◆ disableSensing()

void CheckingSystem::disableSensing ( )

Disable all sensors and detection mechanisms.

Deactivates all sensors and detection mechanisms in the system. Calls individual disable methods for pedestrian and vehicle detection and button usage.

◆ enableSensing()

void CheckingSystem::enableSensing ( )

Enable all sensors and detection mechanisms.

Activates all sensors and detection mechanisms in the system. Calls individual enable methods for pedestrian and vehicle detection and button usage.

◆ initialize()

void CheckingSystem::initialize ( )

Initialize sensors and system components.

Initializes sensors and registers button press callbacks. Configures and initializes all associated sensors and registers callback for the pedestrian button.

◆ onPedestriansButtonPress()

void CheckingSystem::onPedestriansButtonPress ( )

Handler for pedestrian button presses.

Handles actions to be performed when the pedestrian button is pressed. If the button is enabled and the callback is set, it triggers the registered callback.

◆ registerCarsMotionCallback()

void CheckingSystem::registerCarsMotionCallback ( const std::function< void()> & callback)

Registers a callback function for car motion detection.

Parameters
callbackFunction to call when car motion is detected.

◆ registerPedestriansButtonCallback()

void CheckingSystem::registerPedestriansButtonCallback ( const std::function< void()> & callback)

Registers a callback function for pedestrian button press.

Parameters
callbackFunction to call when the pedestrian button is pressed.

◆ registerPedestriansMotionCallback()

void CheckingSystem::registerPedestriansMotionCallback ( const std::function< void()> & callback)

Registers a callback function for pedestrian motion detection.

Parameters
callbackFunction to call when pedestrian motion is detected.

◆ run()

void CheckingSystem::run ( )

Start the system's main operation loop.

Main operation function which activates all systems and starts monitoring. Launches threads for pedestrian and road monitoring and waits for them to complete.

This method initializes the active monitoring process for both pedestrians and vehicles. It starts two threads: one for pedestrian monitoring and another for road monitoring. Both threads are joined to ensure that the system continues running until both monitoring processes complete.

Note
This function must be called after all sensors and callbacks are properly initialized. It will block until all monitoring threads complete, which means it should ideally be run in its own thread if the application must perform other tasks concurrently.
Exceptions
std::system_errorif thread creation fails.
See also
initialize(), enableSensing(), disableSensing()

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