From 601912cc49856a3a728e8f0cbc46b50d488fba37 Mon Sep 17 00:00:00 2001
From: thebonden <51397557+thebonden@users.noreply.github.com>
Date: Mon, 26 Oct 2026 17:59:44 +0100
Subject: [PATCH 01/10] Add Control Hub 0.0.001 core, Stream Deck
PowerPoint/OBS integrations and bilingual docs
---
.github/workflows/ci.yml | 30 +++
.gitignore | 8 +
AGENTS.md | 12 +
CHANGELOG.md | 23 ++
CONTRIBUTING.md | 17 ++
ControlHub.slnx | 13 +
Directory.Build.props | 13 +
Plugins/AndroidLive/README.md | 17 ++
Plugins/AndroidRemote/README.md | 17 ++
Plugins/Audio/README.md | 17 ++
Plugins/FluxKeyboard/README.md | 17 ++
Plugins/Logitech/README.md | 17 ++
Plugins/Obs/ControlHub.Plugins.Obs.csproj | 1 +
Plugins/Obs/ObsClient.cs | 84 +++++++
Plugins/Obs/ObsPlugin.cs | 54 ++++
Plugins/Obs/README.md | 11 +
Plugins/PhysicalRemote/README.md | 17 ++
.../Planned/ControlHub.Plugins.Planned.csproj | 1 +
Plugins/Planned/PlannedPlugin.cs | 15 ++
Plugins/Planned/README.md | 11 +
Plugins/PowerPoint/ComSlideShowSession.cs | 97 ++++++++
.../ControlHub.Plugins.PowerPoint.csproj | 1 +
Plugins/PowerPoint/PowerPointPlugin.cs | 71 ++++++
Plugins/PowerPoint/README.md | 11 +
Plugins/StreamDeck/README.md | 11 +
.../actions.js | 113 +++++++++
.../assets/action.svg | 1 +
.../assets/action@2x.svg | 1 +
.../assets/key.svg | 1 +
.../assets/key@2x.svg | 1 +
.../assets/plugin.svg | 1 +
.../assets/plugin@2x.svg | 1 +
.../bridge.js | 54 ++++
.../inspector.html | 11 +
.../inspector.js | 42 ++++
.../manifest.json | 232 ++++++++++++++++++
.../plugin.js | 22 ++
README.en.md | 66 +++++
README.md | 67 ++++-
VERSION | 1 +
docs/project.da.md | 96 ++++++++
docs/project.en.md | 96 ++++++++
docs/protocol.da.md | 78 ++++++
docs/protocol.en.md | 78 ++++++
docs/references.md | 13 +
docs/setup.da.md | 79 ++++++
docs/setup.en.md | 79 ++++++
docs/testing.da.md | 46 ++++
docs/testing.en.md | 46 ++++
docs/versioning.md | 21 ++
global.json | 7 +
scripts/check-policy.cjs | 18 ++
.../ControlHub.Contracts.csproj | 1 +
src/ControlHub.Contracts/Protocol.cs | 51 ++++
src/ControlHub.Core/CommandDispatcher.cs | 89 +++++++
src/ControlHub.Core/ControlHub.Core.csproj | 1 +
src/ControlHub.Host/ControlHub.Host.csproj | 8 +
src/ControlHub.Host/Program.cs | 73 ++++++
.../ControlHub.Tests/ControlHub.Tests.csproj | 13 +
tests/ControlHub.Tests/DispatcherTests.cs | 125 ++++++++++
tests/ControlHub.Tests/ObsTransportTests.cs | 106 ++++++++
tests/ControlHub.Tests/PluginTests.cs | 129 ++++++++++
tests/host-smoke.cjs | 41 ++++
tests/streamdeck.test.cjs | 88 +++++++
64 files changed, 2580 insertions(+), 2 deletions(-)
create mode 100644 .github/workflows/ci.yml
create mode 100644 .gitignore
create mode 100644 AGENTS.md
create mode 100644 CHANGELOG.md
create mode 100644 CONTRIBUTING.md
create mode 100644 ControlHub.slnx
create mode 100644 Directory.Build.props
create mode 100644 Plugins/AndroidLive/README.md
create mode 100644 Plugins/AndroidRemote/README.md
create mode 100644 Plugins/Audio/README.md
create mode 100644 Plugins/FluxKeyboard/README.md
create mode 100644 Plugins/Logitech/README.md
create mode 100644 Plugins/Obs/ControlHub.Plugins.Obs.csproj
create mode 100644 Plugins/Obs/ObsClient.cs
create mode 100644 Plugins/Obs/ObsPlugin.cs
create mode 100644 Plugins/Obs/README.md
create mode 100644 Plugins/PhysicalRemote/README.md
create mode 100644 Plugins/Planned/ControlHub.Plugins.Planned.csproj
create mode 100644 Plugins/Planned/PlannedPlugin.cs
create mode 100644 Plugins/Planned/README.md
create mode 100644 Plugins/PowerPoint/ComSlideShowSession.cs
create mode 100644 Plugins/PowerPoint/ControlHub.Plugins.PowerPoint.csproj
create mode 100644 Plugins/PowerPoint/PowerPointPlugin.cs
create mode 100644 Plugins/PowerPoint/README.md
create mode 100644 Plugins/StreamDeck/README.md
create mode 100644 Plugins/StreamDeck/dk.thebonden.controlhub.sdPlugin/actions.js
create mode 100644 Plugins/StreamDeck/dk.thebonden.controlhub.sdPlugin/assets/action.svg
create mode 100644 Plugins/StreamDeck/dk.thebonden.controlhub.sdPlugin/assets/action@2x.svg
create mode 100644 Plugins/StreamDeck/dk.thebonden.controlhub.sdPlugin/assets/key.svg
create mode 100644 Plugins/StreamDeck/dk.thebonden.controlhub.sdPlugin/assets/key@2x.svg
create mode 100644 Plugins/StreamDeck/dk.thebonden.controlhub.sdPlugin/assets/plugin.svg
create mode 100644 Plugins/StreamDeck/dk.thebonden.controlhub.sdPlugin/assets/plugin@2x.svg
create mode 100644 Plugins/StreamDeck/dk.thebonden.controlhub.sdPlugin/bridge.js
create mode 100644 Plugins/StreamDeck/dk.thebonden.controlhub.sdPlugin/inspector.html
create mode 100644 Plugins/StreamDeck/dk.thebonden.controlhub.sdPlugin/inspector.js
create mode 100644 Plugins/StreamDeck/dk.thebonden.controlhub.sdPlugin/manifest.json
create mode 100644 Plugins/StreamDeck/dk.thebonden.controlhub.sdPlugin/plugin.js
create mode 100644 README.en.md
create mode 100644 VERSION
create mode 100644 docs/project.da.md
create mode 100644 docs/project.en.md
create mode 100644 docs/protocol.da.md
create mode 100644 docs/protocol.en.md
create mode 100644 docs/references.md
create mode 100644 docs/setup.da.md
create mode 100644 docs/setup.en.md
create mode 100644 docs/testing.da.md
create mode 100644 docs/testing.en.md
create mode 100644 docs/versioning.md
create mode 100644 global.json
create mode 100644 scripts/check-policy.cjs
create mode 100644 src/ControlHub.Contracts/ControlHub.Contracts.csproj
create mode 100644 src/ControlHub.Contracts/Protocol.cs
create mode 100644 src/ControlHub.Core/CommandDispatcher.cs
create mode 100644 src/ControlHub.Core/ControlHub.Core.csproj
create mode 100644 src/ControlHub.Host/ControlHub.Host.csproj
create mode 100644 src/ControlHub.Host/Program.cs
create mode 100644 tests/ControlHub.Tests/ControlHub.Tests.csproj
create mode 100644 tests/ControlHub.Tests/DispatcherTests.cs
create mode 100644 tests/ControlHub.Tests/ObsTransportTests.cs
create mode 100644 tests/ControlHub.Tests/PluginTests.cs
create mode 100644 tests/host-smoke.cjs
create mode 100644 tests/streamdeck.test.cjs
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..6a3eb6a
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,30 @@
+name: Build and tests / Byg og test
+on:
+ push:
+ branches: [main, 'feature/**']
+ pull_request:
+ branches: [main]
+permissions:
+ contents: read
+jobs:
+ verify:
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, windows-latest]
+ runs-on: ${{ matrix.os }}
+ timeout-minutes: 15
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '10.0.x'
+ - uses: actions/setup-node@v4
+ with:
+ node-version: '24'
+ - run: dotnet restore ControlHub.slnx
+ - run: dotnet build ControlHub.slnx --no-restore --configuration Release
+ - run: dotnet test ControlHub.slnx --no-build --configuration Release --logger trx
+ - run: node --test tests/streamdeck.test.cjs
+ - run: node tests/host-smoke.cjs
+ - run: node scripts/check-policy.cjs
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..34bd8da
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+**/bin/
+**/obj/
+.vs/
+TestResults/
+artifacts/
+.env
+*.user
+*.streamDeckPlugin
diff --git a/AGENTS.md b/AGENTS.md
new file mode 100644
index 0000000..dec341f
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1,12 @@
+# Projektregler / Project rules
+
+- Dansk: Kommunikér med ejeren på dansk. Dokumentation og brugervendte tekster skal være på dansk og engelsk.
+- English: Communicate with the owner in Danish. Documentation and user-facing text must be Danish and English.
+- Dansk: Prioritér Stream Deck sammen med PowerPoint og OBS Studio; derefter AndroidRemote.
+- English: Prioritize Stream Deck with PowerPoint and OBS Studio, followed by AndroidRemote.
+- Dansk: Alle pluginimplementationer og aktiver under Plugins/. Ingen ændring af præsentationsfiler eller fokusafhængige genveje.
+- English: All plugin implementations and assets belong under Plugins/. Never modify presentation files or use focus-dependent shortcuts.
+- Dansk: Brug arbejdsbranch og PR mod main. Byg og test. Rapportér faktisk implementering og resterende hardwaretest.
+- English: Use a working branch and PR to main. Build and test. Report actual implementation and remaining hardware tests.
+- Dansk: Ingen release eller tag uden ejerens godkendelse. Hver .100-grænse og skiftet til 0.1.000 kræver særskilt godkendelse. Følg docs/versioning.md.
+- English: No release or tag without owner approval. Each .100 boundary and transition to 0.1.000 needs separate approval. Follow docs/versioning.md.
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..69282d9
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,23 @@
+# Ændringslog / Changelog
+
+## 0.0.001 — udviklingsversion / development version
+
+### Dansk
+- C#/.NET 10-kontrakter, dispatcher og lokal autentificeret HTTP-host.
+- Eksplicit pluginsystem med ærlig status for ikke-implementerede integrationer.
+- PowerPoint COM-navigation på STA-tråd, uden filredigering eller tastaturgenveje.
+- OBS WebSocket v5-klient med godkendelse og konkrete handlinger.
+- Stream Deck-kildeplugin med 12 handlinger, dansk/engelsk opsætning og statusfeedback.
+- Forberedte integrationsplaner for AndroidRemote, lyd, Logitech, Android Live, fysisk fjernkontrol og Flux Keyboard.
+- Automatiske tests, CI på Windows/Linux og projektbeskrivelse på begge sprog.
+- Fysisk test i det aktive miljø afventer. Ingen release eller tag.
+
+### English
+- C#/.NET 10 contracts, dispatcher and authenticated local HTTP host.
+- Explicit plugin system with truthful status for unimplemented integrations.
+- PowerPoint COM navigation on an STA thread without file editing or keyboard shortcuts.
+- OBS WebSocket v5 client with authentication and concrete actions.
+- Stream Deck source plugin with 12 actions, Danish/English settings and status feedback.
+- Prepared integration plans for AndroidRemote, audio, Logitech, Android Live, physical remote and Flux Keyboard.
+- Automated tests, Windows/Linux CI and project description in both languages.
+- Physical testing in the active environment remains pending. No release or tag.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..25d2ebc
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,17 @@
+# Bidrag / Contributing
+
+## Dansk
+
+Arbejd på en branch fra `main`, og åbn en PR mod `main`. Hold alle pluginimplementationer og deres aktiver under `Plugins/`. Bevar danske og engelske dokumenter samt UI-tekster i samme ændring; protokol- og kodeidentifikatorer forbliver engelske.
+
+Kør build, C#-tests, Stream Deck-tests, host-smoketest og kildekoderegler som beskrevet i installationsvejledningen. Beskriv præcist, om en integration er implementeret, simuleret, planlagt eller fysisk afprøvet. Brug ikke grønne enhedstests som bevis for hardwarefunktion.
+
+Ændr aldrig præsentationsfiler, og tilføj ingen fokusafhængige genveje. Gem aldrig tokens eller adgangskoder i kode, eksempler, testlogs eller profiler. Følg [versionsreglerne](docs/versioning.md). Release, tags og .100-grænser kræver ejerens eksplicitte godkendelse.
+
+## English
+
+Work on a branch from `main` and open a PR targeting `main`. Keep all plugin implementations and assets under `Plugins/`. Update Danish and English documentation and UI text together; protocol and code identifiers remain English.
+
+Run the build, C# tests, Stream Deck tests, host smoke test and source policy checks described in setup. State precisely whether an integration is implemented, simulated, planned or physically tested. Green unit tests do not prove hardware functionality.
+
+Never modify presentation files or add focus-dependent shortcuts. Never commit tokens or passwords in code, examples, test logs or profiles. Follow the [version policy](docs/versioning.md). Releases, tags and .100 boundaries require explicit owner approval.
diff --git a/ControlHub.slnx b/ControlHub.slnx
new file mode 100644
index 0000000..3e3f2c4
--- /dev/null
+++ b/ControlHub.slnx
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 0000000..4f588a5
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,13 @@
+
+
+ net10.0
+ enable
+ enable
+ true
+ 0.0.1
+ 0.0.1.0
+ 0.0.1.0
+ 0.0.001
+ true
+
+
diff --git a/Plugins/AndroidLive/README.md b/Plugins/AndroidLive/README.md
new file mode 100644
index 0000000..87918f6
--- /dev/null
+++ b/Plugins/AndroidLive/README.md
@@ -0,0 +1,17 @@
+# Android Live / Android Live
+
+## Dansk
+
+Status i 0.0.001: **planlagt, ikke implementeret**. Plugin-id: `android-live`. Hosten registrerer en fælles `PlannedPlugin` med tom handlingsliste og `not_implemented`-status. Der er ingen driver, transport eller app i denne mappe endnu.
+
+Afklar om integrationen omfatter kamera, status eller styring. Fastlæg transport, parring og adgang. Denne integration er adskilt fra AndroidRemote.
+
+Accept kræver en dokumenteret protokol, fejl- og forbindelsestests, hardwaretest og danske/engelske brugertekster. Implementationskode skal placeres i denne mappe under `Plugins/`.
+
+## English
+
+0.0.001 status: **planned, not implemented**. Plugin ID: `android-live`. The host registers a shared `PlannedPlugin` with an empty action list and `not_implemented` status. No driver, transport or app exists in this directory yet.
+
+Establish whether the integration covers a camera, status or control. Define transport, pairing and access. This integration is separate from AndroidRemote.
+
+Acceptance requires a documented protocol, error and connection tests, hardware testing and Danish/English user text. Implementation code must be placed in this directory under `Plugins/`.
diff --git a/Plugins/AndroidRemote/README.md b/Plugins/AndroidRemote/README.md
new file mode 100644
index 0000000..30ce577
--- /dev/null
+++ b/Plugins/AndroidRemote/README.md
@@ -0,0 +1,17 @@
+# AndroidRemote / AndroidRemote
+
+## Dansk
+
+Status i 0.0.001: **planlagt, ikke implementeret**. Plugin-id: `androidremote`. Hosten registrerer en fælles `PlannedPlugin` med tom handlingsliste og `not_implemented`-status. Der er ingen driver, transport eller app i denne mappe endnu.
+
+Næste prioritet efter Stream Deck/PowerPoint/OBS. Afklar om navnet betyder en eksisterende app eller en ny klient. Design derefter en mobil knapflade, parring, TLS, enhedsgodkendelse, genkaldelse og status. Genbrug protokol v1; åbn ikke den eksisterende loopback-host på LAN. Ingen automatisk replay efter mobil genforbindelse.
+
+Accept kræver en dokumenteret protokol, fejl- og forbindelsestests, hardwaretest og danske/engelske brugertekster. Implementationskode skal placeres i denne mappe under `Plugins/`.
+
+## English
+
+0.0.001 status: **planned, not implemented**. Plugin ID: `androidremote`. The host registers a shared `PlannedPlugin` with an empty action list and `not_implemented` status. No driver, transport or app exists in this directory yet.
+
+Next priority after Stream Deck/PowerPoint/OBS. Establish whether this means an existing app or a new client. Then design mobile buttons, pairing, TLS, device authorization, revocation and status. Reuse protocol v1; do not expose the existing loopback host on the LAN. Never automatically replay commands after mobile reconnection.
+
+Acceptance requires a documented protocol, error and connection tests, hardware testing and Danish/English user text. Implementation code must be placed in this directory under `Plugins/`.
diff --git a/Plugins/Audio/README.md b/Plugins/Audio/README.md
new file mode 100644
index 0000000..eae281c
--- /dev/null
+++ b/Plugins/Audio/README.md
@@ -0,0 +1,17 @@
+# Lyd / Audio
+
+## Dansk
+
+Status i 0.0.001: **planlagt, ikke implementeret**. Plugin-id: `audio`. Hosten registrerer en fælles `PlannedPlugin` med tom handlingsliste og `not_implemented`-status. Der er ingen driver, transport eller app i denne mappe endnu.
+
+Separat styring af operativsystemets lydenheder. Afklar platform, enhedsvalg og ønskede funktioner. Windows Core Audio er en mulig fremtidig adapter, ikke implementeret. OBS input.mute findes allerede i OBS-pluginet.
+
+Accept kræver en dokumenteret protokol, fejl- og forbindelsestests, hardwaretest og danske/engelske brugertekster. Implementationskode skal placeres i denne mappe under `Plugins/`.
+
+## English
+
+0.0.001 status: **planned, not implemented**. Plugin ID: `audio`. The host registers a shared `PlannedPlugin` with an empty action list and `not_implemented` status. No driver, transport or app exists in this directory yet.
+
+Separate control of operating-system audio devices. Establish platform, device selection and required features. Windows Core Audio is a possible future adapter, not implemented. OBS input.mute is already part of the OBS plugin.
+
+Acceptance requires a documented protocol, error and connection tests, hardware testing and Danish/English user text. Implementation code must be placed in this directory under `Plugins/`.
diff --git a/Plugins/FluxKeyboard/README.md b/Plugins/FluxKeyboard/README.md
new file mode 100644
index 0000000..376ffcf
--- /dev/null
+++ b/Plugins/FluxKeyboard/README.md
@@ -0,0 +1,17 @@
+# Flux Keyboard / Flux Keyboard
+
+## Dansk
+
+Status i 0.0.001: **planlagt, ikke implementeret**. Plugin-id: `flux-keyboard`. Hosten registrerer en fælles `PlannedPlugin` med tom handlingsliste og `not_implemented`-status. Der er ingen driver, transport eller app i denne mappe endnu.
+
+Afklar præcis producent, model og tilgængelig dokumentation. Ingen antagelse om API eller SDK. Planlæg navngivne knaphændelser, status og capability-detektion efter verificering.
+
+Accept kræver en dokumenteret protokol, fejl- og forbindelsestests, hardwaretest og danske/engelske brugertekster. Implementationskode skal placeres i denne mappe under `Plugins/`.
+
+## English
+
+0.0.001 status: **planned, not implemented**. Plugin ID: `flux-keyboard`. The host registers a shared `PlannedPlugin` with an empty action list and `not_implemented` status. No driver, transport or app exists in this directory yet.
+
+Establish the exact vendor, model and available documentation. Do not assume an API or SDK. Plan named key events, status and capability detection after verification.
+
+Acceptance requires a documented protocol, error and connection tests, hardware testing and Danish/English user text. Implementation code must be placed in this directory under `Plugins/`.
diff --git a/Plugins/Logitech/README.md b/Plugins/Logitech/README.md
new file mode 100644
index 0000000..1d10e10
--- /dev/null
+++ b/Plugins/Logitech/README.md
@@ -0,0 +1,17 @@
+# Logitech / Logitech
+
+## Dansk
+
+Status i 0.0.001: **planlagt, ikke implementeret**. Plugin-id: `logitech`. Hosten registrerer en fælles `PlannedPlugin` med tom handlingsliste og `not_implemented`-status. Der er ingen driver, transport eller app i denne mappe endnu.
+
+Afklar konkret model og dokumenteret SDK/HID-protokol. Kortlæg enhedshændelser til navngivne kommandoer; anvend ikke globale tastaturgenveje.
+
+Accept kræver en dokumenteret protokol, fejl- og forbindelsestests, hardwaretest og danske/engelske brugertekster. Implementationskode skal placeres i denne mappe under `Plugins/`.
+
+## English
+
+0.0.001 status: **planned, not implemented**. Plugin ID: `logitech`. The host registers a shared `PlannedPlugin` with an empty action list and `not_implemented` status. No driver, transport or app exists in this directory yet.
+
+Establish the exact model and documented SDK/HID protocol. Map device events to named commands; do not use global keyboard shortcuts.
+
+Acceptance requires a documented protocol, error and connection tests, hardware testing and Danish/English user text. Implementation code must be placed in this directory under `Plugins/`.
diff --git a/Plugins/Obs/ControlHub.Plugins.Obs.csproj b/Plugins/Obs/ControlHub.Plugins.Obs.csproj
new file mode 100644
index 0000000..8f74cf8
--- /dev/null
+++ b/Plugins/Obs/ControlHub.Plugins.Obs.csproj
@@ -0,0 +1 @@
+
diff --git a/Plugins/Obs/ObsClient.cs b/Plugins/Obs/ObsClient.cs
new file mode 100644
index 0000000..6c3eaec
--- /dev/null
+++ b/Plugins/Obs/ObsClient.cs
@@ -0,0 +1,84 @@
+using System.Net.WebSockets;
+using System.Security.Cryptography;
+using System.Text;
+using System.Text.Json;
+using ControlHub.Contracts;
+
+namespace ControlHub.Plugins.Obs;
+
+public interface IObsClient
+{
+ Task RequestAsync(string requestType, object requestData, CancellationToken cancellationToken);
+}
+
+public sealed class ObsRequestException : Exception;
+public sealed class ObsClient : IObsClient
+{
+ private readonly Uri endpoint;
+ private readonly string? password;
+ public ObsClient(Uri endpoint, string? password)
+ {
+ if (!endpoint.IsLoopback || endpoint.Scheme != "ws" || !string.IsNullOrEmpty(endpoint.UserInfo) ||
+ endpoint.AbsolutePath != "/" || !string.IsNullOrEmpty(endpoint.Query) || !string.IsNullOrEmpty(endpoint.Fragment))
+ throw new ArgumentException("OBS must use a local ws:// endpoint / OBS skal bruge en lokal ws://-adresse.", nameof(endpoint));
+ this.endpoint = endpoint;
+ this.password = password;
+ }
+
+ public static string Authenticate(string password, string salt, string challenge)
+ {
+ var secret = Convert.ToBase64String(SHA256.HashData(Encoding.UTF8.GetBytes(password + salt)));
+ return Convert.ToBase64String(SHA256.HashData(Encoding.UTF8.GetBytes(secret + challenge)));
+ }
+
+ public async Task RequestAsync(string requestType, object requestData, CancellationToken cancellationToken)
+ {
+ using var socket = new ClientWebSocket();
+ await socket.ConnectAsync(endpoint, cancellationToken);
+ var hello = await ReceiveAsync(socket, cancellationToken);
+ if (hello.GetProperty("op").GetInt32() != 0) throw new ObsRequestException();
+ var identify = new Dictionary { ["rpcVersion"] = 1, ["eventSubscriptions"] = 0 };
+ if (hello.GetProperty("d").TryGetProperty("authentication", out var auth))
+ {
+ if (string.IsNullOrEmpty(password)) throw new ObsRequestException();
+ identify["authentication"] = Authenticate(password, auth.GetProperty("salt").GetString()!, auth.GetProperty("challenge").GetString()!);
+ }
+ await SendAsync(socket, new { op = 1, d = identify }, cancellationToken);
+ var identified = await ReceiveAsync(socket, cancellationToken);
+ if (identified.GetProperty("op").GetInt32() != 2 ||
+ identified.GetProperty("d").GetProperty("negotiatedRpcVersion").GetInt32() != 1) throw new ObsRequestException();
+ var requestId = Guid.NewGuid().ToString("D");
+ await SendAsync(socket, new { op = 6, d = new { requestType, requestId, requestData } }, cancellationToken);
+ while (true)
+ {
+ var response = await ReceiveAsync(socket, cancellationToken);
+ if (response.GetProperty("op").GetInt32() == 5) continue;
+ if (response.GetProperty("op").GetInt32() != 7) throw new ObsRequestException();
+ var data = response.GetProperty("d");
+ if (data.GetProperty("requestId").GetString() != requestId ||
+ data.GetProperty("requestType").GetString() != requestType) throw new ObsRequestException();
+ if (!data.GetProperty("requestStatus").GetProperty("result").GetBoolean()) throw new ObsRequestException();
+ return data.TryGetProperty("responseData", out var body) ? body.Clone() : null;
+ }
+ }
+
+ private static Task SendAsync(WebSocket socket, object message, CancellationToken cancellationToken)
+ => socket.SendAsync(new ArraySegment(JsonSerializer.SerializeToUtf8Bytes(message, Wire.Json)),
+ WebSocketMessageType.Text, true, cancellationToken);
+
+ private static async Task ReceiveAsync(WebSocket socket, CancellationToken cancellationToken)
+ {
+ using var stream = new MemoryStream();
+ var buffer = new byte[8192];
+ WebSocketReceiveResult result;
+ do
+ {
+ result = await socket.ReceiveAsync(new ArraySegment(buffer), cancellationToken);
+ if (result.MessageType != WebSocketMessageType.Text || stream.Length + result.Count > 1_048_576)
+ throw new ObsRequestException();
+ stream.Write(buffer, 0, result.Count);
+ } while (!result.EndOfMessage);
+ using var document = JsonDocument.Parse(stream.ToArray(), new JsonDocumentOptions { MaxDepth = 32 });
+ return document.RootElement.Clone();
+ }
+}
diff --git a/Plugins/Obs/ObsPlugin.cs b/Plugins/Obs/ObsPlugin.cs
new file mode 100644
index 0000000..01f7200
--- /dev/null
+++ b/Plugins/Obs/ObsPlugin.cs
@@ -0,0 +1,54 @@
+using ControlHub.Contracts;
+
+namespace ControlHub.Plugins.Obs;
+
+public sealed class ObsPlugin(IObsClient client) : IHubPlugin
+{
+ public PluginDescriptor Descriptor { get; } = new("obs", new("OBS Studio", "OBS Studio"), "experimental",
+ ["scene.switch", "record.start", "record.stop", "stream.start", "stream.stop", "input.mute"]);
+ public async ValueTask ExecuteAsync(Command command, CancellationToken cancellationToken)
+ {
+ string request;
+ object data = new { };
+ switch (command.Action)
+ {
+ case "scene.switch":
+ if (!Wire.OnlyArguments(command.Arguments, "sceneName") || !Wire.StringArgument(command.Arguments, "sceneName", out var scene))
+ return Invalid(command);
+ request = "SetCurrentProgramScene"; data = new { sceneName = scene }; break;
+ case "input.mute":
+ if (!Wire.OnlyArguments(command.Arguments, "inputName", "muted") ||
+ !Wire.StringArgument(command.Arguments, "inputName", out var input) ||
+ !command.Arguments.TryGetProperty("muted", out var mute) ||
+ mute.ValueKind is not (System.Text.Json.JsonValueKind.True or System.Text.Json.JsonValueKind.False))
+ return Invalid(command);
+ request = "SetInputMute"; data = new { inputName = input, inputMuted = mute.GetBoolean() }; break;
+ case "record.start": request = "StartRecord"; break;
+ case "record.stop": request = "StopRecord"; break;
+ case "stream.start": request = "StartStream"; break;
+ case "stream.stop": request = "StopStream"; break;
+ default: return Wire.Result(command, false, "unsupported_action", "Ukendt OBS-handling.", "Unknown OBS action.");
+ }
+ if (command.Action is not ("scene.switch" or "input.mute") && !Wire.OnlyArguments(command.Arguments)) return Invalid(command);
+ try
+ {
+ await client.RequestAsync(request, data, cancellationToken);
+ return Wire.Result(command, true, "ok", "OBS bekræftede handlingen.", "OBS acknowledged the action.");
+ }
+ catch (ObsRequestException)
+ {
+ return Wire.Result(command, false, "obs_rejected", "OBS-forbindelse eller handling afvist. Kontrollér status.",
+ "OBS connection or request rejected. Check status.");
+ }
+ }
+ private static CommandResult Invalid(Command command) => Wire.Result(command, false, "invalid_arguments", "Ugyldige OBS-argumenter.", "Invalid OBS arguments.");
+
+ public async ValueTask GetStatusAsync(CancellationToken cancellationToken)
+ {
+ var scene = await client.RequestAsync("GetCurrentProgramScene", new { }, cancellationToken);
+ var recording = await client.RequestAsync("GetRecordStatus", new { }, cancellationToken);
+ var streaming = await client.RequestAsync("GetStreamStatus", new { }, cancellationToken);
+ return new("obs", "ready", new("OBS tilsluttet.", "OBS connected."), Wire.Data(new { scene, recording, streaming }));
+ }
+ public ValueTask DisposeAsync() => ValueTask.CompletedTask;
+}
diff --git a/Plugins/Obs/README.md b/Plugins/Obs/README.md
new file mode 100644
index 0000000..6ebfcaa
--- /dev/null
+++ b/Plugins/Obs/README.md
@@ -0,0 +1,11 @@
+# Obs
+
+## Dansk
+Implementeret WebSocket v5-adapter; fysisk OBS-test afventer. Kun lokal server.
+
+Se [installation](../../docs/setup.da.md), [arkitektur](../../docs/project.da.md), [protokol](../../docs/protocol.da.md) og [testplan](../../docs/testing.da.md).
+
+## English
+Implemented WebSocket v5 adapter; physical OBS testing pending. Local server only.
+
+See [setup](../../docs/setup.en.md), [architecture](../../docs/project.en.md), [protocol](../../docs/protocol.en.md) and [test plan](../../docs/testing.en.md).
diff --git a/Plugins/PhysicalRemote/README.md b/Plugins/PhysicalRemote/README.md
new file mode 100644
index 0000000..934e604
--- /dev/null
+++ b/Plugins/PhysicalRemote/README.md
@@ -0,0 +1,17 @@
+# Fysisk fjernkontrol / Physical remote
+
+## Dansk
+
+Status i 0.0.001: **planlagt, ikke implementeret**. Plugin-id: `physical-remote`. Hosten registrerer en fælles `PlannedPlugin` med tom handlingsliste og `not_implemented`-status. Der er ingen driver, transport eller app i denne mappe endnu.
+
+Afklar USB, HID, seriel, Bluetooth eller netværk og den konkrete model. Kræv eksplicit enhedsvalg, debounce, tryk/slip-semantik og kontrolleret reconnect. Ingen fokusbaserede tastetryk.
+
+Accept kræver en dokumenteret protokol, fejl- og forbindelsestests, hardwaretest og danske/engelske brugertekster. Implementationskode skal placeres i denne mappe under `Plugins/`.
+
+## English
+
+0.0.001 status: **planned, not implemented**. Plugin ID: `physical-remote`. The host registers a shared `PlannedPlugin` with an empty action list and `not_implemented` status. No driver, transport or app exists in this directory yet.
+
+Establish USB, HID, serial, Bluetooth or network transport and the exact device model. Require explicit device selection, debounce, press/release semantics and controlled reconnect. No focus-based key injection.
+
+Acceptance requires a documented protocol, error and connection tests, hardware testing and Danish/English user text. Implementation code must be placed in this directory under `Plugins/`.
diff --git a/Plugins/Planned/ControlHub.Plugins.Planned.csproj b/Plugins/Planned/ControlHub.Plugins.Planned.csproj
new file mode 100644
index 0000000..8f74cf8
--- /dev/null
+++ b/Plugins/Planned/ControlHub.Plugins.Planned.csproj
@@ -0,0 +1 @@
+
diff --git a/Plugins/Planned/PlannedPlugin.cs b/Plugins/Planned/PlannedPlugin.cs
new file mode 100644
index 0000000..e253dc4
--- /dev/null
+++ b/Plugins/Planned/PlannedPlugin.cs
@@ -0,0 +1,15 @@
+using ControlHub.Contracts;
+
+namespace ControlHub.Plugins.Planned;
+
+// Explicit capability placeholders. They never report successful device execution.
+// Eksplicitte pladsholdere. De rapporterer aldrig vellykket enhedsstyring.
+public sealed class PlannedPlugin(string id, LocalizedText name) : IHubPlugin
+{
+ public PluginDescriptor Descriptor { get; } = new(id, name, "planned", []);
+ public ValueTask ExecuteAsync(Command command, CancellationToken cancellationToken)
+ => ValueTask.FromResult(Wire.Result(command, false, "not_implemented", "Integrationen er planlagt.", "Integration is planned."));
+ public ValueTask GetStatusAsync(CancellationToken cancellationToken)
+ => ValueTask.FromResult(new PluginStatus(Descriptor.Id, "not_implemented", new("Integrationen er planlagt.", "Integration is planned.")));
+ public ValueTask DisposeAsync() => ValueTask.CompletedTask;
+}
diff --git a/Plugins/Planned/README.md b/Plugins/Planned/README.md
new file mode 100644
index 0000000..a21234c
--- /dev/null
+++ b/Plugins/Planned/README.md
@@ -0,0 +1,11 @@
+# Planned
+
+## Dansk
+Fælles statuspladsholder for endnu ikke implementerede plugins. Udfører ingen enhedshandlinger.
+
+Se [installation](../../docs/setup.da.md), [arkitektur](../../docs/project.da.md), [protokol](../../docs/protocol.da.md) og [testplan](../../docs/testing.da.md).
+
+## English
+Shared status placeholder for unimplemented plugins. Executes no device actions.
+
+See [setup](../../docs/setup.en.md), [architecture](../../docs/project.en.md), [protocol](../../docs/protocol.en.md) and [test plan](../../docs/testing.en.md).
diff --git a/Plugins/PowerPoint/ComSlideShowSession.cs b/Plugins/PowerPoint/ComSlideShowSession.cs
new file mode 100644
index 0000000..b1821b3
--- /dev/null
+++ b/Plugins/PowerPoint/ComSlideShowSession.cs
@@ -0,0 +1,97 @@
+using System.Collections.Concurrent;
+using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
+
+namespace ControlHub.Plugins.PowerPoint;
+
+[SupportedOSPlatform("windows")]
+public sealed class ComSlideShowSession : ISlideShowSession
+{
+ private readonly BlockingCollection queue = new();
+ private readonly Thread thread;
+ private int disposed;
+ public ComSlideShowSession()
+ {
+ thread = new Thread(() => { foreach (var action in queue.GetConsumingEnumerable()) action(); })
+ { IsBackground = true, Name = "ControlHub.PowerPoint.STA" };
+ thread.SetApartmentState(ApartmentState.STA);
+ thread.Start();
+ }
+
+ private async Task InvokeAsync(Func action, CancellationToken cancellationToken)
+ {
+ ObjectDisposedException.ThrowIf(Volatile.Read(ref disposed) != 0, this);
+ var completion = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
+ queue.Add(() =>
+ {
+ if (cancellationToken.IsCancellationRequested) { completion.TrySetCanceled(cancellationToken); return; }
+ try { completion.TrySetResult(action()); }
+ catch (Exception ex) { completion.TrySetException(ex); }
+ }, cancellationToken);
+ // COM cannot be forcibly cancelled; the client must reconcile an unknown result.
+ // COM kan ikke tvangsafbrydes; klienten skal kontrollere status efter timeout.
+ return await completion.Task.WaitAsync(cancellationToken);
+ }
+
+ public Task ReadAsync(CancellationToken cancellationToken)
+ => InvokeAsync(() => WithView((view, count) => new SlideShowSnapshot((int)view.CurrentShowPosition, count, (int)view.State)), cancellationToken);
+
+ public async Task ApplyAsync(string action, int? slide, CancellationToken cancellationToken)
+ {
+ await InvokeAsync(() => WithView((view, count) =>
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ switch (action)
+ {
+ case "next": view.Next(); break;
+ case "previous": view.Previous(); break;
+ case "goto":
+ if (slide is null || slide < 1 || slide > count) throw new ArgumentOutOfRangeException(nameof(slide));
+ view.GotoSlide(slide.Value, -1); break;
+ case "black": view.State = 3; break;
+ case "resume": view.State = 1; break;
+ default: throw new ArgumentException("Unknown action / Ukendt handling.", nameof(action));
+ }
+ return true;
+ }), cancellationToken);
+ }
+
+ private static T WithView(Func action)
+ {
+ var objects = new List