diff options
| author | Tomasz Sterna <tomek@xiaoka.com> | 2014-07-06 02:56:39 +0200 |
|---|---|---|
| committer | Tomasz Sterna <tomek@xiaoka.com> | 2014-07-09 01:57:32 +0200 |
| commit | 66fcda8bf06abcc557d2d435b5dc0562de3a9566 (patch) | |
| tree | 5b1b53ee834514178790a7a6ef87cdcf17d0ef1e /lib/watchconnector.cpp | |
| parent | 558e07f125eea64436e2097b8a35c9c348b5204e (diff) | |
Implemented org.pebbled DBus service
Diffstat (limited to 'lib/watchconnector.cpp')
| -rw-r--r-- | lib/watchconnector.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/watchconnector.cpp b/lib/watchconnector.cpp index 15fd97f..1bfce0d 100644 --- a/lib/watchconnector.cpp +++ b/lib/watchconnector.cpp @@ -40,7 +40,7 @@ void WatchConnector::reconnect() void WatchConnector::handleWatch(const QString &name, const QString &address) { - qDebug() << "handleWatch" << name << (socket != nullptr); + qDebug() << "handleWatch" << name << address; if (socket != nullptr && socket->isOpen()) { socket->close(); socket->deleteLater(); @@ -54,12 +54,13 @@ void WatchConnector::handleWatch(const QString &name, const QString &address) qDebug() << "Creating socket"; socket = new QBluetoothSocket(QBluetoothSocket::RfcommSocket); - // FIXME: Assuming port 1 (with Pebble) - socket->connectToService(QBluetoothAddress(address), 1); - connect(socket, SIGNAL(readyRead()), SLOT(onReadSocket())); connect(socket, SIGNAL(connected()), SLOT(onConnected())); connect(socket, SIGNAL(disconnected()), SLOT(onDisconnected())); + connect(socket, SIGNAL(error(QBluetoothSocket::SocketError)), this, SLOT(onError(QBluetoothSocket::SocketError))); + + // FIXME: Assuming port 1 (with Pebble) + socket->connectToService(QBluetoothAddress(address), 1); } QString WatchConnector::decodeEndpoint(unsigned int val) @@ -171,6 +172,10 @@ void WatchConnector::onDisconnected() QTimer::singleShot(__reconnect_timeout, this, SLOT(reconnect())); } +void WatchConnector::onError(QBluetoothSocket::SocketError error) { + qWarning() << "Error connecting Pebble" << error << socket->errorString(); +} + void WatchConnector::sendData(const QByteArray &data) { if (socket == nullptr) return; |
