# abel-root/serialbuscl architecture

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

- Interactive diagram: https://gitdiagram.com/abel-root/serialbuscl
- Repository: https://github.com/abel-root/serialbuscl

## Overview

SerialBusCL is a C++17 driver library for decoding ASCII bus frames, with a shared polymorphic interface and protocol-specific SLCAN and LinUSB implementations. The principal workflow is a caller supplying a line to `parseLine`, which validates and decodes it into a `Result`; the protocol parsers reuse shared hexadecimal helpers and generic string utilities. Protocol command and baud-rate definitions are part of the public APIs. The tree also exposes a serial-device interface, but the sampled code does not connect it to the parsers or show serial I/O. Edges reflect only documented inheritance and calls visible in the excerpts.

Main entry points: [`src/Slcan.cpp`](https://github.com/abel-root/serialbuscl/blob/master/src/Slcan.cpp) (SLCAN Parser), [`src/LinUSB.cpp`](https://github.com/abel-root/serialbuscl/blob/master/src/LinUSB.cpp) (LinUSB Parser), [`include/WireBus.h`](https://github.com/abel-root/serialbuscl/blob/master/include/WireBus.h) (WireBus API), [`src/WireBus.cpp`](https://github.com/abel-root/serialbuscl/blob/master/src/WireBus.cpp) (Frame Helpers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Shared API"]
  node_wirebus["WireBus API<br/>[WireBus.h]"]
  node_serial_device["Serial Device Interface<br/>[ISerialDevice.h]"]
end

subgraph group_protocols["Protocol Decoders"]
  node_slcan["SLCAN Parser<br/>[Slcan.cpp]"]
  node_linusb["LinUSB Parser<br/>[LinUSB.cpp]"]
end

subgraph group_helpers["Parsing Helpers"]
  node_wirebus_helpers["Frame Helpers<br/>[WireBus.cpp]"]
  node_utility["String Utilities<br/>[utility.h]"]
end

node_slcan -->|"implements"| node_wirebus
node_linusb -->|"implements"| node_wirebus
node_slcan -->|"uses frame helpers"| node_wirebus_helpers
node_linusb -->|"uses frame helpers"| node_wirebus_helpers
node_slcan -->|"uses utilities"| node_utility
node_linusb -->|"uses utilities"| node_utility

click node_wirebus "https://github.com/abel-root/serialbuscl/blob/master/include/WireBus.h"
click node_serial_device "https://github.com/abel-root/serialbuscl/blob/master/include/ISerialDevice.h"
click node_slcan "https://github.com/abel-root/serialbuscl/blob/master/src/Slcan.cpp"
click node_linusb "https://github.com/abel-root/serialbuscl/blob/master/src/LinUSB.cpp"
click node_wirebus_helpers "https://github.com/abel-root/serialbuscl/blob/master/src/WireBus.cpp"
click node_utility "https://github.com/abel-root/serialbuscl/blob/master/include/utility.h"

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_wirebus,node_serial_device toneBlue
class node_slcan,node_linusb toneAmber
class node_wirebus_helpers,node_utility toneMint
```

## Components

### Shared API

- [WireBus API](https://github.com/abel-root/serialbuscl/blob/master/include/WireBus.h): `include/WireBus.h`
- [Serial Device Interface](https://github.com/abel-root/serialbuscl/blob/master/include/ISerialDevice.h): `include/ISerialDevice.h`

### Protocol Decoders

- [SLCAN Parser](https://github.com/abel-root/serialbuscl/blob/master/src/Slcan.cpp): `src/Slcan.cpp`
- [LinUSB Parser](https://github.com/abel-root/serialbuscl/blob/master/src/LinUSB.cpp): `src/LinUSB.cpp`

### Parsing Helpers

- [Frame Helpers](https://github.com/abel-root/serialbuscl/blob/master/src/WireBus.cpp): `src/WireBus.cpp`
- [String Utilities](https://github.com/abel-root/serialbuscl/blob/master/include/utility.h): `include/utility.h`

## Connections

- SLCAN Parser → WireBus API: implements
- LinUSB Parser → WireBus API: implements
- SLCAN Parser → Frame Helpers: uses frame helpers (evidence: `src/Slcan.cpp`)
- LinUSB Parser → Frame Helpers: uses frame helpers (evidence: `src/LinUSB.cpp`)
- SLCAN Parser → String Utilities: uses utilities (evidence: `src/Slcan.cpp`)
- LinUSB Parser → String Utilities: uses utilities (evidence: `src/LinUSB.cpp`)
