diff --git a/libnymea-core/bluetoothserver.cpp b/libnymea-core/bluetoothserver.cpp index 7857126e..026821f8 100644 --- a/libnymea-core/bluetoothserver.cpp +++ b/libnymea-core/bluetoothserver.cpp @@ -106,7 +106,8 @@ void BluetoothServer::onClientConnected() connect(client, SIGNAL(readyRead()), this, SLOT(readData())); connect(client, SIGNAL(disconnected()), this, SLOT(onClientDisconnected())); - connect(client, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(onError(QBluetoothSocket::SocketError))); + connect(client, SIGNAL(stateChanged(QBluetoothSocket::SocketState)), this, SLOT(onClientStateChanged(QBluetoothSocket::SocketState))); + connect(client, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(onClientError(QBluetoothSocket::SocketError))); emit clientConnected(clientId); } @@ -123,11 +124,16 @@ void BluetoothServer::onClientDisconnected() emit clientDisconnected(clientId); } -void BluetoothServer::onError(QBluetoothSocket::SocketError error) +void BluetoothServer::onClientError(QBluetoothSocket::SocketError error) { qCWarning(dcBluetoothServer()) << "BluetoothServer: Error occured:" << error; } +void BluetoothServer::onClientStateChanged(QBluetoothSocket::SocketState state) +{ + qCDebug(dcBluetoothServer()) << "Client socket state changed:" << state; +} + void BluetoothServer::readData() { QBluetoothSocket *client = qobject_cast(sender()); diff --git a/libnymea-core/bluetoothserver.h b/libnymea-core/bluetoothserver.h index cdb96f82..f866c2d1 100644 --- a/libnymea-core/bluetoothserver.h +++ b/libnymea-core/bluetoothserver.h @@ -56,7 +56,8 @@ private slots: void onClientConnected(); void onClientDisconnected(); - void onError(QBluetoothSocket::SocketError error); + void onClientError(QBluetoothSocket::SocketError error); + void onClientStateChanged(QBluetoothSocket::SocketState state); void readData(); public slots: