summaryrefslogtreecommitdiffstats
path: root/tests/bttestui
diff options
context:
space:
mode:
authorSergio Ahumada <sahumada@blackberry.com>2014-03-10 17:34:18 +0100
committerSergio Ahumada <sahumada@blackberry.com>2014-03-10 17:34:18 +0100
commitc03d4f3472ee41c697332ccc95c7db358368b81d (patch)
tree44dc6ed047b396e1c6436db80e2b1bda2f2b97d0 /tests/bttestui
parent9b394fbb18b14af9550f72cf55b2e05ce9ddfbd1 (diff)
parent3300671a9c4e545d8c68f029300cbc53f4712388 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'tests/bttestui')
-rw-r--r--tests/bttestui/btlocaldevice.cpp30
1 files changed, 26 insertions, 4 deletions
diff --git a/tests/bttestui/btlocaldevice.cpp b/tests/bttestui/btlocaldevice.cpp
index b73a2a73..3a9b52b5 100644
--- a/tests/bttestui/btlocaldevice.cpp
+++ b/tests/bttestui/btlocaldevice.cpp
@@ -271,9 +271,11 @@ void BtLocalDevice::stopServiceDiscovery()
void BtLocalDevice::serviceDiscovered(const QBluetoothServiceInfo &info)
{
-
+ QString classIds;
+ foreach (const QBluetoothUuid uuid, info.serviceClassUuids())
+ classIds += uuid.toString() + QLatin1Char(' ');
qDebug() << "$$ Found new service" << info.device().address().toString()
- << info.serviceUuid() << info.serviceName() << info.serviceDescription();
+ << info.serviceUuid() << info.serviceName() << classIds;
if (info.serviceUuid() == QBluetoothUuid(QString(TEST_SERVICE_UUID))
|| info.serviceClassUuids().contains(QBluetoothUuid(QString(TEST_SERVICE_UUID))))
@@ -314,6 +316,15 @@ void BtLocalDevice::serviceDiscoveryError(QBluetoothServiceDiscoveryAgent::Error
void BtLocalDevice::dumpServiceDiscovery()
{
+ if (deviceAgent) {
+ qDebug() << "Device Discovery active:" << deviceAgent->isActive();
+ qDebug() << "Error:" << deviceAgent->error() << deviceAgent->errorString();
+ QList<QBluetoothDeviceInfo> list = deviceAgent->discoveredDevices();
+ qDebug() << "Discovered Devices:" << list.count();
+
+ foreach (const QBluetoothDeviceInfo &info, list)
+ qDebug() << info.name() << info.address().toString();
+ }
if (serviceAgent) {
qDebug() << "Service Discovery active:" << serviceAgent->isActive();
qDebug() << "Error:" << serviceAgent->error() << serviceAgent->errorString();
@@ -413,6 +424,7 @@ void BtLocalDevice::dumpSocketInformation()
<< socket->peerName() << socket->peerPort();
qDebug() << "socket type:" << socket->socketType();
qDebug() << "socket state:" << socket->state();
+ qDebug() << "socket bytesAvailable()" << socket->bytesAvailable();
QString tmp;
switch (socket->error()) {
case QBluetoothSocket::NoSocketError: tmp += "NoSocketError"; break;
@@ -583,9 +595,18 @@ void BtLocalDevice::clientSocketReadyRead()
return;
while (socket->canReadLine()) {
- QByteArray line = socket->readLine().trimmed();
+ const QByteArray line = socket->readLine().trimmed();
+ QString lineString = QString::fromUtf8(line.constData(), line.length());
qDebug() << ">>(" << socket->peerName() << ")>>"
- << QString::fromUtf8(line.constData(), line.length());
+ << lineString;
+
+ //when using the tst_QBluetoothSocket we echo received text back
+ //Any line starting with "Echo:" will be echoed
+ if (lineString.startsWith(QStringLiteral("Echo:"))) {
+ qDebug() << "Assuming tst_qbluetoothsocket as client. Echoing back.";
+ lineString += QLatin1Char('\n');
+ socket->write(lineString.toUtf8());
+ }
}
}
@@ -616,6 +637,7 @@ void BtLocalDevice::dumpServerInformation()
qDebug() << "##" << client->peerAddress().toString()
<< client->peerName() << client->peerPort();
qDebug() << client->socketType() << client->state();
+ qDebug() << "Pending bytes: " << client->bytesAvailable();
QString tmp;
switch (client->error()) {
case QBluetoothSocket::NoSocketError: tmp += "NoSocketError"; break;