Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def connected_cb(self, isconnected):
"""
Callback to run whenever the connection state of our pv changes.
:param isconnected: True if we are connected, False otherwise.
:type isconnected: bool
"""
self.connected = isconnected
self.send_connection_state(isconnected)
if isconnected:
self.epics_type = self.pv.type()
self.count = self.pv.count or 1
# Get the control info for the PV.
self.pv.get_data(True, -1.0, self.count)
pyca.flush_io()
if self.epics_type == "DBF_ENUM":
self.pv.get_enum_strings(-1.0)
if not self.pv.ismonitored:
self.pv.monitor()
self.python_type = type_map.get(self.epics_type)
if self.python_type is None:
raise Exception("Unsupported EPICS type {0} for pv {1}".format(
self.epics_type, self.pv.name))