Files
Heimdall/src/Heimdall.Agent/AgentOptions.cs
T
Arnaud Dartois c38d69a1e5 feat(agent): pipeline capture vidéo — FFmpeg par caméra, snapshots adaptatifs, frames → analyseur (Fixes #1)
- CameraStreamService enregistré dans le DI + hosted SnapshotPipelineService
  qui synchronise les captures avec les caméras assignées (Central = source de
  vérité via clés camera.<id>.* dans la config agent ; fallback local Agent:Cameras)
- Découpage du flux MJPEG en frames JPEG (JpegFrameSplitter, marqueurs SOI/EOI)
- Intervalle adaptatif (spec Phase 15) : scène vide 1000ms / mouvement 500ms /
  objet détecté 200ms, doublé si CPU > 80% ; état de scène piloté par les
  résultats de l'analyseur + proxy de mouvement (FrameMotionDetector, pixel diff
  réel en Phase 16)
- Channel borné 100 snapshots (DropOldest) — backpressure + compteur de drops
  et log rate-limité (alerte admin via remontée des logs agent)
- Frames réellement transmises à FrameAnalyzerService (compteur AnalyzedFrameCount)
- Central : GET /api/settings/agent/{id} embarque les caméras assignées
  (name/rtsp/sub_rtsp/enabled) ; ConfigReceiverService les applique à chaud
- Tests : JpegFrameSplitter, intervalle adaptatif, tracker de scène, motion
  detector, CameraConfigStore, pipeline (snapshot → analyseur), handler config
2026-08-11 21:16:28 +02:00

56 lines
2.2 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace Heimdall.Agent;
/// <summary>
/// Strongly-typed configuration for the Heimdall Agent.
/// Bound from environment variables or appsettings.json on startup.
/// Validated automatically — misconfiguration is caught before any service runs.
/// </summary>
public sealed class AgentOptions
{
public const string SectionName = "Agent";
/// <summary>URL of the Heimdall Central server (e.g. http://heimdall-central:8080).</summary>
[Required, Url]
public string CentralUrl { get; init; } = string.Empty;
/// <summary>Site token for agent registration.</summary>
[Required, MinLength(1)]
public string SiteToken { get; init; } = string.Empty;
/// <summary>
/// Display name for this agent instance. Falls back to hostname if empty.
/// </summary>
public string? AgentName { get; init; }
/// <summary>Interval between heartbeats in seconds (default: 30).</summary>
[Range(5, 300)]
public int HeartbeatIntervalSeconds { get; init; } = 30;
/// <summary>Directory for persisting agent identity state. Defaults to /var/lib/heimdall on Linux.</summary>
public string? StateDirectory { get; init; }
/// <summary>Max retries for agent registration (default: 5).</summary>
[Range(1, 20)]
public int RegistrationMaxRetries { get; init; } = 5;
/// <summary>Interval between automatic camera network scans in seconds (default: 900 = 15 min).</summary>
[Range(60, 86400)]
public int DiscoveryIntervalSeconds { get; init; } = 900;
/// <summary>Enable automatic camera discovery on the local network (default: true).</summary>
public bool DiscoveryEnabled { get; init; } = true;
/// <summary>Agent software version reported to Central.</summary>
public string Version { get; init; } = "1.0.0";
/// <summary>
/// Local camera assignments used as a fallback until the Central ships its
/// camera list (per-agent settings pipeline). Useful for development or
/// agents that cannot reach the Central camera registry. When the Central
/// config arrives, it replaces this list entirely.
/// </summary>
public List<AgentCameraOptions> Cameras { get; init; } = [];
}