From 5c60e2eb58618fed1e925e96d06b0717073faa43 Mon Sep 17 00:00:00 2001 From: Ferdinand Schober Date: Tue, 3 Jan 2023 22:44:31 +0100 Subject: [PATCH] some documentation --- DOC.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 DOC.md diff --git a/DOC.md b/DOC.md new file mode 100644 index 0000000..461c61a --- /dev/null +++ b/DOC.md @@ -0,0 +1,53 @@ +# General Software Architecture + +## Events + +Each instance of lan-mouse can emit and receive events, where +an event is either a mouse or keyboard event for now. + +The general Architecture is shown in the following flow chart: +```mermaid +graph TD + A[Wayland Backend] -->|WaylandEvent| D{Input} + B[X11 Backend] -->|X11Event| D{Input} + C[Windows Backend] -->|WindowsEvent| D{Input} + D -->|Abstract Event| E[Emitter] + E -->|Udp Event| F[Receiver] + F -->|Abstract Event| G{Dispatcher} + G -->|Wayland Event| H[Wayland Backend] + G -->|X11 Event| I[X11 Backend] + G -->|Windows Event| J[Windows Backend] +``` + +### Input +The input component is responsible for translating inputs from a given backend +to a standardized format and passing them to the event emitter. + +### Emitter +The event emitter serializes events and sends them over the network +to the correct client. + +### Receiver +The receiver receives events over the network and deserializes them into +the standardized event format. + +### Dispatcher +The dispatcher component takes events from the event receiver and passes them +to the correct backend corresponding to the type of client. + + +## Requests + +// TODO this currently works differently + +Aside from events, requests can be sent via a simple protocol. +For this, a simple tcp server is listening on the same port as the udp +event receiver and accepts requests for connecting to a device or to +request the keymap of a device. + +```mermaid +sequenceDiagram + Alice->>+Bob: Request Connection (secret) + Bob-->>-Alice: Ack (Keyboard Layout) +``` +