2026-07-16 20:19:11 +02:00
|
|
|
# Heimdall - Plan d'implémentation
|
|
|
|
|
|
|
|
|
|
## Phase 0 - Initialisation projet
|
|
|
|
|
|
|
|
|
|
### Objectif
|
|
|
|
|
|
|
|
|
|
Créer le socle technique stable.
|
|
|
|
|
|
|
|
|
|
Durée estimée : 1-2 jours.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Repository
|
|
|
|
|
|
|
|
|
|
Créer :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Heimdall
|
|
|
|
|
│
|
|
|
|
|
├── src
|
|
|
|
|
│ ├── Heimdall.Domain
|
|
|
|
|
│ ├── Heimdall.Application
|
|
|
|
|
│ ├── Heimdall.Infrastructure
|
|
|
|
|
│ ├── Heimdall.Api
|
|
|
|
|
│ ├── Heimdall.Web
|
|
|
|
|
│ ├── Heimdall.Agent
|
|
|
|
|
│ ├── Heimdall.Workers
|
|
|
|
|
│ ├── Heimdall.Contracts
|
|
|
|
|
│ └── Heimdall.Shared
|
|
|
|
|
│
|
|
|
|
|
├── tests
|
|
|
|
|
│ ├── Heimdall.Domain.Tests
|
|
|
|
|
│ ├── Heimdall.Application.Tests
|
|
|
|
|
│ ├── Heimdall.Infrastructure.Tests
|
|
|
|
|
│ ├── Heimdall.Api.Tests
|
|
|
|
|
│ ├── Heimdall.Agent.Tests
|
|
|
|
|
│ └── Heimdall.IntegrationTests
|
|
|
|
|
│
|
|
|
|
|
├── docker
|
|
|
|
|
│
|
|
|
|
|
├── .github/workflows
|
|
|
|
|
│
|
|
|
|
|
└── README.md
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Phase 1 - Solution .NET 10 + Clean Architecture
|
|
|
|
|
|
|
|
|
|
## Objectif
|
|
|
|
|
|
|
|
|
|
Créer tous les projets avec références correctes.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Domain
|
|
|
|
|
|
|
|
|
|
Aucune dépendance externe.
|
|
|
|
|
|
|
|
|
|
Références autorisées :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Domain
|
|
|
|
|
|
|
|
|
|
|
X
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Contient :
|
|
|
|
|
|
|
|
|
|
* Entities
|
|
|
|
|
* Value Objects
|
|
|
|
|
* Enums
|
|
|
|
|
* Domain Events
|
|
|
|
|
* Business Rules
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Exemple :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
CameraStatus.cs
|
|
|
|
|
|
|
|
|
|
EventType.cs
|
|
|
|
|
|
|
|
|
|
StorageProvider.cs
|
|
|
|
|
|
|
|
|
|
Site.cs
|
|
|
|
|
|
|
|
|
|
Camera.cs
|
|
|
|
|
|
|
|
|
|
Person.cs
|
|
|
|
|
|
|
|
|
|
Vehicle.cs
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Application
|
|
|
|
|
|
|
|
|
|
Dépend :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Application
|
|
|
|
|
|
|
|
|
|
|
v
|
|
|
|
|
Domain
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Contient :
|
|
|
|
|
|
|
|
|
|
* Commands
|
|
|
|
|
* Queries
|
|
|
|
|
* DTO
|
|
|
|
|
* Validators
|
|
|
|
|
* Interfaces
|
|
|
|
|
* Specifications
|
|
|
|
|
|
|
|
|
|
Technologies :
|
|
|
|
|
|
|
|
|
|
* MediatR
|
|
|
|
|
* FluentValidation
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Infrastructure
|
|
|
|
|
|
|
|
|
|
Dépend :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Infrastructure
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
v
|
|
|
|
|
|
|
|
|
|
Application
|
|
|
|
|
Domain
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Contient :
|
|
|
|
|
|
|
|
|
|
* EF Core
|
|
|
|
|
* PostgreSQL
|
|
|
|
|
* Identity
|
|
|
|
|
* File storage
|
|
|
|
|
* S3
|
|
|
|
|
* External services
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## API
|
|
|
|
|
|
|
|
|
|
Dépend :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
API
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Application
|
|
|
|
|
Infrastructure
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Contient :
|
|
|
|
|
|
|
|
|
|
* REST endpoints
|
|
|
|
|
* Authentication
|
|
|
|
|
* API Keys
|
|
|
|
|
* OpenAPI
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Agent
|
|
|
|
|
|
|
|
|
|
Même architecture :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Heimdall.Agent
|
|
|
|
|
|
|
|
|
|
Domain
|
|
|
|
|
|
|
|
|
|
Application
|
|
|
|
|
|
|
|
|
|
Infrastructure
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Mais orientée :
|
|
|
|
|
|
|
|
|
|
* Worker Service
|
|
|
|
|
* Communication API
|
|
|
|
|
* Camera management
|
2026-07-16 19:09:28 +00:00
|
|
|
* **WebRTC streaming** (SIPSorcery + SIPSorceryMedia.FFmpeg)
|
2026-07-16 20:19:11 +02:00
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Web
|
|
|
|
|
|
|
|
|
|
Blazor :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Heimdall.Web
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Dernière phase.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Phase 2 - Framework de tests
|
|
|
|
|
|
|
|
|
|
## Objectif
|
|
|
|
|
|
|
|
|
|
Avoir les tests avant le métier.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Stack :
|
|
|
|
|
|
|
|
|
|
* xUnit
|
|
|
|
|
* Shouldly
|
|
|
|
|
* NSubstitute
|
|
|
|
|
* Testcontainers
|
|
|
|
|
* FluentAssertions éventuellement
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Tests Domain
|
|
|
|
|
|
|
|
|
|
Premier projet.
|
|
|
|
|
|
|
|
|
|
Exemple :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
CameraTests.cs
|
|
|
|
|
|
|
|
|
|
PersonTests.cs
|
|
|
|
|
|
|
|
|
|
VehicleTests.cs
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Exemple TDD :
|
|
|
|
|
|
|
|
|
|
Avant code :
|
|
|
|
|
|
|
|
|
|
```csharp
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Camera_should_start_disabled()
|
|
|
|
|
{
|
|
|
|
|
var camera = new Camera();
|
|
|
|
|
|
|
|
|
|
camera.Status.ShouldBe(CameraStatus.Disabled);
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Puis seulement :
|
|
|
|
|
|
|
|
|
|
```csharp
|
|
|
|
|
public class Camera
|
|
|
|
|
{
|
|
|
|
|
public CameraStatus Status {get;private set;}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Phase 3 - CI/CD DockerHub
|
|
|
|
|
|
|
|
|
|
## Objectif
|
|
|
|
|
|
|
|
|
|
Chaque commit doit être compilable.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Pipeline :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Push
|
|
|
|
|
|
|
|
|
|
↓
|
|
|
|
|
|
|
|
|
|
Restore
|
|
|
|
|
|
|
|
|
|
↓
|
|
|
|
|
|
|
|
|
|
Build
|
|
|
|
|
|
|
|
|
|
↓
|
|
|
|
|
|
|
|
|
|
Unit Tests
|
|
|
|
|
|
|
|
|
|
↓
|
|
|
|
|
|
|
|
|
|
Coverage
|
|
|
|
|
|
|
|
|
|
↓
|
|
|
|
|
|
|
|
|
|
Docker Build
|
|
|
|
|
|
|
|
|
|
↓
|
|
|
|
|
|
|
|
|
|
Docker Push
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Images :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
heimdall/api
|
|
|
|
|
|
|
|
|
|
heimdall/agent
|
|
|
|
|
|
|
|
|
|
heimdall/web
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Tags :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
latest
|
|
|
|
|
|
|
|
|
|
1.0.0
|
|
|
|
|
|
|
|
|
|
commit-sha
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Quality gates :
|
|
|
|
|
|
|
|
|
|
* Build OK
|
|
|
|
|
* Tests OK
|
|
|
|
|
* Coverage minimum
|
|
|
|
|
* Sonar optionnel
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Phase 4 - Socle métier commun
|
|
|
|
|
|
|
|
|
|
## Objectif
|
|
|
|
|
|
|
|
|
|
Construire les fondations.
|
|
|
|
|
|
|
|
|
|
Ordre :
|
|
|
|
|
|
|
|
|
|
1. Tenant / Site
|
|
|
|
|
2. User
|
|
|
|
|
3. Permissions
|
|
|
|
|
4. Audit
|
|
|
|
|
5. Configuration
|
|
|
|
|
6. Events
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Entities
|
|
|
|
|
|
|
|
|
|
Premier modèle :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Site
|
|
|
|
|
|
|
|
|
|
Camera
|
|
|
|
|
|
|
|
|
|
Person
|
|
|
|
|
|
|
|
|
|
Vehicle
|
|
|
|
|
|
|
|
|
|
LicensePlate
|
|
|
|
|
|
|
|
|
|
Event
|
|
|
|
|
|
|
|
|
|
StoragePolicy
|
|
|
|
|
|
|
|
|
|
ApiKey
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Avant chaque Entity :
|
|
|
|
|
|
|
|
|
|
Créer :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Tests
|
|
|
|
|
|
|
|
|
|
↓
|
|
|
|
|
|
|
|
|
|
Implementation
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Phase 5 - API Core
|
|
|
|
|
|
|
|
|
|
Développer API et tests ensemble.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Première fonctionnalité
|
|
|
|
|
|
|
|
|
|
Health Check.
|
|
|
|
|
|
|
|
|
|
Test :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
GET /health
|
|
|
|
|
|
|
|
|
|
200 OK
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Puis :
|
|
|
|
|
|
|
|
|
|
## Site Management
|
|
|
|
|
|
|
|
|
|
Tests :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
CreateSiteCommandTests
|
|
|
|
|
|
|
|
|
|
GetSiteQueryTests
|
|
|
|
|
|
|
|
|
|
DeleteSiteTests
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Code ensuite.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Camera Management
|
|
|
|
|
|
|
|
|
|
Tests :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
CreateCameraTests
|
|
|
|
|
|
|
|
|
|
UpdateCameraTests
|
|
|
|
|
|
|
|
|
|
DisableCameraTests
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Puis implémentation.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Phase 6 - Agent Heimdall
|
|
|
|
|
|
|
|
|
|
Développement parallèle API.
|
|
|
|
|
|
|
|
|
|
Objectif :
|
|
|
|
|
|
|
|
|
|
Premier agent connecté.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Fonctionnalités V1
|
|
|
|
|
|
|
|
|
|
### Agent Registration
|
|
|
|
|
|
|
|
|
|
Test :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Agent can register to server
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Puis code.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### Heartbeat
|
|
|
|
|
|
|
|
|
|
Test :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Agent sends heartbeat
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Puis code.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### Site association
|
|
|
|
|
|
|
|
|
|
Test :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Agent belongs to site
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Puis code.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Architecture :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Agent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HTTPS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
API
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Phase 7 - Camera Discovery
|
|
|
|
|
|
|
|
|
|
## Agent
|
|
|
|
|
|
|
|
|
|
Implémentation :
|
|
|
|
|
|
|
|
|
|
ONVIF discovery.
|
|
|
|
|
|
|
|
|
|
Tests :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Should discover camera
|
|
|
|
|
|
|
|
|
|
Should reject invalid credentials
|
|
|
|
|
|
|
|
|
|
Should detect capabilities
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Mock :
|
|
|
|
|
|
|
|
|
|
Créer :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
FakeOnvifClient
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Tests sans caméra réelle.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Phase 8 - Video Pipeline
|
|
|
|
|
|
|
|
|
|
## FFmpeg abstraction
|
|
|
|
|
|
|
|
|
|
Ne jamais appeler FFmpeg directement partout.
|
|
|
|
|
|
|
|
|
|
Créer :
|
|
|
|
|
|
|
|
|
|
```csharp
|
|
|
|
|
IVideoRecorder
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Test :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Recorder creates segment
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Implémentation :
|
|
|
|
|
|
|
|
|
|
* FFmpeg
|
|
|
|
|
* Hardware acceleration
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2026-07-16 19:09:28 +00:00
|
|
|
# Phase 8b - WebRTC Streaming
|
|
|
|
|
|
|
|
|
|
Ajoutée après Phase 8 (Video Pipeline) — dépend de FFmpeg et de l'Agent.
|
|
|
|
|
|
|
|
|
|
## Objectif
|
|
|
|
|
|
|
|
|
|
Permettre la visualisation en direct des caméras depuis le navigateur via WebRTC P2P.
|
|
|
|
|
|
|
|
|
|
## Architecture
|
|
|
|
|
|
|
|
|
|
```text
|
|
|
|
|
Agent (SIPSorcery) ◄═════ WebRTC P2P (SRTP/H264) ═════► Navigateur (Blazor)
|
|
|
|
|
│ │
|
|
|
|
|
│ SignalR (SDP + ICE candidates) │
|
|
|
|
|
└────────────────── Heimdall API ────────────────────────┘
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Dépendances NuGet (Agent)
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
dotnet add package SIPSorcery
|
|
|
|
|
dotnet add package SIPSorceryMedia.FFmpeg
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Dépendances côté Central :
|
|
|
|
|
|
|
|
|
|
* SignalR (déjà dans ASP.NET Core)
|
|
|
|
|
|
|
|
|
|
## Étapes d'implémentation
|
|
|
|
|
|
|
|
|
|
### 8b.1 — SignalR Hub de signaling
|
|
|
|
|
|
|
|
|
|
Créer dans `Heimdall.Api` :
|
|
|
|
|
|
|
|
|
|
```csharp
|
|
|
|
|
public class StreamingHub : Hub
|
|
|
|
|
{
|
|
|
|
|
// Agent → Central : enregistrement des flux disponibles
|
|
|
|
|
// Browser → Central : demande de flux
|
|
|
|
|
// Central relay SDP / ICE entre Agent et Browser
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Tests :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Agent can register camera stream
|
|
|
|
|
Browser requests stream
|
|
|
|
|
SDP offer is relayed to browser
|
|
|
|
|
ICE candidates are exchanged
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### 8b.2 — WebRTC Peer dans l'Agent (SIPSorcery)
|
|
|
|
|
|
|
|
|
|
Créer dans `Heimdall.Agent` :
|
|
|
|
|
|
|
|
|
|
```csharp
|
|
|
|
|
IWebRtcStreamingService
|
|
|
|
|
|
|
|
|
|
RunAsync() // Démarre le pipeline
|
|
|
|
|
AddCameraTrack() // Ajoute un flux H264 depuis FFmpeg
|
|
|
|
|
CreateOffer() // Génère l'offre SDP
|
|
|
|
|
SetAnswer() // Reçoit l'answer du navigateur
|
|
|
|
|
AddIceCandidate() // Ajoute un ICE candidate
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Utilise SIPSorcery :
|
|
|
|
|
|
|
|
|
|
```csharp
|
|
|
|
|
var pc = new RTCPeerConnection(null);
|
|
|
|
|
|
|
|
|
|
var ffmpegSource = new FFmpegVideoSource(rtspUrl);
|
|
|
|
|
ffmpegSource.OnVideoSourceEncodedSample += pc.SendVideo;
|
|
|
|
|
|
|
|
|
|
var track = new MediaStreamTrack(
|
|
|
|
|
ffmpegSource.GetVideoSourceFormats(),
|
|
|
|
|
MediaStreamStatusEnum.SendOnly);
|
|
|
|
|
pc.addTrack(track);
|
|
|
|
|
|
|
|
|
|
pc.onconnectionstatechange += async (state) => { ... };
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Tests :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
RTSP stream produces H264 frames
|
|
|
|
|
WebRTC offer contains H264 codec
|
|
|
|
|
ICE candidates are generated
|
|
|
|
|
Connection state transitions correctly
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### 8b.3 — Client Blazor WebRTC
|
|
|
|
|
|
|
|
|
|
Dans `Heimdall.Web` :
|
|
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
|
// wwwroot/js/liveStream.js
|
|
|
|
|
const pc = new RTCPeerConnection({
|
|
|
|
|
iceServers: [{ urls: 'stun:stun.l.google.com:19302' }]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
pc.ontrack = (evt) => {
|
|
|
|
|
video.srcObject = evt.streams[0];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Connexion SignalR au hub /hubs/streaming
|
|
|
|
|
// Échange SDP + ICE
|
|
|
|
|
// Lecture du flux dans <video controls>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### 8b.4 — TURN relay (optionnel)
|
|
|
|
|
|
|
|
|
|
Ajouter `coturn` dans docker-compose si nécessaire :
|
|
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
|
coturn:
|
|
|
|
|
image: coturn/coturn:latest
|
|
|
|
|
command: -n --min-port=49160 --max-port=49200
|
|
|
|
|
ports:
|
|
|
|
|
- "3478:3478/udp"
|
|
|
|
|
- "3478:3478/tcp"
|
|
|
|
|
- "49160-49200:49160-49200/udp"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Configuré dans les ICE servers du client :
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{ "iceServers": [
|
|
|
|
|
{ "urls": "stun:heimdall.local:3478" },
|
|
|
|
|
{ "urls": "turn:heimdall.local:3478",
|
|
|
|
|
"username": "...", "credential": "..." }
|
|
|
|
|
] }
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Tests de bout en bout
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Browser requests camera stream
|
|
|
|
|
→ Agent reçoit signaling → établit WebRTC
|
|
|
|
|
→ Video feed visible in browser < 3s
|
|
|
|
|
→ ICE candidate exchange works through NAT
|
|
|
|
|
→ Stream stops cleanly on disconnect
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Phase 9 - IA Pipeline
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2026-07-16 20:19:11 +02:00
|
|
|
# Phase 9 - IA Pipeline
|
|
|
|
|
|
|
|
|
|
## Abstraction
|
|
|
|
|
|
|
|
|
|
Créer :
|
|
|
|
|
|
|
|
|
|
```csharp
|
|
|
|
|
IAiDetectionService
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Mock :
|
|
|
|
|
|
|
|
|
|
```csharp
|
|
|
|
|
FakeAiDetectionService
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Tests :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Person detection creates event
|
|
|
|
|
|
|
|
|
|
Unknown face creates alert
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Implémentation :
|
|
|
|
|
|
|
|
|
|
CodeProject.AI.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Phase 10 - Storage
|
|
|
|
|
|
|
|
|
|
## Abstraction
|
|
|
|
|
|
|
|
|
|
Créer :
|
|
|
|
|
|
|
|
|
|
```csharp
|
|
|
|
|
IStorageProvider
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Implémentations :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
LocalStorageProvider
|
|
|
|
|
|
|
|
|
|
S3StorageProvider
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Tests :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
File saved
|
|
|
|
|
|
|
|
|
|
File deleted
|
|
|
|
|
|
|
|
|
|
Retention applied
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Phase 11 - Hangfire
|
|
|
|
|
|
|
|
|
|
Implémenter :
|
|
|
|
|
|
|
|
|
|
* Retention jobs
|
|
|
|
|
* Health checks
|
|
|
|
|
* Cleanup
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Tests :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Expired recording is deleted
|
|
|
|
|
|
|
|
|
|
Active recording is kept
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Phase 12 - Security
|
|
|
|
|
|
|
|
|
|
## Identity
|
|
|
|
|
|
|
|
|
|
Tests :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
User can login
|
|
|
|
|
|
|
|
|
|
Permission denied
|
|
|
|
|
|
|
|
|
|
Permission granted
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## API Keys
|
|
|
|
|
|
|
|
|
|
Tests :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Generate key
|
|
|
|
|
|
|
|
|
|
Validate key
|
|
|
|
|
|
|
|
|
|
Expired key rejected
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Phase 13 - Blazor Web
|
|
|
|
|
|
|
|
|
|
Seulement maintenant.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Développement :
|
|
|
|
|
|
|
|
|
|
Tests :
|
|
|
|
|
|
|
|
|
|
* Component tests
|
|
|
|
|
* bUnit
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
Ordre :
|
|
|
|
|
|
|
|
|
|
1. Layout
|
|
|
|
|
2. Authentication
|
|
|
|
|
3. Dashboard
|
|
|
|
|
4. Sites
|
|
|
|
|
5. Cameras
|
|
|
|
|
6. Events
|
|
|
|
|
7. Persons
|
|
|
|
|
8. Vehicles
|
|
|
|
|
9. Administration
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Phase 14 - Dashboard KPI
|
|
|
|
|
|
|
|
|
|
Créer les APIs d'abord.
|
|
|
|
|
|
|
|
|
|
Tests :
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Dashboard returns camera KPI
|
|
|
|
|
|
|
|
|
|
Dashboard returns event KPI
|
|
|
|
|
|
|
|
|
|
Dashboard returns storage KPI
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Puis UI MudBlazor.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Phase 15 - Production Ready
|
|
|
|
|
|
|
|
|
|
## Observabilité
|
|
|
|
|
|
|
|
|
|
Ajouter :
|
|
|
|
|
|
|
|
|
|
* Serilog
|
|
|
|
|
* Sentry
|
|
|
|
|
* GlitchTip
|
|
|
|
|
* OpenTelemetry
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Documentation
|
|
|
|
|
|
|
|
|
|
Générer :
|
|
|
|
|
|
|
|
|
|
* README
|
|
|
|
|
* Architecture Decision Records
|
|
|
|
|
* API documentation
|
|
|
|
|
* Deployment guide
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Stratégie Git
|
|
|
|
|
|
|
|
|
|
## Branches
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
main
|
|
|
|
|
|
|
|
|
|
develop
|
|
|
|
|
|
|
|
|
|
feature/*
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Commit convention
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
feat:
|
|
|
|
|
|
|
|
|
|
fix:
|
|
|
|
|
|
|
|
|
|
test:
|
|
|
|
|
|
|
|
|
|
refactor:
|
|
|
|
|
|
|
|
|
|
docs:
|
|
|
|
|
|
|
|
|
|
ci:
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Definition of Done
|
|
|
|
|
|
|
|
|
|
Une fonctionnalité est terminée uniquement si :
|
|
|
|
|
|
|
|
|
|
✅ Tests écrits avant le code
|
|
|
|
|
✅ Code fonctionnel
|
|
|
|
|
✅ Couverture TU OK
|
|
|
|
|
✅ Documentation XML
|
|
|
|
|
✅ Logs présents
|
|
|
|
|
✅ Gestion des erreurs
|
|
|
|
|
✅ Validation FluentValidation
|
|
|
|
|
✅ Docker OK
|
|
|
|
|
✅ CI verte
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Ordre global résumé
|
|
|
|
|
|
|
|
|
|
```
|
2026-07-16 19:09:28 +00:00
|
|
|
1. Solution .NET 10
|
|
|
|
|
2. Clean Architecture
|
|
|
|
|
3. Tests Framework
|
|
|
|
|
4. CI DockerHub
|
|
|
|
|
5. Domain Model
|
|
|
|
|
6. Application Layer
|
|
|
|
|
7. API Core
|
|
|
|
|
8. Agent Core
|
|
|
|
|
9. ONVIF
|
2026-07-16 20:19:11 +02:00
|
|
|
10. FFmpeg
|
2026-07-16 19:09:28 +00:00
|
|
|
11. WebRTC Streaming (SIPSorcery + SignalR)
|
|
|
|
|
12. CodeProject.AI
|
|
|
|
|
13. Storage
|
|
|
|
|
14. Hangfire
|
|
|
|
|
15. Security
|
|
|
|
|
16. Blazor UI
|
|
|
|
|
17. Dashboard
|
|
|
|
|
18. Production Hardening
|
2026-07-16 20:19:11 +02:00
|
|
|
```
|