@@ -187,9 +187,11 @@ def _get_input_record(pv: str, attribute: AttrR) -> RecordWrapper:
187187 case Bool (znam , onam ):
188188 return builder .boolIn (pv , ZNAM = znam , ONAM = onam , ** attribute_fields )
189189 case Int ():
190- return builder .longIn (pv , ** attribute_fields )
190+ return builder .longIn (pv , EGU = attribute . datatype . units , ** attribute_fields )
191191 case Float (prec ):
192- return builder .aIn (pv , PREC = prec , ** attribute_fields )
192+ return builder .aIn (
193+ pv , EGU = attribute .datatype .units , PREC = prec , ** attribute_fields
194+ )
193195 case String ():
194196 return builder .longStringIn (pv , ** attribute_fields )
195197 case _:
@@ -236,7 +238,13 @@ def _get_output_record(pv: str, attribute: AttrW, on_update: Callable) -> Any:
236238 isinstance (v , str ) for v in attribute .allowed_values
237239 )
238240 state_keys = dict (zip (MBB_STATE_FIELDS , attribute .allowed_values , strict = False ))
239- return builder .mbbOut (pv , always_update = True , on_update = on_update , ** state_keys , ** attribute_fields )
241+ return builder .mbbOut (
242+ pv ,
243+ always_update = True ,
244+ on_update = on_update ,
245+ ** state_keys ,
246+ ** attribute_fields ,
247+ )
240248
241249 match attribute .datatype :
242250 case Bool (znam , onam ):
@@ -247,12 +255,27 @@ def _get_output_record(pv: str, attribute: AttrW, on_update: Callable) -> Any:
247255 always_update = True ,
248256 on_update = on_update ,
249257 )
250- case Int ():
251- return builder .longOut (pv , always_update = True , on_update = on_update , ** attribute_fields )
252- case Float (prec ):
253- return builder .aOut (pv , always_update = True , on_update = on_update , PREC = prec , ** attribute_fields )
258+ case Int (units = units ):
259+ return builder .longOut (
260+ pv ,
261+ always_update = True ,
262+ on_update = on_update ,
263+ EGU = units ,
264+ ** attribute_fields ,
265+ )
266+ case Float (prec = prec , units = units ):
267+ return builder .aOut (
268+ pv ,
269+ always_update = True ,
270+ on_update = on_update ,
271+ EGU = units ,
272+ PREC = prec ,
273+ ** attribute_fields ,
274+ )
254275 case String ():
255- return builder .longStringOut (pv , always_update = True , on_update = on_update , ** attribute_fields )
276+ return builder .longStringOut (
277+ pv , always_update = True , on_update = on_update , ** attribute_fields
278+ )
256279 case _:
257280 raise FastCSException (
258281 f"Unsupported type { type (attribute .datatype )} : { attribute .datatype } "
0 commit comments