# 3axg4uvdpk/fiberalarmgateway_onvif architecture

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

- Interactive diagram: https://gitdiagram.com/3axg4uvdpk/fiberalarmgateway_onvif
- Repository: https://github.com/3axg4uvdpk/fiberalarmgateway_onvif

## Overview

This is a vibration-fiber alarm gateway. Its principal workflow receives alarm messages, processes alarms into camera captures and video-download tasks, then uploads media and forwards result messages. Separate workers receive device-status updates and report heartbeats. The graph preserves camera control, video retrieval, storage, and status-reporting branches. Source excerpts show the main startup and several component behaviors; some worker wiring is only identified through the source index, so unverified links are omitted or marked dashed.

Main entry points: [`main.py`](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/main.py) (Application runtime), [`processing/processing_worker.py`](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/processing/processing_worker.py) (Alarm processing), [`video/video_downloader.py`](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/video/video_downloader.py) (Video downloader), [`messaging/upload_worker.py`](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/messaging/upload_worker.py) (Upload and forwarding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Runtime setup"]
  node_main["Application runtime<br/>[main.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_logging["Logging setup<br/>[logging_config.py]"]
end

subgraph group_alarms["Alarm workflow"]
  node_alarm_receiver["Alarm receiver<br/>[alarm_receiver.py]"]
  node_processing["Alarm processing"]
  node_upload["Upload and forwarding<br/>[upload_worker.py]"]
end

subgraph group_camera_video["Camera and video"]
  node_camera_manager["Camera manager<br/>[camera_manager.py]"]
  node_onvif["ONVIF operations<br/>[onvif_camera.py]"]
  node_video_downloader["Video downloader"]
  node_ffmpeg["FFmpeg utilities<br/>[ffmpeg_utils.py]"]
end

subgraph group_messaging_state["Messaging and status"]
  node_status_receiver["Status receivers<br/>[status_receiver.py]"]
  node_system_status["System status<br/>[system_status.py]"]
  node_heartbeat["Heartbeat reporter"]
end

subgraph group_storage["Media storage"]
  node_minio_manager["MinIO manager<br/>[minio_manager.py]"]
  node_minio[("MinIO object store")]
end

node_operator(("Alarm sources"))
node_camera_devices(("Camera devices"))
node_rabbitmq["RabbitMQ"]
node_http_service(("Heartbeat service"))

node_main -->|"loads"| node_config
node_main -->|"configures"| node_logging
node_main -->|"starts"| node_alarm_receiver
node_main -->|"starts"| node_processing
node_main -->|"starts"| node_upload
node_main -->|"initializes"| node_camera_manager
node_main -->|"starts"| node_video_downloader
node_main -->|"starts"| node_status_receiver
node_main -->|"starts"| node_heartbeat
node_operator -.->|"sends alarms"| node_alarm_receiver
node_alarm_receiver -.->|"queues alarms"| node_processing
node_processing -->|"requests captures"| node_camera_manager
node_camera_manager -->|"delegates"| node_onvif
node_onvif -->|"controls and captures"| node_camera_devices
node_processing -->|"queues downloads"| node_video_downloader
node_video_downloader -->|"retrieves recordings"| node_camera_devices
node_video_downloader -->|"uses"| node_ffmpeg
node_processing -->|"uses"| node_ffmpeg
node_processing -->|"queues results"| node_upload
node_video_downloader -->|"uploads videos"| node_minio_manager
node_upload -->|"uploads media"| node_minio_manager
node_minio_manager -->|"stores objects"| node_minio
node_upload -->|"forwards results"| node_rabbitmq
node_rabbitmq -.->|"delivers status"| node_status_receiver
node_status_receiver -->|"updates"| node_system_status
node_status_receiver -->|"triggers promptly"| node_heartbeat
node_heartbeat -->|"reads status"| node_system_status
node_heartbeat -->|"posts heartbeat"| node_http_service

click node_main "https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/main.py"
click node_config "https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/core/config.py"
click node_logging "https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/core/logging_config.py"
click node_alarm_receiver "https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/messaging/alarm_receiver.py"
click node_processing "https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/processing/processing_worker.py"
click node_upload "https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/messaging/upload_worker.py"
click node_camera_manager "https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/camera/camera_manager.py"
click node_onvif "https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/camera/onvif_camera.py"
click node_video_downloader "https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/video/video_downloader.py"
click node_ffmpeg "https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/core/ffmpeg_utils.py"
click node_status_receiver "https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/messaging/status_receiver.py"
click node_system_status "https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/core/system_status.py"
click node_heartbeat "https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/messaging/heartbeat_worker.py"
click node_minio_manager "https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/storage/minio_manager.py"

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,node_logging toneBlue
class node_alarm_receiver,node_processing,node_upload toneAmber
class node_camera_manager,node_onvif,node_video_downloader,node_ffmpeg toneMint
class node_status_receiver,node_system_status,node_heartbeat toneRose
class node_minio_manager,node_minio,node_operator,node_camera_devices,node_rabbitmq,node_http_service toneIndigo
```

## Components

### Runtime setup

- [Application runtime](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/main.py): `main.py`
- [Configuration](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/core/config.py): `core/config.py`
- [Logging setup](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/core/logging_config.py): `core/logging_config.py`

### Alarm workflow

- [Alarm receiver](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/messaging/alarm_receiver.py): `messaging/alarm_receiver.py`
- [Alarm processing](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/processing/processing_worker.py): `processing/processing_worker.py`
- [Upload and forwarding](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/messaging/upload_worker.py): `messaging/upload_worker.py`

### Camera and video

- [Camera manager](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/camera/camera_manager.py): `camera/camera_manager.py`
- [ONVIF operations](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/camera/onvif_camera.py): `camera/onvif_camera.py`
- [Video downloader](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/video/video_downloader.py): `video/video_downloader.py`
- [FFmpeg utilities](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/core/ffmpeg_utils.py): `core/ffmpeg_utils.py`

### Messaging and status

- [Status receivers](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/messaging/status_receiver.py): `messaging/status_receiver.py`
- [System status](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/core/system_status.py): `core/system_status.py`
- [Heartbeat reporter](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/messaging/heartbeat_worker.py): `messaging/heartbeat_worker.py`

### Media storage

- [MinIO manager](https://github.com/3axg4uvdpk/fiberalarmgateway_onvif/blob/main/storage/minio_manager.py): `storage/minio_manager.py`
- **MinIO object store**

### Other components

- **Alarm sources**
- **Camera devices**
- **RabbitMQ**
- **Heartbeat service**

## Connections

- Application runtime → Configuration: loads (evidence: `main.py`)
- Application runtime → Logging setup: configures (evidence: `main.py`)
- Application runtime → Alarm receiver: starts (evidence: `main.py`)
- Application runtime → Alarm processing: starts (evidence: `main.py`)
- Application runtime → Upload and forwarding: starts (evidence: `main.py`)
- Application runtime → Camera manager: initializes (evidence: `main.py`)
- Application runtime → Video downloader: starts (evidence: `main.py`)
- Application runtime → Status receivers: starts (evidence: `main.py`)
- Application runtime → Heartbeat reporter: starts (evidence: `main.py`)
- Alarm sources → Alarm receiver: sends alarms
- Alarm receiver → Alarm processing: queues alarms
- Alarm processing → Camera manager: requests captures (evidence: `processing/processing_worker.py`)
- Camera manager → ONVIF operations: delegates (evidence: `camera/camera_manager.py`)
- ONVIF operations → Camera devices: controls and captures (evidence: `camera/onvif_camera.py`)
- Alarm processing → Video downloader: queues downloads (evidence: `processing/processing_worker.py`)
- Video downloader → Camera devices: retrieves recordings (evidence: `video/video_downloader.py`)
- Video downloader → FFmpeg utilities: uses (evidence: `video/video_downloader.py`)
- Alarm processing → FFmpeg utilities: uses (evidence: `processing/processing_worker.py`)
- Alarm processing → Upload and forwarding: queues results (evidence: `processing/processing_worker.py`)
- Video downloader → MinIO manager: uploads videos (evidence: `video/video_downloader.py`)
- Upload and forwarding → MinIO manager: uploads media (evidence: `messaging/upload_worker.py`)
- MinIO manager → MinIO object store: stores objects (evidence: `storage/minio_manager.py`)
- Upload and forwarding → RabbitMQ: forwards results (evidence: `messaging/upload_worker.py`)
- RabbitMQ → Status receivers: delivers status
- Status receivers → System status: updates (evidence: `messaging/status_receiver.py`)
- Status receivers → Heartbeat reporter: triggers promptly (evidence: `messaging/status_receiver.py`)
- Heartbeat reporter → System status: reads status (evidence: `messaging/heartbeat_worker.py`)
- Heartbeat reporter → Heartbeat service: posts heartbeat (evidence: `messaging/heartbeat_worker.py`)
