# ingdric29/driver_modbus architecture

> Architecture diagram of the GitHub repository ingdric29/driver_modbus, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ingdric29/driver_modbus
- Repository: https://github.com/ingdric29/driver_modbus

## Overview

Devlog is a SCADA-style variable logger: the runtime loads configuration, periodically polls configured devices, stores readings for later analysis, and evaluates alarms and events. The README also describes a dynamic web interface, but its implementation is not present in the supplied tree. MySQL/MariaDB, SMTP, and SMS are documented or represented integrations; some specific runtime links are uncertain because excerpts are partial, so those links are marked unverified.

Main entry points: [`src/main.cpp`](https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/main.cpp) (Polling runtime), [`src/cls_defalarmas.cpp`](https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/cls_defalarmas.cpp) (Alarm evaluation), [`src/cls_equipos.cpp`](https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/cls_equipos.cpp) (Device readers), [`src/loadconfig.cpp`](https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/loadconfig.cpp) (Configuration loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime orchestration"]
  node_main["Polling runtime<br/>[main.cpp]"]
  node_config["Configuration loader<br/>[loadconfig.cpp]"]
end

subgraph group_acquisition["Device acquisition"]
  node_equipment["Device readers<br/>[cls_equipos.cpp]"]
  node_serial["Serial transport<br/>[rs232.c]"]
end

subgraph group_operations["Monitoring operations"]
  node_alarms["Alarm evaluation<br/>[cls_defalarmas.cpp]"]
  node_events["Event definitions<br/>[cls_defeventos.cpp]"]
  node_commands["Device commands<br/>[cls_cmd.cpp]"]
  node_email["Email delivery<br/>[cls_email.cpp]"]
  node_sms["SMS notifications<br/>[cls_sms.cpp]"]
  node_web["Web visualization"]
end

subgraph group_support["Shared services"]
  node_conversion["Value conversion<br/>[conversiones.cpp]"]
  node_logger["Runtime logging<br/>[cls_logger.cpp]"]
end

node_operator(("Operator"))
node_configfile["Runtime settings<br/>[configdb.cfg]"]
node_fielddevices["Field devices"]
node_database[("MySQL / MariaDB")]
node_smtp["SMTP service"]
node_logfile["Log files"]

node_operator -->|"starts"| node_main
node_main -->|"loads settings"| node_config
node_config -.->|"reads"| node_configfile
node_main -->|"starts polling"| node_equipment
node_equipment -.->|"polls"| node_fielddevices
node_equipment -.->|"uses serial I/O"| node_serial
node_main -.->|"stores readings"| node_database
node_main -->|"evaluates alarms"| node_alarms
node_main -.->|"updates events"| node_events
node_main -.->|"dispatches commands"| node_commands
node_alarms -.->|"can trigger"| node_commands
node_alarms -.->|"can notify"| node_email
node_alarms -.->|"can notify"| node_sms
node_email -.->|"sends mail"| node_smtp
node_database -.->|"serves visualization data"| node_web
node_main -.->|"uses conversions"| node_conversion
node_main -.->|"records runtime events"| node_logger
node_logger -.->|"writes logs"| node_logfile

click node_main "https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/main.cpp"
click node_config "https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/loadconfig.cpp"
click node_configfile "https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/configdb.cfg"
click node_equipment "https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/cls_equipos.cpp"
click node_serial "https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/rs232.c"
click node_alarms "https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/cls_defalarmas.cpp"
click node_events "https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/cls_defeventos.cpp"
click node_commands "https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/cls_cmd.cpp"
click node_email "https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/cls_email.cpp"
click node_sms "https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/cls_sms.cpp"
click node_conversion "https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/conversiones.cpp"
click node_logger "https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/cls_logger.cpp"
click node_logfile "https://github.com/ingdric29/driver_modbus/tree/automonitor-driver-V1.1.4/log"

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_main,node_config toneBlue
class node_equipment,node_serial,node_database toneAmber
class node_alarms,node_events,node_commands,node_email,node_sms,node_web toneMint
class node_conversion,node_logger toneRose
class node_operator,node_fielddevices,node_smtp toneIndigo
class node_configfile,node_logfile toneTeal
```

## Components

### Runtime orchestration

- [Polling runtime](https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/main.cpp): `src/main.cpp`
- [Configuration loader](https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/loadconfig.cpp): `src/loadconfig.cpp`

### Device acquisition

- [Device readers](https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/cls_equipos.cpp): `src/cls_equipos.cpp`
- [Serial transport](https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/rs232.c): `src/rs232.c`

### Monitoring operations

- [Alarm evaluation](https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/cls_defalarmas.cpp): `src/cls_defalarmas.cpp`
- [Event definitions](https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/cls_defeventos.cpp): `src/cls_defeventos.cpp`
- [Device commands](https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/cls_cmd.cpp): `src/cls_cmd.cpp`
- [Email delivery](https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/cls_email.cpp): `src/cls_email.cpp`
- [SMS notifications](https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/cls_sms.cpp): `src/cls_sms.cpp`
- **Web visualization**

### Shared services

- [Value conversion](https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/conversiones.cpp): `src/conversiones.cpp`
- [Runtime logging](https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/src/cls_logger.cpp): `src/cls_logger.cpp`

### Other components

- **Operator**
- [Runtime settings](https://github.com/ingdric29/driver_modbus/blob/automonitor-driver-V1.1.4/configdb.cfg): `configdb.cfg`
- **Field devices**
- **MySQL / MariaDB**
- **SMTP service**
- [Log files](https://github.com/ingdric29/driver_modbus/tree/automonitor-driver-V1.1.4/log): `log`

## Connections

- Operator → Polling runtime: starts (evidence: `README.md`)
- Polling runtime → Configuration loader: loads settings (evidence: `src/main.cpp`)
- Configuration loader → Runtime settings: reads
- Polling runtime → Device readers: starts polling (evidence: `src/main.cpp`)
- Device readers → Field devices: polls
- Device readers → Serial transport: uses serial I/O
- Polling runtime → MySQL / MariaDB: stores readings
- Polling runtime → Alarm evaluation: evaluates alarms (evidence: `src/main.cpp`)
- Polling runtime → Event definitions: updates events
- Polling runtime → Device commands: dispatches commands
- Alarm evaluation → Device commands: can trigger
- Alarm evaluation → Email delivery: can notify
- Alarm evaluation → SMS notifications: can notify
- Email delivery → SMTP service: sends mail
- MySQL / MariaDB → Web visualization: serves visualization data (evidence: `README.md`)
- Polling runtime → Value conversion: uses conversions
- Polling runtime → Runtime logging: records runtime events
- Runtime logging → Log files: writes logs
