- Starlight docs: 28 pages covering getting started, guides, tool reference, concepts (architecture, dynamic tools, runtime comms) - LoRa examples: channel scanner, quality analyzer, multi-SF receiver with both .grc and .py forms, plus ADSB+LoRa combo test - .gitignore: exclude generated artifacts (*_patched_*.py, *.wav, docs build cache, tests/scratch/) - Add .mcp.json for local MCP server config - Sync uv.lock with date-based version
114 lines
2.1 KiB
Plaintext
114 lines
2.1 KiB
Plaintext
---
|
|
title: Connection Tools
|
|
description: Tools for wiring blocks together
|
|
draft: false
|
|
---
|
|
|
|
Tools for managing connections (wires) between blocks.
|
|
|
|
## `get_connections`
|
|
|
|
List all connections in the flowgraph.
|
|
|
|
### Returns
|
|
|
|
**Type:** `list[ConnectionModel]`
|
|
|
|
List of connections with source/sink block names and port keys.
|
|
|
|
### Example
|
|
|
|
```python
|
|
connections = get_connections()
|
|
# Returns: [
|
|
# ConnectionModel(
|
|
# source_block="osmosdr_source_0", source_port="0",
|
|
# sink_block="low_pass_filter_0", sink_port="0"
|
|
# ),
|
|
# ...
|
|
# ]
|
|
```
|
|
|
|
---
|
|
|
|
## `connect_blocks`
|
|
|
|
Connect two blocks by their ports.
|
|
|
|
### Parameters
|
|
|
|
| Name | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `source_block_name` | `str` | - | Name of source block |
|
|
| `sink_block_name` | `str` | - | Name of sink block |
|
|
| `source_port_name` | `str` | - | Port key on source block |
|
|
| `sink_port_name` | `str` | - | Port key on sink block |
|
|
|
|
### Returns
|
|
|
|
**Type:** `bool`
|
|
|
|
True if successful.
|
|
|
|
### Example
|
|
|
|
```python
|
|
connect_blocks(
|
|
source_block_name="osmosdr_source_0",
|
|
sink_block_name="low_pass_filter_0",
|
|
source_port_name="0",
|
|
sink_port_name="0"
|
|
)
|
|
# Returns: True
|
|
```
|
|
|
|
### Notes
|
|
|
|
- Use `get_block_sources()` and `get_block_sinks()` to discover available ports
|
|
- Most blocks use port `"0"` for their primary input/output
|
|
- Port types must be compatible (e.g., both complex, both float)
|
|
|
|
---
|
|
|
|
## `disconnect_blocks`
|
|
|
|
Disconnect two blocks.
|
|
|
|
### Parameters
|
|
|
|
| Name | Type | Default | Description |
|
|
|------|------|---------|-------------|
|
|
| `source_port` | `PortModel` | - | Source port to disconnect |
|
|
| `sink_port` | `PortModel` | - | Sink port to disconnect |
|
|
|
|
### Returns
|
|
|
|
**Type:** `bool`
|
|
|
|
True if successful.
|
|
|
|
### Example
|
|
|
|
```python
|
|
# Get the connection to disconnect
|
|
connections = get_connections()
|
|
conn = connections[0]
|
|
|
|
disconnect_blocks(
|
|
source_port=PortModel(
|
|
parent=conn.source_block,
|
|
key=conn.source_port,
|
|
name="out",
|
|
dtype="complex",
|
|
direction="source"
|
|
),
|
|
sink_port=PortModel(
|
|
parent=conn.sink_block,
|
|
key=conn.sink_port,
|
|
name="in",
|
|
dtype="complex",
|
|
direction="sink"
|
|
)
|
|
)
|
|
```
|