diff options
Diffstat (limited to 'saltoqd/toqconnection.cpp')
-rw-r--r-- | saltoqd/toqconnection.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/saltoqd/toqconnection.cpp b/saltoqd/toqconnection.cpp index c2e2349..564b7d2 100644 --- a/saltoqd/toqconnection.cpp +++ b/saltoqd/toqconnection.cpp @@ -21,11 +21,16 @@ ToqConnection::ToqConnection(const QBluetoothAddress &address, QObject *parent) _reconnectTimer->start(); } -const char * ToqConnection::nameOfEndpoint(Endpoint ep) +QString ToqConnection::nameOfEndpoint(Endpoint ep) { int index = staticMetaObject.indexOfEnumerator("CoreEndpoints"); QMetaEnum epEnum = staticMetaObject.enumerator(index); - return epEnum.valueToKey(ep); + const char * ret = epEnum.valueToKey(ep); + if (ret) { + return QString::fromLatin1(ret); + } else { + return QString::number(ep); + } } quint32 ToqConnection::checksum(const QByteArray &data) @@ -151,7 +156,9 @@ void ToqConnection::handleSocketDisconnected() void ToqConnection::handleSocketError(QBluetoothSocket::SocketError error) { + Q_ASSERT(_socket); qWarning() << error << _socket->errorString(); + _socket->disconnectFromService(); } void ToqConnection::handleSocketData() |