@@ -58,17 +58,16 @@ async def attribute_initialise(self) -> None:
5858
5959 def _add_io_callbacks (self ):
6060 for attr in self .attributes .values ():
61- io = self ._attribute_ref_io_map .get (type (attr .io_ref ), None )
61+ ref = attr .io_ref if attr .has_io_ref () else None
62+ io = self ._attribute_ref_io_map .get (type (ref ), None )
6263 if isinstance (attr , AttrW ):
6364 # is it on process or write_display?
64- attr .add_process_callback (self ._create_send_callback (io , attr ))
65- if attr .io_ref is None or io is None :
66- continue
65+ attr .add_process_callback (self ._create_send_callback (io , attr , ref ))
6766 if isinstance (attr , AttrR ):
68- attr .add_update_callback (self ._create_update_callback (io , attr ))
67+ attr .add_update_callback (self ._create_update_callback (io , attr , ref ))
6968
70- def _create_send_callback (self , io , attr ):
71- if attr . io_ref is None :
69+ def _create_send_callback (self , io , attr , ref ):
70+ if ref is None :
7271
7372 async def send_callback (value ):
7473 await attr .update_display_without_process (value )
@@ -77,13 +76,13 @@ async def send_callback(value):
7776 else :
7877
7978 async def send_callback (value ):
80- await io .send (attr , attr . io_ref , value )
79+ await io .send (attr , value )
8180 # TODO, should we just then call the above send_callback here?
8281
8382 return send_callback
8483
85- def _create_update_callback (self , io , attr ):
86- if io is None or attr . io_ref is None :
84+ def _create_update_callback (self , io , attr , ref ):
85+ if io is None or ref is None :
8786
8887 async def error_callback ():
8988 raise RuntimeError ("No AttributeIO registered to handle update" )
@@ -92,7 +91,7 @@ async def error_callback():
9291 else :
9392
9493 async def update_callback ():
95- await io .update (attr , attr . io_ref )
94+ await io .update (attr )
9695
9796 return update_callback
9897
@@ -154,7 +153,7 @@ def _validate_io(self):
154153 """Validate that each Attribute has an AttributeIORef for which the
155154 controller has an associated AttributeIO class."""
156155 for attr in self .attributes .values ():
157- if attr .io_ref is None :
156+ if not attr .has_io_ref () :
158157 continue
159158 assert type (attr .io_ref ) in self ._attribute_ref_io_map , (
160159 f"{ self .__class__ .__name__ } does not have an AttributeIO to handle "
0 commit comments