Example #1
0
 def _update_value(self, value: Any) -> None:
     if not value.ok:
         self.attr.set_value(None,
                             alarm=Alarm.disconnected("PV Disconnected"))
     else:
         # Split "@asyn(PORT,num)" into ["PORT", "num"]
         split = value.split("(")[1].rstrip(")").split(",")
         cs_port = split[0].strip()
         cs_axis = CS_AXIS_NAMES[int(split[1].strip()) - 1]
         self.attr.set_value(f"{cs_port},{cs_axis}")
Example #2
0
 def callback(value=None):
     if isinstance(value, Exception):
         # Disconnect or Cancelled or RemoteError
         if isinstance(value, Disconnected):
             # We will get a reconnect with a whole new structure
             update_fields.clear()
             block.health.set_value(
                 value="pvAccess disconnected",
                 alarm=Alarm.disconnected("pvAccess disconnected"))
     else:
         with block.notifier.changes_squashed:
             if not update_fields:
                 self.log.debug("Regenerating from %s", list(value))
                 self._regenerate_block(block, value, update_fields)
                 done_queue.put(None)
             else:
                 self._update_block(block, value, update_fields)
Example #3
0
 def _update_value(self, value):
     # Attribute value might not be raw PV, PV which triggered update is
     # passed as status
     if self._user_callback is not None:
         self._user_callback(value)
     if not value.ok:
         self.attr.set_value(self.attr.value,
                             alarm=Alarm.disconnected("PV disconnected"))
     else:
         if value.severity:
             alarm = Alarm(
                 severity=value.severity,
                 status=AlarmStatus.RECORD_STATUS,
                 message="PV in alarm state",
             )
         else:
             alarm = Alarm.ok
         # We only have a raw_stamp attr on monitor, the initial
         # caget with CTRL doesn't give us a timestamp
         ts = TimeStamp(*getattr(value, "raw_stamp", (None, None)))
         value = self.attr.meta.validate(value)
         self.attr.set_value_alarm_ts(value, alarm, ts)