@@ -20,6 +20,7 @@ class Set(Command):
2020 :param readback: `False` to not check any readback,
2121 `True` to wait for readback from the `device`,
2222 or name of specific device to check for readback.
23+ :param readback_value: None to use `value` when checking `readback`, otherwise an alternate value to check.
2324 :param tolerance: Tolerance when checking numeric `readback`.
2425 :param timeout: Timeout in seconds, used for `completion` and `readback`.
2526 :param errhandler: Error handler
@@ -105,11 +106,12 @@ class Set(Command):
105106 who knows the PV's behavior.
106107 """
107108
108- def __init__ (self , device , value , completion = False , readback = False , tolerance = 0.0 , timeout = 0.0 , errhandler = None ):
109+ def __init__ (self , device , value , completion = False , readback = False , readback_value = None , tolerance = 0.0 , timeout = 0.0 , errhandler = None ):
109110 self .__device = device
110111 self .__value = value
111112 self .__completion = completion
112113 self .__readback = readback
114+ self .__readback_value = readback_value
113115 self .__tolerance = tolerance
114116 self .__timeout = timeout
115117 self .__errHandler = errhandler
@@ -168,6 +170,13 @@ def genXML(self):
168170 if self .__readback :
169171 ET .SubElement (xml , "wait" ).text = "true"
170172 ET .SubElement (xml , "readback" ).text = self .__device if self .__readback == True else self .__readback
173+
174+ if isinstance (self .__readback_value , str ):
175+ if len (self .__readback_value ) > 0 :
176+ ET .SubElement (xml , 'readback_value' ).text = '"%s"' % self .__readback_value
177+ elif self .__readback_value is not None :
178+ ET .SubElement (xml , 'readback_value' ).text = str (self .__readback_value )
179+
171180 ET .SubElement (xml , "tolerance" ).text = str (self .__tolerance )
172181 need_timeout = True
173182 else :
@@ -199,7 +208,15 @@ def __repr__(self):
199208 result += ', timeout=' + str (self .__timeout )
200209 if isinstance (self .__readback , str ):
201210 result += ", readback='%s'" % self .__readback
202- result += ", tolerance=%f" % self .__tolerance
211+
212+ if isinstance (self .__readback_value , str ):
213+ if len (self .__readback_value ) > 0 :
214+ result += ", readback_value='%s'" % self .__readback_value
215+ elif self .__readback_value is not None :
216+ result += ", readback_value=" + str (self .__readback_value )
217+
218+ if self .__tolerance != 0.0 :
219+ result += ", tolerance=%f" % self .__tolerance
203220 if not self .__completion and self .__timeout != 0.0 :
204221 result += ', timeout=' + str (self .__timeout )
205222 elif self .__readback :
0 commit comments