# tomermeidan/cc architecture

> Architecture diagram of the GitHub repository tomermeidan/cc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tomermeidan/cc
- Repository: https://github.com/tomermeidan/cc

## Overview

EncoderHub is a WPF encoder-control application with a vendor-neutral driver contract and concrete iC-Haus PZ1SL and MHM1SL drivers. The main workflow is selecting a registered driver, connecting or resetting it, polling position, and issuing a preset—with optional EEPROM storage. Driver-specific communication is isolated behind the contract; the MHM driver uses a managed native wrapper, while PZ delegates to an external controller library. Some UI wiring and PZ internals are unsampled, so their relationships are omitted where not evidenced.

Main entry points: [`EncoderHub.App/ViewModels/DriverControlViewModel.cs`](https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/ViewModels/DriverControlViewModel.cs) (Driver Controls), [`EncoderHub.App/App.xaml.cs`](https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/App.xaml.cs) (App Startup), [`EncoderHub.Driver.PZ1SL/PZ1SLDriver.cs`](https://github.com/tomermeidan/cc/blob/main/EncoderHub.Driver.PZ1SL/PZ1SLDriver.cs) (PZ1SL Driver), [`EncoderHub.Driver.MHM1SL/MHM1SLDriver.cs`](https://github.com/tomermeidan/cc/blob/main/EncoderHub.Driver.MHM1SL/MHM1SLDriver.cs) (MHM1SL Driver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application UI"]
  node_app_startup["App Startup<br/>[App.xaml.cs]"]
  node_main_window["Main Window<br/>[MainWindow.xaml.cs]"]
  node_main_vm["Main ViewModel<br/>[MainViewModel.cs]"]
  node_control_vm["Driver Controls"]
  node_relay_command["Relay Commands<br/>[RelayCommand.cs]"]
  node_base_vm["ViewModel Base<br/>[BaseViewModel.cs]"]
  node_driver_view["Driver Control View"]
  node_radial_gauge["Radial Gauge<br/>[RadialGauge.cs]"]
end

subgraph group_platform["Driver Platform"]
  node_registry["Driver Registry<br/>[DriverRegistry.cs]"]
  node_driver_contract["Driver Contract<br/>[IEncoderDriver.cs]"]
end

subgraph group_pz["PZ1SL Driver"]
  node_pz_driver["PZ1SL Driver<br/>[PZ1SLDriver.cs]"]
  node_pz_config["PZ Configuration"]
  node_pz_controller["PZ Controller Library"]
end

subgraph group_mhm["MHM1SL Driver"]
  node_mhm_driver["MHM1SL Driver<br/>[MHM1SLDriver.cs]"]
  node_mhm_config["MHM Configuration"]
  node_mhm_wrapper["MHM Native Wrapper<br/>[MHM1SLWrapper.cs]"]
  node_mhm_interop["MHM Interop Types<br/>[Interop]"]
end

node_operator(("Operator"))
node_mhm_native["MHM Native DLL"]

node_operator -.->|"uses"| node_main_window
node_app_startup -->|"registers"| node_registry
node_app_startup -->|"registers"| node_control_vm
node_app_startup -->|"registers"| node_main_vm
node_app_startup -->|"opens"| node_main_window
node_main_window -->|"uses"| node_main_vm
node_main_vm -->|"exposes"| node_control_vm
node_control_vm -->|"loads drivers"| node_registry
node_control_vm -->|"commands and polls"| node_driver_contract
node_control_vm -->|"creates commands"| node_relay_command
node_control_vm -->|"inherits"| node_base_vm
node_registry -->|"instantiates"| node_pz_driver
node_registry -->|"instantiates"| node_mhm_driver
node_pz_driver -->|"implements"| node_driver_contract
node_mhm_driver -->|"implements"| node_driver_contract
node_pz_driver -->|"uses settings"| node_pz_config
node_pz_driver -->|"delegates connect and reads"| node_pz_controller
node_mhm_driver -->|"uses settings"| node_mhm_config
node_mhm_driver -->|"calls"| node_mhm_wrapper
node_mhm_wrapper -->|"uses declarations"| node_mhm_interop
node_mhm_wrapper -->|"invokes"| node_mhm_native

click node_app_startup "https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/App.xaml.cs"
click node_main_window "https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/MainWindow.xaml.cs"
click node_main_vm "https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/ViewModels/MainViewModel.cs"
click node_control_vm "https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/ViewModels/DriverControlViewModel.cs"
click node_relay_command "https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/ViewModels/RelayCommand.cs"
click node_base_vm "https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/ViewModels/BaseViewModel.cs"
click node_driver_view "https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/Views/DriverControlView.xaml"
click node_radial_gauge "https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/Controls/RadialGauge.cs"
click node_registry "https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/Models/DriverRegistry.cs"
click node_driver_contract "https://github.com/tomermeidan/cc/blob/main/EncoderHub.Abstractions/IEncoderDriver.cs"
click node_pz_driver "https://github.com/tomermeidan/cc/blob/main/EncoderHub.Driver.PZ1SL/PZ1SLDriver.cs"
click node_pz_config "https://github.com/tomermeidan/cc/blob/main/EncoderHub.Driver.PZ1SL/PZ1SLDriverConfiguration.cs"
click node_mhm_driver "https://github.com/tomermeidan/cc/blob/main/EncoderHub.Driver.MHM1SL/MHM1SLDriver.cs"
click node_mhm_config "https://github.com/tomermeidan/cc/blob/main/EncoderHub.Driver.MHM1SL/MHM1SLDriverConfiguration.cs"
click node_mhm_wrapper "https://github.com/tomermeidan/cc/blob/main/EncoderHub.Driver.MHM1SL/MHM1SLWrapper.cs"
click node_mhm_interop "https://github.com/tomermeidan/cc/tree/main/EncoderHub.Driver.MHM1SL/Interop"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_startup,node_main_window,node_main_vm,node_control_vm,node_relay_command,node_base_vm,node_driver_view,node_radial_gauge toneBlue
class node_registry,node_driver_contract toneAmber
class node_pz_driver,node_pz_config,node_pz_controller toneMint
class node_mhm_driver,node_mhm_config,node_mhm_wrapper,node_mhm_interop toneRose
class node_operator,node_mhm_native toneIndigo
```

## Components

### Application UI

- [App Startup](https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/App.xaml.cs): `EncoderHub.App/App.xaml.cs`
- [Main Window](https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/MainWindow.xaml.cs): `EncoderHub.App/MainWindow.xaml.cs`
- [Main ViewModel](https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/ViewModels/MainViewModel.cs): `EncoderHub.App/ViewModels/MainViewModel.cs`
- [Driver Controls](https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/ViewModels/DriverControlViewModel.cs): `EncoderHub.App/ViewModels/DriverControlViewModel.cs`
- [Relay Commands](https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/ViewModels/RelayCommand.cs): `EncoderHub.App/ViewModels/RelayCommand.cs`
- [ViewModel Base](https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/ViewModels/BaseViewModel.cs): `EncoderHub.App/ViewModels/BaseViewModel.cs`
- [Driver Control View](https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/Views/DriverControlView.xaml): `EncoderHub.App/Views/DriverControlView.xaml`
- [Radial Gauge](https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/Controls/RadialGauge.cs): `EncoderHub.App/Controls/RadialGauge.cs`

### Driver Platform

- [Driver Registry](https://github.com/tomermeidan/cc/blob/main/EncoderHub.App/Models/DriverRegistry.cs): `EncoderHub.App/Models/DriverRegistry.cs`
- [Driver Contract](https://github.com/tomermeidan/cc/blob/main/EncoderHub.Abstractions/IEncoderDriver.cs): `EncoderHub.Abstractions/IEncoderDriver.cs`

### PZ1SL Driver

- [PZ1SL Driver](https://github.com/tomermeidan/cc/blob/main/EncoderHub.Driver.PZ1SL/PZ1SLDriver.cs): `EncoderHub.Driver.PZ1SL/PZ1SLDriver.cs`
- [PZ Configuration](https://github.com/tomermeidan/cc/blob/main/EncoderHub.Driver.PZ1SL/PZ1SLDriverConfiguration.cs): `EncoderHub.Driver.PZ1SL/PZ1SLDriverConfiguration.cs`
- **PZ Controller Library**

### MHM1SL Driver

- [MHM1SL Driver](https://github.com/tomermeidan/cc/blob/main/EncoderHub.Driver.MHM1SL/MHM1SLDriver.cs): `EncoderHub.Driver.MHM1SL/MHM1SLDriver.cs`
- [MHM Configuration](https://github.com/tomermeidan/cc/blob/main/EncoderHub.Driver.MHM1SL/MHM1SLDriverConfiguration.cs): `EncoderHub.Driver.MHM1SL/MHM1SLDriverConfiguration.cs`
- [MHM Native Wrapper](https://github.com/tomermeidan/cc/blob/main/EncoderHub.Driver.MHM1SL/MHM1SLWrapper.cs): `EncoderHub.Driver.MHM1SL/MHM1SLWrapper.cs`
- [MHM Interop Types](https://github.com/tomermeidan/cc/tree/main/EncoderHub.Driver.MHM1SL/Interop): `EncoderHub.Driver.MHM1SL/Interop`

### Other components

- **Operator**
- **MHM Native DLL**

## Connections

- Operator → Main Window: uses
- App Startup → Driver Registry: registers (evidence: `EncoderHub.App/App.xaml.cs`)
- App Startup → Driver Controls: registers (evidence: `EncoderHub.App/App.xaml.cs`)
- App Startup → Main ViewModel: registers (evidence: `EncoderHub.App/App.xaml.cs`)
- App Startup → Main Window: opens (evidence: `EncoderHub.App/App.xaml.cs`)
- Main Window → Main ViewModel: uses (evidence: `EncoderHub.App/MainWindow.xaml.cs`)
- Main ViewModel → Driver Controls: exposes (evidence: `EncoderHub.App/ViewModels/MainViewModel.cs`)
- Driver Controls → Driver Registry: loads drivers (evidence: `EncoderHub.App/ViewModels/DriverControlViewModel.cs`)
- Driver Controls → Driver Contract: commands and polls (evidence: `EncoderHub.App/ViewModels/DriverControlViewModel.cs`)
- Driver Controls → Relay Commands: creates commands (evidence: `EncoderHub.App/ViewModels/DriverControlViewModel.cs`)
- Driver Controls → ViewModel Base: inherits (evidence: `EncoderHub.App/ViewModels/DriverControlViewModel.cs`)
- Driver Registry → PZ1SL Driver: instantiates (evidence: `EncoderHub.App/Models/DriverRegistry.cs`)
- Driver Registry → MHM1SL Driver: instantiates (evidence: `EncoderHub.App/Models/DriverRegistry.cs`)
- PZ1SL Driver → Driver Contract: implements (evidence: `EncoderHub.Driver.PZ1SL/PZ1SLDriver.cs`)
- MHM1SL Driver → Driver Contract: implements (evidence: `EncoderHub.Driver.MHM1SL/MHM1SLDriver.cs`)
- PZ1SL Driver → PZ Configuration: uses settings (evidence: `EncoderHub.Driver.PZ1SL/PZ1SLDriver.cs`)
- PZ1SL Driver → PZ Controller Library: delegates connect and reads (evidence: `EncoderHub.Driver.PZ1SL/PZ1SLDriver.cs`)
- MHM1SL Driver → MHM Configuration: uses settings (evidence: `EncoderHub.Driver.MHM1SL/MHM1SLDriver.cs`)
- MHM1SL Driver → MHM Native Wrapper: calls (evidence: `EncoderHub.Driver.MHM1SL/MHM1SLDriver.cs`)
- MHM Native Wrapper → MHM Interop Types: uses declarations (evidence: `EncoderHub.Driver.MHM1SL/MHM1SLWrapper.cs`)
- MHM Native Wrapper → MHM Native DLL: invokes (evidence: `EncoderHub.Driver.MHM1SL/MHM1SLWrapper.cs`)
