Qt5.4.1, but "Bluetooth QML Ping Pong example" still does not work!
-
wrote on 13 May 2015, 09:15 last edited by
Hello!
I'm trying to use the Qt 5.4.1 to create a connection between the two Android devices using bluetooth. ASUS_T00J android 4.4.2 and U30GT-H android 4.0.4. For example, I launched the "Bluetooth QML Ping Pong example", but it does not work.
http://doc.qt.io/qt-5/qtbluetooth-pingpong-example.html
After the message "Service found. Setting parameters..." nothing happens, no data exchange. And so indefinitely.The feeling that is not processed:
signal connect(socket, SIGNAL(connected()), this, SLOT(serverConnected()));System files are transferred, all right, mate there. Until then tried QTcpServer on these devices, everything works without problems.
I decided to bring data:
void Server::addService(const QBluetoothServiceInfo &service){//setMessage("Service found. Setting parameters..."); qDebug() << "Service found. Setting parameters..."; //! [Connecting the socket] socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol); socket->connectToService(service); qDebug() << service.serviceName(); qDebug() << service.device().address().toString(); qDebug() << service.serviceUuid(); qDebug() << service.isComplete(); qDebug() << socket->localAddress(); qDebug() << socket->localName(); qDebug() << socket->localPort(); qDebug() << socket->peerAddress(); qDebug() << socket->peerName(); qDebug() << socket->peerPort(); connect(socket, SIGNAL(connected()), this, SLOT(serverConnected())); connect(socket, SIGNAL(readyRead()), this, SLOT(readSocket())); connect(socket, SIGNAL(disconnected()), this, SLOT(serverDisconnected())); //! [Connecting the socket] m_serviceFound = true;
}
Outputs:
Service found. Setting parameters...""
"XX:XX:XX:XX:XX:XX" - This is client. All is well.
"{e8e10f95-1a70-4b27-9ccf-02010264e9c9}"
true"XX:XX:XX:XX:XX:XX" - This is server. All is well.
"U30GT-H"
0"00:00:00:00:00:00"
""
0
Service scan doneQuestions arise
- Why serviceName() is empry?
- What peerAddress() and why it empty? Returns the address of the peer device. This is client (ASUS_T00J)?
And why this is example not working? And "Bluetoth Chat Server example" too.
Somebody working examples with bluetooth? -
wrote on 14 May 2015, 08:32 last edited by Alexorleon
I installed the Ubuntu 14.04, but does not turn on bluetooth.
I installed the OpenSUSE and I was able to run btchat. http://doc.qt.digia.com/qtmobility/btchat.html
Successfully connected to U30GT-H and produced messaging.But between android devices nothing works.
And the example of "Bluetooth QML Ping Pong example" is also not works.
Sorry for my english.
2/2