Beispiel #1
0
 def test_string_sts(self):
     val, rmeta=cadata.fromstring('\x00\x10\x00\x03hello world'+('\0'*9),
                                defs.DBR.STS_STRING, 1, self.meta)
     self.assertEqual(self.meta, self.bmeta)
     self.assertEqual(rmeta.status, defs.STATUS.BAD_SUB)
     self.assertEqual(rmeta.severity, defs.SEVERITY.INVALID)
     self._check_value(val, rmeta)
Beispiel #2
0
    def dispatch(self, pkt, circuit, peer=None):
        if pkt.cmd != 1:
            log.warning('Channel %s monitor ignoring pkt %s',self._chan.name,pkt)
            # wait for real reply
            chan._circ.pendingActions[self.subid]=self
            return

        pkt.check() # check that dtype*count is consistent with message size

        data = fromstring(pkt.body, pkt.dtype, pkt.count, self.meta)

        self._updates(data, self.mask, pkt.p1)
Beispiel #3
0
    def set(self, channel, data, dbr, count):
        """A Client is sending data
        """

        try:
            val, rmeta = fromstring(data, dbr, count, self.meta)
        except ValueError:
            log.exception("type conversion failed")
            raise CAError("type conversion failed", ECA_NOCONVERT)
        log.info('set %s to %s',self.name,str(val))
        self.value=val
        self.post(DBE.VALUE|DBE.LOG)
        return True
Beispiel #4
0
    def dispatch(self, pkt, circuit, peer=None):
        if pkt.cmd != 15:
            log.warning('Channel %s get ignoring pkt %s', self._chan.name, pkt)
            # wait for real reply
            chan._circ.pendingActions[self.ioid] = self
            return

        meta = self.meta
        if meta is None:
            dbf, _ = dbr_to_dbf(pkt.dtype)
            meta = caMeta(dbf)

        data = fromstring(pkt.body, pkt.dtype, pkt.count, meta)

        self.ioid = None
        self.done = True
        self._result.callback(data)
Beispiel #5
0
 def test_string_char(self):
     val, rmeta=cadata.fromstring('hello world'+('\0'*5),
                                defs.DBR.CHAR, 11, self.meta)
     self.assertEqual(self.meta, self.bmeta)
     self._check_value(val, rmeta)