Ejemplo n.º 1
0
    def sendPropertiesEvent(self, ids=None):
        # Avoid marshalling overhead if there are no connections
        if not self._outPorts:
            self._component._log.debug(
                "Skipping sendPropertiesEvent (no connections)")
            return

        if ids is None:
            ids = [
                prop.id_ for prop in self._component._props.values()
                if prop.isSendEventChange()
            ]
        self._component._log.debug("sendPropertiesEvent %s", ids)

        properties = []
        for id_ in ids:
            propDef = self._component._props.getPropDef(id_)
            if not propDef.isSendEventChange():
                self._component._log.warning(
                    "Send property event for non-eventable property %s", id_)
            v = propDef._toAny(propDef.get(self._component))
            properties.append(CF.DataType(id_, v))

        if len(properties) == 0:
            self._component._log.debug("Refusing to send empty property event")
        else:
            event = any.to_any(
                ExtendedEvent.PropertySetChangeEventType(
                    self._component._id, self._component._name, properties))
            self.sendEvent(event)
Ejemplo n.º 2
0
    def sendPropertiesEvent(self, ids=None):
        if ids is None:
            ids = [
                prop.id_ for prop in self._component._props.values()
                if prop.isSendEventChange()
            ]
        self._component._log.debug("sendPropertiesEvent %s", ids)

        properties = []
        for id_ in ids:
            propDef = self._component._props.getPropDef(id_)
            if not propDef.isSendEventChange():
                self._component._log.warning(
                    "Send property event for non-eventable property %s", id_)
            v = propDef._toAny(propDef.get(self._component))
            properties.append(CF.DataType(id_, v))

        if len(properties) == 0:
            self._component._log.debug("Refusing to send empty property event")
        else:
            event = any.to_any(
                ExtendedEvent.PropertySetChangeEventType(
                    self._component._id, self._component._name, properties))
            self.sendEvent(event)