Ejemplo n.º 1
0
 def getValue(self):
     """
     If :meth:`setMonitor` has not been called then this function simply calls
     :meth:`CaChannel.CaChannel.getValue`.  If setMonitor has been called then it calls
     :meth:`CaChannel.CaChannel.pend_event` with a very short timeout, and then returns the
     PV value from the last callback.
     """
     if self.callBack.monitorState != 0:
         # This should be self.poll(), but that is generating errors
         self.pend_event(.0001)
     if self.callBack.monitorState == 2:
         self.callBack.newMonitor = 0
         return self.callBack.pv_value
     else:
         return CaChannel.getValue(self)
Ejemplo n.º 2
0
        # issue read requests and wait for completion
        for chan in chans.values():
            chan.array_get(ca.dbf_type_to_DBR_CTRL(chan.field_type()))
        ca.pend_io(10)

        # compare and print
        all_consistent = True
        for field, chan in chans.items():
            # get configured value
            config_value = record.fields[field]
            # skip those with empty config values
            if config_value == '':
                continue

            # dbr is a dict containing the channel information
            dbr = chan.getValue()
            actual_value = dbr['pv_value']

            # convert actual or config value for comparison if necessary
            ftype = chan.field_type()
            if ftype == ca.DBF_STRING:
                # remove "NPP" "NMS" from known link fields
                if re.match(
                        r'SDIS|FLNK|SIOL|SIML|RDBL|RLNK|DINP|RINP|STOO|NVL|SELL|DOL\d?|LNK[1-9A]|OUT[A-U]?|INP[A-U]?|IN([A-L])\1',
                        field):
                    actual_value = re.sub(
                        ' +', ' ', re.sub(' +(NPP|NMS)', '',
                                          actual_value)).strip()
                    config_value = re.sub(
                        ' +', ' ', re.sub(' +(NPP|NMS)', '',
                                          config_value)).strip()