# besteaydogan/smart-home-console-app-c-plus-plus architecture

> Architecture diagram of the GitHub repository besteaydogan/smart-home-console-app-c-plus-plus, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/besteaydogan/smart-home-console-app-c-plus-plus
- Repository: https://github.com/besteaydogan/smart-home-console-app-c-plus-plus

## Overview

MSH is a console-based smart-home manager. The main workflow starts at the menu, where users inspect and manage devices or change home modes and states. Cameras and hazard detectors notify separate security protocols; hazard handling also cycles lights and records a fire-station call. Device operations, notifications, and mode changes are supported by shared managers and logging. The README documents capabilities beyond the sampled excerpts; those links are shown only where documented, and integrations are simulations rather than evidenced external services.

Main entry points: [`zga/MSHSystem.h`](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/MSHSystem.h) (System coordinator), [`zga/Managers.h`](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Managers.h) (Hazard protocol), [`zga/Common.h`](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Common.h) (Notifications), [`zga/Devices.h`](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Devices.h) (Device types)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["User interaction"]
  node_menu["Console menu<br/>[MSHSystem.h]"]
  node_input["Input handler<br/>[Common.h]"]
end

subgraph group_coordination["System coordination"]
  node_system["System coordinator<br/>[MSHSystem.h]"]
  node_device_manager["Device manager<br/>[Managers.h]"]
  node_states["System states<br/>[ModesStates.h]"]
  node_memento["State memento<br/>[ModesStates.h]"]
end

subgraph group_devices["Devices and modes"]
  node_device_factory["Device factory<br/>[Devices.h]"]
  node_device_types["Device types<br/>[Devices.h]"]
  node_camera["Camera detection<br/>[Devices.h]"]
  node_hazard_sensors["Hazard sensors<br/>[Devices.h]"]
  node_modes["Home modes<br/>[ModesStates.h]"]
end

subgraph group_safety["Safety protocols"]
  node_security["Motion protocol<br/>[Managers.h]"]
  node_detection["Hazard protocol<br/>[Managers.h]"]
end

subgraph group_support["Shared services"]
  node_notifications["Notifications<br/>[Common.h]"]
  node_logger["Event logger<br/>[Common.h]"]
  node_logfile[("System log<br/>[msh_log.txt]")]
end

node_user(("Home user"))
node_police(("Police response"))
node_fire_station(("Fire station response"))
node_sms(("SMS recipient"))

node_user -->|"chooses actions"| node_menu
node_menu -->|"reads input"| node_input
node_menu -->|"changes mode/state"| node_system
node_menu -->|"manages devices"| node_device_manager
node_menu -->|"creates devices"| node_device_factory
node_system -->|"applies modes"| node_device_manager
node_system -->|"initializes observer"| node_security
node_system -->|"initializes observer"| node_detection
node_system -->|"sets and restores"| node_states
node_system -->|"saves prior state"| node_memento
node_device_factory -->|"creates instances"| node_device_types
node_device_manager -->|"stores devices"| node_device_types
node_device_manager -->|"logs changes"| node_logger
node_modes -->|"powers devices"| node_device_types
node_camera -->|"notifies motion"| node_security
node_hazard_sensors -->|"notifies hazards"| node_detection
node_security -->|"logs alerts"| node_logger
node_security -->|"simulates call"| node_police
node_detection -->|"cycles lights"| node_device_manager
node_detection -->|"records call"| node_notifications
node_detection -->|"simulates call"| node_fire_station
node_device_types -->|"reports failures"| node_notifications
node_notifications -->|"simulates SMS"| node_sms
node_notifications -->|"records events"| node_logger
node_logger -->|"writes entries"| node_logfile

click node_menu "https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/MSHSystem.h"
click node_input "https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Common.h"
click node_system "https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/MSHSystem.h"
click node_device_manager "https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Managers.h"
click node_device_factory "https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Devices.h"
click node_device_types "https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Devices.h"
click node_camera "https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Devices.h"
click node_hazard_sensors "https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Devices.h"
click node_modes "https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/ModesStates.h"
click node_states "https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/ModesStates.h"
click node_memento "https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/ModesStates.h"
click node_security "https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Managers.h"
click node_detection "https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Managers.h"
click node_notifications "https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Common.h"
click node_logger "https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Common.h"
click node_logfile "https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/msh_log.txt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_menu,node_input,node_user toneBlue
class node_system,node_device_manager,node_states,node_memento toneAmber
class node_device_factory,node_device_types,node_camera,node_hazard_sensors,node_modes toneMint
class node_security,node_detection toneRose
class node_notifications,node_logger,node_logfile,node_police,node_fire_station,node_sms toneIndigo
```

## Components

### User interaction

- [Console menu](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/MSHSystem.h): `zga/MSHSystem.h`
- [Input handler](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Common.h): `zga/Common.h`

### System coordination

- [System coordinator](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/MSHSystem.h): `zga/MSHSystem.h`
- [Device manager](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Managers.h): `zga/Managers.h`
- [System states](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/ModesStates.h): `zga/ModesStates.h`
- [State memento](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/ModesStates.h): `zga/ModesStates.h`

### Devices and modes

- [Device factory](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Devices.h): `zga/Devices.h`
- [Device types](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Devices.h): `zga/Devices.h`
- [Camera detection](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Devices.h): `zga/Devices.h`
- [Hazard sensors](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Devices.h): `zga/Devices.h`
- [Home modes](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/ModesStates.h): `zga/ModesStates.h`

### Safety protocols

- [Motion protocol](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Managers.h): `zga/Managers.h`
- [Hazard protocol](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Managers.h): `zga/Managers.h`

### Shared services

- [Notifications](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Common.h): `zga/Common.h`
- [Event logger](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/Common.h): `zga/Common.h`
- [System log](https://github.com/besteaydogan/smart-home-console-app-c-plus-plus/blob/main/zga/msh_log.txt): `zga/msh_log.txt`

### Other components

- **Home user**
- **Police response**
- **Fire station response**
- **SMS recipient**

## Connections

- Home user → Console menu: chooses actions (evidence: `README.md`)
- Console menu → Input handler: reads input (evidence: `zga/MSHSystem.h`)
- Console menu → System coordinator: changes mode/state (evidence: `zga/MSHSystem.h`)
- Console menu → Device manager: manages devices (evidence: `zga/MSHSystem.h`)
- Console menu → Device factory: creates devices (evidence: `zga/MSHSystem.h`)
- System coordinator → Device manager: applies modes (evidence: `zga/MSHSystem.h`)
- System coordinator → Motion protocol: initializes observer (evidence: `zga/MSHSystem.h`)
- System coordinator → Hazard protocol: initializes observer (evidence: `zga/MSHSystem.h`)
- System coordinator → System states: sets and restores (evidence: `zga/MSHSystem.h`)
- System coordinator → State memento: saves prior state (evidence: `zga/MSHSystem.h`)
- Device factory → Device types: creates instances (evidence: `zga/Devices.h`)
- Device manager → Device types: stores devices (evidence: `zga/Managers.h`)
- Device manager → Event logger: logs changes (evidence: `zga/Managers.h`)
- Home modes → Device types: powers devices (evidence: `zga/ModesStates.h`)
- Camera detection → Motion protocol: notifies motion (evidence: `README.md`)
- Hazard sensors → Hazard protocol: notifies hazards (evidence: `README.md`)
- Motion protocol → Event logger: logs alerts (evidence: `zga/Managers.h`)
- Motion protocol → Police response: simulates call (evidence: `README.md`)
- Hazard protocol → Device manager: cycles lights (evidence: `zga/Managers.h`)
- Hazard protocol → Notifications: records call (evidence: `zga/Managers.h`)
- Hazard protocol → Fire station response: simulates call (evidence: `README.md`)
- Device types → Notifications: reports failures (evidence: `zga/Devices.h`)
- Notifications → SMS recipient: simulates SMS (evidence: `zga/Common.h`)
- Notifications → Event logger: records events (evidence: `zga/Common.h`)
- Event logger → System log: writes entries (evidence: `zga/Common.h`)
