mirror of https://github.com/qt/qtcoap.git
Add a button for closing the connection in secure client example
Change-Id: Icc21315a5a20eeee02b578dc56459d4697a6361d Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This commit is contained in:
parent
637b228a38
commit
7706ea9792
|
@ -64,8 +64,9 @@ Window {
|
|||
CoapSecureClient {
|
||||
id: client
|
||||
onFinished: {
|
||||
outputView.text = result
|
||||
statusLabel.text = ""
|
||||
outputView.text = result;
|
||||
statusLabel.text = "";
|
||||
disconnectButton.enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +183,6 @@ Window {
|
|||
id: requestButton
|
||||
text: qsTr("Send Request")
|
||||
enabled: securityModeGroup.checkState !== Qt.Unchecked
|
||||
Layout.columnSpan: 2
|
||||
|
||||
onClicked: {
|
||||
outputView.text = "";
|
||||
|
@ -201,6 +201,19 @@ Window {
|
|||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
id: disconnectButton
|
||||
text: qsTr("Disconnect")
|
||||
enabled: false
|
||||
|
||||
onClicked: {
|
||||
client.disconnect();
|
||||
statusLabel.text = qsTr("Disconnected.");
|
||||
outputView.text = "";
|
||||
disconnectButton.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
TextArea {
|
||||
id: outputView
|
||||
placeholderText: qsTr("<Client Output>")
|
||||
|
|
|
@ -159,3 +159,9 @@ void QmlCoapSecureClient::setSecurityConfiguration(const QString &localCertifica
|
|||
}
|
||||
m_configuration = configuration;
|
||||
}
|
||||
|
||||
void QmlCoapSecureClient::disconnect()
|
||||
{
|
||||
if (m_coapClient)
|
||||
m_coapClient->disconnect();
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ public:
|
|||
Q_INVOKABLE void setSecurityConfiguration(const QString &localCertificatePath,
|
||||
const QString &caCertificatePath,
|
||||
const QString &privateKeyPath);
|
||||
Q_INVOKABLE void disconnect();
|
||||
|
||||
Q_SIGNALS:
|
||||
void finished(const QString &result);
|
||||
|
|
Loading…
Reference in New Issue