mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-04-12 11:11:29 +03:00
some documentation
This commit is contained in:
53
DOC.md
Normal file
53
DOC.md
Normal file
@@ -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)
|
||||||
|
```
|
||||||
|
|
||||||
Reference in New Issue
Block a user