Qt World Summit: Register Today!

Bluetooth - Service not discovered..

  • Hi,
    I'm trying to connect to Bluetooth server running on my laptop with Qt_Bluetooth client on phone.

    But my issue is, though the service published by server running on laptop, it is not discovered by " Qt_Bluetooth client on phone "

    And if I try to connect to server using the bluetooth address and port number, it works, I can establish the connection.
    can you tell me why I'm not getting service discovered signal. Am I missing anything.

    Here is the code.
    #include "Bluetooth_Client.h"

    Bluetooth_Client::Bluetooth_Client(QWidget *parent)
    : QMainWindow(parent)
    socket = new QBluetoothSocket(QBluetoothSocket::RfcommSocket);
    qDebug() << "Create socket";

    DeviceDiscoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
    connect(DeviceDiscoveryAgent, SIGNAL(deviceDiscovered(const QBluetoothDeviceInfo&)),
            this, SLOT(deviceDiscovered(const QBluetoothDeviceInfo&)));
    connect(ui.pushButton, SIGNAL(clicked()),this,SLOT(ButtonClicked()));


    void Bluetooth_Client::deviceDiscovered(const QBluetoothDeviceInfo& ServiceInfo)

    qDebug() << "~Device discovered";
    ui.textEdit->append("\nConnecting to Server....\n");
    ServiceDiscoveryAgent = new QBluetoothServiceDiscoveryAgent(this);
    connect(ServiceDiscoveryAgent,SIGNAL(serviceDiscovered(const QBluetoothServiceInfo &info)),this,SLOT(ServiceDiscovered(const QBluetoothServiceInfo &info)));
    //socket->connectToService(QBluetoothAddress("XX:XX:XX:XX:XX:XX"),1); // Connecting via bluetooth address works.


    void Bluetooth_Client::ButtonClicked()--
    qDebug() << "Button CLicked";


    void Bluetooth_Client::ServiceDiscovered(const QBluetoothServiceInfo &info)
    ui.textEdit->append("Service Discovered...");

    qDebug() << info.serviceName();
    qDebug() << info.device().name();
    qDebug() << info.serviceUuid().toString();
    qDebug() << info.serviceProvider();
    //QBluetoothAddress address(QString("70:F3:95:34:26:14"));

    void Bluetooth_Client::ConnectedToServer()
    ui.textEdit->append("Connected to server...\n");

    ui.textEdit->append(QString::number(socket->write(QString("Hello Der.. Welcome 1").toUtf8())));



    Thanks in advance,


    Edit: please use @ tags around code sections; Andre

  • Some information on the kind of device you are using might be helpful.

  • Thanks for the reply,
    I'm using the latest symbian bell, nokia 701

  • Hi Tobias,
    Any updates on this issue.


  • Not from my side: I have never done any serious programming on Symbian.

    Maybe the guys over at developer.nokia.com (the experts on the actual devices) might know more here, but unfortunately their site is currently down.

  • I am having the same isuue on N950. If you try to use a service discovery agent and set a uuid on it to filter the service discovery only to the service you are trying to connect it will not find any service. If you set up the service discovery agent with your laptop's bluetooth address and no service uuid filter it will correctly (finally!!!) find all the bluetooth services currently running on the laptop. If in the slot you try to qDebug() print each of the discovered service uuid it will be 0000000 etc. So this is clearly a BUG !!!! The workaround is to use the service info name or description to compare it with a string that you know matches your desired bt service name/description and use it to connect.

Log in to reply