示例#1
0
 def topicManager(self):
     if self._topicManager:
         return self._topicManager
     else:
         self._topicManager = topicManagerFactory.load(
             self.get(self.kTopicManager))
         return self._topicManager
示例#2
0
    def __init__(self, creator, layer=None, broker=None, topicManager=None):

        self._layer = layer
        self._plugin_dir = creator._plugin_dir
        self._creator = creator
        self._dict = {}

        self._mutex = QMutex(0)
        self._values = {}
        self.Q = Queue.Queue(self.kQueueSize)
        self._dirty = False
        self.establishedFeatures = []
        self.restartScheduled = False

        self.isEditing = False

        self._iface = creator._iface
        self._paused = False
        self._fid = None
        self._feat = None
        self._broker = None
        self._topicType = None
        self._topicManager = None
        self._formattersSet = False
        self._deferredEdit = False

        if broker is not None and topicManager is not None:
            self.setBroker(broker, False)
            if not self.isTLayer(self._layer):
                self._prepare(broker,
                              topicManager)  # Add Layer properties for broker
        else:
            _broker = Brokers.instance().find(self.get(self.kBrokerId))
            if _broker is None:
                raise BrokerNotFound(
                    "No MQTT Broker found when loading Telemetry Layer " +
                    self.layer().name())

            self.setBroker(_broker)

            self.setTopicManager(
                topicManagerFactory.load(self.get(self.kTopicManager)))

            #self._setFormatters()

        super(tLayer, self).__init__(
            self,
            self._layer.id(),  # Add randown
            self._broker,
            True)

        self.updateConnected(False)
        self._broker.deletingBroker.connect(self.tearDown)
        self.layer().attributeValueChanged.connect(self.attributeValueChanged)
        self.commitChanges.connect(self._commitChanges)
示例#3
0
    def __init__(self,
                 creator,
                 layer=None,
                 broker=None,
                 topicManager=None):

        self._layer = layer
        self._plugin_dir = creator._plugin_dir
        self._creator = creator
        self._dict = {}

        self._mutex  = QMutex(0)
        self._values = {}
        self.Q       = Queue.Queue(self.kQueueSize)
        self._dirty  = False
        self.establishedFeatures = []
        self.restartScheduled = False
 
        self.isEditing = False

        self._iface     = creator._iface
        self._paused    = False
        self._fid       = None
        self._feat      = None
        self._broker    = None
        self._topicType = None
        self._topicManager = None
        self._formattersSet = False
        self._deferredEdit = False

        if broker is not None and topicManager is not None:
            self.setBroker(broker, False)
            if not self.isTLayer(self._layer):
                self._prepare(broker, topicManager)  # Add Layer properties for broker
        else:
            _broker = Brokers.instance().find(self.get(self.kBrokerId))
            if _broker is None:
                raise BrokerNotFound("No MQTT Broker found when loading Telemetry Layer " + self.layer().name())

            self.setBroker(_broker)
            
            self.setTopicManager(topicManagerFactory.load(self.get(self.kTopicManager)))
            
            #self._setFormatters()

        super(tLayer, self).__init__(self,
                                     self._layer.id(),  # Add randown
                                     self._broker,
                                     True)

        self.updateConnected(False)
        self._broker.deletingBroker.connect(self.tearDown)
        self.layer().attributeValueChanged.connect(self.attributeValueChanged)
        self.commitChanges.connect(self._commitChanges)
示例#4
0
 def getTopicManager(self):
     return tmFactory.load(self.selectTopicManager.itemData(self.selectTopicManager.currentIndex()))
示例#5
0
 def topicManager(self):
     if self._topicManager:
         return self._topicManager
     else:
         self._topicManager = topicManagerFactory.load(self.get(self.kTopicManager))
         return self._topicManager
示例#6
0
 def getTopicManager(self):
     return tmFactory.load(
         self.selectTopicManager.itemData(
             self.selectTopicManager.currentIndex()))