# plotjuggler/plotjuggler-can-dbs architecture

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

- Interactive diagram: https://gitdiagram.com/plotjuggler/plotjuggler-can-dbs
- Repository: https://github.com/plotjuggler/plotjuggler-can-dbs
- Video tour (about a minute): https://gitdiagram.com/plotjuggler/plotjuggler-can-dbs/video

## Overview

This repository provides two PlotJuggler CAN plugins: one imports candump logs, and the other streams frames from a live CAN interface. Both select a DBC database and protocol, then decode frames into PlotJuggler series; RAW, NMEA2K, and J1939 are distinct decoding modes. The shared processor also handles decoded signal metadata, while NMEA2K message support includes fast-packet assembly. The stream plugin is optional because it depends on Qt SerialBus. Some implementation excerpts are partial, so uncertain internal wiring is omitted.

Main entry points: [`PluginsCommonCAN/CanFrameProcessor.cpp`](https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/PluginsCommonCAN/CanFrameProcessor.cpp) (Frame processor), [`DataLoadCAN/dataload_can.cpp`](https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/DataLoadCAN/dataload_can.cpp) (Log loader), [`DataStreamCAN/datastream_can.cpp`](https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/DataStreamCAN/datastream_can.cpp) (Stream plugin), [`DataStreamCAN/connectdialog.cpp`](https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/DataStreamCAN/connectdialog.cpp) (Connection dialog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_loading["Log Import"]
  node_loader["Log loader<br/>[dataload_can.cpp]"]
end

subgraph group_streaming["Live Streaming"]
  node_streamplugin["Stream plugin<br/>[datastream_can.cpp]"]
  node_connectdialog["Connection dialog<br/>[connectdialog.cpp]"]
end

subgraph group_shared["Shared CAN Processing"]
  node_selectdb["Database selector"]
  node_processor["Frame processor"]
  node_protocols["Protocol decoding"]
  node_n2k["N2K messages<br/>[N2kMsgBase.h]"]
  node_fastpacket["Fast packets"]
end

subgraph group_plot["PlotJuggler Integration"]
  node_plotdata[("Plot data series")]
end

node_logfile(("candump log"))
node_canstream(("CAN interface"))
node_dbc["DBC parser"]
node_plotjuggler(("PlotJuggler"))

node_logfile -->|"loads"| node_loader
node_loader -->|"opens"| node_selectdb
node_loader -->|"creates"| node_processor
node_loader -->|"submits frames"| node_processor
node_connectdialog -->|"opens"| node_selectdb
node_connectdialog -->|"provides settings"| node_streamplugin
node_streamplugin -->|"connects"| node_canstream
node_canstream -->|"delivers frames"| node_streamplugin
node_streamplugin -->|"creates and submits"| node_processor
node_processor -->|"loads database"| node_dbc
node_processor -->|"dispatches decoding"| node_protocols
node_protocols -->|"decodes NMEA2K"| node_n2k
node_n2k -->|"unpacks packets"| node_fastpacket
node_processor -->|"writes decoded series"| node_plotdata
node_plotdata -->|"provides plot data"| node_plotjuggler

click node_loader "https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/DataLoadCAN/dataload_can.cpp"
click node_selectdb "https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/PluginsCommonCAN/select_can_database.cpp"
click node_streamplugin "https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/DataStreamCAN/datastream_can.cpp"
click node_connectdialog "https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/DataStreamCAN/connectdialog.cpp"
click node_processor "https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/PluginsCommonCAN/CanFrameProcessor.cpp"
click node_protocols "https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/PluginsCommonCAN/CanFrameProcessor.cpp"
click node_n2k "https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/PluginsCommonCAN/N2kMsg/N2kMsgBase.h"
click node_fastpacket "https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/PluginsCommonCAN/N2kMsg/GenericFastPacket.c"
click node_dbc "https://github.com/plotjuggler/plotjuggler-can-dbs/tree/development/3rdparty/dbcppp"

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_loader toneBlue
class node_streamplugin,node_connectdialog toneAmber
class node_selectdb,node_processor,node_protocols,node_n2k,node_fastpacket toneMint
class node_plotdata toneRose
class node_logfile,node_canstream,node_plotjuggler toneIndigo
class node_dbc toneTeal
```

## Components

### Log Import

- [Log loader](https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/DataLoadCAN/dataload_can.cpp): `DataLoadCAN/dataload_can.cpp`

### Live Streaming

- [Stream plugin](https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/DataStreamCAN/datastream_can.cpp): `DataStreamCAN/datastream_can.cpp`
- [Connection dialog](https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/DataStreamCAN/connectdialog.cpp): `DataStreamCAN/connectdialog.cpp`

### Shared CAN Processing

- [Database selector](https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/PluginsCommonCAN/select_can_database.cpp): `PluginsCommonCAN/select_can_database.cpp`
- [Frame processor](https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/PluginsCommonCAN/CanFrameProcessor.cpp): `PluginsCommonCAN/CanFrameProcessor.cpp`
- [Protocol decoding](https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/PluginsCommonCAN/CanFrameProcessor.cpp): `PluginsCommonCAN/CanFrameProcessor.cpp`
- [N2K messages](https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/PluginsCommonCAN/N2kMsg/N2kMsgBase.h): `PluginsCommonCAN/N2kMsg/N2kMsgBase.h`
- [Fast packets](https://github.com/plotjuggler/plotjuggler-can-dbs/blob/development/PluginsCommonCAN/N2kMsg/GenericFastPacket.c): `PluginsCommonCAN/N2kMsg/GenericFastPacket.c`

### PlotJuggler Integration

- **Plot data series**

### Other components

- **candump log**
- **CAN interface**
- [DBC parser](https://github.com/plotjuggler/plotjuggler-can-dbs/tree/development/3rdparty/dbcppp): `3rdparty/dbcppp`
- **PlotJuggler**

## Connections

- candump log → Log loader: loads
- Log loader → Database selector: opens
- Log loader → Frame processor: creates
- Log loader → Frame processor: submits frames
- Connection dialog → Database selector: opens
- Connection dialog → Stream plugin: provides settings
- Stream plugin → CAN interface: connects
- CAN interface → Stream plugin: delivers frames
- Stream plugin → Frame processor: creates and submits
- Frame processor → DBC parser: loads database
- Frame processor → Protocol decoding: dispatches decoding
- Protocol decoding → N2K messages: decodes NMEA2K
- N2K messages → Fast packets: unpacks packets
- Frame processor → Plot data series: writes decoded series
- Plot data series → PlotJuggler: provides plot data
