Scopy Component Relationships
Library Dependency Graph
┌──────────────┐
│ scopy-core │
└──────┬───────┘
┌───────────────┼───────────────────┐
│ │ │
┌──────▼───────┐ ┌─────▼──────┐ ┌──────────▼──────────┐
│scopy-pluginbase│ │ scopy-gui │ │ scopy-pkg-manager │
└──────┬───────┘ └─────┬──────┘ └─────────────────────┘
│ │
┌──────▼───────────────▼──────┐
│ scopy-common │
└──────┬──────────────────────┘
│
┌──────▼───────┐ ┌────────────────────┐
│ scopyiioutil │◄───│ scopy-iio-widgets │
└──────────────┘ └────────────────────┘
│
┌─────▼──────┐
│scopy-gr-util│
└────────────┘
Detailed link dependencies:
| Library |
Links Against |
scopy-common |
Qt Core/Widgets/Concurrent |
scopyiioutil |
Qt Widgets, libiio, libserialport |
scopy-gui |
scopy-common, scopy-pluginbase, QWT, Boost, Qt Widgets/Xml/Svg |
scopy-gr-util |
scopy-iioutil, scopy-gui, scopy-iio-widgets, Gnuradio (runtime/analog/blocks/fft/filter/pmt/iio), Genalyzer |
scopy-pluginbase |
scopy-common, scopyiioutil, Qt Core/Widgets/Concurrent/Qml, libiio |
scopy-iio-widgets |
scopy-gui, scopyiioutil, libiio, Qt Core/Widgets |
scopy-pkg-manager |
Qt Core |
scopy-core |
all above, Python3, libsigrokdecode, Qt Core/Widgets/Concurrent/Network |
Plugin Pattern Families
Device Plugins (hardware-specific)
Packages: ad936x, ad9371, adrv9002, adrv9009, apollo-ad9084, cn0511, daq2, fmcomms11, swiot, pqmon, imu, rfpowermeter
Common patterns:
compatible() checks IIO context for specific device names
- Use IIOWidgetBuilder extensively for attribute controls
- Create instrument/tool classes per device feature
- Often have gain widgets, frequency controls, calibration sections
- Use CyclicalTask/PingTask for device monitoring
- API class exposes Q_INVOKABLE methods for test automation
Generic Plugins
Package: generic-plugins
Plugins: ADC, DAC, Datalogger, Debugger, Regmap, JESD Status
Common patterns:
- Work with any IIO device (not device-specific compatible())
- ADC/DAC use GNU Radio pipeline (gr-util dependency)
- Debugger/Regmap are register-level tools
- Datalogger handles data recording across devices
Utility Plugins
Package: extproc (external processor), test-plugins
Patterns:
- extproc: External process management, plot management
- test-plugins: Development/testing utilities (default OFF)
MessageBroker Topics
The MessageBroker is a singleton pub/sub system. All plugins auto-subscribe to "broadcast".
Known topic conventions:
- Topic names typically match plugin class names (e.g., "TestPlugin", "TestPlugin2")
- "broadcast" — default topic, all plugins receive
- Device-specific topics for cross-plugin coordination
Usage pattern:
// Publisher plugin
MessageBroker::GetInstance()->publish("MyPlugin", "calibration_complete");
// Subscriber plugin (in constructor or init)
MessageBroker::GetInstance()->subscribe(this, "MyPlugin");
// Receive
void messageCallback(QString topic, QString message) override {
if(topic == "MyPlugin" && message == "calibration_complete") { /* react */ }
}
Shared IIOWidget Patterns
IIOWidgetBuilder is used across most device plugins. Common widget configurations:
| Widget Type |
Use Case |
Plugins Using It |
RangeUi |
Numeric attributes (frequency, gain) |
ad936x, adrv9002, adrv9009, generic ADC/DAC |
ComboUi |
Enumerated attributes (mode, filter) |
ad936x, adrv9002, swiot, generic |
CheckBoxUi |
Boolean attributes (enable/disable) |
swiot, pqmon |
EditableUi |
Free-form text attributes |
debugger, regmap |
TemperatureUi |
Temperature with thresholds |
imu, rfpowermeter |
IIOWidgetGroup — groups widgets for batch read/write operations. Most plugins create one group per tool/section.
Style System Flow
JSON theme files → Style::getAttribute() / Style::getColor()
→ Style::setStyle(widget, property)
→ Style::setBackgroundColor(widget, color)
Key theme color categories:
| Category |
Values |
Purpose |
| Background |
background_primary, background_subtle, background_secondary, background_plot |
Container backgrounds |
| Content |
content_default, content_subtle, content_silent, content_inverse |
Text and icons |
| Status |
content_success, content_error, content_busy |
Status indicators |
| Interactive |
interactive_primary_*, interactive_subtle_*, interactive_secondary_* |
Buttons, controls (idle/hover/pressed/disabled) |
| Special |
interactive_accent_idle, danger_default, interactive_focus |
Accent and danger states |
Common style properties:
Style::setStyle(widget, style::properties::label::menuBig);
Style::setStyle(widget, style::properties::widget::border_interactive);
Style::setStyle(widget, style::properties::widget::basicBackground, true, true);
Style::setBackgroundColor(widget, json::theme::background_primary);
Build System Relationships
Package enable flags:
ENABLE_PACKAGE_<NAME> — uppercase name with dashes preserved
ENABLE_ALL_PACKAGES=ON — enables everything
- Default ON for all except:
TEST-PLUGINS (OFF), EXTPROC (OFF)
Plugin enable flags (within a package):
ENABLE_PLUGIN_<NAME> — individual plugin control
- Defined by
add_plugins() function in PackageUtils.cmake
Available packages (16 total):
ad936x, ad9371, adrv9002, adrv9009, apollo-ad9084, cn0511, daq2, extproc, fmcomms11, generic-plugins, imu, m2k, pqmon, rfpowermeter, swiot, test-plugins
Cross-Cutting Concerns
Settings Persistence
- Plugin-level:
saveSettings(QSettings&) / loadSettings(QSettings&)
- Global:
Preferences::get/set() singleton
- Both backed by QSettings (INI file format)
Device Connection State
- DeviceImpl manages plugin lifecycle
m_connectedPlugins tracks which plugins are active
- PingTask monitors device health
connectionLost() signal triggers reconnection/warning UI
ScopyJS (JavaScript Engine)
- Enabled by default (
ENABLE_SCOPYJS=ON)
- API objects registered via
ScopyJS::GetInstance()->registerApi()
- Used for test automation and scripting
- Each plugin can expose one API object
1---2name: scopy-component-relationships3description: How Scopy libraries depend on each other, plugin commonalities, MessageBroker topics, shared widgets, style system flow, and build system relationships. Loaded when determining component interactions or change impact.4---56# Scopy Component Relationships78## Library Dependency Graph910```11 ┌──────────────┐12 │ scopy-core │13 └──────┬───────┘14 ┌───────────────┼───────────────────┐15 │ │ │16 ┌──────▼───────┐ ┌─────▼──────┐ ┌──────────▼──────────┐17 │scopy-pluginbase│ │ scopy-gui │ │ scopy-pkg-manager │18 └──────┬───────┘ └─────┬──────┘ └─────────────────────┘19 │ │20 ┌──────▼───────────────▼──────┐21 │ scopy-common │22 └──────┬──────────────────────┘23 │24 ┌──────▼───────┐ ┌────────────────────┐25 │ scopyiioutil │◄───│ scopy-iio-widgets │26 └──────────────┘ └────────────────────┘27 │28 ┌─────▼──────┐29 │scopy-gr-util│30 └────────────┘31```3233**Detailed link dependencies:**3435| Library | Links Against |36|---------|--------------|37| `scopy-common` | Qt Core/Widgets/Concurrent |38| `scopyiioutil` | Qt Widgets, libiio, libserialport |39| `scopy-gui` | scopy-common, scopy-pluginbase, QWT, Boost, Qt Widgets/Xml/Svg |40| `scopy-gr-util` | scopy-iioutil, scopy-gui, scopy-iio-widgets, Gnuradio (runtime/analog/blocks/fft/filter/pmt/iio), Genalyzer |41| `scopy-pluginbase` | scopy-common, scopyiioutil, Qt Core/Widgets/Concurrent/Qml, libiio |42| `scopy-iio-widgets` | scopy-gui, scopyiioutil, libiio, Qt Core/Widgets |43| `scopy-pkg-manager` | Qt Core |44| `scopy-core` | all above, Python3, libsigrokdecode, Qt Core/Widgets/Concurrent/Network |4546## Plugin Pattern Families4748### Device Plugins (hardware-specific)49**Packages:** ad936x, ad9371, adrv9002, adrv9009, apollo-ad9084, cn0511, daq2, fmcomms11, swiot, pqmon, imu, rfpowermeter5051**Common patterns:**52- `compatible()` checks IIO context for specific device names53- Use IIOWidgetBuilder extensively for attribute controls54- Create instrument/tool classes per device feature55- Often have gain widgets, frequency controls, calibration sections56- Use CyclicalTask/PingTask for device monitoring57- API class exposes Q_INVOKABLE methods for test automation5859### Generic Plugins60**Package:** generic-plugins61**Plugins:** ADC, DAC, Datalogger, Debugger, Regmap, JESD Status6263**Common patterns:**64- Work with any IIO device (not device-specific compatible())65- ADC/DAC use GNU Radio pipeline (gr-util dependency)66- Debugger/Regmap are register-level tools67- Datalogger handles data recording across devices6869### Utility Plugins70**Package:** extproc (external processor), test-plugins7172**Patterns:**73- extproc: External process management, plot management74- test-plugins: Development/testing utilities (default OFF)7576## MessageBroker Topics7778The MessageBroker is a singleton pub/sub system. All plugins auto-subscribe to "broadcast".7980**Known topic conventions:**81- Topic names typically match plugin class names (e.g., "TestPlugin", "TestPlugin2")82- "broadcast" — default topic, all plugins receive83- Device-specific topics for cross-plugin coordination8485**Usage pattern:**86```cpp87// Publisher plugin88MessageBroker::GetInstance()->publish("MyPlugin", "calibration_complete");8990// Subscriber plugin (in constructor or init)91MessageBroker::GetInstance()->subscribe(this, "MyPlugin");9293// Receive94void messageCallback(QString topic, QString message) override {95 if(topic == "MyPlugin" && message == "calibration_complete") { /* react */ }96}97```9899## Shared IIOWidget Patterns100101IIOWidgetBuilder is used across most device plugins. Common widget configurations:102103| Widget Type | Use Case | Plugins Using It |104|-------------|----------|-----------------|105| `RangeUi` | Numeric attributes (frequency, gain) | ad936x, adrv9002, adrv9009, generic ADC/DAC |106| `ComboUi` | Enumerated attributes (mode, filter) | ad936x, adrv9002, swiot, generic |107| `CheckBoxUi` | Boolean attributes (enable/disable) | swiot, pqmon |108| `EditableUi` | Free-form text attributes | debugger, regmap |109| `TemperatureUi` | Temperature with thresholds | imu, rfpowermeter |110111**IIOWidgetGroup** — groups widgets for batch read/write operations. Most plugins create one group per tool/section.112113## Style System Flow114115```116JSON theme files → Style::getAttribute() / Style::getColor()117 → Style::setStyle(widget, property)118 → Style::setBackgroundColor(widget, color)119```120121**Key theme color categories:**122123| Category | Values | Purpose |124|----------|--------|---------|125| Background | `background_primary`, `background_subtle`, `background_secondary`, `background_plot` | Container backgrounds |126| Content | `content_default`, `content_subtle`, `content_silent`, `content_inverse` | Text and icons |127| Status | `content_success`, `content_error`, `content_busy` | Status indicators |128| Interactive | `interactive_primary_*`, `interactive_subtle_*`, `interactive_secondary_*` | Buttons, controls (idle/hover/pressed/disabled) |129| Special | `interactive_accent_idle`, `danger_default`, `interactive_focus` | Accent and danger states |130131**Common style properties:**132```cpp133Style::setStyle(widget, style::properties::label::menuBig);134Style::setStyle(widget, style::properties::widget::border_interactive);135Style::setStyle(widget, style::properties::widget::basicBackground, true, true);136Style::setBackgroundColor(widget, json::theme::background_primary);137```138139## Build System Relationships140141**Package enable flags:**142- `ENABLE_PACKAGE_<NAME>` — uppercase name with dashes preserved143- `ENABLE_ALL_PACKAGES=ON` — enables everything144- Default ON for all except: `TEST-PLUGINS` (OFF), `EXTPROC` (OFF)145146**Plugin enable flags (within a package):**147- `ENABLE_PLUGIN_<NAME>` — individual plugin control148- Defined by `add_plugins()` function in PackageUtils.cmake149150**Available packages (16 total):**151ad936x, ad9371, adrv9002, adrv9009, apollo-ad9084, cn0511, daq2, extproc, fmcomms11, generic-plugins, imu, m2k, pqmon, rfpowermeter, swiot, test-plugins152153## Cross-Cutting Concerns154155### Settings Persistence156- Plugin-level: `saveSettings(QSettings&)` / `loadSettings(QSettings&)`157- Global: `Preferences::get/set()` singleton158- Both backed by QSettings (INI file format)159160### Device Connection State161- DeviceImpl manages plugin lifecycle162- `m_connectedPlugins` tracks which plugins are active163- PingTask monitors device health164- `connectionLost()` signal triggers reconnection/warning UI165166### ScopyJS (JavaScript Engine)167- Enabled by default (`ENABLE_SCOPYJS=ON`)168- API objects registered via `ScopyJS::GetInstance()->registerApi()`169- Used for test automation and scripting170- Each plugin can expose one API object