MqttMonitor/MqttClient.py

changeset 51
b865211461c7
parent 43
a0853f7a8b80
child 63
1004a9b850a9
equal deleted inserted replaced
50:8e9e83221c15 51:b865211461c7
31 @signal onPublish(mid) emitted after a message has been published 31 @signal onPublish(mid) emitted after a message has been published
32 @signal onSubscribe(mid, grantedQos) emitted after the client has 32 @signal onSubscribe(mid, grantedQos) emitted after the client has
33 subscribed to some topics 33 subscribed to some topics
34 @signal onUnsubscribe(mid) emitted after the client has unsubscribed from 34 @signal onUnsubscribe(mid) emitted after the client has unsubscribed from
35 some topics 35 some topics
36 @signal connectTimeout() emitted to indicate, that a connection attempt
37 timed out
36 """ 38 """
37 onConnect = pyqtSignal(dict, int) 39 onConnect = pyqtSignal(dict, int)
38 onDisconnected = pyqtSignal(int) 40 onDisconnected = pyqtSignal(int)
39 onLog = pyqtSignal(int, str) 41 onLog = pyqtSignal(int, str)
40 onMessage = pyqtSignal(str, bytes, int, bool) 42 onMessage = pyqtSignal(str, bytes, int, bool)
119 lambda client, userdata, mid: self.onUnsubscribe.emit(mid) 121 lambda client, userdata, mid: self.onUnsubscribe.emit(mid)
120 122
121 @pyqtSlot() 123 @pyqtSlot()
122 def __connectTimeout(self): 124 def __connectTimeout(self):
123 """ 125 """
124 Privat slot handling a failed connection attempt. 126 Private slot handling a failed connection attempt.
125 """ 127 """
126 self.stopLoop() 128 self.stopLoop()
127 self.connectTimeout.emit() 129 self.connectTimeout.emit()
128 130
129 def reinitialise(self, clientId="", cleanSession=True, userdata=None): 131 def reinitialise(self, clientId="", cleanSession=True, userdata=None):
264 communications with the broker 266 communications with the broker
265 @type int 267 @type int
266 @param bindAddress IP address of a local network interface to bind 268 @param bindAddress IP address of a local network interface to bind
267 this client to 269 this client to
268 @type str 270 @type str
271 @param reinit flag indicating to reinitialize the MQTT client before
272 trying to connect with the given parameters
273 @type bool
269 """ 274 """
270 if reinit: 275 if reinit:
271 self.reinitialise() 276 self.reinitialise()
272 self.__mqttClient.connect_async( 277 self.__mqttClient.connect_async(
273 host, port=port, keepalive=keepalive, bind_address=bindAddress) 278 host, port=port, keepalive=keepalive, bind_address=bindAddress)

eric ide

mercurial