Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt5.4.1, but "Bluetooth QML Ping Pong example" still does not work!
Forum Updated to NodeBB v4.3 + New Features

Qt5.4.1, but "Bluetooth QML Ping Pong example" still does not work!

Scheduled Pinned Locked Moved Mobile and Embedded
c++androidbluetoothqml
2 Posts 1 Posters 974 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • AlexorleonA Offline
    AlexorleonA Offline
    Alexorleon
    wrote on last edited by
    #1

    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 done

    Questions arise

    1. Why serviceName() is empry?
    2. 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?

    1 Reply Last reply
    0
    • AlexorleonA Offline
      AlexorleonA Offline
      Alexorleon
      wrote on last edited by Alexorleon
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved