You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part of the tutorial examples (#388). Tutorial 2 — getter/setter: per-attribute IO as getter/setter callables supplied in __init__ (AttrRW(getter=…, setter=…)), on the temperature-controller backend.
Retargeted from a standalone Thorlabs MFF device onto the temperature sim (per Tom, 2026-07-22) so the ladder keeps to two backends.
Scope
Add src/fastcs/demo/temperature_attr.py: a small temperature controller (e.g. ramp_rate, power) reusing the temperature sim; no bespoke device.
Baseline now (current callback-IO API) — use the single callable-wrapping IO + protocol shape, NOT one IO subclass per attribute:
a single generic TemperatureIO(AttributeIO[...]) registered once (ios=[TemperatureIO(conn)]) whose update/send just invoke callables carried on the ref;
a TemperatureIORef(AttributeIORef) carrying the command-building callables (read_cmd: Callable[[], str], write_cmd: Callable[[float], str] | None);
a single TemperatureProtocol class with one method per command (the getters/setters), referenced by each attribute's ref — mirrors fastcs-thorlabs-mff (MFFAttributeIO/MFFAttributeIORef/ThorlabsAPTProtocol).
Response parsing stays inline in TemperatureIO.update (float(...)), not a separate response_handler callable.
Part of the tutorial examples (#388). Tutorial 2 — getter/setter: per-attribute IO as
getter/settercallables supplied in__init__(AttrRW(getter=…, setter=…)), on the temperature-controller backend.Retargeted from a standalone Thorlabs MFF device onto the temperature sim (per Tom, 2026-07-22) so the ladder keeps to two backends.
Scope
src/fastcs/demo/temperature_attr.py: a small temperature controller (e.g.ramp_rate,power) reusing the temperature sim; no bespoke device.TemperatureIO(AttributeIO[...])registered once (ios=[TemperatureIO(conn)]) whoseupdate/sendjust invoke callables carried on the ref;TemperatureIORef(AttributeIORef)carrying the command-building callables (read_cmd: Callable[[], str],write_cmd: Callable[[float], str] | None);TemperatureProtocolclass with one method per command (the getters/setters), referenced by each attribute's ref — mirrorsfastcs-thorlabs-mff(MFFAttributeIO/MFFAttributeIORef/ThorlabsAPTProtocol).TemperatureIO.update(float(...)), not a separateresponse_handlercallable.read_cmd/write_cmdare the getter/setter; getter/setter IO rework; remove AttributeIORef and DataType #392 promotes them onto the constructor and deletes the IO/ref wrapper, whileTemperatureProtocolsurvives unchanged.AttrRW(Float(), getter=protocol.get_…, setter=protocol.set_…)(getter/setter constructor params; datatype inferred from the getter's return annotation).Notes
@attrdecorator form (@attr decorator sugar over getter/setter constructors #397) is the sugar over this same getter/setter; Example 1 — hello-world: pure-soft @attr decorator device #398 (hello-world) is the decorator's showcase.Acceptance
uv run --locked tox -e pre-commit,type-checking,testsgreen (full tox in real CI on the PR).ADR: 0014 (getter/setter), 0018 (
@attr)Priority: build this baseline before the framework issues.
Parent: #388
Blocked by: none