diff --git a/src/fastcs/backends/epics/gui.py b/src/fastcs/backends/epics/gui.py index 31b2dce5..4c66b1df 100644 --- a/src/fastcs/backends/epics/gui.py +++ b/src/fastcs/backends/epics/gui.py @@ -16,6 +16,7 @@ SignalRW, SignalW, SignalX, + TextFormat, TextRead, TextWrite, Tree, @@ -23,7 +24,7 @@ ) from fastcs.attributes import Attribute, AttrR, AttrRW, AttrW -from fastcs.datatypes import Bool, DataType, Float, Int +from fastcs.datatypes import Bool, DataType, Float, Int, String from fastcs.exceptions import FastCSException from fastcs.mapping import Mapping @@ -62,6 +63,8 @@ def _get_read_widget(datatype: DataType) -> ReadWidget: return LED() case Int() | Float(): return TextRead() + case String(): + return TextRead(format=TextFormat.string) case _: raise FastCSException(f"Unsupported type {type(datatype)}: {datatype}") @@ -72,6 +75,8 @@ def _get_write_widget(datatype: DataType) -> WriteWidget: return CheckBox() case Int() | Float(): return TextWrite() + case String(): + return TextRead(format=TextFormat.string) case _: raise FastCSException(f"Unsupported type {type(datatype)}: {datatype}") diff --git a/src/fastcs/backends/epics/ioc.py b/src/fastcs/backends/epics/ioc.py index adc14758..583eb0a8 100644 --- a/src/fastcs/backends/epics/ioc.py +++ b/src/fastcs/backends/epics/ioc.py @@ -7,7 +7,7 @@ from fastcs.attributes import AttrR, AttrRW, AttrW from fastcs.backend import Backend -from fastcs.datatypes import Bool, DataType, Float, Int +from fastcs.datatypes import Bool, DataType, Float, Int, String from fastcs.exceptions import FastCSException from fastcs.mapping import Mapping @@ -25,6 +25,8 @@ def _get_input_record(pv_name: str, datatype: DataType) -> RecordWrapper: return builder.longIn(pv_name) case Float(prec): return builder.aIn(pv_name, PREC=prec) + case String(): + return builder.longStringIn(pv_name) case _: raise FastCSException(f"Unsupported type {type(datatype)}: {datatype}") @@ -54,6 +56,10 @@ def _get_output_record(pv_name: str, datatype: DataType, on_update: Callable) -> return builder.aOut( pv_name, always_update=True, on_update=on_update, PREC=prec ) + case String(): + return builder.longStringOut( + pv_name, always_update=True, on_update=on_update + ) case _: raise FastCSException(f"Unsupported type {type(datatype)}: {datatype}")