38 @param profiles dictionary containing dictionaries containing the |
38 @param profiles dictionary containing dictionaries containing the |
39 connection parameters. Each entry must have the keys |
39 connection parameters. Each entry must have the keys |
40 "BrokerAddress", "BrokerPort", "ClientId", |
40 "BrokerAddress", "BrokerPort", "ClientId", |
41 "Keepalive", "CleanSession", "Username", "Password", "WillTopic", |
41 "Keepalive", "CleanSession", "Username", "Password", "WillTopic", |
42 "WillMessage", "WillQos", "WillRetain", "TlsEnable", "TlsCaCert", |
42 "WillMessage", "WillQos", "WillRetain", "TlsEnable", "TlsCaCert", |
43 "TlsClientCert", "TlsClientKey". |
43 "TlsClientCert", "TlsClientKey", "ConnectionTimeout". |
44 @type dict |
44 @type dict |
45 @param parent reference to the parent widget |
45 @param parent reference to the parent widget |
46 @type QWidget |
46 @type QWidget |
47 """ |
47 """ |
48 super(MqttConnectionProfilesDialog, self).__init__(parent) |
48 super(MqttConnectionProfilesDialog, self).__init__(parent) |
229 |
229 |
230 @return dictionary containing dictionaries containing the defined |
230 @return dictionary containing dictionaries containing the defined |
231 connection profiles. Each entry have the keys "BrokerAddress", |
231 connection profiles. Each entry have the keys "BrokerAddress", |
232 "BrokerPort", "ClientId", "Keepalive", "CleanSession", "Username", |
232 "BrokerPort", "ClientId", "Keepalive", "CleanSession", "Username", |
233 "Password", "WillTopic", "WillMessage", "WillQos", "WillRetain", |
233 "Password", "WillTopic", "WillMessage", "WillQos", "WillRetain", |
234 "TlsEnable", "TlsCaCert", "TlsClientCert", "TlsClientKey". |
234 "TlsEnable", "TlsCaCert", "TlsClientCert", "TlsClientKey", |
|
235 "ConnectionTimeout". |
235 @rtype dict |
236 @rtype dict |
236 """ |
237 """ |
237 profilesDict = {} |
238 profilesDict = {} |
238 profilesDict.update(self.__profiles) |
239 profilesDict.update(self.__profiles) |
239 return profilesDict |
240 return profilesDict |
248 profileName = self.profileEdit.text() |
249 profileName = self.profileEdit.text() |
249 profile = { |
250 profile = { |
250 "BrokerAddress": self.brokerAddressEdit.text(), |
251 "BrokerAddress": self.brokerAddressEdit.text(), |
251 "BrokerPort": self.brokerPortSpinBox.value(), |
252 "BrokerPort": self.brokerPortSpinBox.value(), |
252 "ClientId": self.clientIdEdit.text(), |
253 "ClientId": self.clientIdEdit.text(), |
|
254 "ConnectionTimeout": self.connectionTimeoutSpinBox.value(), |
253 "Keepalive": self.keepaliveSpinBox.value(), |
255 "Keepalive": self.keepaliveSpinBox.value(), |
254 "CleanSession": self.cleanSessionCheckBox.isChecked(), |
256 "CleanSession": self.cleanSessionCheckBox.isChecked(), |
255 "Username": self.usernameEdit.text(), |
257 "Username": self.usernameEdit.text(), |
256 "Password": pwConvert(self.passwordEdit.text(), encode=True), |
258 "Password": pwConvert(self.passwordEdit.text(), encode=True), |
257 "WillTopic": self.willTopicEdit.text(), |
259 "WillTopic": self.willTopicEdit.text(), |
334 if profileName is not None: |
336 if profileName is not None: |
335 self.profileEdit.setText(profileName) |
337 self.profileEdit.setText(profileName) |
336 self.brokerAddressEdit.setText(profile["BrokerAddress"]) |
338 self.brokerAddressEdit.setText(profile["BrokerAddress"]) |
337 self.brokerPortSpinBox.setValue(profile["BrokerPort"]) |
339 self.brokerPortSpinBox.setValue(profile["BrokerPort"]) |
338 self.clientIdEdit.setText(profile["ClientId"]) |
340 self.clientIdEdit.setText(profile["ClientId"]) |
|
341 self.connectionTimeoutSpinBox.setValue(profile["ConnectionTimeout"]) |
339 self.keepaliveSpinBox.setValue(profile["Keepalive"]) |
342 self.keepaliveSpinBox.setValue(profile["Keepalive"]) |
340 self.cleanSessionCheckBox.setChecked(profile["CleanSession"]) |
343 self.cleanSessionCheckBox.setChecked(profile["CleanSession"]) |
341 self.usernameEdit.setText(profile["Username"]) |
344 self.usernameEdit.setText(profile["Username"]) |
342 self.passwordEdit.setText(pwConvert(profile["Password"], encode=False)) |
345 self.passwordEdit.setText(pwConvert(profile["Password"], encode=False)) |
343 self.willTopicEdit.setText(profile["WillTopic"]) |
346 self.willTopicEdit.setText(profile["WillTopic"]) |
425 profile.update(self.__profiles[profileName]) |
428 profile.update(self.__profiles[profileName]) |
426 changed = ( |
429 changed = ( |
427 self.brokerAddressEdit.text() != profile["BrokerAddress"] or |
430 self.brokerAddressEdit.text() != profile["BrokerAddress"] or |
428 self.brokerPortSpinBox.value() != profile["BrokerPort"] or |
431 self.brokerPortSpinBox.value() != profile["BrokerPort"] or |
429 self.clientIdEdit.text() != profile["ClientId"] or |
432 self.clientIdEdit.text() != profile["ClientId"] or |
|
433 self.connectionTimeoutSpinBox.value() != |
|
434 profile["ConnectionTimeout"] or |
430 self.keepaliveSpinBox.value() != profile["Keepalive"] or |
435 self.keepaliveSpinBox.value() != profile["Keepalive"] or |
431 self.cleanSessionCheckBox.isChecked() != |
436 self.cleanSessionCheckBox.isChecked() != |
432 profile["CleanSession"] or |
437 profile["CleanSession"] or |
433 self.usernameEdit.text() != profile["Username"] or |
438 self.usernameEdit.text() != profile["Username"] or |
434 self.passwordEdit.text() != |
439 self.passwordEdit.text() != |