Run Multiple Transports Simultaneously#
This guide shows how to expose a fastcs driver through multiple protocols at once.
Basic Setup#
Pass a list of transports to FastCS:
from fastcs.control_system import FastCS
from fastcs.transports import (
EpicsCATransport,
EpicsIOCOptions,
GraphQLTransport,
RestTransport,
)
controller = MyController()
fastcs = FastCS(
controller,
[
EpicsCATransport(epicsca=EpicsIOCOptions(pv_prefix="DEVICE")),
RestTransport(),
GraphQLTransport(),
]
)
fastcs.run()
All transports run concurrently, exposing the same controller API.
Available Transports#
Transport |
Protocol |
Install Extra |
Primary Use Case |
|---|---|---|---|
|
EPICS Channel Access |
|
Control system integration |
|
EPICS PV Access |
|
Modern EPICS with structured data |
|
Tango |
|
Tango control system |
|
HTTP REST |
|
Web applications, debugging |
|
GraphQL |
|
Flexible queries, web clients |
Install extras as needed:
pip install "fastcs[epicsca,rest,graphql]"
Transport Configuration#
Each transport has its own options:
EPICS Channel Access#
from pathlib import Path
from fastcs.transports import (
EpicsCATransport,
EpicsDocsOptions,
EpicsGUIOptions,
EpicsIOCOptions,
)
epics_ca = EpicsCATransport(
epicsca=EpicsIOCOptions(pv_prefix="DEVICE"),
gui=EpicsGUIOptions(
output_path=Path(".") / "device.bob",
title="Device Control",
),
docs=EpicsDocsOptions(
output_path=Path(".") / "device.csv",
),
)
EPICS PV Access#
from fastcs.transports import EpicsPVATransport, EpicsIOCOptions
epics_pva = EpicsPVATransport(
epicspva=EpicsIOCOptions(pv_prefix="DEVICE"),
)
REST#
from fastcs.transports import RestTransport
from fastcs.transports.rest import RestServerOptions
rest = RestTransport(
rest=RestServerOptions(
host="0.0.0.0",
port=8080,
log_level="info",
)
)
GraphQL#
from fastcs.transports import GraphQLTransport
from fastcs.transports.graphql import GraphQLServerOptions
graphql = GraphQLTransport(
graphql=GraphQLServerOptions(
host="localhost",
port=8081,
)
)
Tango#
from fastcs.transports import TangoTransport, TangoDSROptions
tango = TangoTransport(
tango=TangoDSROptions(
device_name="test/device/1",
),
)
EPICS CA + PVA Together#
Run both EPICS protocols simultaneously:
from pathlib import Path
from fastcs.transports import (
EpicsCATransport,
EpicsGUIOptions,
EpicsIOCOptions,
EpicsPVATransport,
)
fastcs = FastCS(
controller,
[
EpicsCATransport(
epicsca=EpicsIOCOptions(pv_prefix="DEVICE"),
gui=EpicsGUIOptions(output_path=Path(".") / "device.bob"),
),
EpicsPVATransport(
epicspva=EpicsIOCOptions(pv_prefix="DEVICE"),
),
]
)
Both transports share the same PV prefix and expose identical PVs.
YAML Configuration#
When using the launch() framework, configure transports in YAML.
See Using the Launch Framework for details.